Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 (#8649)

* Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781

* distro

* fix tests
This commit is contained in:
Anthony Dresser
2019-12-11 22:42:23 -08:00
committed by GitHub
parent 82974a2135
commit 4ba6a979ba
280 changed files with 10898 additions and 14231 deletions

View File

@@ -34,6 +34,8 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
import { isSafari } from 'vs/base/browser/browser';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
const $ = dom.$;
@@ -52,18 +54,19 @@ const breakpointHelperDecoration: IModelDecorationOptions = {
function createBreakpointDecorations(model: ITextModel, breakpoints: ReadonlyArray<IBreakpoint>, debugService: IDebugService, debugSettings: IDebugConfiguration): { range: Range; options: IModelDecorationOptions; }[] {
const result: { range: Range; options: IModelDecorationOptions; }[] = [];
breakpoints.forEach((breakpoint) => {
if (breakpoint.lineNumber <= model.getLineCount()) {
const column = model.getLineFirstNonWhitespaceColumn(breakpoint.lineNumber);
const range = model.validateRange(
breakpoint.column ? new Range(breakpoint.lineNumber, breakpoint.column, breakpoint.lineNumber, breakpoint.column + 1)
: new Range(breakpoint.lineNumber, column, breakpoint.lineNumber, column + 1) // Decoration has to have a width #20688
);
result.push({
options: getBreakpointDecorationOptions(model, breakpoint, debugService, debugSettings),
range
});
if (breakpoint.lineNumber > model.getLineCount()) {
return;
}
const column = model.getLineFirstNonWhitespaceColumn(breakpoint.lineNumber);
const range = model.validateRange(
breakpoint.column ? new Range(breakpoint.lineNumber, breakpoint.column, breakpoint.lineNumber, breakpoint.column + 1)
: new Range(breakpoint.lineNumber, column, breakpoint.lineNumber, column + 1) // Decoration has to have a width #20688
);
result.push({
options: getBreakpointDecorationOptions(model, breakpoint, debugService, debugSettings),
range
});
});
return result;
@@ -111,8 +114,14 @@ async function createCandidateDecorations(model: ITextModel, breakpointDecoratio
const positions = await session.breakpointsLocations(model.uri, lineNumber);
if (positions.length > 1) {
// Do not render candidates if there is only one, since it is already covered by the line breakpoint
const firstColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
positions.forEach(p => {
const range = new Range(p.lineNumber, p.column, p.lineNumber, p.column + 1);
if (p.column <= firstColumn) {
// Do not render candidates on the start of the line.
return;
}
const breakpointAtPosition = breakpointDecorations.filter(bpd => bpd.range.equalsRange(range)).pop();
if (breakpointAtPosition && breakpointAtPosition.inlineWidget) {
// Space already occupied, do not render candidate.
@@ -622,4 +631,65 @@ class InlineBreakpointWidget implements IContentWidget, IDisposable {
}
}
registerThemingParticipant((theme, collector) => {
const debugIconBreakpointColor = theme.getColor(debugIconBreakpointForeground);
if (debugIconBreakpointColor) {
collector.addRule(`
.monaco-workbench .codicon-debug-breakpoint,
.monaco-workbench .codicon-debug-breakpoint-conditional,
.monaco-workbench .codicon-debug-breakpoint-log,
.monaco-workbench .codicon-debug-breakpoint-function,
.monaco-workbench .codicon-debug-breakpoint-data,
.monaco-workbench .codicon-debug-breakpoint-unsupported,
.monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']),
.monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after,
.monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe::after {
color: ${debugIconBreakpointColor} !important;
}
`);
}
const debugIconBreakpointDisabledColor = theme.getColor(debugIconBreakpointDisabledForeground);
if (debugIconBreakpointDisabledColor) {
collector.addRule(`
.monaco-workbench .codicon[class*='-disabled'] {
color: ${debugIconBreakpointDisabledColor} !important;
}
`);
}
const debugIconBreakpointUnverifiedColor = theme.getColor(debugIconBreakpointUnverifiedForeground);
if (debugIconBreakpointUnverifiedColor) {
collector.addRule(`
.monaco-workbench .codicon[class*='-unverified'] {
color: ${debugIconBreakpointUnverifiedColor} !important;
}
`);
}
const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground);
if (debugIconBreakpointCurrentStackframeForegroundColor) {
collector.addRule(`
.monaco-workbench .codicon-debug-stackframe {
color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important;
}
`);
}
const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground);
if (debugIconBreakpointStackframeFocusedColor) {
collector.addRule(`
.monaco-workbench .codicon-debug-stackframe-focused {
color: ${debugIconBreakpointStackframeFocusedColor} !important;
}
`);
}
});
const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hc: '#E51400' }, nls.localize('debugIcon.breakpointForeground', 'Icon color for breakpoints.'));
const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, nls.localize('debugIcon.breakpointDisabledForeground', 'Icon color for disabled breakpoints.'));
const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, nls.localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.'));
const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, nls.localize('debugIcon.breakpointCurrentStackframeForeground', 'Icon color for the current breakpoint stack frame.'));
const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, nls.localize('debugIcon.breakpointStackframeForeground', 'Icon color for all breakpoint stack frames.'));
registerEditorContribution(BREAKPOINT_EDITOR_CONTRIBUTION_ID, BreakpointEditorContribution);

View File

@@ -28,7 +28,7 @@ import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet';
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { ILabelService } from 'vs/platform/label/common/label';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
@@ -45,7 +45,7 @@ function createCheckbox(): HTMLInputElement {
return checkbox;
}
export class BreakpointsView extends ViewletPane {
export class BreakpointsView extends ViewPane {
private static readonly MAX_VISIBLE_FILES = 9;
private list!: WorkbenchList<IEnablement>;
@@ -63,7 +63,7 @@ export class BreakpointsView extends ViewletPane {
@IConfigurationService configurationService: IConfigurationService,
@IContextKeyService contextKeyService: IContextKeyService,
) {
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
this.minimumBodySize = this.maximumBodySize = this.getExpandedBodySize();
this._register(this.debugService.getModel().onDidChangeBreakpoints(() => this.onBreakpointsChange()));

View File

@@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Constants } from 'vs/base/common/uint';
import { Range } from 'vs/editor/common/core/range';
import { TrackedRangeStickiness, IModelDeltaDecoration, IModelDecorationOptions } from 'vs/editor/common/model';
import { IDebugService, IStackFrame } from 'vs/workbench/contrib/debug/common/debug';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { localize } from 'vs/nls';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
const stickiness = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
class CallStackEditorContribution implements IEditorContribution {
private toDispose: IDisposable[] = [];
private decorationIds: string[] = [];
private topStackFrameRange: Range | undefined;
constructor(
private readonly editor: ICodeEditor,
@IDebugService private readonly debugService: IDebugService,
) {
const setDecorations = () => this.decorationIds = this.editor.deltaDecorations(this.decorationIds, this.createCallStackDecorations());
this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(() => {
setDecorations();
}));
this.toDispose.push(this.editor.onDidChangeModel(e => {
if (e.newModelUrl) {
setDecorations();
}
}));
}
private createCallStackDecorations(): IModelDeltaDecoration[] {
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
const decorations: IModelDeltaDecoration[] = [];
this.debugService.getModel().getSessions().forEach(s => {
s.getAllThreads().forEach(t => {
if (t.stopped) {
let candidateStackFrame = t === focusedStackFrame?.thread ? focusedStackFrame : undefined;
if (!candidateStackFrame) {
const callStack = t.getCallStack();
if (callStack.length) {
candidateStackFrame = callStack[0];
}
}
if (candidateStackFrame && candidateStackFrame.source.uri.toString() === this.editor.getModel()?.uri.toString()) {
decorations.push(...this.createDecorationsForStackFrame(candidateStackFrame));
}
}
});
});
return decorations;
}
private createDecorationsForStackFrame(stackFrame: IStackFrame): IModelDeltaDecoration[] {
// only show decorations for the currently focused thread.
const result: IModelDeltaDecoration[] = [];
const columnUntilEOLRange = new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn, stackFrame.range.startLineNumber, Constants.MAX_SAFE_SMALL_INTEGER);
const range = new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn, stackFrame.range.startLineNumber, stackFrame.range.startColumn + 1);
// compute how to decorate the editor. Different decorations are used if this is a top stack frame, focused stack frame,
// an exception or a stack frame that did not change the line number (we only decorate the columns, not the whole line).
const callStack = stackFrame.thread.getCallStack();
if (callStack && callStack.length && stackFrame === callStack[0]) {
result.push({
options: CallStackEditorContribution.TOP_STACK_FRAME_MARGIN,
range
});
result.push({
options: CallStackEditorContribution.TOP_STACK_FRAME_DECORATION,
range: columnUntilEOLRange
});
if (this.topStackFrameRange && this.topStackFrameRange.startLineNumber === stackFrame.range.startLineNumber && this.topStackFrameRange.startColumn !== stackFrame.range.startColumn) {
result.push({
options: CallStackEditorContribution.TOP_STACK_FRAME_INLINE_DECORATION,
range: columnUntilEOLRange
});
}
this.topStackFrameRange = columnUntilEOLRange;
} else {
result.push({
options: CallStackEditorContribution.FOCUSED_STACK_FRAME_MARGIN,
range
});
result.push({
options: CallStackEditorContribution.FOCUSED_STACK_FRAME_DECORATION,
range: columnUntilEOLRange
});
}
return result;
}
// editor decorations
static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
// we need a separate decoration for glyph margin, since we do not want it on each line of a multi line statement.
private static TOP_STACK_FRAME_MARGIN: IModelDecorationOptions = {
glyphMarginClassName: 'codicon-debug-stackframe',
stickiness
};
private static FOCUSED_STACK_FRAME_MARGIN: IModelDecorationOptions = {
glyphMarginClassName: 'codicon-debug-stackframe-focused',
stickiness
};
private static TOP_STACK_FRAME_DECORATION: IModelDecorationOptions = {
isWholeLine: true,
inlineClassName: 'debug-remove-token-colors',
className: 'debug-top-stack-frame-line',
stickiness
};
private static TOP_STACK_FRAME_INLINE_DECORATION: IModelDecorationOptions = {
beforeContentClassName: 'debug-top-stack-frame-column'
};
private static FOCUSED_STACK_FRAME_DECORATION: IModelDecorationOptions = {
isWholeLine: true,
inlineClassName: 'debug-remove-token-colors',
className: 'debug-focused-stack-frame-line',
stickiness
};
dispose(): void {
this.editor.deltaDecorations(this.decorationIds, []);
this.toDispose = dispose(this.toDispose);
}
}
registerThemingParticipant((theme, collector) => {
const topStackFrame = theme.getColor(topStackFrameColor);
if (topStackFrame) {
collector.addRule(`.monaco-editor .view-overlays .debug-top-stack-frame-line { background: ${topStackFrame}; }`);
collector.addRule(`.monaco-editor .view-overlays .debug-top-stack-frame-line { background: ${topStackFrame}; }`);
}
const focusedStackFrame = theme.getColor(focusedStackFrameColor);
if (focusedStackFrame) {
collector.addRule(`.monaco-editor .view-overlays .debug-focused-stack-frame-line { background: ${focusedStackFrame}; }`);
}
});
const topStackFrameColor = registerColor('editor.stackFrameHighlightBackground', { dark: '#ffff0033', light: '#ffff6673', hc: '#fff600' }, localize('topStackFrameLineHighlight', 'Background color for the highlight of line at the top stack frame position.'));
const focusedStackFrameColor = registerColor('editor.focusedStackFrameHighlightBackground', { dark: '#7abd7a4d', light: '#cee7ce73', hc: '#cee7ce' }, localize('focusedStackFrameLineHighlight', 'Background color for the highlight of line at focused stack frame position.'));
registerEditorContribution('editor.contrib.callStack', CallStackEditorContribution);

