Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)

* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79

* Fix breaks

* Extension management fixes

* Fix breaks in windows bundling

* Fix/skip failing tests

* Update distro

* Add clear to nuget.config

* Add hygiene task

* Bump distro

* Fix hygiene issue

* Add build to hygiene exclusion

* Update distro

* Update hygiene

* Hygiene exclusions

* Update tsconfig

* Bump distro for server breaks

* Update build config

* Update darwin path

* Add done calls to notebook tests

* Skip failing tests

* Disable smoke tests
This commit is contained in:
Karl Burtram
2021-02-09 16:15:05 -08:00
committed by GitHub
parent 6f192f9af5
commit ce612a3d96
1929 changed files with 68012 additions and 34564 deletions

View File

@@ -14,7 +14,6 @@ import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensi
import { IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { IAdapterDescriptor } from 'vs/workbench/contrib/debug/common/debug';
import { IExtHostConfiguration, ExtHostConfigProvider } from '../common/extHostConfiguration';
import { IExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/common/extensionDescriptionRegistry';
import { IExtHostTerminalService } from 'vs/workbench/api/common/extHostTerminalService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
@@ -24,13 +23,14 @@ import { SignService } from 'vs/platform/sign/node/signService';
import { hasChildProcesses, prepareCommand, runInExternalTerminal } from 'vs/workbench/contrib/debug/node/terminals';
import { IDisposable } from 'vs/base/common/lifecycle';
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
import { createCancelablePromise, firstParallel } from 'vs/base/common/async';
export class ExtHostDebugService extends ExtHostDebugServiceBase {
readonly _serviceBrand: undefined;
private _integratedTerminalInstance?: vscode.Terminal;
private _integratedTerminalInstances = new DebugTerminalCollection();
private _terminalDisposedListener: IDisposable | undefined;
constructor(
@@ -39,10 +39,9 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
@IExtHostExtensionService extensionService: IExtHostExtensionService,
@IExtHostDocumentsAndEditors editorsService: IExtHostDocumentsAndEditors,
@IExtHostConfiguration configurationService: IExtHostConfiguration,
@IExtHostTerminalService private _terminalService: IExtHostTerminalService,
@IExtHostCommands commandService: IExtHostCommands
@IExtHostTerminalService private _terminalService: IExtHostTerminalService
) {
super(extHostRpcService, workspaceService, extensionService, editorsService, configurationService, commandService);
super(extHostRpcService, workspaceService, extensionService, editorsService, configurationService);
}
protected createDebugAdapter(adapter: IAdapterDescriptor, session: ExtHostDebugSession): AbstractDebugAdapter | undefined {
@@ -76,40 +75,44 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
if (!this._terminalDisposedListener) {
// React on terminal disposed and check if that is the debug terminal #12956
this._terminalDisposedListener = this._terminalService.onDidCloseTerminal(terminal => {
if (this._integratedTerminalInstance && this._integratedTerminalInstance === terminal) {
this._integratedTerminalInstance = undefined;
}
this._integratedTerminalInstances.onTerminalClosed(terminal);
});
}
let needNewTerminal = true; // be pessimistic
if (this._integratedTerminalInstance) {
const pid = await this._integratedTerminalInstance.processId;
needNewTerminal = await hasChildProcesses(pid); // if no processes running in terminal reuse terminal
}
const configProvider = await this._configurationService.getConfigProvider();
const shell = this._terminalService.getDefaultShell(true, configProvider);
const shellArgs = this._terminalService.getDefaultShellArgs(true, configProvider);
const shellConfig = JSON.stringify({ shell, shellArgs });
let terminal = await this._integratedTerminalInstances.checkout(shellConfig);
let cwdForPrepareCommand: string | undefined;
let giveShellTimeToInitialize = false;
if (needNewTerminal || !this._integratedTerminalInstance) {
if (!terminal) {
const options: vscode.TerminalOptions = {
shellPath: shell,
// shellArgs: this._terminalService._getDefaultShellArgs(configProvider),
shellArgs: shellArgs,
cwd: args.cwd,
name: args.title || nls.localize('debug.terminal.title', "debuggee"),
};
this._integratedTerminalInstance = this._terminalService.createTerminalFromOptions(options);
giveShellTimeToInitialize = true;
terminal = this._terminalService.createTerminalFromOptions(options, true);
this._integratedTerminalInstances.insert(terminal, shellConfig);
} else {
cwdForPrepareCommand = args.cwd;
}
const terminal = this._integratedTerminalInstance;
terminal.show();
const shellProcessId = await this._integratedTerminalInstance.processId;
const shellProcessId = await terminal.processId;
if (giveShellTimeToInitialize) {
// give a new terminal some time to initialize the shell
await new Promise(resolve => setTimeout(resolve, 1000));
}
const command = prepareCommand(shell, args.args, cwdForPrepareCommand, args.env);
terminal.sendText(command, true);
@@ -123,6 +126,49 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
}
protected createVariableResolver(folders: vscode.WorkspaceFolder[], editorService: ExtHostDocumentsAndEditors, configurationService: ExtHostConfigProvider): AbstractVariableResolverService {
return new ExtHostVariableResolverService(folders, editorService, configurationService, process.env as env.IProcessEnvironment);
return new ExtHostVariableResolverService(folders, editorService, configurationService, process.env as env.IProcessEnvironment, this._workspaceService);
}
}
class DebugTerminalCollection {
/**
* Delay before a new terminal is a candidate for reuse. See #71850
*/
private static minUseDelay = 1000;
private _terminalInstances = new Map<vscode.Terminal, { lastUsedAt: number, config: string }>();
public async checkout(config: string) {
const entries = [...this._terminalInstances.keys()];
const promises = entries.map((terminal) => createCancelablePromise(async ct => {
const pid = await terminal.processId;
if (await hasChildProcesses(pid)) {
return null;
}
// important: date check and map operations must be synchronous
const now = Date.now();
const termInfo = this._terminalInstances.get(terminal);
if (!termInfo || termInfo.lastUsedAt + DebugTerminalCollection.minUseDelay > now || ct.isCancellationRequested) {
return null;
}
if (termInfo.config !== config) {
return null;
}
termInfo.lastUsedAt = now;
return terminal;
}));
return await firstParallel(promises, (t): t is vscode.Terminal => !!t);
}
public insert(terminal: vscode.Terminal, termConfig: string) {
this._terminalInstances.set(terminal, { lastUsedAt: Date.now(), config: termConfig });
}
public onTerminalClosed(terminal: vscode.Terminal) {
this._terminalInstances.delete(terminal);
}
}