Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3 (#6516)

* Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3

* fix tests
This commit is contained in:
Anthony Dresser
2019-07-28 15:15:24 -07:00
committed by GitHub
parent aacf1e7f1c
commit 1d56a17f32
292 changed files with 19784 additions and 1873 deletions

View File

@@ -83,7 +83,7 @@ export class BreakpointsView extends ViewletPanel {
getRole: (breakpoint: IEnablement) => 'checkbox',
isChecked: (breakpoint: IEnablement) => breakpoint.enabled
}
}) as WorkbenchList<IEnablement>;
});
CONTEXT_BREAKPOINTS_FOCUSED.bindTo(this.list.contextKeyService);

View File

@@ -145,7 +145,7 @@ export class CallStackView extends ViewletPanel {
return nls.localize('showMoreStackFrames2', "Show More Stack Frames");
}
}
}) as WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>;
});
this.tree.setInput(this.debugService.getModel()).then(undefined, onUnexpectedError);

View File

@@ -539,7 +539,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
// Touch Bar
if (isMacintosh) {
const registerTouchBarEntry = (id: string, title: string, order: number, when: ContextKeyExpr, icon: string) => {
const registerTouchBarEntry = (id: string, title: string, order: number, when: ContextKeyExpr | undefined, icon: string) => {
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
command: {
id,

View File

@@ -21,7 +21,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, ITerminalSettings, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory, IDebugService } from 'vs/workbench/contrib/debug/common/debug';
import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory, IDebugService } from 'vs/workbench/contrib/debug/common/debug';
import { Debugger } from 'vs/workbench/contrib/debug/common/debugger';
import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -108,10 +108,10 @@ export class ConfigurationManager implements IConfigurationManager {
return Promise.resolve(config);
}
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> {
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
let tl = this.debugAdapterFactories.get(debugType);
if (tl) {
return tl.runInTerminal(args, config);
return tl.runInTerminal(args);
}
return Promise.resolve(void 0);
}

View File

@@ -80,7 +80,7 @@ export class DebugHoverWidget implements IContentWidget {
accessibilityProvider: new DebugHoverAccessibilityProvider(),
mouseSupport: false,
horizontalScrolling: true
}) as any as AsyncDataTree<IExpression, IExpression, any>;
});
this.valueContainer = $('.value');
this.valueContainer.tabIndex = 0;

View File

@@ -31,7 +31,6 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ReplModel } from 'vs/workbench/contrib/debug/common/replModel';
import { onUnexpectedError } from 'vs/base/common/errors';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ISignService } from 'vs/platform/sign/common/sign';
export class DebugSession implements IDebugSession {
@@ -66,7 +65,6 @@ export class DebugSession implements IDebugSession {
@IViewletService private readonly viewletService: IViewletService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@INotificationService private readonly notificationService: INotificationService,
@ISignService private readonly signService: ISignService,
@IProductService private readonly productService: IProductService,
@IWindowsService private readonly windowsService: IWindowsService
) {
@@ -169,7 +167,7 @@ export class DebugSession implements IDebugSession {
return dbgr.createDebugAdapter(this).then(debugAdapter => {
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.signService, this.windowsService);
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.windowsService);
return this.raw!.start().then(() => {

View File

@@ -433,7 +433,7 @@ export class LoadedScriptsView extends ViewletPanel {
accessibilityProvider: new LoadedSciptsAccessibilityProvider(),
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'loadedScriptsAriaLabel' }, "Debug Loaded Scripts"),
}
) as WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
);
this.tree.setInput(root);

View File

@@ -12,7 +12,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { formatPII, isUri } from 'vs/workbench/contrib/debug/common/debugUtils';
import { IDebugAdapter, IConfig, AdapterEndEvent, IDebugger } from 'vs/workbench/contrib/debug/common/debug';
import { createErrorWithActions } from 'vs/base/common/errorsWithActions';
import { ISignService } from 'vs/platform/sign/common/sign';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { URI } from 'vs/base/common/uri';
@@ -74,7 +73,6 @@ export class RawDebugSession {
dbgr: IDebugger,
private readonly telemetryService: ITelemetryService,
public readonly customTelemetryService: ITelemetryService | undefined,
private readonly signService: ISignService,
private readonly windowsService: IWindowsService
) {
@@ -548,19 +546,6 @@ export class RawDebugSession {
safeSendResponse(response);
});
break;
case 'handshake':
try {
const signature = await this.signService.sign(request.arguments.value);
response.body = {
signature: signature
};
safeSendResponse(response);
} catch (e) {
response.success = false;
response.message = e.message;
safeSendResponse(response);
}
break;
default:
response.success = false;
response.message = `unknown request '${request.command}'`;
@@ -602,7 +587,13 @@ export class RawDebugSession {
}
} else {
args._.push(a2);
const match = /^--(.+)$/.exec(a2);
if (match && match.length === 2) {
const key = match[1];
(<any>args)[key] = true;
} else {
args._.push(a2);
}
}
}
}