View File

@@ -18,7 +18,7 @@ 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 { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
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';
@@ -53,8 +53,7 @@ function getContext(element: CallStackItem | null): any {
} : undefined;
}
export class CallStackView extends ViewletPane {
export class CallStackView extends ViewPane {
private pauseMessage!: HTMLSpanElement;
private pauseMessageLabel!: HTMLSpanElement;
private onCallStackChangeScheduler: RunOnceScheduler;
@@ -79,7 +78,7 @@ export class CallStackView extends ViewletPane {
@IMenuService menuService: IMenuService,
@IContextKeyService readonly contextKeyService: IContextKeyService,
) {
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), 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);
@@ -818,7 +817,7 @@ class StopAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(STOP_ID, getContext(this.session));
return this.commandService.executeCommand(STOP_ID, undefined, getContext(this.session));
}
}
@@ -832,7 +831,7 @@ class DisconnectAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(DISCONNECT_ID, getContext(this.session));
return this.commandService.executeCommand(DISCONNECT_ID, undefined, getContext(this.session));
}
}
@@ -846,7 +845,7 @@ class RestartAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(RESTART_SESSION_ID, getContext(this.session));
return this.commandService.executeCommand(RESTART_SESSION_ID, undefined, getContext(this.session));
}
}
@@ -860,7 +859,7 @@ class StepOverAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(STEP_OVER_ID, getContext(this.thread));
return this.commandService.executeCommand(STEP_OVER_ID, undefined, getContext(this.thread));
}
}
@@ -874,7 +873,7 @@ class StepIntoAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(STEP_INTO_ID, getContext(this.thread));
return this.commandService.executeCommand(STEP_INTO_ID, undefined, getContext(this.thread));
}
}
@@ -888,7 +887,7 @@ class StepOutAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(STEP_OUT_ID, getContext(this.thread));
return this.commandService.executeCommand(STEP_OUT_ID, undefined, getContext(this.thread));
}
}
@@ -902,7 +901,7 @@ class PauseAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(PAUSE_ID, getContext(this.thread));
return this.commandService.executeCommand(PAUSE_ID, undefined, getContext(this.thread));
}
}
@@ -916,6 +915,6 @@ class ContinueAction extends Action {
}
public run(): Promise<any> {
return this.commandService.executeCommand(CONTINUE_ID, getContext(this.thread));
return this.commandService.executeCommand(CONTINUE_ID, undefined, getContext(this.thread));
}
}

