Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -13,7 +13,7 @@ import * as lifecycle from 'vs/base/common/lifecycle';
import * as dom from 'vs/base/browser/dom';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/zoneWidget';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IDebugService, IBreakpoint, IRawBreakpoint } from 'vs/workbench/parts/debug/common/debug';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';

View File

@@ -12,7 +12,6 @@ import * as dom from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { SelectActionItem, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { EventEmitter } from 'vs/base/common/eventEmitter';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IDebugService } from 'vs/workbench/parts/debug/common/debug';
@@ -23,9 +22,9 @@ import { selectBorder } from 'vs/platform/theme/common/colorRegistry';
const $ = dom.$;
export class StartDebugActionItem extends EventEmitter implements IActionItem {
export class StartDebugActionItem implements IActionItem {
private static SEPARATOR = '─────────';
private static readonly SEPARATOR = '─────────';
public actionRunner: IActionRunner;
private container: HTMLElement;
@@ -43,7 +42,6 @@ export class StartDebugActionItem extends EventEmitter implements IActionItem {
@IConfigurationService private configurationService: IConfigurationService,
@ICommandService private commandService: ICommandService
) {
super();
this.toDispose = [];
this.selectBox = new SelectBox([], -1);
this.toDispose.push(attachSelectBoxStyler(this.selectBox, themeService, {

View File

@@ -14,7 +14,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IFileService } from 'vs/platform/files/common/files';
import { IMessageService } from 'vs/platform/message/common/message';
import { IDebugService, State, IProcess, IThread, IEnablement, IBreakpoint, IStackFrame, IFunctionBreakpoint, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, IExpression, REPL_ID, ProcessState }
import { IDebugService, State, IProcess, IThread, IEnablement, IBreakpoint, IStackFrame, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, IExpression, REPL_ID, ProcessState }
from 'vs/workbench/parts/debug/common/debug';
import { Variable, Expression, Thread, Breakpoint, Process } from 'vs/workbench/parts/debug/common/debugModel';
import { IPartService } from 'vs/workbench/services/part/common/partService';
@@ -77,7 +77,6 @@ export class ConfigureAction extends AbstractDebugAction {
constructor(id: string, label: string,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IMessageService private messageService: IMessageService
) {
super(id, label, 'debug-action configure', debugService, keybindingService);
@@ -133,28 +132,31 @@ export class StartAction extends AbstractDebugAction {
return false;
}
// Disabled if the launch drop down shows the launch config that is already running.
protected isEnabled(state: State): boolean {
const processes = this.debugService.getModel().getProcesses();
const selectedName = this.debugService.getConfigurationManager().selectedName;
const launch = this.debugService.getConfigurationManager().selectedLaunch;
public static isEnabled(debugService: IDebugService, contextService: IWorkspaceContextService, configName: string) {
const processes = debugService.getModel().getProcesses();
const launch = debugService.getConfigurationManager().selectedLaunch;
if (state === State.Initializing) {
if (debugService.state === State.Initializing) {
return false;
}
if (this.contextService && this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && processes.length > 0) {
if (contextService && contextService.getWorkbenchState() === WorkbenchState.EMPTY && processes.length > 0) {
return false;
}
if (processes.some(p => p.getName(false) === selectedName && (!launch || p.session.root.uri.toString() === launch.workspace.uri.toString()))) {
if (processes.some(p => p.getName(false) === configName && (!launch || p.session.root.uri.toString() === launch.workspace.uri.toString()))) {
return false;
}
const compound = launch && launch.getCompound(selectedName);
const compound = launch && launch.getCompound(configName);
if (compound && compound.configurations && processes.some(p => compound.configurations.indexOf(p.getName(false)) !== -1)) {
return false;
}
return true;
}
// Disabled if the launch drop down shows the launch config that is already running.
protected isEnabled(state: State): boolean {
return StartAction.isEnabled(this.debugService, this.contextService, this.debugService.getConfigurationManager().selectedName);
}
}
export class RunAction extends StartAction {
@@ -529,25 +531,17 @@ export class AddFunctionBreakpointAction extends AbstractDebugAction {
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action add-function-breakpoint', debugService, keybindingService);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => this.updateEnablement()));
}
public run(): TPromise<any> {
this.debugService.addFunctionBreakpoint();
return TPromise.as(null);
}
}
export class RenameFunctionBreakpointAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.renameFunctionBreakpointAction';
static LABEL = nls.localize('renameFunctionBreakpoint', "Rename Function Breakpoint");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, null, debugService, keybindingService);
}
public run(fbp: IFunctionBreakpoint): TPromise<any> {
this.debugService.getViewModel().setSelectedFunctionBreakpoint(fbp);
return TPromise.as(null);
protected isEnabled(state: State): boolean {
return !this.debugService.getViewModel().getSelectedFunctionBreakpoint()
&& this.debugService.getModel().getFunctionBreakpoints().every(fbp => !!fbp.name);
}
}

View File

@@ -12,15 +12,13 @@ import * as builder from 'vs/base/browser/builder';
import * as dom from 'vs/base/browser/dom';
import * as arrays from 'vs/base/common/arrays';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IAction } from 'vs/base/common/actions';
import { EventType } from 'vs/base/common/events';
import { IAction, IRunEvent } from 'vs/base/common/actions';
import { ActionBar, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IDebugConfiguration, IDebugService, State } from 'vs/workbench/parts/debug/common/debug';
import { AbstractDebugAction, PauseAction, ContinueAction, StepBackAction, ReverseContinueAction, StopAction, DisconnectAction, StepOverAction, StepIntoAction, StepOutAction, RestartAction, FocusProcessAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { FocusProcessActionItem } from 'vs/workbench/parts/debug/browser/debugActionItems';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IMessageService } from 'vs/platform/message/common/message';
@@ -29,6 +27,8 @@ import { Themable } from 'vs/workbench/common/theme';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { registerColor, contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { localize } from 'vs/nls';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
const $ = builder.$;
const DEBUG_ACTIONS_WIDGET_POSITION_KEY = 'debug.actionswidgetposition';
@@ -40,7 +40,6 @@ export const debugToolBarBackground = registerColor('debugToolBar.background', {
}, localize('debugToolBarBackground', "Debug toolbar background color."));
export class DebugActionsWidget extends Themable implements IWorkbenchContribution {
private static ID = 'debug.actionsWidget';
private $el: builder.Builder;
private dragArea: builder.Builder;
@@ -55,11 +54,12 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
@IMessageService private messageService: IMessageService,
@ITelemetryService private telemetryService: ITelemetryService,
@IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService,
@IPartService private partService: IPartService,
@IStorageService private storageService: IStorageService,
@IConfigurationService private configurationService: IConfigurationService,
@IThemeService themeService: IThemeService
@IThemeService themeService: IThemeService,
@IKeybindingService private keybindingService: IKeybindingService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
super(themeService);
@@ -75,7 +75,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
orientation: ActionsOrientation.HORIZONTAL,
actionItemProvider: (action: IAction) => {
if (action.id === FocusProcessAction.ID) {
return this.instantiationService.createInstance(FocusProcessActionItem, action);
return new FocusProcessActionItem(action, this.debugService, this.themeService);
}
return null;
@@ -94,7 +94,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
private registerListeners(): void {
this.toUnbind.push(this.debugService.onDidChangeState(state => this.update(state)));
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onDidConfigurationChange(e)));
this.toUnbind.push(this.actionBar.actionRunner.addListener(EventType.RUN, (e: any) => {
this.toUnbind.push(this.actionBar.actionRunner.onDidRun((e: IRunEvent) => {
// check for error
if (e.error && !errors.isPromiseCanceledError(e.error)) {
this.messageService.show(severity.Error, e.error);
@@ -147,12 +147,6 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
private storePosition(): void {
const position = parseFloat(this.$el.getComputedStyle().left) / window.innerWidth;
this.storageService.store(DEBUG_ACTIONS_WIDGET_POSITION_KEY, position, StorageScope.WORKSPACE);
/* __GDPR__
"debug.actionswidgetposition" : {
"position" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.telemetryService.publicLog(DEBUG_ACTIONS_WIDGET_POSITION_KEY, { position });
}
protected updateStyles(): void {
@@ -191,10 +185,6 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.$el.style('left', `${x}px`);
}
public getId(): string {
return DebugActionsWidget.ID;
}
private onDidConfigurationChange(event: IConfigurationChangeEvent): void {
if (event.affectsConfiguration('debug.hideActionBar')) {
this.update(this.debugService.state);
@@ -202,7 +192,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
}
private update(state: State): void {
if (state === State.Inactive || state === State.Initializing || this.configurationService.getConfiguration<IDebugConfiguration>('debug').hideActionBar) {
if (state === State.Inactive || state === State.Initializing || this.configurationService.getValue<IDebugConfiguration>('debug').hideActionBar) {
return this.hide();
}
@@ -237,17 +227,17 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
private getActions(): AbstractDebugAction[] {
if (!this.allActions) {
this.allActions = [];
this.allActions.push(this.instantiationService.createInstance(ContinueAction, ContinueAction.ID, ContinueAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(PauseAction, PauseAction.ID, PauseAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(StopAction, StopAction.ID, StopAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(DisconnectAction, DisconnectAction.ID, DisconnectAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(StepOverAction, StepOverAction.ID, StepOverAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(StepIntoAction, StepIntoAction.ID, StepIntoAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(StepOutAction, StepOutAction.ID, StepOutAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(RestartAction, RestartAction.ID, RestartAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(StepBackAction, StepBackAction.ID, StepBackAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(ReverseContinueAction, ReverseContinueAction.ID, ReverseContinueAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(FocusProcessAction, FocusProcessAction.ID, FocusProcessAction.LABEL));
this.allActions.push(new ContinueAction(ContinueAction.ID, ContinueAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new PauseAction(PauseAction.ID, PauseAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StopAction(StopAction.ID, StopAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new DisconnectAction(DisconnectAction.ID, DisconnectAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StepOverAction(StepOverAction.ID, StepOverAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StepIntoAction(StepIntoAction.ID, StepIntoAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StepOutAction(StepOutAction.ID, StepOutAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new RestartAction(RestartAction.ID, RestartAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StepBackAction(StepBackAction.ID, StepBackAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new ReverseContinueAction(ReverseContinueAction.ID, ReverseContinueAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new FocusProcessAction(FocusProcessAction.ID, FocusProcessAction.LABEL, this.debugService, this.keybindingService, this.editorService));
this.allActions.forEach(a => {
this.toUnbind.push(a);
});

View File

@@ -39,10 +39,6 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
textModelResolverService.registerTextModelContentProvider(DEBUG_SCHEME, this);
}
public getId(): string {
return 'debug.contentprovider';
}
public provideTextContent(resource: uri): TPromise<IModel> {
let process: IProcess;

View File

@@ -7,15 +7,15 @@ import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import { Range } from 'vs/editor/common/core/range';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ServicesAccessor, editorAction, EditorAction, CommonEditorRegistry, EditorCommand } from 'vs/editor/common/editorCommonExtensions';
import { ServicesAccessor, registerEditorAction, EditorAction, EditorCommand, registerEditorCommand } from 'vs/editor/browser/editorExtensions';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { IDebugService, CONTEXT_IN_DEBUG_MODE, CONTEXT_NOT_IN_DEBUG_REPL, CONTEXT_DEBUG_STATE, State, REPL_ID, VIEWLET_ID, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINT_WIDGET_VISIBLE } from 'vs/workbench/parts/debug/common/debug';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
@editorAction
class ToggleBreakpointAction extends EditorAction {
constructor() {
super({
@@ -30,7 +30,7 @@ class ToggleBreakpointAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<any> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<any> {
const debugService = accessor.get(IDebugService);
const position = editor.getPosition();
@@ -49,7 +49,7 @@ class ToggleBreakpointAction extends EditorAction {
}
}
function addColumnBreakpoint(accessor: ServicesAccessor, editor: ICommonCodeEditor, remove: boolean): TPromise<any> {
function addColumnBreakpoint(accessor: ServicesAccessor, editor: ICodeEditor, remove: boolean): TPromise<any> {
const debugService = accessor.get(IDebugService);
const position = editor.getPosition();
@@ -67,7 +67,6 @@ function addColumnBreakpoint(accessor: ServicesAccessor, editor: ICommonCodeEdit
return TPromise.as(null);
}
@editorAction
class ToggleColumnBreakpointAction extends EditorAction {
constructor() {
super({
@@ -82,13 +81,12 @@ class ToggleColumnBreakpointAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<any> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<any> {
return addColumnBreakpoint(accessor, editor, true);
}
}
// TODO@Isidor merge two column breakpoints actions together
@editorAction
class ToggleColumnBreakpointContextMenuAction extends EditorAction {
constructor() {
super({
@@ -103,12 +101,11 @@ class ToggleColumnBreakpointContextMenuAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<any> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<any> {
return addColumnBreakpoint(accessor, editor, false);
}
}
@editorAction
class ConditionalBreakpointAction extends EditorAction {
constructor() {
@@ -120,7 +117,7 @@ class ConditionalBreakpointAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
const debugService = accessor.get(IDebugService);
const { lineNumber, column } = editor.getPosition();
@@ -131,7 +128,6 @@ class ConditionalBreakpointAction extends EditorAction {
}
@editorAction
class RunToCursorAction extends EditorAction {
constructor() {
@@ -147,7 +143,7 @@ class RunToCursorAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<void> {
const debugService = accessor.get(IDebugService);
if (debugService.state !== State.Stopped) {
@@ -174,7 +170,6 @@ class RunToCursorAction extends EditorAction {
}
}
@editorAction
class SelectionToReplAction extends EditorAction {
constructor() {
@@ -190,7 +185,7 @@ class SelectionToReplAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<void> {
const debugService = accessor.get(IDebugService);
const panelService = accessor.get(IPanelService);
@@ -201,7 +196,6 @@ class SelectionToReplAction extends EditorAction {
}
}
@editorAction
class SelectionToWatchExpressionsAction extends EditorAction {
constructor() {
@@ -217,7 +211,7 @@ class SelectionToWatchExpressionsAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<void> {
const debugService = accessor.get(IDebugService);
const viewletService = accessor.get(IViewletService);
@@ -226,7 +220,6 @@ class SelectionToWatchExpressionsAction extends EditorAction {
}
}
@editorAction
class ShowDebugHoverAction extends EditorAction {
constructor() {
@@ -242,7 +235,7 @@ class ShowDebugHoverAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<void> {
const position = editor.getPosition();
const word = editor.getModel().getWordAtPosition(position);
if (!word) {
@@ -261,7 +254,7 @@ class CloseBreakpointWidgetCommand extends EditorCommand {
id: 'closeBreakpointWidget',
precondition: CONTEXT_BREAKPOINT_WIDGET_VISIBLE,
kbOpts: {
weight: CommonEditorRegistry.commandWeight(8),
weight: KeybindingsRegistry.WEIGHT.editorContrib(8),
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
@@ -269,9 +262,18 @@ class CloseBreakpointWidgetCommand extends EditorCommand {
});
}
public runEditorCommand(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
return editor.getContribution<IDebugEditorContribution>(EDITOR_CONTRIBUTION_ID).closeBreakpointWidget();
}
}
CommonEditorRegistry.registerEditorCommand(new CloseBreakpointWidgetCommand());
registerEditorAction(ToggleBreakpointAction);
registerEditorAction(ToggleColumnBreakpointAction);
registerEditorAction(ToggleColumnBreakpointContextMenuAction);
registerEditorAction(ConditionalBreakpointAction);
registerEditorAction(RunToCursorAction);
registerEditorAction(SelectionToReplAction);
registerEditorAction(SelectionToWatchExpressionsAction);
registerEditorAction(ShowDebugHoverAction);
registerEditorCommand(new CloseBreakpointWidgetCommand());

View File

@@ -4,23 +4,26 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import * as objects from 'vs/base/common/objects';
import * as lifecycle from 'vs/base/common/lifecycle';
import { Constants } from 'vs/editor/common/core/uint';
import { Range } from 'vs/editor/common/core/range';
import { IModel, TrackedRangeStickiness, IModelDeltaDecoration, IModelDecorationOptions } from 'vs/editor/common/editorCommon';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IDebugService, IBreakpoint, IRawBreakpoint, State } from 'vs/workbench/parts/debug/common/debug';
import { IDebugService, IBreakpoint, State } from 'vs/workbench/parts/debug/common/debug';
import { IModelService } from 'vs/editor/common/services/modelService';
import { MarkdownString } from 'vs/base/common/htmlContent';
interface IBreakpointDecoration {
decorationId: string;
modelId: string;
range: Range;
}
interface IDebugEditorModelData {
model: IModel;
toDispose: lifecycle.IDisposable[];
breakpointDecorationIds: string[];
breakpointModelIds: string[];
breakpointDecorationsAsMap: Map<string, Range>;
breakpointDecorations: IBreakpointDecoration[];
currentStackDecorations: string[];
dirty: boolean;
topStackFrameRange: Range;
@@ -44,14 +47,10 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
this.registerListeners();
}
public getId(): string {
return DebugEditorModelManager.ID;
}
public dispose(): void {
this.modelDataMap.forEach(modelData => {
lifecycle.dispose(modelData.toDispose);
modelData.model.deltaDecorations(modelData.breakpointDecorationIds, []);
modelData.model.deltaDecorations(modelData.breakpointDecorations.map(bpd => bpd.decorationId), []);
modelData.model.deltaDecorations(modelData.currentStackDecorations, []);
});
this.toDispose = lifecycle.dispose(this.toDispose);
@@ -82,18 +81,13 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
const currentStackDecorations = model.deltaDecorations([], this.createCallStackDecorations(modelUrlStr));
const desiredDecorations = this.createBreakpointDecorations(model, breakpoints);
const breakPointDecorations = model.deltaDecorations([], desiredDecorations);
const breakpointDecorationIds = model.deltaDecorations([], desiredDecorations);
const toDispose: lifecycle.IDisposable[] = [model.onDidChangeDecorations((e) => this.onModelDecorationsChanged(modelUrlStr))];
const breakpointDecorationsAsMap = new Map<string, Range>();
breakPointDecorations.forEach((decorationId, index) => breakpointDecorationsAsMap.set(decorationId, desiredDecorations[index].range));
this.modelDataMap.set(modelUrlStr, {
model: model,
toDispose: toDispose,
breakpointDecorationIds: breakPointDecorations,
breakpointModelIds: breakpoints.map(bp => bp.getId()),
breakpointDecorationsAsMap,
breakpointDecorations: breakpointDecorationIds.map((decorationId, index) => ({ decorationId, modelId: breakpoints[index].getId(), range: desiredDecorations[index].range })),
currentStackDecorations: currentStackDecorations,
dirty: false,
topStackFrameRange: undefined
@@ -188,17 +182,17 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
// breakpoints management. Represent data coming from the debug service and also send data back.
private onModelDecorationsChanged(modelUrlStr: string): void {
const modelData = this.modelDataMap.get(modelUrlStr);
if (modelData.breakpointDecorationsAsMap.size === 0 || this.ignoreDecorationsChangedEvent) {
if (modelData.breakpointDecorations.length === 0 || this.ignoreDecorationsChangedEvent) {
// I have no decorations
return;
}
let somethingChanged = false;
modelData.breakpointDecorationsAsMap.forEach((breakpointRange, decorationId) => {
modelData.breakpointDecorations.forEach(breakpointDecoration => {
if (somethingChanged) {
return;
}
const newBreakpointRange = modelData.model.getDecorationRange(decorationId);
if (newBreakpointRange && !breakpointRange.equalsRange(newBreakpointRange)) {
const newBreakpointRange = modelData.model.getDecorationRange(breakpointDecoration.decorationId);
if (newBreakpointRange && (!breakpointDecoration.range.equalsRange(newBreakpointRange))) {
somethingChanged = true;
}
});
@@ -207,35 +201,28 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
return;
}
const data: IRawBreakpoint[] = [];
const data: { [id: string]: DebugProtocol.Breakpoint } = Object.create(null);
const breakpoints = this.debugService.getModel().getBreakpoints();
const modelUri = modelData.model.uri;
for (let i = 0, len = modelData.breakpointDecorationIds.length; i < len; i++) {
const decorationRange = modelData.model.getDecorationRange(modelData.breakpointDecorationIds[i]);
for (let i = 0, len = modelData.breakpointDecorations.length; i < len; i++) {
const breakpointDecoration = modelData.breakpointDecorations[i];
const decorationRange = modelData.model.getDecorationRange(breakpointDecoration.decorationId);
// check if the line got deleted.
if (decorationRange && decorationRange.endColumn - decorationRange.startColumn > 0) {
const breakpoint = breakpoints.filter(bp => bp.getId() === modelData.breakpointModelIds[i]).pop();
if (decorationRange) {
const breakpoint = breakpoints.filter(bp => bp.getId() === breakpointDecoration.modelId).pop();
// since we know it is collapsed, it cannot grow to multiple lines
if (breakpoint) {
data.push({
lineNumber: decorationRange.startLineNumber,
enabled: breakpoint.enabled,
condition: breakpoint.condition,
hitCondition: breakpoint.hitCondition,
column: breakpoint.column ? decorationRange.startColumn : undefined
});
data[breakpoint.getId()] = {
line: decorationRange.startLineNumber,
column: breakpoint.column ? decorationRange.startColumn : undefined,
verified: breakpoint.verified
};
}
}
}
modelData.dirty = this.debugService.state !== State.Inactive;
const toRemove = this.debugService.getModel().getBreakpoints()
.filter(bp => bp.uri.toString() === modelUri.toString());
TPromise.join(toRemove.map(bp => this.debugService.removeBreakpoints(bp.getId()))).then(() => {
this.debugService.addBreakpoints(modelUri, data);
});
this.debugService.updateBreakpoints(modelUri, data);
}
private onBreakpointsChange(): void {
@@ -263,22 +250,24 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
private updateBreakpoints(modelData: IDebugEditorModelData, newBreakpoints: IBreakpoint[]): void {
const desiredDecorations = this.createBreakpointDecorations(modelData.model, newBreakpoints);
let breakpointDecorationIds: string[];
try {
this.ignoreDecorationsChangedEvent = true;
modelData.breakpointDecorationIds = modelData.model.deltaDecorations(modelData.breakpointDecorationIds, desiredDecorations);
breakpointDecorationIds = modelData.model.deltaDecorations(modelData.breakpointDecorations.map(bpd => bpd.decorationId), desiredDecorations);
} finally {
this.ignoreDecorationsChangedEvent = false;
}
modelData.breakpointModelIds = newBreakpoints.map(nbp => nbp.getId());
modelData.breakpointDecorationsAsMap.clear();
modelData.breakpointDecorationIds.forEach((decorationId, index) => modelData.breakpointDecorationsAsMap.set(decorationId, desiredDecorations[index].range));
modelData.breakpointDecorations = breakpointDecorationIds.map((decorationId, index) =>
({ decorationId, modelId: newBreakpoints[index].getId(), range: desiredDecorations[index].range }));
}
private createBreakpointDecorations(model: IModel, breakpoints: IBreakpoint[]): { range: Range; options: IModelDecorationOptions; }[] {
return breakpoints.map((breakpoint) => {
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, 1, breakpoint.lineNumber, Constants.MAX_SAFE_SMALL_INTEGER) // Decoration has to have a width #20688
: new Range(breakpoint.lineNumber, column, breakpoint.lineNumber, column + 1) // Decoration has to have a width #20688
);
return {
options: this.getBreakpointDecorationOptions(breakpoint),
@@ -299,7 +288,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
!breakpoint.condition && !breakpoint.hitCondition ? DebugEditorModelManager.BREAKPOINT_DECORATION : null;
if (result) {
result = objects.clone(result);
result = objects.deepClone(result);
if (breakpoint.message) {
result.glyphMarginHoverMessage = new MarkdownString().appendText(breakpoint.message);
}

View File

@@ -9,12 +9,14 @@ import { TPromise } from 'vs/base/common/winjs.base';
import Quickopen = require('vs/workbench/browser/quickopen');
import QuickOpen = require('vs/base/parts/quickopen/common/quickOpen');
import Model = require('vs/base/parts/quickopen/browser/quickOpenModel');
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { IDebugService, ILaunch } from 'vs/workbench/parts/debug/common/debug';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import * as errors from 'vs/base/common/errors';
import { QuickOpenEntry, QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { StartAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { IMessageService } from 'vs/platform/message/common/message';
import { Severity } from 'vs/workbench/services/message/browser/messageList';
class AddConfigEntry extends Model.QuickOpenEntry {
@@ -46,7 +48,7 @@ class AddConfigEntry extends Model.QuickOpenEntry {
class StartDebugEntry extends Model.QuickOpenEntry {
constructor(private debugService: IDebugService, private contextService: IWorkspaceContextService, private launch: ILaunch, private configurationName: string, highlights: Model.IHighlight[] = []) {
constructor(private debugService: IDebugService, private contextService: IWorkspaceContextService, private messageService: IMessageService, private launch: ILaunch, private configurationName: string, highlights: Model.IHighlight[] = []) {
super(highlights);
}
@@ -63,12 +65,12 @@ class StartDebugEntry extends Model.QuickOpenEntry {
}
public run(mode: QuickOpen.Mode, context: Model.IContext): boolean {
if (mode === QuickOpen.Mode.PREVIEW) {
if (mode === QuickOpen.Mode.PREVIEW || !StartAction.isEnabled(this.debugService, this.contextService, this.configurationName)) {
return false;
}
// Run selected debug configuration
this.debugService.getConfigurationManager().selectConfiguration(this.launch, this.configurationName);
this.debugService.startDebugging(this.launch.workspace).done(undefined, errors.onUnexpectedError);
this.debugService.startDebugging(this.launch.workspace).done(undefined, e => this.messageService.show(Severity.Error, e));
return true;
}
@@ -80,10 +82,10 @@ export class DebugQuickOpenHandler extends Quickopen.QuickOpenHandler {
private autoFocusIndex: number;
constructor(
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IDebugService private debugService: IDebugService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ICommandService private commandService: ICommandService
@ICommandService private commandService: ICommandService,
@IMessageService private messageService: IMessageService
) {
super();
}
@@ -104,7 +106,7 @@ export class DebugQuickOpenHandler extends Quickopen.QuickOpenHandler {
if (launch === configManager.selectedLaunch && config === configManager.selectedName) {
this.autoFocusIndex = configurations.length;
}
configurations.push(new StartDebugEntry(this.debugService, this.contextService, launch, config, highlights));
configurations.push(new StartDebugEntry(this.debugService, this.contextService, this.messageService, launch, config, highlights));
});
}
launches.forEach((l, index) => {

View File

@@ -10,22 +10,25 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { IDebugService, State } from 'vs/workbench/parts/debug/common/debug';
import { IDebugService, State, IDebugConfiguration } from 'vs/workbench/parts/debug/common/debug';
import { Themable, STATUS_BAR_FOREGROUND } from 'vs/workbench/common/theme';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const $ = dom.$;
export class DebugStatus extends Themable implements IStatusbarItem {
private toDispose: IDisposable[];
private container: HTMLElement;
private statusBarItem: HTMLElement;
private label: HTMLElement;
private icon: HTMLElement;
private hidden = true;
private showInStatusBar: string;
constructor(
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IDebugService private debugService: IDebugService,
@IThemeService themeService: IThemeService
@IThemeService themeService: IThemeService,
@IConfigurationService configurationService: IConfigurationService
) {
super(themeService);
this.toDispose = [];
@@ -33,9 +36,24 @@ export class DebugStatus extends Themable implements IStatusbarItem {
this.setLabel();
}));
this.toDispose.push(this.debugService.onDidChangeState(state => {
if (state !== State.Inactive && this.hidden) {
this.hidden = false;
this.render(this.container);
if (state !== State.Inactive && this.showInStatusBar === 'onFirstSessionStart') {
this.doRender();
}
}));
this.showInStatusBar = configurationService.getValue<IDebugConfiguration>('debug').showInStatusBar;
this.toDispose.push(configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('debug.showInStatusBar')) {
this.showInStatusBar = configurationService.getValue<IDebugConfiguration>('debug').showInStatusBar;
if (this.showInStatusBar === 'never' && this.statusBarItem) {
this.statusBarItem.hidden = true;
} else {
if (this.statusBarItem) {
this.statusBarItem.hidden = false;
}
if (this.showInStatusBar === 'always') {
this.doRender();
}
}
}
}));
}
@@ -49,24 +67,30 @@ export class DebugStatus extends Themable implements IStatusbarItem {
public render(container: HTMLElement): IDisposable {
this.container = container;
if (!this.hidden) {
const statusBarItem = dom.append(container, $('.debug-statusbar-item'));
this.toDispose.push(dom.addDisposableListener(statusBarItem, 'click', () => {
if (this.showInStatusBar === 'always') {
this.doRender();
}
// noop, we render when we decide is best
return this;
}
private doRender(): void {
if (!this.statusBarItem && this.container) {
this.statusBarItem = dom.append(this.container, $('.debug-statusbar-item'));
this.toDispose.push(dom.addDisposableListener(this.statusBarItem, 'click', () => {
this.quickOpenService.show('debug ').done(undefined, errors.onUnexpectedError);
}));
statusBarItem.title = nls.localize('selectAndStartDebug', "Select and start debug configuration");
const a = dom.append(statusBarItem, $('a'));
this.statusBarItem.title = nls.localize('selectAndStartDebug', "Select and start debug configuration");
const a = dom.append(this.statusBarItem, $('a'));
this.icon = dom.append(a, $('.icon'));
this.label = dom.append(a, $('span.label'));
this.setLabel();
this.updateStyles();
}
return this;
}
private setLabel(): void {
if (this.label && !this.hidden) {
if (this.label && this.statusBarItem) {
const manager = this.debugService.getConfigurationManager();
const name = manager.selectedName || '';
this.label.textContent = manager.getLaunches().length > 1 ? `${name} (${manager.selectedLaunch.workspace.name})` : name;

View File

@@ -10,7 +10,7 @@ import { Action, IAction } from 'vs/base/common/actions';
import * as DOM from 'vs/base/browser/dom';
import { TPromise } from 'vs/base/common/winjs.base';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { PersistentViewsViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { PersistentViewsViewlet, ViewsViewletPanel } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, VIEWLET_ID, State, VARIABLES_VIEW_ID, WATCH_VIEW_ID, CALLSTACK_VIEW_ID, BREAKPOINTS_VIEW_ID } from 'vs/workbench/parts/debug/common/debug';
import { StartAction, ToggleReplAction, ConfigureAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { StartDebugActionItem } from 'vs/workbench/parts/debug/browser/debugActionItems';
@@ -25,11 +25,14 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ViewLocation } from 'vs/workbench/browser/parts/views/viewsRegistry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
export class DebugViewlet extends PersistentViewsViewlet {
private startDebugActionItem: StartDebugActionItem;
private progressRunner: IProgressRunner;
private breakpointView: ViewsViewletPanel;
private panelListeners = new Map<string, IDisposable>();
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@@ -105,6 +108,32 @@ export class DebugViewlet extends PersistentViewsViewlet {
this.progressRunner = null;
}
}
addPanel(panel: ViewsViewletPanel, size: number, index?: number): void {
super.addPanel(panel, size, index);
// attach event listener to
if (panel.id === BREAKPOINTS_VIEW_ID) {
this.breakpointView = panel;
this.updateBreakpointsMaxSize();
} else {
this.panelListeners.set(panel.id, panel.onDidChange(() => this.updateBreakpointsMaxSize()));
}
}
removePanel(panel: ViewsViewletPanel): void {
super.removePanel(panel);
dispose(this.panelListeners.get(panel.id));
this.panelListeners.delete(panel.id);
}
private updateBreakpointsMaxSize(): void {
if (this.breakpointView) {
// We need to update the breakpoints view since all other views are collapsed #25384
const allOtherCollapsed = this.views.every(view => !view.isExpanded() || view === this.breakpointView);
this.breakpointView.maximumBodySize = allOtherCollapsed ? Number.POSITIVE_INFINITY : this.breakpointView.minimumBodySize;
}
}
}
export class FocusVariablesViewAction extends Action {

View File

@@ -6,10 +6,9 @@
import 'vs/css!../browser/media/exceptionWidget';
import * as nls from 'vs/nls';
import * as dom from 'vs/base/browser/dom';
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/zoneWidget';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IDebugService, IExceptionInfo } from 'vs/workbench/parts/debug/common/debug';
import { IExceptionInfo } from 'vs/workbench/parts/debug/common/debug';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color';
@@ -27,9 +26,7 @@ export class ExceptionWidget extends ZoneWidget {
private _backgroundColor: Color;
constructor(editor: ICodeEditor, private exceptionInfo: IExceptionInfo, private lineNumber: number,
@IContextViewService private contextViewService: IContextViewService,
@IDebugService private debugService: IDebugService,
constructor(editor: ICodeEditor, private exceptionInfo: IExceptionInfo,
@IThemeService themeService: IThemeService,
@IInstantiationService private instantiationService: IInstantiationService
) {

View File

@@ -9,7 +9,6 @@ import * as errors from 'vs/base/common/errors';
import { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import * as nls from 'vs/nls';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
export class LinkDetector {
private static FILE_LOCATION_PATTERNS: RegExp[] = [
@@ -23,8 +22,7 @@ export class LinkDetector {
];
constructor(
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IWorkspaceContextService private contextService: IWorkspaceContextService
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
// noop
}

View File

@@ -109,9 +109,13 @@
padding: 0 5px 0 5px;
}
.monaco-workbench .part.statusbar .debug-statusbar-item.hidden {
display: none;
}
.monaco-workbench .part.statusbar .debug-statusbar-item .icon {
-webkit-mask: url('continue.svg') no-repeat 50% 50%;
-webkit-mask-size: 18px;
-webkit-mask-size: 16px;
display: inline-block;
padding-right: 2px;
width: 16px;
@@ -142,6 +146,10 @@
color: #9B46B0;
}
.monaco-workbench .monaco-tree-row:not(.selected) .expression .name.virtual {
opacity: 0.5;
}
.monaco-workbench > .monaco-tree-row:not(.selected) .expression .value {
color: rgba(108, 108, 108, 0.8);
}

View File

@@ -110,6 +110,7 @@
}
.debug-viewlet .monaco-tree .monaco-tree-row.selected .line-number,
.debug-viewlet .monaco-list .monaco-list-row.selected .line-number,
.debug-viewlet .monaco-tree .monaco-tree-row.selected .thread > .state > .label,
.debug-viewlet .monaco-tree .monaco-tree-row.selected .process > .state > .label {
background-color: #ffffff;
@@ -347,6 +348,10 @@
/* Breakpoints */
.debug-viewlet .debug-breakpoints .monaco-list-row {
padding-left: 20px;
}
.debug-viewlet .debug-breakpoints .breakpoint {
display: flex;
padding-right: 0.8em;
@@ -367,7 +372,6 @@
overflow: hidden;
}
.debug-viewlet .debug-action.remove {
background: url('remove.svg') center center no-repeat;
}