Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)

* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c

* remove files we don't want

* fix hygiene

* update distro

* update distro

* fix hygiene

* fix strict nulls

* distro

* distro

* fix tests

* fix tests

* add another edit

* fix viewlet icon

* fix azure dialog

* fix some padding

* fix more padding issues
This commit is contained in:
Anthony Dresser
2019-12-04 19:28:22 -08:00
committed by GitHub
parent a8818ab0df
commit f5ce7fb2a5
1507 changed files with 42813 additions and 27370 deletions

View File

@@ -18,14 +18,13 @@ import { IAction, Action } from 'vs/base/common/actions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
import { ILabelService } from 'vs/platform/label/common/label';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { ITreeRenderer, ITreeNode, ITreeContextMenuEvent, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree';
import { TreeResourceNavigator2, WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
import { onUnexpectedError } from 'vs/base/common/errors';
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { createMatches, FuzzyScore } from 'vs/base/common/filters';
import { Event } from 'vs/base/common/event';
@@ -35,12 +34,26 @@ import { isSessionAttach } from 'vs/workbench/contrib/debug/common/debugUtils';
import { STOP_ID, STOP_LABEL, DISCONNECT_ID, DISCONNECT_LABEL, RESTART_SESSION_ID, RESTART_LABEL, STEP_OVER_ID, STEP_OVER_LABEL, STEP_INTO_LABEL, STEP_INTO_ID, STEP_OUT_LABEL, STEP_OUT_ID, PAUSE_ID, PAUSE_LABEL, CONTINUE_ID, CONTINUE_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
const $ = dom.$;
type CallStackItem = IStackFrame | IThread | IDebugSession | string | ThreadAndSessionIds | IStackFrame[];
export class CallStackView extends ViewletPanel {
function getContext(element: CallStackItem | null): any {
return element instanceof StackFrame ? {
sessionId: element.thread.session.getId(),
threadId: element.thread.getId(),
frameId: element.getId()
} : element instanceof Thread ? {
sessionId: element.session.getId(),
threadId: element.getId()
} : isDebugSession(element) ? {
sessionId: element.getId()
} : undefined;
}
export class CallStackView extends ViewletPane {
private pauseMessage!: HTMLSpanElement;
private pauseMessageLabel!: HTMLSpanElement;
@@ -66,7 +79,7 @@ export class CallStackView extends ViewletPanel {
@IMenuService menuService: IMenuService,
@IContextKeyService readonly contextKeyService: IContextKeyService,
) {
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
this.callStackItemType = CONTEXT_CALLSTACK_ITEM_TYPE.bindTo(contextKeyService);
this.contributedContextMenu = menuService.createMenu(MenuId.DebugCallStackContext, contextKeyService);
@@ -90,7 +103,7 @@ export class CallStackView extends ViewletPanel {
} else {
this.pauseMessage.hidden = true;
if (this.toolbar) {
const collapseAction = new CollapseAction(this.tree, true, 'explorer-action collapse-explorer');
const collapseAction = new CollapseAction(this.tree, true, 'explorer-action codicon-collapse-all');
this.toolbar.setActions([collapseAction])();
}
}
@@ -122,7 +135,7 @@ export class CallStackView extends ViewletPanel {
const treeContainer = renderViewTree(container);
this.dataSource = new CallStackDataSource(this.debugService);
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'CallStackView', treeContainer, new CallStackDelegate(), [
this.tree = this.instantiationService.createInstance<typeof WorkbenchAsyncDataTree, WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>>(WorkbenchAsyncDataTree, 'CallStackView', treeContainer, new CallStackDelegate(), [
new SessionsRenderer(this.instantiationService),
new ThreadsRenderer(this.instantiationService),
this.instantiationService.createInstance(StackFramesRenderer),
@@ -162,10 +175,13 @@ export class CallStackView extends ViewletPanel {
return nls.localize('showMoreStackFrames2', "Show More Stack Frames");
}
},
expandOnlyOnTwistieClick: true
expandOnlyOnTwistieClick: true,
overrideStyles: {
listBackground: SIDE_BAR_BACKGROUND
}
});
this.tree.setInput(this.debugService.getModel()).then(undefined, onUnexpectedError);
this.tree.setInput(this.debugService.getModel());
const callstackNavigator = new TreeResourceNavigator2(this.tree);
this._register(callstackNavigator);
@@ -326,15 +342,15 @@ export class CallStackView extends ViewletPanel {
this.contextMenuService.showContextMenu({
getAnchor: () => e.anchor,
getActions: () => actions,
getActionsContext: () => element && element instanceof StackFrame ? element.getId() : undefined,
getActionsContext: () => getContext(element),
onHide: () => dispose(actionsDisposable)
});
}
private getContextForContributedActions(element: CallStackItem | null): string | number | undefined {
private getContextForContributedActions(element: CallStackItem | null): string | number {
if (element instanceof StackFrame) {
if (element.source.inMemory) {
return element.source.raw.path || element.source.reference;
return element.source.raw.path || element.source.reference || '';
}
return element.source.uri.toString();
@@ -346,7 +362,7 @@ export class CallStackView extends ViewletPanel {
return element.getId();
}
return undefined;
return '';
}
}
@@ -382,6 +398,7 @@ interface IStackFrameTemplateData {
fileName: HTMLElement;
lineNumber: HTMLElement;
label: HighlightedLabel;
actionBar: ActionBar;
}
class SessionsRenderer implements ITreeRenderer<IDebugSession, FuzzyScore, ISessionTemplateData> {
@@ -478,8 +495,9 @@ class StackFramesRenderer implements ITreeRenderer<IStackFrame, FuzzyScore, ISta
const wrapper = dom.append(file, $('span.line-number-wrapper'));
const lineNumber = dom.append(wrapper, $('span.line-number'));
const label = new HighlightedLabel(labelDiv, false);
const actionBar = new ActionBar(stackFrame);
return { file, fileName, label, lineNumber, stackFrame };
return { file, fileName, label, lineNumber, stackFrame, actionBar };
}
renderElement(element: ITreeNode<IStackFrame, FuzzyScore>, index: number, data: IStackFrameTemplateData): void {
@@ -487,6 +505,8 @@ class StackFramesRenderer implements ITreeRenderer<IStackFrame, FuzzyScore, ISta
dom.toggleClass(data.stackFrame, 'disabled', !stackFrame.source || !stackFrame.source.available || isDeemphasized(stackFrame));
dom.toggleClass(data.stackFrame, 'label', stackFrame.presentationHint === 'label');
dom.toggleClass(data.stackFrame, 'subtle', stackFrame.presentationHint === 'subtle');
const hasActions = stackFrame.thread.session.capabilities.supportsRestartFrame;
dom.toggleClass(data.stackFrame, 'has-actions', hasActions);
data.file.title = stackFrame.source.inMemory ? stackFrame.source.uri.path : this.labelService.getUriLabel(stackFrame.source.uri);
if (stackFrame.source.raw.origin) {
@@ -503,10 +523,18 @@ class StackFramesRenderer implements ITreeRenderer<IStackFrame, FuzzyScore, ISta
} else {
dom.addClass(data.lineNumber, 'unavailable');
}
data.actionBar.clear();
if (hasActions) {
const action = new Action('debug.callStack.restartFrame', nls.localize('restartFrame', "Restart Frame"), 'codicon-debug-restart-frame', true, () => {
return stackFrame.restart();
});
data.actionBar.push(action, { icon: true, label: false });
}
}
disposeTemplate(templateData: IStackFrameTemplateData): void {
// noop
templateData.actionBar.dispose();
}
}
@@ -644,7 +672,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
if (sessions.length === 0) {
return Promise.resolve([]);
}
if (sessions.length > 1) {
if (sessions.length > 1 || this.debugService.getViewModel().isMultiSessionView()) {
return Promise.resolve(sessions.filter(s => !s.parentSession));
}
@@ -786,11 +814,11 @@ class StopAction extends Action {
private readonly session: IDebugSession,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${STOP_ID}`, STOP_LABEL, 'debug-action stop');
super(`action.${STOP_ID}`, STOP_LABEL, 'debug-action codicon-debug-stop');
}
public run(): Promise<any> {
return this.commandService.executeCommand(STOP_ID, this.session.getId(), this.session);
return this.commandService.executeCommand(STOP_ID, getContext(this.session));
}
}
@@ -800,11 +828,11 @@ class DisconnectAction extends Action {
private readonly session: IDebugSession,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${DISCONNECT_ID}`, DISCONNECT_LABEL, 'debug-action disconnect');
super(`action.${DISCONNECT_ID}`, DISCONNECT_LABEL, 'debug-action codicon-debug-disconnect');
}
public run(): Promise<any> {
return this.commandService.executeCommand(DISCONNECT_ID, this.session.getId(), this.session);
return this.commandService.executeCommand(DISCONNECT_ID, getContext(this.session));
}
}
@@ -814,11 +842,11 @@ class RestartAction extends Action {
private readonly session: IDebugSession,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${RESTART_SESSION_ID}`, RESTART_LABEL, 'debug-action restart');
super(`action.${RESTART_SESSION_ID}`, RESTART_LABEL, 'debug-action codicon-debug-restart');
}
public run(): Promise<any> {
return this.commandService.executeCommand(RESTART_SESSION_ID, this.session.getId(), this.session);
return this.commandService.executeCommand(RESTART_SESSION_ID, getContext(this.session));
}
}
@@ -828,11 +856,11 @@ class StepOverAction extends Action {
private readonly thread: IThread,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${STEP_OVER_ID}`, STEP_OVER_LABEL, 'debug-action step-over', thread.stopped);
super(`action.${STEP_OVER_ID}`, STEP_OVER_LABEL, 'debug-action codicon-debug-step-over', thread.stopped);
}
public run(): Promise<any> {
return this.commandService.executeCommand(STEP_OVER_ID, this.thread.threadId, this.thread);
return this.commandService.executeCommand(STEP_OVER_ID, getContext(this.thread));
}
}
@@ -842,11 +870,11 @@ class StepIntoAction extends Action {
private readonly thread: IThread,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${STEP_INTO_ID}`, STEP_INTO_LABEL, 'debug-action step-into', thread.stopped);
super(`action.${STEP_INTO_ID}`, STEP_INTO_LABEL, 'debug-action codicon-debug-step-into', thread.stopped);
}
public run(): Promise<any> {
return this.commandService.executeCommand(STEP_INTO_ID, this.thread.threadId, this.thread);
return this.commandService.executeCommand(STEP_INTO_ID, getContext(this.thread));
}
}
@@ -856,11 +884,11 @@ class StepOutAction extends Action {
private readonly thread: IThread,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${STEP_OUT_ID}`, STEP_OUT_LABEL, 'debug-action step-out', thread.stopped);
super(`action.${STEP_OUT_ID}`, STEP_OUT_LABEL, 'debug-action codicon-debug-step-out', thread.stopped);
}
public run(): Promise<any> {
return this.commandService.executeCommand(STEP_OUT_ID, this.thread.threadId, this.thread);
return this.commandService.executeCommand(STEP_OUT_ID, getContext(this.thread));
}
}
@@ -870,11 +898,11 @@ class PauseAction extends Action {
private readonly thread: IThread,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${PAUSE_ID}`, PAUSE_LABEL, 'debug-action pause', !thread.stopped);
super(`action.${PAUSE_ID}`, PAUSE_LABEL, 'debug-action codicon-debug-pause', !thread.stopped);
}
public run(): Promise<any> {
return this.commandService.executeCommand(PAUSE_ID, this.thread.threadId, this.thread);
return this.commandService.executeCommand(PAUSE_ID, getContext(this.thread));
}
}
@@ -884,10 +912,10 @@ class ContinueAction extends Action {
private readonly thread: IThread,
@ICommandService private readonly commandService: ICommandService
) {
super(`action.${CONTINUE_ID}`, CONTINUE_LABEL, 'debug-action continue', thread.stopped);
super(`action.${CONTINUE_ID}`, CONTINUE_LABEL, 'debug-action codicon-debug-continue', thread.stopped);
}
public run(): Promise<any> {
return this.commandService.executeCommand(CONTINUE_ID, this.thread.threadId, this.thread);
return this.commandService.executeCommand(CONTINUE_ID, getContext(this.thread));
}
}