View File

@@ -35,7 +35,6 @@ import { IViewsRegistry, Extensions as ViewExtensions } from 'vs/workbench/commo
import { isMacintosh } from 'vs/base/common/platform';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { URI } from 'vs/base/common/uri';
import { DebugViewlet } from 'vs/workbench/contrib/debug/browser/debugViewlet';
import { DebugQuickOpenHandler } from 'vs/workbench/contrib/debug/browser/debugQuickOpen';
import { DebugStatusContribution } from 'vs/workbench/contrib/debug/browser/debugStatus';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
@@ -47,7 +46,7 @@ import { WatchExpressionsView } from 'vs/workbench/contrib/debug/browser/watchEx
import { VariablesView } from 'vs/workbench/contrib/debug/browser/variablesView';
import { ClearReplAction, Repl } from 'vs/workbench/contrib/debug/browser/repl';
import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugContentProvider';
import { DebugCallStackContribution } from 'vs/workbench/contrib/debug/browser/debugCallStackContribution';
import { DebugViewlet } from 'vs/workbench/contrib/debug/browser/debugViewlet';
import { StartView } from 'vs/workbench/contrib/debug/browser/startView';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
@@ -122,7 +121,6 @@ const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionRegistryEx
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugPanelAction, OpenDebugPanelAction.ID, OpenDebugPanelAction.LABEL, openPanelKb), 'View: Debug Console', nls.localize('view', "View"));
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View"));
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugCallStackContribution, 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);

View File

