未验证 提交 2e0d310d 编写于 作者: D Daniel Imms 提交者: GitHub

Merge pull request #59629 from Microsoft/tyriar/shell_os_only

Only detect shell for the current OS
......@@ -13,7 +13,7 @@ import * as panel from 'vs/workbench/browser/panel';
import * as platform from 'vs/base/common/platform';
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, TerminalCursorStyle, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_NOT_VISIBLE, DEFAULT_LINE_HEIGHT, DEFAULT_LETTER_SPACING, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_FOCUSED } from 'vs/workbench/parts/terminal/common/terminal';
import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/node/terminal';
import { getDefaultShell } from 'vs/workbench/parts/terminal/node/terminal';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
......@@ -77,7 +77,7 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.shell.linux': {
markdownDescription: nls.localize('terminal.integrated.shell.linux', "The path of the shell that the terminal uses on Linux. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."),
type: 'string',
default: getTerminalDefaultShellUnixLike()
default: getDefaultShell(platform.Platform.Linux)
},
'terminal.integrated.shellArgs.linux': {
markdownDescription: nls.localize('terminal.integrated.shellArgs.linux', "The command line arguments to use when on the Linux terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."),
......@@ -90,7 +90,7 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.shell.osx': {
markdownDescription: nls.localize('terminal.integrated.shell.osx', "The path of the shell that the terminal uses on macOS. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."),
type: 'string',
default: getTerminalDefaultShellUnixLike()
default: getDefaultShell(platform.Platform.Mac)
},
'terminal.integrated.shellArgs.osx': {
markdownDescription: nls.localize('terminal.integrated.shellArgs.osx', "The command line arguments to use when on the macOS terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."),
......@@ -106,7 +106,7 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.shell.windows': {
markdownDescription: nls.localize('terminal.integrated.shell.windows', "The path of the shell that the terminal uses on Windows. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."),
type: 'string',
default: getTerminalDefaultShellWindows()
default: getDefaultShell(platform.Platform.Windows)
},
'terminal.integrated.shellArgs.windows': {
markdownDescription: nls.localize('terminal.integrated.shellArgs.windows', "The command line arguments to use when on the Windows terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."),
......
......@@ -18,7 +18,7 @@ import { TerminalConfigHelper } from 'vs/workbench/parts/terminal/electron-brows
import { TPromise } from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/node/terminal';
import { getDefaultShell } from 'vs/workbench/parts/terminal/node/terminal';
import { TerminalPanel } from 'vs/workbench/parts/terminal/electron-browser/terminalPanel';
import { TerminalTab } from 'vs/workbench/parts/terminal/browser/terminalTab';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
......@@ -161,7 +161,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
}
// Never suggest if the setting is non-default already (ie. they set the setting manually)
if (this._configHelper.config.shell.windows !== getTerminalDefaultShellWindows()) {
if (this._configHelper.config.shell.windows !== getDefaultShell(platform.Platform.Windows)) {
this._storageService.store(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, true);
return;
}
......
......@@ -30,8 +30,23 @@ export interface ITerminalChildProcess {
resize(cols: number, rows: number): void;
}
export function getDefaultShell(p: platform.Platform): string {
if (p === platform.Platform.Windows) {
if (platform.isWindows) {
return getTerminalDefaultShellWindows();
}
// Don't detect Windows shell when not on Windows
return processes.getWindowsShell();
}
// Only use $SHELL for the current OS
if (platform.isLinux && p === platform.Platform.Mac || platform.isMacintosh && p === platform.Platform.Linux) {
return '/bin/bash';
}
return getTerminalDefaultShellUnixLike();
}
let _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string = null;
export function getTerminalDefaultShellUnixLike(): string {
function getTerminalDefaultShellUnixLike(): string {
if (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) {
let unixLikeTerminal = 'sh';
if (!platform.isWindows && process.env.SHELL) {
......@@ -47,7 +62,7 @@ export function getTerminalDefaultShellUnixLike(): string {
}
let _TERMINAL_DEFAULT_SHELL_WINDOWS: string = null;
export function getTerminalDefaultShellWindows(): string {
function getTerminalDefaultShellWindows(): string {
if (!_TERMINAL_DEFAULT_SHELL_WINDOWS) {
const isAtLeastWindows10 = platform.isWindows && parseFloat(os.release()) >= 10;
const is32ProcessOn64Windows = process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册