View File

@@ -378,12 +378,19 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
this.replDelegate = new ReplDelegate(this.configurationService);
const wordWrap = this.configurationService.getValue<IDebugConfiguration>('debug').console.wordWrap;
dom.toggleClass(treeContainer, 'word-wrap', wordWrap);
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, treeContainer, this.replDelegate, [
this.instantiationService.createInstance(VariablesRenderer),
this.instantiationService.createInstance(ReplSimpleElementsRenderer),
new ReplExpressionsRenderer(),
new ReplRawObjectsRenderer()
], new ReplDataSource(), {
this.tree = this.instantiationService.createInstance(
WorkbenchAsyncDataTree,
treeContainer,
this.replDelegate,
[
this.instantiationService.createInstance(VariablesRenderer),
this.instantiationService.createInstance(ReplSimpleElementsRenderer),
new ReplExpressionsRenderer(),
new ReplRawObjectsRenderer()
],
// https://github.com/microsoft/TypeScript/issues/32526
new ReplDataSource() as IAsyncDataSource<IDebugSession, IReplElement>,
{
ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel"),
accessibilityProvider: new ReplAccessibilityProvider(),
identityProvider: { getId: (element: IReplElement) => element.getId() },
@@ -392,7 +399,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
horizontalScrolling: !wordWrap,
setRowLineHeight: false,
supportDynamicHeights: wordWrap
}) as WorkbenchAsyncDataTree<IDebugSession, IReplElement, FuzzyScore>;
});
this._register(this.tree.onContextMenu(e => this.onContextMenu(e)));
let lastSelectedString: string;
this._register(this.tree.onMouseClick(() => {

View File

@@ -91,7 +91,7 @@ export class VariablesView extends ViewletPanel {
accessibilityProvider: new VariablesAccessibilityProvider(),
identityProvider: { getId: (element: IExpression | IScope) => element.getId() },
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression | IScope) => e }
}) as WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
});
this.tree.setInput(this.debugService.getViewModel()).then(null, onUnexpectedError);

View File

@@ -66,7 +66,7 @@ export class WatchExpressionsView extends ViewletPanel {
identityProvider: { getId: (element: IExpression) => element.getId() },
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression) => e },
dnd: new WatchExpressionsDragAndDrop(this.debugService),
}) as WorkbenchAsyncDataTree<IDebugService | IExpression, IExpression, FuzzyScore>;
});
this.tree.setInput(this.debugService).then(undefined, onUnexpectedError);
CONTEXT_WATCH_EXPRESSIONS_FOCUSED.bindTo(this.tree.contextKeyService);

View File