@@ -1,242 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Constants } from 'vs/base/common/uint';
import { Range } from 'vs/editor/common/core/range';
import { ITextModel, TrackedRangeStickiness, IModelDeltaDecoration, IModelDecorationOptions } from 'vs/editor/common/model';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IDebugService, State } from 'vs/workbench/contrib/debug/common/debug';
import { IModelService } from 'vs/editor/common/services/modelService';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { localize } from 'vs/nls';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
interface IDebugEditorModelData {
model: ITextModel;
currentStackDecorations: string[];
topStackFrameRange: Range | undefined;
}
const stickiness = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
export class DebugCallStackContribution implements IWorkbenchContribution {
private modelDataMap = new Map<string, IDebugEditorModelData>();
private toDispose: IDisposable[] = [];
constructor(
@IModelService private readonly modelService: IModelService,
@IDebugService private readonly debugService: IDebugService,
) {
this.registerListeners();
}
private registerListeners(): void {
this.toDispose.push(this.modelService.onModelAdded(this.onModelAdded, this));
this.modelService.getModels().forEach(model => this.onModelAdded(model));
this.toDispose.push(this.modelService.onModelRemoved(this.onModelRemoved, this));
this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(() => this.onFocusStackFrame()));
this.toDispose.push(this.debugService.onDidChangeState(state => {
if (state === State.Inactive) {
this.modelDataMap.forEach(modelData => {
modelData.topStackFrameRange = undefined;
});
}
}));
}
private onModelAdded(model: ITextModel): void {
const modelUriStr = model.uri.toString();
const currentStackDecorations = model.deltaDecorations([], this.createCallStackDecorations(modelUriStr));
this.modelDataMap.set(modelUriStr, {
model: model,
currentStackDecorations: currentStackDecorations,
topStackFrameRange: undefined
});
}
private onModelRemoved(model: ITextModel): void {
const modelUriStr = model.uri.toString();
const data = this.modelDataMap.get(modelUriStr);
if (data) {
this.modelDataMap.delete(modelUriStr);
}
}
private onFocusStackFrame(): void {
this.modelDataMap.forEach((modelData, uri) => {
modelData.currentStackDecorations = modelData.model.deltaDecorations(modelData.currentStackDecorations, this.createCallStackDecorations(uri));
});
}
private createCallStackDecorations(modelUriStr: string): IModelDeltaDecoration[] {
const result: IModelDeltaDecoration[] = [];
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
if (!stackFrame || stackFrame.source.uri.toString() !== modelUriStr) {
return result;
}
// only show decorations for the currently focused thread.
const columnUntilEOLRange = new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn, stackFrame.range.startLineNumber, Constants.MAX_SAFE_SMALL_INTEGER);
const range = new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn, stackFrame.range.startLineNumber, stackFrame.range.startColumn + 1);
// compute how to decorate the editor. Different decorations are used if this is a top stack frame, focused stack frame,
// an exception or a stack frame that did not change the line number (we only decorate the columns, not the whole line).
const callStack = stackFrame.thread.getCallStack();
if (callStack && callStack.length && stackFrame === callStack[0]) {
result.push({
options: DebugCallStackContribution.TOP_STACK_FRAME_MARGIN,
range
});
result.push({
options: DebugCallStackContribution.TOP_STACK_FRAME_DECORATION,
range: columnUntilEOLRange
});
const modelData = this.modelDataMap.get(modelUriStr);
if (modelData) {
if (modelData.topStackFrameRange && modelData.topStackFrameRange.startLineNumber === stackFrame.range.startLineNumber && modelData.topStackFrameRange.startColumn !== stackFrame.range.startColumn) {
result.push({
options: DebugCallStackContribution.TOP_STACK_FRAME_INLINE_DECORATION,
range: columnUntilEOLRange
});
}
modelData.topStackFrameRange = columnUntilEOLRange;
}
} else {
result.push({
options: DebugCallStackContribution.FOCUSED_STACK_FRAME_MARGIN,
range
});
result.push({
options: DebugCallStackContribution.FOCUSED_STACK_FRAME_DECORATION,
range: columnUntilEOLRange
});
}
return result;
}
// editor decorations
static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
// we need a separate decoration for glyph margin, since we do not want it on each line of a multi line statement.
private static TOP_STACK_FRAME_MARGIN: IModelDecorationOptions = {
glyphMarginClassName: 'codicon-debug-breakpoint-stackframe',
stickiness
};
private static FOCUSED_STACK_FRAME_MARGIN: IModelDecorationOptions = {
glyphMarginClassName: 'codicon-debug-breakpoint-stackframe-focused',
stickiness
};
private static TOP_STACK_FRAME_DECORATION: IModelDecorationOptions = {
isWholeLine: true,
inlineClassName: 'debug-remove-token-colors',
className: 'debug-top-stack-frame-line',
stickiness
};
private static TOP_STACK_FRAME_INLINE_DECORATION: IModelDecorationOptions = {
beforeContentClassName: 'debug-top-stack-frame-column'
};
private static FOCUSED_STACK_FRAME_DECORATION: IModelDecorationOptions = {
isWholeLine: true,
inlineClassName: 'debug-remove-token-colors',
className: 'debug-focused-stack-frame-line',
stickiness
};
dispose(): void {
this.modelDataMap.forEach(modelData => {
modelData.model.deltaDecorations(modelData.currentStackDecorations, []);
});
this.toDispose = dispose(this.toDispose);
this.modelDataMap.clear();
}
}
registerThemingParticipant((theme, collector) => {
const topStackFrame = theme.getColor(topStackFrameColor);
if (topStackFrame) {
collector.addRule(`.monaco-editor .view-overlays .debug-top-stack-frame-line { background: ${topStackFrame}; }`);
collector.addRule(`.monaco-editor .view-overlays .debug-top-stack-frame-line { background: ${topStackFrame}; }`);
}
const focusedStackFrame = theme.getColor(focusedStackFrameColor);
if (focusedStackFrame) {
collector.addRule(`.monaco-editor .view-overlays .debug-focused-stack-frame-line { background: ${focusedStackFrame}; }`);
}
const debugIconBreakpointColor = theme.getColor(debugIconBreakpointForeground);
if (debugIconBreakpointColor) {
collector.addRule(`
.monaco-workbench .codicon-debug-breakpoint,
.monaco-workbench .codicon-debug-breakpoint-conditional,
.monaco-workbench .codicon-debug-breakpoint-log,
.monaco-workbench .codicon-debug-breakpoint-function,
.monaco-workbench .codicon-debug-breakpoint-data,
.monaco-workbench .codicon-debug-breakpoint-unsupported,
.monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']),
.monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after,
.monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe::after {
color: ${debugIconBreakpointColor} !important;
}
`);
}
const debugIconBreakpointDisabledColor = theme.getColor(debugIconBreakpointDisabledForeground);
if (debugIconBreakpointDisabledColor) {
collector.addRule(`
.monaco-workbench .codicon[class*='-disabled'] {
color: ${debugIconBreakpointDisabledColor} !important;
}
`);
}
const debugIconBreakpointUnverifiedColor = theme.getColor(debugIconBreakpointUnverifiedForeground);
if (debugIconBreakpointUnverifiedColor) {
collector.addRule(`
.monaco-workbench .codicon[class*='-unverified'] {
color: ${debugIconBreakpointUnverifiedColor} !important;
}
`);
}
const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground);
if (debugIconBreakpointCurrentStackframeForegroundColor) {
collector.addRule(`
.monaco-workbench .codicon-debug-breakpoint-stackframe {
color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important;
}
`);
}
const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground);
if (debugIconBreakpointStackframeFocusedColor) {
collector.addRule(`
.monaco-workbench .codicon-debug-breakpoint-stackframe-focused {
color: ${debugIconBreakpointStackframeFocusedColor} !important;
}
`);
}
});
const topStackFrameColor = registerColor('editor.stackFrameHighlightBackground', { dark: '#ffff0033', light: '#ffff6673', hc: '#fff600' }, localize('topStackFrameLineHighlight', 'Background color for the highlight of line at the top stack frame position.'));
const focusedStackFrameColor = registerColor('editor.focusedStackFrameHighlightBackground', { dark: '#7abd7a4d', light: '#cee7ce73', hc: '#cee7ce' }, localize('focusedStackFrameLineHighlight', 'Background color for the highlight of line at focused stack frame position.'));
const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hc: '#E51400' }, localize('debugIcon.breakpointForeground', 'Icon color for breakpoints.'));
const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointDisabledForeground', 'Icon color for disabled breakpoints.'));
const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.'));
const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointCurrentStackframeForeground', 'Icon color for the current breakpoint stack frame.'));
const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for all breakpoint stack frames.'));

