Skip to content

Commit 93f4d64

Browse files
committed
Update description and make sure to read log dir file from coder.sshFlags
1 parent 581d285 commit 93f4d64

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"default": "auto"
137137
},
138138
"coder.sshFlags": {
139-
"markdownDescription": "Additional flags to pass to the `coder ssh` command when establishing SSH connections. Enter each flag as a separate array item; values are passed verbatim and in order. See the [CLI ssh reference](https://coder.com/docs/reference/cli/ssh) for available flags.\n\nNote that the following flags are ignored because they are managed internally by the extension: `--network-info-dir`, `--log-dir`, `--ssh-host-prefix`. To manage the `--disable-autostart` flag, use the `coder.disableAutostart` setting.",
139+
"markdownDescription": "Additional flags to pass to the `coder ssh` command when establishing SSH connections. Enter each flag as a separate array item; values are passed verbatim and in order. See the [CLI ssh reference](https://coder.com/docs/reference/cli/ssh) for available flags.\n\nNote: `--network-info-dir` and `--ssh-host-prefix` are ignored (managed internally). `--disable-autostart` and `--log-dir`/`-l` can be specified here, but prefer using `#coder.disableAutostart#` and `#coder.proxyLogDirectory#` settings respectively.",
140140
"type": "array",
141141
"items": {
142142
"type": "string"

src/remote/remote.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -558,20 +558,30 @@ export class Remote {
558558
}
559559

560560
/**
561-
* Return the --log-dir argument value for the ProxyCommand. It may be an
561+
* Return the --log-dir argument value for the ProxyCommand. It may be an
562562
* empty string if the setting is not set or the cli does not support it.
563563
*/
564564
private getLogDir(featureSet: FeatureSet): string {
565565
if (!featureSet.proxyLogDirectory) {
566566
return "";
567567
}
568-
// If the proxyLogDirectory is not set in the extension settings we don't send one.
569-
return expandPath(
570-
String(
571-
vscode.workspace.getConfiguration().get("coder.proxyLogDirectory") ??
572-
"",
573-
).trim(),
568+
569+
const vscodeConfig = vscode.workspace.getConfiguration();
570+
const proxyLogDir = vscodeConfig
571+
.get<string>("coder.proxyLogDirectory")
572+
?.trim();
573+
if (proxyLogDir) {
574+
return expandPath(proxyLogDir);
575+
}
576+
577+
const sshFlags = getSshFlags(vscodeConfig);
578+
const logDirFlagIndex = sshFlags.findIndex(
579+
(option) => option === "-l" || option === "--log-dir",
574580
);
581+
if (logDirFlagIndex !== -1 && logDirFlagIndex + 1 < sshFlags.length) {
582+
return expandPath(sshFlags[logDirFlagIndex + 1].trim());
583+
}
584+
return "";
575585
}
576586

577587
/**
@@ -605,6 +615,7 @@ export class Remote {
605615
)
606616
? ["--disable-autostart"]
607617
: [];
618+
// Make sure to update the `coder.sshFlags` description if we add more internal flags here!
608619
const internalFlags = [
609620
"--stdio",
610621
"--usage-app=vscode",

0 commit comments

Comments
 (0)