@@ -24,9 +24,7 @@ import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExte
import { Registry } from 'vs/platform/registry/common/platform';
import { TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { ITerminalConfiguration } from 'vs/workbench/contrib/terminal/common/terminal';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IExternalTerminalSettings } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
export const VIEWLET_ID = 'workbench.view.debug';
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);
@@ -573,12 +571,7 @@ export interface IDebugAdapterTrackerFactory {
}
export interface ITerminalLauncher {
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined>;
}
export interface ITerminalSettings {
external: IExternalTerminalSettings;
integrated: ITerminalConfiguration;
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined>;
}
export interface IConfigurationManager {
@@ -623,7 +616,7 @@ export interface IConfigurationManager {
createDebugAdapter(session: IDebugSession): IDebugAdapter | undefined;
substituteVariables(debugType: string, folder: IWorkspaceFolder | undefined, config: IConfig): Promise<IConfig>;
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined>;
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined>;
}
export interface ILaunch {

View File

@@ -9,7 +9,7 @@ import * as objects from 'vs/base/common/objects';
import { isObject } from 'vs/base/common/types';
import { IJSONSchema, IJSONSchemaSnippet } from 'vs/base/common/jsonSchema';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IConfig, IDebuggerContribution, INTERNAL_CONSOLE_OPTIONS_SCHEMA, IConfigurationManager, IDebugAdapter, ITerminalSettings, IDebugger, IDebugSession, IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
import { IConfig, IDebuggerContribution, INTERNAL_CONSOLE_OPTIONS_SCHEMA, IConfigurationManager, IDebugAdapter, IDebugger, IDebugSession, IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import * as ConfigurationResolverUtils from 'vs/workbench/services/configurationResolver/common/configurationResolverUtils';
@@ -108,8 +108,7 @@ export class Debugger implements IDebugger {
}
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
const config = this.configurationService.getValue<ITerminalSettings>('terminal');
return this.configurationManager.runInTerminal(this.type, args, config);
return this.configurationManager.runInTerminal(this.type, args);
}
get label(): string {

View File

@@ -8,7 +8,7 @@ import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppen
import { TelemetryAppenderChannel } from 'vs/platform/telemetry/node/telemetryIpc';
const appender = new AppInsightsAppender(process.argv[2], JSON.parse(process.argv[3]), process.argv[4]);
process.once('exit', () => appender.dispose());
process.once('exit', () => appender.flush());
const channel = new TelemetryAppenderChannel(appender);
const server = new Server('telemetry');

View File

@@ -5,15 +5,15 @@
import * as cp from 'child_process';
import * as env from 'vs/base/common/platform';
import { ITerminalSettings } from 'vs/workbench/contrib/debug/common/debug';
import { getSystemShell } from 'vs/workbench/contrib/terminal/node/terminal';
import { WindowsExternalTerminalService, MacExternalTerminalService, LinuxExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/node/externalTerminalService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
import { ExtHostConfigProvider } from 'vs/workbench/api/common/extHostConfiguration';
let externalTerminalService: IExternalTerminalService | undefined = undefined;
export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): void {
export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestArguments, configProvider: ExtHostConfigProvider): void {
if (!externalTerminalService) {
if (env.isWindows) {
externalTerminalService = new WindowsExternalTerminalService(<IConfigurationService><unknown>undefined);
@@ -24,6 +24,7 @@ export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestAr
}
}
if (externalTerminalService) {
const config = configProvider.getConfiguration('terminal');
externalTerminalService.runInTerminal(args.title!, args.cwd, args.args, args.env || {}, config.external || {});
}
}
@@ -60,24 +61,25 @@ export function hasChildProcesses(processId: number): boolean {
const enum ShellType { cmd, powershell, bash }
export function prepareCommand(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): string {
export function prepareCommand(args: DebugProtocol.RunInTerminalRequestArguments, shell: string, configProvider: ExtHostConfigProvider): string {
let shellType: ShellType;
let shellType = env.isWindows ? ShellType.cmd : ShellType.bash; // pick a good default
// get the shell configuration for the current platform
let shell: string;
const shell_config = config.integrated.shell;
if (env.isWindows) {
shell = shell_config.windows || getSystemShell(env.Platform.Windows);
shellType = ShellType.cmd;
} else if (env.isLinux) {
shell = shell_config.linux || getSystemShell(env.Platform.Linux);
shellType = ShellType.bash;
} else if (env.isMacintosh) {
shell = shell_config.osx || getSystemShell(env.Platform.Mac);
shellType = ShellType.bash;
} else {
throw new Error('Unknown platform');
if (shell) {
const config = configProvider.getConfiguration('terminal');
// get the shell configuration for the current platform
const shell_config = config.integrated.shell;
if (env.isWindows) {
shell = shell_config.windows || getSystemShell(env.Platform.Windows);
} else if (env.isLinux) {
shell = shell_config.linux || getSystemShell(env.Platform.Linux);
} else if (env.isMacintosh) {
shell = shell_config.osx || getSystemShell(env.Platform.Mac);
} else {
throw new Error('Unknown platform');
}
}
// try to determine the shell type

View File

@@ -15,7 +15,7 @@ import { ReplModel } from 'vs/workbench/contrib/debug/common/replModel';
import { IBreakpointUpdateData } from 'vs/workbench/contrib/debug/common/debug';
function createMockSession(model: DebugModel, name = 'mockSession', parentSession?: DebugSession | undefined): DebugSession {
return new DebugSession({ resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, parentSession, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
return new DebugSession({ resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, parentSession, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
}
suite('Debug - Model', () => {
@@ -427,7 +427,7 @@ suite('Debug - Model', () => {
// Repl output
test('repl output', () => {
const session = new DebugSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
const session = new DebugSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
const repl = new ReplModel(session);
repl.appendToRepl('first line\n', severity.Error);
repl.appendToRepl('second line ', severity.Error);