View File

@@ -11,7 +11,7 @@ import { IListService } from 'vs/platform/list/browser/listService';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, CONTEXT_BREAKPOINT_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, REPL_ID, IDebugConfiguration, CONTEXT_JUMP_TO_CURSOR_SUPPORTED } from 'vs/workbench/contrib/debug/common/debug';
import { Expression, Variable, Breakpoint, FunctionBreakpoint, DataBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IExtensionsViewlet, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
@@ -120,7 +120,7 @@ export function registerCommands(): void {
// Same for stackFrame commands and session commands.
CommandsRegistry.registerCommand({
id: COPY_STACK_TRACE_ID,
handler: async (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: async (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
const textResourcePropertiesService = accessor.get(ITextResourcePropertiesService);
const clipboardService = accessor.get(IClipboardService);
let frame = getFrame(accessor.get(IDebugService), context);
@@ -133,21 +133,21 @@ export function registerCommands(): void {
CommandsRegistry.registerCommand({
id: REVERSE_CONTINUE_ID,
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, thread => thread.reverseContinue());
}
});
CommandsRegistry.registerCommand({
id: STEP_BACK_ID,
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, thread => thread.stepBack());
}
});
CommandsRegistry.registerCommand({
id: TERMINATE_THREAD_ID,
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, thread => thread.terminate());
}
});
@@ -206,7 +206,7 @@ export function registerCommands(): void {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.F5,
when: CONTEXT_IN_DEBUG_MODE,
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
const debugService = accessor.get(IDebugService);
let session: IDebugSession | undefined;
if (isSessionContext(context)) {
@@ -230,7 +230,7 @@ export function registerCommands(): void {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.F10,
when: CONTEXT_DEBUG_STATE.isEqualTo('stopped'),
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, (thread: IThread) => thread.next());
}
});
@@ -240,7 +240,7 @@ export function registerCommands(): void {
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, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, (thread: IThread) => thread.stepIn());
}
});
@@ -250,7 +250,7 @@ export function registerCommands(): void {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.Shift | KeyCode.F11,
when: CONTEXT_DEBUG_STATE.isEqualTo('stopped'),
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, (thread: IThread) => thread.stepOut());
}
});
@@ -260,7 +260,7 @@ export function registerCommands(): void {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.F6,
when: CONTEXT_DEBUG_STATE.isEqualTo('running'),
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, thread => thread.pause());
}
});
@@ -279,7 +279,7 @@ export function registerCommands(): void {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.Shift | KeyCode.F5,
when: CONTEXT_IN_DEBUG_MODE,
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
const debugService = accessor.get(IDebugService);
let session: IDebugSession | undefined;
if (isSessionContext(context)) {
@@ -301,7 +301,7 @@ export function registerCommands(): void {
CommandsRegistry.registerCommand({
id: RESTART_FRAME_ID,
handler: async (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: async (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
const debugService = accessor.get(IDebugService);
let frame = getFrame(debugService, context);
if (frame) {
@@ -315,7 +315,7 @@ export function registerCommands(): void {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.F5,
when: CONTEXT_IN_DEBUG_MODE,
handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => {
handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => {
getThreadAndRun(accessor, context, thread => thread.continue());
}
});
@@ -430,9 +430,13 @@ export function registerCommands(): void {
const focused = listService.lastFocusedList;
if (focused) {
const elements = focused.getFocus();
let elements = focused.getFocus();
if (Array.isArray(elements) && elements[0] instanceof Expression) {
debugService.removeWatchExpressions(elements[0].getId());
const selection = focused.getSelection();
if (selection && selection.indexOf(elements[0]) >= 0) {
elements = selection;
}
elements.forEach((e: Expression) => debugService.removeWatchExpressions(e.getId()));
}
}
}
@@ -470,7 +474,7 @@ export function registerCommands(): void {
primary: undefined,
handler: async (accessor) => {
const viewletService = accessor.get(IViewletService);
const viewlet = await viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true) as IExtensionsViewlet;
const viewlet = (await viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer;
viewlet.search('tag:debuggers @sort:installs');
viewlet.focus();
}

View File

@@ -157,8 +157,8 @@ class SelectionToReplAction extends EditorAction {
constructor() {
super({
id: 'editor.debug.action.selectionToRepl',
label: nls.localize('debugEvaluate', "Debug: Evaluate"),
alias: 'Debug: Evaluate',
label: nls.localize('evaluateInDebugConsole', "Evaluate in Debug Console"),
alias: 'Evaluate',
precondition: ContextKeyExpr.and(EditorContextKeys.hasNonEmptySelection, CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus),
contextMenuOpts: {
group: 'debug',
@@ -187,8 +187,8 @@ class SelectionToWatchExpressionsAction extends EditorAction {
constructor() {
super({
id: 'editor.debug.action.selectionToWatch',
label: nls.localize('debugAddToWatch', "Debug: Add to Watch"),
alias: 'Debug: Add to Watch',
label: nls.localize('addToWatch', "Add to Watch"),
alias: 'Add to Watch',
precondition: ContextKeyExpr.and(EditorContextKeys.hasNonEmptySelection, CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus),
contextMenuOpts: {
group: 'debug',

View File

@@ -8,7 +8,6 @@ import * as nls from 'vs/nls';
import { IAction } from 'vs/base/common/actions';
import * as DOM from 'vs/base/browser/dom';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, VIEWLET_ID, State, BREAKPOINTS_VIEW_ID, IDebugConfiguration, REPL_ID, CONTEXT_DEBUG_UX, CONTEXT_DEBUG_UX_KEY } from 'vs/workbench/contrib/debug/common/debug';
import { StartAction, ConfigureAction, SelectAndStartAction, FocusSessionAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { StartDebugActionViewItem, FocusSessionActionViewItem } from 'vs/workbench/contrib/debug/browser/debugActionViewItems';
@@ -26,20 +25,38 @@ 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 { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
import { ViewPane, ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IMenu, MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { TogglePanelAction } from 'vs/workbench/browser/panel';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { Viewlet } from 'vs/workbench/browser/viewlet';
import { StartView } from 'vs/workbench/contrib/debug/browser/startView';
export class DebugViewlet extends ViewContainerViewlet {
// Register a lightweight viewlet responsible for making the container
export class DebugViewlet extends Viewlet {
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IStorageService protected storageService: IStorageService,
@IInstantiationService protected instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@IContextMenuService protected contextMenuService: IContextMenuService,
@IExtensionService protected extensionService: IExtensionService,
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
@IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService,
@IConfigurationService protected configurationService: IConfigurationService
) {
super(VIEWLET_ID, instantiationService.createInstance(DebugViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService);
}
}
export class DebugViewPaneContainer extends ViewPaneContainer {
private startDebugActionViewItem: StartDebugActionViewItem | undefined;
private progressResolve: (() => void) | undefined;
private breakpointView: ViewletPane | undefined;
private breakpointView: ViewPane | undefined;
private paneListeners = new Map<string, IDisposable>();
private debugToolBarMenu: IMenu | undefined;
private disposeOnTitleUpdate: IDisposable | undefined;
@@ -62,12 +79,12 @@ export class DebugViewlet extends ViewContainerViewlet {
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@INotificationService private readonly notificationService: INotificationService
) {
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService);
this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state)));
this._register(this.debugService.onDidNewSession(() => this.updateToolBar()));
this._register(this.contextKeyService.onDidChangeContext(e => {
if (e.affectsSome(new Set(CONTEXT_DEBUG_UX_KEY))) {
if (e.affectsSome(new Set([CONTEXT_DEBUG_UX_KEY]))) {
this.updateTitleArea();
}
}));
@@ -198,7 +215,7 @@ export class DebugViewlet extends ViewContainerViewlet {
}
}
addPanes(panes: { pane: ViewletPane, size: number, index?: number }[]): void {
addPanes(panes: { pane: ViewPane, size: number, index?: number }[]): void {
super.addPanes(panes);
for (const { pane: pane } of panes) {
@@ -212,7 +229,7 @@ export class DebugViewlet extends ViewContainerViewlet {
}
}
removePanes(panes: ViewletPane[]): void {
removePanes(panes: ViewPane[]): void {
super.removePanes(panes);
for (const pane of panes) {
dispose(this.paneListeners.get(pane.id));

View File

@@ -65,11 +65,6 @@ class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient i
openExtensionDevelopmentHostWindow(args: string[], env: IProcessEnvironment): Promise<void> {
if (!this.workspaceProvider.payload) {
// TODO@Ben remove me once environment is adopted
return this.openExtensionDevelopmentHostWindowLegacy(args);
}
// Find out which workspace to open debug window on
let debugWorkspace: IWorkspace = undefined;
const folderUriArg = this.findArgument('folder-uri', args);
@@ -117,66 +112,6 @@ class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient i
});
}
private openExtensionDevelopmentHostWindowLegacy(args: string[]): Promise<void> {
// we pass the "args" as query parameters of the URL
let newAddress = `${document.location.origin}${document.location.pathname}?`;
let gotFolder = false;
const addQueryParameter = (key: string, value: string) => {
const lastChar = newAddress.charAt(newAddress.length - 1);
if (lastChar !== '?' && lastChar !== '&') {
newAddress += '&';
}
newAddress += `${key}=${encodeURIComponent(value)}`;
};
const findArgument = (key: string) => {
for (let a of args) {
const k = `--${key}=`;
if (a.indexOf(k) === 0) {
return a.substr(k.length);
}
}
return undefined;
};
const f = findArgument('folder-uri');
if (f) {
const u = URI.parse(f);
gotFolder = true;
addQueryParameter('folder', u.path);
}
if (!gotFolder) {
// request empty window
addQueryParameter('ew', 'true');
}
const ep = findArgument('extensionDevelopmentPath');
if (ep) {
addQueryParameter('extensionDevelopmentPath', ep);
}
const etp = findArgument('extensionTestsPath');
if (etp) {
addQueryParameter('extensionTestsPath', etp);
}
const di = findArgument('debugId');
if (di) {
addQueryParameter('debugId', di);
}
const ibe = findArgument('inspect-brk-extensions');
if (ibe) {
addQueryParameter('inspect-brk-extensions', ibe);
}
window.open(newAddress);
return Promise.resolve();
}
private findArgument(key: string, args: string[]): string | undefined {
for (const a of args) {
const k = `--${key}=`;

View File

@@ -131,6 +131,8 @@ export class LinkDetector {
}
const options = { selection: { startLineNumber: lineNumber, startColumn: columnNumber } };
this.decorateLink(link, () => this.editorService.openEditor({ resource: uri, options }));
}).catch(() => {
// If the uri can not be resolved we should not spam the console with error, remain quite #86587
});
return link;
}

View File

@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import * as dom from 'vs/base/browser/dom';
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { normalize, isAbsolute, posix } from 'vs/base/common/path';
import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -388,7 +388,7 @@ class SessionTreeItem extends BaseTreeItem {
}
}
export class LoadedScriptsView extends ViewletPane {
export class LoadedScriptsView extends ViewPane {
private treeContainer!: HTMLElement;
private loadedScriptsItemType: IContextKey<string>;
@@ -411,7 +411,7 @@ export class LoadedScriptsView extends ViewletPane {
@IDebugService private readonly debugService: IDebugService,
@ILabelService private readonly labelService: ILabelService
) {
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService);
}

View File

@@ -16,8 +16,8 @@
align-items: center;
}
.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after,
.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe::after {
.codicon-debug-breakpoint.codicon-debug-stackframe-focused::after,
.codicon-debug-breakpoint.codicon-debug-stackframe::after {
content: "\eb8a";
position: absolute;
}

View File

@@ -108,7 +108,7 @@
}
.debug-viewlet .disabled {
opacity: 0.35;
opacity: 0.65;
}
/* Call stack */

View File

@@ -11,7 +11,6 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { localize } from 'vs/nls';
import { ICommandService } from 'vs/platform/commands/common/commands';
@@ -21,11 +20,13 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { equals } from 'vs/base/common/arrays';
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
const $ = dom.$;
export class StartView extends ViewletPane {
export class StartView extends ViewPane {
static ID = 'workbench.debug.startView';
static LABEL = localize('start', "Start");
@@ -34,6 +35,7 @@ export class StartView extends ViewletPane {
private runButton!: Button;
private firstMessageContainer!: HTMLElement;
private secondMessageContainer!: HTMLElement;
private clickElement: HTMLElement | undefined;
private debuggerLabels: string[] | undefined = undefined;
constructor(
@@ -49,7 +51,7 @@ export class StartView extends ViewletPane {
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IFileDialogService private readonly dialogService: IFileDialogService
) {
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
this._register(editorService.onDidActiveEditorChange(() => this.updateView()));
this._register(this.debugService.getConfigurationManager().onDidRegisterDebugger(() => this.updateView()));
}
@@ -74,13 +76,13 @@ export class StartView extends ViewletPane {
const setSecondMessage = () => {
secondMessageElement.textContent = localize('specifyHowToRun', "To futher configure Debug and Run");
const clickElement = this.createClickElement(localize('configure', " create a launch.json file."), () => this.commandService.executeCommand(ConfigureAction.ID));
this.secondMessageContainer.appendChild(clickElement);
this.clickElement = this.createClickElement(localize('configure', " create a launch.json file."), () => this.commandService.executeCommand(ConfigureAction.ID));
this.secondMessageContainer.appendChild(this.clickElement);
};
const setSecondMessageWithFolder = () => {
secondMessageElement.textContent = localize('noLaunchConfiguration', "To futher configure Debug and Run, ");
const clickElement = this.createClickElement(localize('openFolder', " open a folder"), () => this.dialogService.pickFolderAndOpen({ forceNewWindow: false }));
this.secondMessageContainer.appendChild(clickElement);
this.clickElement = this.createClickElement(localize('openFolder', " open a folder"), () => this.dialogService.pickFolderAndOpen({ forceNewWindow: false }));
this.secondMessageContainer.appendChild(this.clickElement);
const moreText = $('span.moreText');
moreText.textContent = localize('andconfigure', " and create a launch.json file.");
@@ -104,8 +106,8 @@ export class StartView extends ViewletPane {
}
if (!enabled && emptyWorkbench) {
const clickElement = this.createClickElement(localize('openFile', "Open a file"), () => this.dialogService.pickFileAndOpen({ forceNewWindow: false }));
this.firstMessageContainer.appendChild(clickElement);
this.clickElement = this.createClickElement(localize('openFile', "Open a file"), () => this.dialogService.pickFileAndOpen({ forceNewWindow: false }));
this.firstMessageContainer.appendChild(this.clickElement);
const firstMessageElement = $('span');
this.firstMessageContainer.appendChild(firstMessageElement);
firstMessageElement.textContent = localize('canBeDebuggedOrRun', " which can be debugged or run.");
@@ -161,6 +163,10 @@ export class StartView extends ViewletPane {
}
focus(): void {
this.runButton.focus();
if (this.debugButton.enabled) {
this.debugButton.focus();
} else if (this.clickElement) {
this.clickElement.focus();
}
}
}

View File

@@ -17,7 +17,7 @@ import { IAction, Action } from 'vs/base/common/actions';
import { CopyValueAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { ITreeRenderer, ITreeNode, ITreeMouseEvent, ITreeContextMenuEvent, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree';
@@ -37,7 +37,7 @@ let forgetScopes = true;
export const variableSetEmitter = new Emitter<void>();
export class VariablesView extends ViewletPane {
export class VariablesView extends ViewPane {
private onFocusStackFrameScheduler: RunOnceScheduler;
private needsRefresh = false;
@@ -54,7 +54,7 @@ export class VariablesView extends ViewletPane {
@IClipboardService private readonly clipboardService: IClipboardService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
// Use scheduler to prevent unnecessary flashing
this.onFocusStackFrameScheduler = new RunOnceScheduler(async () => {

View File

@@ -18,7 +18,7 @@ import { IAction, Action } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { renderExpressionValue, renderViewTree, IInputBoxOptions, AbstractExpressionsRenderer, IExpressionTemplateData } from 'vs/workbench/contrib/debug/browser/baseDebugView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
@@ -34,7 +34,7 @@ import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024;
export class WatchExpressionsView extends ViewletPane {
export class WatchExpressionsView extends ViewPane {
private onWatchExpressionsUpdatedScheduler: RunOnceScheduler;
private needsRefresh = false;
@@ -49,7 +49,7 @@ export class WatchExpressionsView extends ViewletPane {
@IConfigurationService configurationService: IConfigurationService,
@IContextKeyService contextKeyService: IContextKeyService,
) {
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService, contextKeyService);
this.onWatchExpressionsUpdatedScheduler = new RunOnceScheduler(() => {
this.needsRefresh = false;

View File

@@ -20,12 +20,12 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
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 { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Extensions as ViewContainerExtensions, IViewContainersRegistry, ViewContainer } from 'vs/workbench/common/views';
import { Registry } from 'vs/platform/registry/common/platform';
export const VIEWLET_ID = 'workbench.view.debug';
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);

View File

@@ -122,7 +122,7 @@ export class ExpressionContainer implements IExpressionContainer {
new Variable(this.session, this.threadId, this, v.variablesReference, v.name, v.evaluateName, v.value, v.namedVariables, v.indexedVariables, v.presentationHint, v.type))
: [];
} catch (e) {
return [new Variable(this.session, this.threadId, this, 0, e.message, e.message, '', 0, 0, { kind: 'virtual' }, undefined, false)];
return [new Variable(this.session, this.threadId, this, 0, '', undefined, e.message, 0, 0, { kind: 'virtual' }, undefined, false)];
}
}