Skip to content

Commit a745d81

Browse files
authored
Fix issue where local terminal failed to open in remote scenarios wsl (#277920)
* try adding options.remoteAuthority field for profile * try explicit remoteAuthority undefined when local * Dont touch terminalProfileResolverService.ts * Better comments to explicitly get local default profile in remote * Try to handle mac -> linux scenario * see if caching is problem * Dont mix up profile and skip list when creating local terminal in remote * Just handle wsl in this PR to make life simpler * Logs for debugging * Allow local to get backend by checking from createTerminal in terminalService.ts * leave logs to debug, code doesnt work after prev commit * stringify for better logs. isLocalRemoteTerminal value is still false * more and more logs * Bug fixed) Use Schemas.file instead of Shemas.vscodeFileResource
1 parent 5e820f1 commit a745d81

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/vs/workbench/contrib/terminal/browser/terminalService.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,9 @@ export class TerminalService extends Disposable implements ITerminalService {
975975
// Await the initialization of available profiles as long as this is not a pty terminal or a
976976
// local terminal in a remote workspace as profile won't be used in those cases and these
977977
// terminals need to be launched before remote connections are established.
978+
const isLocalInRemoteTerminal = this._remoteAgentService.getConnection() && URI.isUri(options?.cwd) && options?.cwd.scheme === Schemas.file;
978979
if (this._terminalProfileService.availableProfiles.length === 0) {
979980
const isPtyTerminal = options?.config && hasKey(options.config, { customPtyImplementation: true });
980-
const isLocalInRemoteTerminal = this._remoteAgentService.getConnection() && URI.isUri(options?.cwd) && options?.cwd.scheme === Schemas.vscodeFileResource;
981981
if (!isPtyTerminal && !isLocalInRemoteTerminal) {
982982
if (this._connectionState === TerminalConnectionState.Connecting) {
983983
mark(`code/terminal/willGetProfiles`);
@@ -989,7 +989,18 @@ export class TerminalService extends Disposable implements ITerminalService {
989989
}
990990
}
991991

992-
const config = options?.config || this._terminalProfileService.getDefaultProfile();
992+
let config = options?.config;
993+
if (!config && isLocalInRemoteTerminal) {
994+
const backend = await this._terminalInstanceService.getBackend(undefined);
995+
const executable = await backend?.getDefaultSystemShell();
996+
if (executable) {
997+
config = { executable };
998+
}
999+
}
1000+
1001+
if (!config) {
1002+
config = this._terminalProfileService.getDefaultProfile();
1003+
}
9931004
const shellLaunchConfig = config && hasKey(config, { extensionIdentifier: true }) ? {} : this._terminalInstanceService.convertProfileToShellLaunchConfig(config || {});
9941005

9951006
// Get the contributed profile if it was provided

0 commit comments

Comments
 (0)