Merge from vscode 709a07d51919d3266ca71699c6ddfb2d3547c0e1 (#6575)

This commit is contained in:
Chris LaFreniere
2019-08-02 21:06:44 -07:00
committed by GitHub
parent 402b50c03b
commit 62d2fb534d
103 changed files with 726 additions and 374 deletions

View File

@@ -378,6 +378,9 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(RenameTerminalAc
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalFindWidgetAction, FocusTerminalFindWidgetAction.ID, FocusTerminalFindWidgetAction.LABEL, {
primary: KeyMod.CtrlCmd | KeyCode.KEY_F
}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Focus Find Widget', category);
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalFindWidgetAction, FocusTerminalFindWidgetAction.ID, FocusTerminalFindWidgetAction.LABEL, {
primary: KeyMod.CtrlCmd | KeyCode.KEY_F
}, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_FOCUSED), 'Terminal: Focus Find Widget', category);
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(HideTerminalFindWidgetAction, HideTerminalFindWidgetAction.ID, HideTerminalFindWidgetAction.LABEL, {
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]

View File

@@ -38,6 +38,7 @@ const winLocalLinkClause = '((' + winPathPrefix + '|(' + winExcludedPathCharacte
replacing space with nonBreakningSpace or space ASCII code - 32. */
const lineAndColumnClause = [
'((\\S*)", line ((\\d+)( column (\\d+))?))', // "(file path)", line 45 [see #40468]
'((\\S*)",((\\d+)(:(\\d+))?))', // "(file path)",45 [see #78205]
'((\\S*) on line ((\\d+)(, column (\\d+))?))', // (file path) on line 8, column 13
'((\\S*):line ((\\d+)(, column (\\d+))?))', // (file path):line 8, column 13
'(([^\\s\\(\\)]*)(\\s?[\\(\\[](\\d+)(,\\s?(\\d+))?)[\\)\\]])', // (file path)(45), (file path) (45), (file path)(45,18), (file path) (45,18), (file path)(45, 18), (file path) (45, 18), also with []

View File

@@ -78,7 +78,11 @@ function resolveConfigurationVariables(configurationResolverService: IConfigurat
Object.keys(env).forEach((key) => {
const value = env[key];
if (typeof value === 'string' && lastActiveWorkspaceRoot !== null) {
env[key] = configurationResolverService.resolve(lastActiveWorkspaceRoot, value);
try {
env[key] = configurationResolverService.resolve(lastActiveWorkspaceRoot, value);
} catch (e) {
env[key] = value;
}
}
});
return env;
@@ -138,19 +142,19 @@ export function getCwd(
if (!shell.ignoreConfigurationCwd && customCwd) {
if (configurationResolverService) {
try {
cwd = configurationResolverService.resolve(lastActiveWorkspace, customCwd);
customCwd = configurationResolverService.resolve(lastActiveWorkspace, customCwd);
} catch (e) {
// There was an issue resolving a variable, just use the unresolved customCwd which
// which will fail, and log the error in the console.
cwd = customCwd;
if (logService) {
logService.error('Resolving terminal.integrated.cwd', e);
logService.error('Could not resolve terminal.integrated.cwd', e);
}
return customCwd;
}
}
if (path.isAbsolute(customCwd) && !cwd) {
if (path.isAbsolute(customCwd)) {
cwd = customCwd;
} else if (root && !cwd) {
} else if (root) {
cwd = path.join(root.fsPath, customCwd);
}
}
@@ -192,7 +196,8 @@ export function getDefaultShell(
windir: string | undefined,
lastActiveWorkspace: IWorkspaceFolder | undefined,
configurationResolverService: IConfigurationResolverService | undefined,
platformOverride: platform.Platform = platform.platform,
logService: ILogService,
platformOverride: platform.Platform = platform.platform
): string {
const platformKey = platformOverride === platform.Platform.Windows ? 'windows' : platformOverride === platform.Platform.Mac ? 'osx' : 'linux';
const shellConfigValue = fetchSetting(`terminal.integrated.shell.${platformKey}`);
@@ -214,7 +219,12 @@ export function getDefaultShell(
}
if (configurationResolverService) {
executable = configurationResolverService.resolve(lastActiveWorkspace, executable);
try {
executable = configurationResolverService.resolve(lastActiveWorkspace, executable);
} catch (e) {
logService.error(`Could not resolve terminal.integrated.shell.${platformKey}`, e);
executable = executable;
}
}
return executable;
@@ -225,6 +235,7 @@ export function getDefaultShellArgs(
isWorkspaceShellAllowed: boolean,
lastActiveWorkspace: IWorkspaceFolder | undefined,
configurationResolverService: IConfigurationResolverService | undefined,
logService: ILogService,
platformOverride: platform.Platform = platform.platform,
): string | string[] {
const platformKey = platformOverride === platform.Platform.Windows ? 'windows' : platformOverride === platform.Platform.Mac ? 'osx' : 'linux';
@@ -236,7 +247,12 @@ export function getDefaultShellArgs(
if (configurationResolverService) {
const resolvedArgs: string[] = [];
for (const arg of args) {
resolvedArgs.push(configurationResolverService.resolve(lastActiveWorkspace, arg));
try {
resolvedArgs.push(configurationResolverService.resolve(lastActiveWorkspace, arg));
} catch (e) {
logService.error(`Could not resolve terminal.integrated.shellArgs.${platformKey}`, e);
resolvedArgs.push(arg);
}
}
args = resolvedArgs;
}

View File

@@ -20,6 +20,7 @@ import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/term
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { ILogService } from 'vs/platform/log/common/log';
let Terminal: typeof XTermTerminal;
let WebLinksAddon: typeof XTermWebLinksAddon;
@@ -34,7 +35,8 @@ export class TerminalInstanceService implements ITerminalInstanceService {
@IStorageService private readonly _storageService: IStorageService,
@IConfigurationResolverService private readonly _configurationResolverService: IConfigurationResolverService,
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService,
@IHistoryService private readonly _historyService: IHistoryService
@IHistoryService private readonly _historyService: IHistoryService,
@ILogService private readonly _logService: ILogService
) {
}
@@ -84,6 +86,7 @@ export class TerminalInstanceService implements ITerminalInstanceService {
process.env.windir,
lastActiveWorkspace,
this._configurationResolverService,
this._logService,
platformOverride
);
const args = getDefaultShellArgs(
@@ -91,6 +94,7 @@ export class TerminalInstanceService implements ITerminalInstanceService {
isWorkspaceShellAllowed,
lastActiveWorkspace,
this._configurationResolverService,
this._logService,
platformOverride
);
return Promise.resolve({ shell, args });
@@ -99,4 +103,4 @@ export class TerminalInstanceService implements ITerminalInstanceService {
public getMainProcessParentEnv(): Promise<IProcessEnvironment> {
return getMainProcessParentEnv();
}
}
}

View File

@@ -120,10 +120,11 @@ async function detectAvailableWindowsShells(): Promise<IShellDefinition[]> {
`${process.env['ProgramFiles']}\\Git\\usr\\bin\\bash.exe`,
`${process.env['LocalAppData']}\\Programs\\Git\\bin\\bash.exe`,
],
Cygwin: [
`${process.env['HOMEDRIVE']}\\cygwin64\\bin\\bash.exe`,
`${process.env['HOMEDRIVE']}\\cygwin\\bin\\bash.exe`
]
// See #75945
// Cygwin: [
// `${process.env['HOMEDRIVE']}\\cygwin64\\bin\\bash.exe`,
// `${process.env['HOMEDRIVE']}\\cygwin\\bin\\bash.exe`
// ]
};
const promises: PromiseLike<IShellDefinition | undefined>[] = [];
Object.keys(expectedLocations).forEach(key => promises.push(validateShellPaths(key, expectedLocations[key])));
@@ -170,4 +171,4 @@ async function getShellPathFromRegistry(shellName: string): Promise<string> {
} catch (error) {
return '';
}
}
}

View File

@@ -121,7 +121,8 @@ suite('Workbench - TerminalLinkHandler', () => {
{ urlFormat: '{0}[{1},{2}]', line: '5', column: '3' },
{ urlFormat: '{0} [{1},{2}]', line: '5', column: '3' },
{ urlFormat: '{0}[{1}, {2}]', line: '5', column: '3' },
{ urlFormat: '{0} [{1}, {2}]', line: '5', column: '3' }
{ urlFormat: '{0} [{1}, {2}]', line: '5', column: '3' },
{ urlFormat: '"{0}",{1}', line: '5' }
];
linkUrls.forEach(linkUrl => {
@@ -185,7 +186,8 @@ suite('Workbench - TerminalLinkHandler', () => {
{ urlFormat: '{0}[{1}]', line: '5' },
{ urlFormat: '{0} [{1}]', line: '5' },
{ urlFormat: '{0}[{1},{2}]', line: '5', column: '3' },
{ urlFormat: '{0} [{1},{2}]', line: '5', column: '3' }
{ urlFormat: '{0} [{1},{2}]', line: '5', column: '3' },
{ urlFormat: '"{0}",{1}', line: '5' }
];
linkUrls.forEach(linkUrl => {