Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)

This commit is contained in:
Anthony Dresser
2019-03-26 11:43:38 -07:00
committed by GitHub
parent b1393ae615
commit 0d8ef9583b
268 changed files with 5947 additions and 3422 deletions

View File

@@ -126,7 +126,7 @@ export interface IExpressionTemplateData {
name: HTMLSpanElement;
value: HTMLSpanElement;
inputBoxContainer: HTMLElement;
enableInputBox(expression: IExpression, options: IInputBoxOptions);
enableInputBox(expression: IExpression, options: IInputBoxOptions): void;
toDispose: IDisposable[];
label: HighlightedLabel;
}

View File

@@ -76,7 +76,7 @@ export class BreakpointsView extends ViewletPanel {
], {
identityProvider: { getId: (element: IEnablement) => element.getId() },
multipleSelectionSupport: false,
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: e => e }
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IEnablement) => e }
}) as WorkbenchList<IEnablement>;
CONTEXT_BREAKPOINTS_FOCUSED.bindTo(this.list.contextKeyService);

View File

@@ -109,7 +109,7 @@ export class CallStackView extends ViewletPanel {
accessibilityProvider: new CallStackAccessibilityProvider(),
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'callStackAriaLabel' }, "Debug Call Stack"),
identityProvider: {
getId: element => {
getId: (element: CallStackItem) => {
if (typeof element === 'string') {
return element;
}
@@ -117,11 +117,11 @@ export class CallStackView extends ViewletPanel {
return `showMore ${element[0].getId()}`;
}
return (<IStackFrame | IThread | IDebugSession | ThreadAndSessionIds>element).getId();
return element.getId();
}
},
keyboardNavigationLabelProvider: {
getKeyboardNavigationLabel: e => {
getKeyboardNavigationLabel: (e: CallStackItem) => {
if (isDebugSession(e)) {
return e.getLabel();
}
@@ -170,7 +170,7 @@ export class CallStackView extends ViewletPanel {
focusStackFrame(undefined, undefined, element);
}
if (element instanceof ThreadAndSessionIds) {
const session = this.debugService.getModel().getSessions().filter(p => p.getId() === element.sessionId).pop();
const session = this.debugService.getModel().getSession(element.sessionId);
const thread = session && session.getThread(element.threadId);
if (thread) {
(<Thread>thread).fetchCallStack()

View File

@@ -125,7 +125,7 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: STEP_INTO_ID,
weight: KeybindingWeight.WorkbenchContrib,
weight: KeybindingWeight.WorkbenchContrib + 10, // Have a stronger weight to have priority over full screen when debugging
primary: KeyCode.F11,
when: CONTEXT_DEBUG_STATE.isEqualTo('stopped'),
handler: (accessor: ServicesAccessor, _: string, thread: IThread | undefined) => {

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/debugToolbar';
import 'vs/css!./media/debugToolBar';
import * as errors from 'vs/base/common/errors';
import * as browser from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
@@ -46,14 +46,14 @@ export const debugToolBarBorder = registerColor('debugToolBar.border', {
hc: null
}, localize('debugToolBarBorder', "Debug toolbar border color."));
export class DebugToolbar extends Themable implements IWorkbenchContribution {
export class DebugToolBar extends Themable implements IWorkbenchContribution {
private $el: HTMLElement;
private dragArea: HTMLElement;
private actionBar: ActionBar;
private activeActions: IAction[];
private updateScheduler: RunOnceScheduler;
private debugToolbarMenu: IMenu;
private debugToolBarMenu: IMenu;
private isVisible: boolean;
private isBuilt: boolean;
@@ -81,8 +81,8 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
this.dragArea = dom.append(this.$el, dom.$('div.drag-area'));
const actionBarContainer = dom.append(this.$el, dom.$('div.action-bar-container'));
this.debugToolbarMenu = menuService.createMenu(MenuId.DebugToolbar, contextKeyService);
this.toDispose.push(this.debugToolbarMenu);
this.debugToolBarMenu = menuService.createMenu(MenuId.DebugToolBar, contextKeyService);
this.toDispose.push(this.debugToolBarMenu);
this.activeActions = [];
this.actionBar = this._register(new ActionBar(actionBarContainer, {
@@ -106,7 +106,7 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
return this.hide();
}
const actions = DebugToolbar.getActions(this.debugToolbarMenu, this.debugService, this.instantiationService);
const actions = DebugToolBar.getActions(this.debugToolBarMenu, this.debugService, this.instantiationService);
if (!arrays.equals(actions, this.activeActions, (first, second) => first.id === second.id)) {
this.actionBar.clear();
this.actionBar.push(actions, { icon: true, label: false });

View File

@@ -24,7 +24,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { memoize } from 'vs/base/common/decorators';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { DebugToolbar } from 'vs/workbench/contrib/debug/browser/debugToolbar';
import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IMenu, MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
@@ -40,7 +40,7 @@ export class DebugViewlet extends ViewContainerViewlet {
private progressRunner: IProgressRunner;
private breakpointView: ViewletPanel;
private panelListeners = new Map<string, IDisposable>();
private debugToolbarMenu: IMenu;
private debugToolBarMenu: IMenu;
constructor(
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@@ -63,6 +63,7 @@ export class DebugViewlet extends ViewContainerViewlet {
super(VIEWLET_ID, `${VIEWLET_ID}.state`, false, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state)));
this._register(this.debugService.onDidNewSession(() => this.updateToolBar()));
this._register(this.contextService.onDidChangeWorkbenchState(() => this.updateTitleArea()));
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('debug.toolBarLocation')) {
@@ -109,11 +110,11 @@ export class DebugViewlet extends ViewContainerViewlet {
return [this.startAction, this.configureAction, this.toggleReplAction];
}
if (!this.debugToolbarMenu) {
this.debugToolbarMenu = this.menuService.createMenu(MenuId.DebugToolbar, this.contextKeyService);
this.toDispose.push(this.debugToolbarMenu);
if (!this.debugToolBarMenu) {
this.debugToolBarMenu = this.menuService.createMenu(MenuId.DebugToolBar, this.contextKeyService);
this.toDispose.push(this.debugToolBarMenu);
}
return DebugToolbar.getActions(this.debugToolbarMenu, this.debugService, this.instantiationService);
return DebugToolBar.getActions(this.debugToolBarMenu, this.debugService, this.instantiationService);
}
get showInitialDebugActions(): boolean {
@@ -160,6 +161,10 @@ export class DebugViewlet extends ViewContainerViewlet {
this.progressRunner = this.progressService.show(true);
}
this.updateToolBar();
}
private updateToolBar(): void {
if (this.configurationService.getValue<IDebugConfiguration>('debug').toolBarLocation === 'docked') {
this.updateTitleArea();
}

View File

@@ -424,10 +424,10 @@ export class LoadedScriptsView extends ViewletPanel {
new LoadedScriptsDataSource(),
{
identityProvider: {
getId: element => (<LoadedScriptsItem>element).getId()
getId: (element: LoadedScriptsItem) => element.getId()
},
keyboardNavigationLabelProvider: {
getKeyboardNavigationLabel: element => (<LoadedScriptsItem>element).getLabel()
getKeyboardNavigationLabel: (element: LoadedScriptsItem) => element.getLabel()
},
filter: this.filter,
accessibilityProvider: new LoadedSciptsAccessibilityProvider(),

View File

@@ -373,9 +373,9 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
], new ReplDataSource(), {
ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel"),
accessibilityProvider: new ReplAccessibilityProvider(),
identityProvider: { getId: element => (<IReplElement>element).getId() },
identityProvider: { getId: (element: IReplElement) => element.getId() },
mouseSupport: false,
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: e => e },
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IReplElement) => e },
horizontalScrolling: false,
setRowLineHeight: false,
supportDynamicHeights: true
@@ -452,7 +452,10 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
private onContextMenu(e: ITreeContextMenuEvent<IReplElement>): void {
const actions: IAction[] = [];
actions.push(new Action('debug.replCopy', nls.localize('copy', "Copy"), undefined, true, () => {
this.clipboardService.writeText(window.getSelection().toString());
const nativeSelection = window.getSelection();
if (nativeSelection) {
this.clipboardService.writeText(nativeSelection.toString());
}
return Promise.resolve();
}));
actions.push(new Action('workbench.debug.action.copyAll', nls.localize('copyAll', "Copy All"), undefined, true, () => {
@@ -740,7 +743,8 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
}
hasDynamicHeight?(element: IReplElement): boolean {
return true;
// Empty elements should not have dynamic height since they will be invisible
return element.toString().length > 0;
}
}

View File

@@ -76,8 +76,8 @@ export class VariablesView extends ViewletPanel {
new VariablesDataSource(), {
ariaLabel: nls.localize('variablesAriaTreeLabel', "Debug Variables"),
accessibilityProvider: new VariablesAccessibilityProvider(),
identityProvider: { getId: element => (<IExpression | IScope>element).getId() },
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: e => e }
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

@@ -63,8 +63,8 @@ export class WatchExpressionsView extends ViewletPanel {
new WatchExpressionsDataSource(), {
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'watchAriaTreeLabel' }, "Debug Watch Expressions"),
accessibilityProvider: new WatchExpressionsAccessibilityProvider(),
identityProvider: { getId: element => (<IExpression>element).getId() },
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: e => e },
identityProvider: { getId: (element: IExpression) => element.getId() },
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression) => e },
dnd: new WatchExpressionsDragAndDrop(this.debugService),
}) as WorkbenchAsyncDataTree<IDebugService | IExpression, IExpression, FuzzyScore>;

View File

@@ -168,7 +168,7 @@ export interface IDebugSession extends ITreeElement {
removeReplExpressions(): void;
addReplExpression(stackFrame: IStackFrame | undefined, name: string): Promise<void>;
appendToRepl(data: string | IExpression, severity: severity, source?: IReplElementSource): void;
logToRepl(sev: severity, args: any[], frame?: { uri: uri, line: number, column: number });
logToRepl(sev: severity, args: any[], frame?: { uri: uri, line: number, column: number }): void;
// session events
readonly onDidEndAdapter: Event<AdapterEndEvent>;
@@ -389,6 +389,7 @@ export interface IEvaluate {
}
export interface IDebugModel extends ITreeElement {
getSession(sessionId: string | undefined, includeInactive?: boolean): IDebugSession | undefined;
getSessions(includeInactive?: boolean): IDebugSession[];
getBreakpoints(filter?: { uri?: uri, lineNumber?: number, column?: number, enabledOnly?: boolean }): ReadonlyArray<IBreakpoint>;
areBreakpointsActivated(): boolean;
@@ -471,8 +472,8 @@ export interface ICompound {
export interface IDebugAdapter extends IDisposable {
readonly onError: Event<Error>;
readonly onExit: Event<number | null>;
onRequest(callback: (request: DebugProtocol.Request) => void);
onEvent(callback: (event: DebugProtocol.Event) => void);
onRequest(callback: (request: DebugProtocol.Request) => void): void;
onEvent(callback: (event: DebugProtocol.Event) => void): void;
startSession(): Promise<void>;
sendMessage(message: DebugProtocol.ProtocolMessage): void;
sendResponse(response: DebugProtocol.Response): void;

View File

@@ -81,7 +81,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
if (resource.query) {
const data = Source.getEncodedDebugData(resource);
session = this.debugService.getModel().getSessions().filter(p => p.getId() === data.sessionId).pop();
session = this.debugService.getModel().getSession(data.sessionId);
}
if (!session) {

View File

@@ -778,6 +778,13 @@ export class DebugModel implements IDebugModel {
return 'root';
}
getSession(sessionId: string | undefined, includeInactive = false): IDebugSession | undefined {
if (sessionId) {
return this.getSessions(includeInactive).filter(s => s.getId() === sessionId).pop();
}
return undefined;
}
getSessions(includeInactive = false): IDebugSession[] {
// By default do not return inactive sesions.
// However we are still holding onto inactive sessions due to repl and debug service session revival (eh scenario)

View File

@@ -199,7 +199,7 @@ function convertPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePath: (toDA:
fixSourcePath(true, (<DebugProtocol.GotoTargetsArguments>request.arguments).source);
break;
case 'launchVSCode':
request.arguments.args.forEach(arg => fixSourcePath(false, arg));
request.arguments.args.forEach((arg: PathContainer | undefined) => fixSourcePath(false, arg));
break;
default:
break;

View File

@@ -28,7 +28,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { DebugEditorModelManager } from 'vs/workbench/contrib/debug/browser/debugEditorModelManager';
import { StartAction, AddFunctionBreakpointAction, ConfigureAction, DisableAllBreakpointsAction, EnableAllBreakpointsAction, RemoveAllBreakpointsAction, RunAction, ReapplyBreakpointsAction, SelectAndStartAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { DebugToolbar } from 'vs/workbench/contrib/debug/browser/debugToolbar';
import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar';
import * as service from 'vs/workbench/contrib/debug/electron-browser/debugService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { registerCommands, ADD_CONFIGURATION_ID, TOGGLE_INLINE_BREAKPOINT_ID, COPY_STACK_TRACE_ID, REVERSE_CONTINUE_ID, STEP_BACK_ID, RESTART_SESSION_ID, TERMINATE_THREAD_ID, STEP_OVER_ID, STEP_INTO_ID, STEP_OUT_ID, PAUSE_ID, DISCONNECT_ID, STOP_ID, RESTART_FRAME_ID, CONTINUE_ID, FOCUS_REPL_ID } from 'vs/workbench/contrib/debug/browser/debugCommands';
@@ -124,7 +124,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugPanelAction,
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View"));
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugEditorModelManager, LifecyclePhase.Restored);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugToolbar, LifecyclePhase.Restored);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugToolBar, LifecyclePhase.Restored);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Eventually);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider, LifecyclePhase.Eventually);
@@ -259,8 +259,8 @@ statusBar.registerStatusbarItem(new StatusbarItemDescriptor(DebugStatus, Statusb
// Debug toolbar
const registerDebugToolbarItem = (id: string, title: string, icon: string, order: number, when?: ContextKeyExpr, precondition?: ContextKeyExpr) => {
MenuRegistry.appendMenuItem(MenuId.DebugToolbar, {
const registerDebugToolBarItem = (id: string, title: string, icon: string, order: number, when?: ContextKeyExpr, precondition?: ContextKeyExpr) => {
MenuRegistry.appendMenuItem(MenuId.DebugToolBar, {
group: 'navigation',
when,
order,
@@ -276,16 +276,16 @@ const registerDebugToolbarItem = (id: string, title: string, icon: string, order
});
};
registerDebugToolbarItem(CONTINUE_ID, continueLabel, 'continue', 10, CONTEXT_DEBUG_STATE.notEqualsTo('running'));
registerDebugToolbarItem(PAUSE_ID, pauseLabel, 'pause', 10, CONTEXT_DEBUG_STATE.isEqualTo('running'));
registerDebugToolbarItem(STOP_ID, stopLabel, 'stop', 70, CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated());
registerDebugToolbarItem(DISCONNECT_ID, disconnectLabel, 'disconnect', 70, CONTEXT_FOCUSED_SESSION_IS_ATTACH);
registerDebugToolbarItem(STEP_OVER_ID, stepOverLabel, 'step-over', 20, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolbarItem(STEP_INTO_ID, stepIntoLabel, 'step-into', 30, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolbarItem(STEP_OUT_ID, stepOutLabel, 'step-out', 40, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolbarItem(RESTART_SESSION_ID, restartLabel, 'restart', 60);
registerDebugToolbarItem(STEP_BACK_ID, nls.localize('stepBackDebug', "Step Back"), 'step-back', 50, CONTEXT_STEP_BACK_SUPPORTED, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolbarItem(REVERSE_CONTINUE_ID, nls.localize('reverseContinue', "Reverse"), 'reverse-continue', 60, CONTEXT_STEP_BACK_SUPPORTED, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(CONTINUE_ID, continueLabel, 'continue', 10, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(PAUSE_ID, pauseLabel, 'pause', 10, CONTEXT_DEBUG_STATE.notEqualsTo('stopped'), CONTEXT_DEBUG_STATE.isEqualTo('running'));
registerDebugToolBarItem(STOP_ID, stopLabel, 'stop', 70, CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated());
registerDebugToolBarItem(DISCONNECT_ID, disconnectLabel, 'disconnect', 70, CONTEXT_FOCUSED_SESSION_IS_ATTACH);
registerDebugToolBarItem(STEP_OVER_ID, stepOverLabel, 'step-over', 20, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(STEP_INTO_ID, stepIntoLabel, 'step-into', 30, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(STEP_OUT_ID, stepOutLabel, 'step-out', 40, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(RESTART_SESSION_ID, restartLabel, 'restart', 60);
registerDebugToolBarItem(STEP_BACK_ID, nls.localize('stepBackDebug', "Step Back"), 'step-back', 50, CONTEXT_STEP_BACK_SUPPORTED, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(REVERSE_CONTINUE_ID, nls.localize('reverseContinue', "Reverse"), 'reverse-continue', 60, CONTEXT_STEP_BACK_SUPPORTED, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
// Debug callstack context menu
const registerDebugCallstackItem = (id: string, title: string, order: number, when?: ContextKeyExpr, precondition?: ContextKeyExpr, group = 'navigation') => {
@@ -529,7 +529,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
// Touch Bar
if (isMacintosh) {
const registerTouchBarEntry = (id: string, title: string, order, when: ContextKeyExpr, icon: string) => {
const registerTouchBarEntry = (id: string, title: string, order: number, when: ContextKeyExpr, icon: string) => {
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
command: {
id, title, iconLocation: { dark: URI.parse(require.toUrl(`vs/workbench/contrib/debug/electron-browser/media/${icon}`)) }

View File

@@ -137,7 +137,7 @@ export class DebugService implements IDebugService {
this.lifecycleService.onShutdown(this.dispose, this);
this.toDispose.push(this.broadcastService.onBroadcast(broadcast => {
const session = this.model.getSessions(true).filter(s => s.getId() === broadcast.payload.debugId).pop();
const session = this.model.getSession(broadcast.payload.debugId, true);
if (session) {
switch (broadcast.channel) {

View File

@@ -497,7 +497,7 @@ export class RawDebugSession {
success: true
};
const safeSendResponse = (response) => this.debugAdapter && this.debugAdapter.sendResponse(response);
const safeSendResponse = (response: DebugProtocol.Response) => this.debugAdapter && this.debugAdapter.sendResponse(response);
switch (request.command) {
case 'launchVSCode':

View File

@@ -71,7 +71,7 @@ abstract class TerminalLauncher implements ITerminalLauncher {
return this.runInTerminal0(args.title!, args.cwd, args.args, args.env || {}, config);
}
abstract runInTerminal0(title: string, dir: string, args: string[], envVars: env.IProcessEnvironment | {}, config): Promise<number | undefined>;
abstract runInTerminal0(title: string, dir: string, args: string[], envVars: env.IProcessEnvironment | {}, config: ITerminalSettings): Promise<number | undefined>;
}
class WinTerminalService extends TerminalLauncher {