mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 18:46:34 -05:00
Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)
This commit is contained in:
@@ -45,10 +45,10 @@ export interface IPrivateBreakpointWidgetService {
|
||||
const DECORATION_KEY = 'breakpointwidgetdecoration';
|
||||
|
||||
export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWidgetService {
|
||||
public _serviceBrand: any;
|
||||
_serviceBrand: any;
|
||||
|
||||
private selectContainer: HTMLElement;
|
||||
private input: IActiveCodeEditor;
|
||||
private selectContainer!: HTMLElement;
|
||||
private input!: IActiveCodeEditor;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private conditionInput = '';
|
||||
private hitCountInput = '';
|
||||
@@ -130,12 +130,12 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
||||
}
|
||||
}
|
||||
|
||||
public show(rangeOrPos: IRange | IPosition, heightInLines: number) {
|
||||
show(rangeOrPos: IRange | IPosition, heightInLines: number) {
|
||||
const lineNum = this.input.getModel().getLineCount();
|
||||
super.show(rangeOrPos, lineNum + 1);
|
||||
}
|
||||
|
||||
public fitHeightToContent() {
|
||||
fitHeightToContent() {
|
||||
const lineNum = this.input.getModel().getLineCount();
|
||||
this._relayout(lineNum + 1);
|
||||
}
|
||||
@@ -165,50 +165,6 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
||||
setTimeout(() => this.input.focus(), 150);
|
||||
}
|
||||
|
||||
public close(success: boolean): void {
|
||||
if (success) {
|
||||
// if there is already a breakpoint on this location - remove it.
|
||||
|
||||
let condition = this.breakpoint && this.breakpoint.condition;
|
||||
let hitCondition = this.breakpoint && this.breakpoint.hitCondition;
|
||||
let logMessage = this.breakpoint && this.breakpoint.logMessage;
|
||||
this.rememberInput();
|
||||
|
||||
if (this.conditionInput || this.context === Context.CONDITION) {
|
||||
condition = this.conditionInput;
|
||||
}
|
||||
if (this.hitCountInput || this.context === Context.HIT_COUNT) {
|
||||
hitCondition = this.hitCountInput;
|
||||
}
|
||||
if (this.logMessageInput || this.context === Context.LOG_MESSAGE) {
|
||||
logMessage = this.logMessageInput;
|
||||
}
|
||||
|
||||
if (this.breakpoint) {
|
||||
const data = new Map<string, IBreakpointUpdateData>();
|
||||
data.set(this.breakpoint.getId(), {
|
||||
condition,
|
||||
hitCondition,
|
||||
logMessage
|
||||
});
|
||||
this.debugService.updateBreakpoints(this.breakpoint.uri, data, false).then(undefined, onUnexpectedError);
|
||||
} else {
|
||||
const model = this.editor.getModel();
|
||||
if (model) {
|
||||
this.debugService.addBreakpoints(model.uri, [{
|
||||
lineNumber: this.lineNumber,
|
||||
enabled: true,
|
||||
condition,
|
||||
hitCondition,
|
||||
logMessage
|
||||
}], `breakpointWidget`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
protected _doLayout(heightInPixel: number, widthInPixel: number): void {
|
||||
this.input.layout({ height: heightInPixel, width: widthInPixel - 113 });
|
||||
}
|
||||
@@ -305,7 +261,51 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
||||
return false;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
close(success: boolean): void {
|
||||
if (success) {
|
||||
// if there is already a breakpoint on this location - remove it.
|
||||
|
||||
let condition = this.breakpoint && this.breakpoint.condition;
|
||||
let hitCondition = this.breakpoint && this.breakpoint.hitCondition;
|
||||
let logMessage = this.breakpoint && this.breakpoint.logMessage;
|
||||
this.rememberInput();
|
||||
|
||||
if (this.conditionInput || this.context === Context.CONDITION) {
|
||||
condition = this.conditionInput;
|
||||
}
|
||||
if (this.hitCountInput || this.context === Context.HIT_COUNT) {
|
||||
hitCondition = this.hitCountInput;
|
||||
}
|
||||
if (this.logMessageInput || this.context === Context.LOG_MESSAGE) {
|
||||
logMessage = this.logMessageInput;
|
||||
}
|
||||
|
||||
if (this.breakpoint) {
|
||||
const data = new Map<string, IBreakpointUpdateData>();
|
||||
data.set(this.breakpoint.getId(), {
|
||||
condition,
|
||||
hitCondition,
|
||||
logMessage
|
||||
});
|
||||
this.debugService.updateBreakpoints(this.breakpoint.uri, data, false).then(undefined, onUnexpectedError);
|
||||
} else {
|
||||
const model = this.editor.getModel();
|
||||
if (model) {
|
||||
this.debugService.addBreakpoints(model.uri, [{
|
||||
lineNumber: this.lineNumber,
|
||||
enabled: true,
|
||||
condition,
|
||||
hitCondition,
|
||||
logMessage
|
||||
}], `breakpointWidget`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
super.dispose();
|
||||
this.input.dispose();
|
||||
lifecycle.dispose(this.toDispose);
|
||||
@@ -327,7 +327,7 @@ class AcceptBreakpointWidgetInputAction extends EditorCommand {
|
||||
});
|
||||
}
|
||||
|
||||
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor): void {
|
||||
runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor): void {
|
||||
accessor.get(IPrivateBreakpointWidgetService).close(true);
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@ class CloseBreakpointWidgetCommand extends EditorCommand {
|
||||
});
|
||||
}
|
||||
|
||||
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
|
||||
runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
|
||||
const debugContribution = editor.getContribution<IDebugEditorContribution>(EDITOR_CONTRIBUTION_ID);
|
||||
if (debugContribution) {
|
||||
// if focus is in outer editor we need to use the debug contribution to close
|
||||
|
||||
@@ -45,8 +45,8 @@ function createCheckbox(): HTMLInputElement {
|
||||
export class BreakpointsView extends ViewletPanel {
|
||||
|
||||
private static readonly MAX_VISIBLE_FILES = 9;
|
||||
private list: WorkbenchList<IEnablement>;
|
||||
private needsRefresh: boolean;
|
||||
private list!: WorkbenchList<IEnablement>;
|
||||
private needsRefresh = false;
|
||||
|
||||
constructor(
|
||||
options: IViewletViewOptions,
|
||||
|
||||
@@ -37,15 +37,15 @@ type CallStackItem = IStackFrame | IThread | IDebugSession | string | ThreadAndS
|
||||
|
||||
export class CallStackView extends ViewletPanel {
|
||||
|
||||
private pauseMessage: HTMLSpanElement;
|
||||
private pauseMessageLabel: HTMLSpanElement;
|
||||
private pauseMessage!: HTMLSpanElement;
|
||||
private pauseMessageLabel!: HTMLSpanElement;
|
||||
private onCallStackChangeScheduler: RunOnceScheduler;
|
||||
private needsRefresh: boolean;
|
||||
private ignoreSelectionChangedEvent: boolean;
|
||||
private ignoreFocusStackFrameEvent: boolean;
|
||||
private needsRefresh = false;
|
||||
private ignoreSelectionChangedEvent = false;
|
||||
private ignoreFocusStackFrameEvent = false;
|
||||
private callStackItemType: IContextKey<string>;
|
||||
private dataSource: CallStackDataSource;
|
||||
private tree: WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>;
|
||||
private dataSource!: CallStackDataSource;
|
||||
private tree!: WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>;
|
||||
private contributedContextMenu: IMenu;
|
||||
private parentSessionToExpand = new Set<IDebugSession>();
|
||||
|
||||
@@ -584,7 +584,7 @@ function isDeemphasized(frame: IStackFrame): boolean {
|
||||
}
|
||||
|
||||
class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem> {
|
||||
deemphasizedStackFramesToShow: IStackFrame[];
|
||||
deemphasizedStackFramesToShow: IStackFrame[] = [];
|
||||
|
||||
constructor(private debugService: IDebugService) { }
|
||||
|
||||
|
||||
@@ -260,6 +260,11 @@ configurationRegistry.registerConfiguration({
|
||||
description: nls.localize({ comment: ['This is the description for a setting'], key: 'launch' }, "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces."),
|
||||
default: { configurations: [], compounds: [] },
|
||||
$ref: launchSchemaId
|
||||
},
|
||||
'debug.focusWindowOnBreak': {
|
||||
type: 'boolean',
|
||||
description: nls.localize('debug.focusWindowOnBreak', "Controls whether the workbench window should be focused when the debugger breaks."),
|
||||
default: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -27,13 +27,13 @@ export class StartDebugActionViewItem implements IActionViewItem {
|
||||
|
||||
private static readonly SEPARATOR = '─────────';
|
||||
|
||||
public actionRunner: IActionRunner;
|
||||
private container: HTMLElement;
|
||||
private start: HTMLElement;
|
||||
actionRunner!: IActionRunner;
|
||||
private container!: HTMLElement;
|
||||
private start!: HTMLElement;
|
||||
private selectBox: SelectBox;
|
||||
private options: { label: string, handler?: (() => boolean) }[];
|
||||
private options: { label: string, handler?: (() => boolean) }[] = [];
|
||||
private toDispose: IDisposable[];
|
||||
private selected: number;
|
||||
private selected = 0;
|
||||
|
||||
constructor(
|
||||
private context: any,
|
||||
@@ -66,7 +66,7 @@ export class StartDebugActionViewItem implements IActionViewItem {
|
||||
}));
|
||||
}
|
||||
|
||||
public render(container: HTMLElement): void {
|
||||
render(container: HTMLElement): void {
|
||||
this.container = container;
|
||||
dom.addClass(container, 'start-debug-action-item');
|
||||
this.start = dom.append(container, $('.icon'));
|
||||
@@ -129,15 +129,15 @@ export class StartDebugActionViewItem implements IActionViewItem {
|
||||
this.updateOptions();
|
||||
}
|
||||
|
||||
public setActionContext(context: any): void {
|
||||
setActionContext(context: any): void {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public isEnabled(): boolean {
|
||||
isEnabled(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public focus(fromRight?: boolean): void {
|
||||
focus(fromRight?: boolean): void {
|
||||
if (fromRight) {
|
||||
this.selectBox.focus();
|
||||
} else {
|
||||
@@ -145,11 +145,11 @@ export class StartDebugActionViewItem implements IActionViewItem {
|
||||
}
|
||||
}
|
||||
|
||||
public blur(): void {
|
||||
blur(): void {
|
||||
this.container.blur();
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
dispose(): void {
|
||||
this.toDispose = dispose(this.toDispose);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
|
||||
jsonRegistry.registerSchema(launchSchemaId, launchSchema);
|
||||
@@ -44,7 +45,7 @@ const DEBUG_SELECTED_ROOT = 'debug.selectedroot';
|
||||
export class ConfigurationManager implements IConfigurationManager {
|
||||
private debuggers: Debugger[];
|
||||
private breakpointModeIdsSet = new Set<string>();
|
||||
private launches: ILaunch[];
|
||||
private launches!: ILaunch[];
|
||||
private selectedName: string | undefined;
|
||||
private selectedLaunch: ILaunch | undefined;
|
||||
private toDispose: IDisposable[];
|
||||
@@ -180,7 +181,7 @@ export class ConfigurationManager implements IConfigurationManager {
|
||||
return providers.length > 0;
|
||||
}
|
||||
|
||||
resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: IConfig): Promise<IConfig | null | undefined> {
|
||||
resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined> {
|
||||
return this.activateDebuggers('onDebugResolve', type).then(() => {
|
||||
// pipe the config through the promises sequentially. Append at the end the '*' types
|
||||
const providers = this.configProviders.filter(p => p.type === type && p.resolveDebugConfiguration)
|
||||
@@ -189,7 +190,7 @@ export class ConfigurationManager implements IConfigurationManager {
|
||||
return providers.reduce((promise, provider) => {
|
||||
return promise.then(config => {
|
||||
if (config) {
|
||||
return provider.resolveDebugConfiguration!(folderUri, config);
|
||||
return provider.resolveDebugConfiguration!(folderUri, config, token);
|
||||
} else {
|
||||
return Promise.resolve(config);
|
||||
}
|
||||
@@ -198,9 +199,9 @@ export class ConfigurationManager implements IConfigurationManager {
|
||||
});
|
||||
}
|
||||
|
||||
provideDebugConfigurations(folderUri: uri | undefined, type: string): Promise<any[]> {
|
||||
provideDebugConfigurations(folderUri: uri | undefined, type: string, token: CancellationToken): Promise<any[]> {
|
||||
return this.activateDebuggers('onDebugInitialConfigurations')
|
||||
.then(() => Promise.all(this.configProviders.filter(p => p.type === type && p.provideDebugConfigurations).map(p => p.provideDebugConfigurations!(folderUri)))
|
||||
.then(() => Promise.all(this.configProviders.filter(p => p.type === type && p.provideDebugConfigurations).map(p => p.provideDebugConfigurations!(folderUri, token)))
|
||||
.then(results => results.reduce((first, second) => first.concat(second), [])));
|
||||
}
|
||||
|
||||
@@ -531,7 +532,7 @@ class Launch extends AbstractLaunch implements ILaunch {
|
||||
return this.configurationService.inspect<IGlobalConfig>('launch', { resource: this.workspace.uri }).workspaceFolder;
|
||||
}
|
||||
|
||||
openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string): Promise<{ editor: IEditor | null, created: boolean }> {
|
||||
openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string, token?: CancellationToken): Promise<{ editor: IEditor | null, created: boolean }> {
|
||||
const resource = this.uri;
|
||||
let created = false;
|
||||
|
||||
@@ -539,7 +540,7 @@ class Launch extends AbstractLaunch implements ILaunch {
|
||||
// launch.json not found: create one by collecting launch configs from debugConfigProviders
|
||||
return this.configurationManager.guessDebugger(type).then(adapter => {
|
||||
if (adapter) {
|
||||
return this.configurationManager.provideDebugConfigurations(this.workspace.uri, adapter.type).then(initialConfigs => {
|
||||
return this.configurationManager.provideDebugConfigurations(this.workspace.uri, adapter.type, token || CancellationToken.None).then(initialConfigs => {
|
||||
return adapter.getInitialConfigurationContent(initialConfigs);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -57,8 +57,8 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private hoverWidget: DebugHoverWidget;
|
||||
private nonDebugHoverPosition: Position;
|
||||
private hoverRange: Range;
|
||||
private nonDebugHoverPosition: Position | undefined;
|
||||
private hoverRange: Range | null = null;
|
||||
private mouseDown = false;
|
||||
|
||||
private breakpointHintDecoration: string[];
|
||||
@@ -68,7 +68,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||
|
||||
private exceptionWidget: ExceptionWidget | undefined;
|
||||
|
||||
private configurationWidget: FloatingClickWidget;
|
||||
private configurationWidget: FloatingClickWidget | undefined;
|
||||
|
||||
constructor(
|
||||
private editor: ICodeEditor,
|
||||
@@ -377,7 +377,11 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||
|
||||
@memoize
|
||||
private get showHoverScheduler(): RunOnceScheduler {
|
||||
const scheduler = new RunOnceScheduler(() => this.showHover(this.hoverRange, false), HOVER_DELAY);
|
||||
const scheduler = new RunOnceScheduler(() => {
|
||||
if (this.hoverRange) {
|
||||
this.showHover(this.hoverRange, false);
|
||||
}
|
||||
}, HOVER_DELAY);
|
||||
this.toDispose.push(scheduler);
|
||||
|
||||
return scheduler;
|
||||
@@ -385,7 +389,11 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||
|
||||
@memoize
|
||||
private get hideHoverScheduler(): RunOnceScheduler {
|
||||
const scheduler = new RunOnceScheduler(() => this.hoverWidget.hide(), 2 * HOVER_DELAY);
|
||||
const scheduler = new RunOnceScheduler(() => {
|
||||
if (!this.hoverWidget.isHovered()) {
|
||||
this.hoverWidget.hide();
|
||||
}
|
||||
}, 2 * HOVER_DELAY);
|
||||
this.toDispose.push(scheduler);
|
||||
|
||||
return scheduler;
|
||||
@@ -394,7 +402,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||
@memoize
|
||||
private get provideNonDebugHoverScheduler(): RunOnceScheduler {
|
||||
const scheduler = new RunOnceScheduler(() => {
|
||||
if (this.editor.hasModel()) {
|
||||
if (this.editor.hasModel() && this.nonDebugHoverPosition) {
|
||||
getHover(this.editor.getModel(), this.nonDebugHoverPosition, CancellationToken.None);
|
||||
}
|
||||
}, HOVER_DELAY);
|
||||
|
||||
@@ -36,7 +36,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
|
||||
static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
|
||||
private modelDataMap: Map<string, IDebugEditorModelData>;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private ignoreDecorationsChangedEvent: boolean;
|
||||
private ignoreDecorationsChangedEvent = false;
|
||||
|
||||
constructor(
|
||||
@IModelService private readonly modelService: IModelService,
|
||||
|
||||
@@ -1,21 +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 { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
||||
export class BrowserDebugHelperService implements IDebugHelperService {
|
||||
|
||||
_serviceBrand: ServiceIdentifier<IDebugHelperService>;
|
||||
|
||||
createTelemetryService(configurationService: IConfigurationService, args: string[]): TelemetryService | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IDebugHelperService, BrowserDebugHelperService);
|
||||
@@ -41,17 +41,16 @@ export class DebugHoverWidget implements IContentWidget {
|
||||
allowEditorOverflow = true;
|
||||
|
||||
private _isVisible: boolean;
|
||||
private domNode: HTMLElement;
|
||||
private tree: AsyncDataTree<IExpression, IExpression, any>;
|
||||
private domNode!: HTMLElement;
|
||||
private tree!: AsyncDataTree<IExpression, IExpression, any>;
|
||||
private showAtPosition: Position | null;
|
||||
private highlightDecorations: string[];
|
||||
private complexValueContainer: HTMLElement;
|
||||
private complexValueTitle: HTMLElement;
|
||||
private valueContainer: HTMLElement;
|
||||
private treeContainer: HTMLElement;
|
||||
private complexValueContainer!: HTMLElement;
|
||||
private complexValueTitle!: HTMLElement;
|
||||
private valueContainer!: HTMLElement;
|
||||
private treeContainer!: HTMLElement;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private scrollbar: DomScrollableElement;
|
||||
private dataSource: DebugHoverDataSource;
|
||||
private scrollbar!: DomScrollableElement;
|
||||
|
||||
constructor(
|
||||
private editor: ICodeEditor,
|
||||
@@ -72,10 +71,10 @@ export class DebugHoverWidget implements IContentWidget {
|
||||
this.complexValueTitle = dom.append(this.complexValueContainer, $('.title'));
|
||||
this.treeContainer = dom.append(this.complexValueContainer, $('.debug-hover-tree'));
|
||||
this.treeContainer.setAttribute('role', 'tree');
|
||||
this.dataSource = new DebugHoverDataSource();
|
||||
const dataSource = new DebugHoverDataSource();
|
||||
|
||||
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new DebugHoverDelegate(), [this.instantiationService.createInstance(VariablesRenderer)],
|
||||
this.dataSource, {
|
||||
dataSource, {
|
||||
ariaLabel: nls.localize('treeAriaLabel', "Debug Hover"),
|
||||
accessibilityProvider: new DebugHoverAccessibilityProvider(),
|
||||
mouseSupport: false,
|
||||
@@ -122,6 +121,10 @@ export class DebugHoverWidget implements IContentWidget {
|
||||
}));
|
||||
}
|
||||
|
||||
isHovered(): boolean {
|
||||
return this.domNode.matches(':hover');
|
||||
}
|
||||
|
||||
isVisible(): boolean {
|
||||
return this._isVisible;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export class DebugQuickOpenHandler extends QuickOpenHandler {
|
||||
|
||||
public static readonly ID = 'workbench.picker.launch';
|
||||
|
||||
private autoFocusIndex: number;
|
||||
private autoFocusIndex: number | undefined;
|
||||
|
||||
constructor(
|
||||
@IDebugService private readonly debugService: IDebugService,
|
||||
|
||||
@@ -47,6 +47,7 @@ import { isErrorWithActions, createErrorWithActions } from 'vs/base/common/error
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
|
||||
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
|
||||
const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated';
|
||||
@@ -87,7 +88,8 @@ export class DebugService implements IDebugService {
|
||||
private inDebugMode: IContextKey<boolean>;
|
||||
private breakpointsToSendOnResourceSaved: Set<string>;
|
||||
private initializing = false;
|
||||
private previousState: State;
|
||||
private previousState: State | undefined;
|
||||
private initCancellationToken: CancellationTokenSource | undefined;
|
||||
|
||||
constructor(
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@@ -211,6 +213,10 @@ export class DebugService implements IDebugService {
|
||||
}
|
||||
|
||||
private endInitializingState() {
|
||||
if (this.initCancellationToken) {
|
||||
this.initCancellationToken.cancel();
|
||||
this.initCancellationToken = undefined;
|
||||
}
|
||||
if (this.initializing) {
|
||||
this.initializing = false;
|
||||
this.onStateChange();
|
||||
@@ -355,8 +361,9 @@ export class DebugService implements IDebugService {
|
||||
}
|
||||
|
||||
const debuggerThenable: Promise<void> = type ? Promise.resolve() : this.configurationManager.guessDebugger().then(dbgr => { type = dbgr && dbgr.type; });
|
||||
return debuggerThenable.then(() =>
|
||||
this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config!).then(config => {
|
||||
return debuggerThenable.then(() => {
|
||||
this.initCancellationToken = new CancellationTokenSource();
|
||||
return this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config!, this.initCancellationToken.token).then(config => {
|
||||
// a falsy config indicates an aborted launch
|
||||
if (config && config.type) {
|
||||
return this.substituteVariables(launch, config).then(resolvedConfig => {
|
||||
@@ -396,17 +403,17 @@ export class DebugService implements IDebugService {
|
||||
.then(() => false);
|
||||
}
|
||||
|
||||
return launch && launch.openConfigFile(false, true).then(() => false);
|
||||
return launch && launch.openConfigFile(false, true, undefined, this.initCancellationToken ? this.initCancellationToken.token : undefined).then(() => false);
|
||||
});
|
||||
}
|
||||
|
||||
if (launch && type && config === null) { // show launch.json only for "config" being "null".
|
||||
return launch.openConfigFile(false, true, type).then(() => false);
|
||||
return launch.openConfigFile(false, true, type, this.initCancellationToken ? this.initCancellationToken.token : undefined).then(() => false);
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -587,7 +594,8 @@ export class DebugService implements IDebugService {
|
||||
|
||||
let substitutionThenable: Promise<IConfig | null | undefined> = Promise.resolve(session.configuration);
|
||||
if (launch && needsToSubstitute && unresolved) {
|
||||
substitutionThenable = this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved.type, unresolved)
|
||||
this.initCancellationToken = new CancellationTokenSource();
|
||||
substitutionThenable = this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved.type, unresolved, this.initCancellationToken.token)
|
||||
.then(resolved => {
|
||||
if (resolved) {
|
||||
// start debugging
|
||||
|
||||
@@ -42,7 +42,7 @@ export class DebugSession implements IDebugSession {
|
||||
private sources = new Map<string, Source>();
|
||||
private threads = new Map<number, Thread>();
|
||||
private rawListeners: IDisposable[] = [];
|
||||
private fetchThreadsScheduler: RunOnceScheduler;
|
||||
private fetchThreadsScheduler: RunOnceScheduler | undefined;
|
||||
private repl: ReplModel;
|
||||
|
||||
private readonly _onDidChangeState = new Emitter<void>();
|
||||
@@ -169,7 +169,7 @@ export class DebugSession implements IDebugSession {
|
||||
|
||||
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.windowsService);
|
||||
|
||||
return this.raw!.start().then(() => {
|
||||
return this.raw.start().then(() => {
|
||||
|
||||
this.registerListeners();
|
||||
|
||||
@@ -674,7 +674,10 @@ export class DebugSession implements IDebugSession {
|
||||
if (this.configurationService.getValue<IDebugConfiguration>('debug').openDebug === 'openOnDebugBreak') {
|
||||
this.viewletService.openViewlet(VIEWLET_ID);
|
||||
}
|
||||
this.windowService.focusWindow();
|
||||
|
||||
if (this.configurationService.getValue<IDebugConfiguration>('debug').focusWindowOnBreak) {
|
||||
this.windowService.focusWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
|
||||
export class DebugStatusContribution implements IWorkbenchContribution {
|
||||
|
||||
private showInStatusBar: 'never' | 'always' | 'onFirstSessionStart';
|
||||
private showInStatusBar!: 'never' | 'always' | 'onFirstSessionStart';
|
||||
private toDispose: IDisposable[] = [];
|
||||
private entryAccessor: IStatusbarEntryAccessor | undefined;
|
||||
|
||||
|
||||
@@ -55,10 +55,10 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
|
||||
private activeActions: IAction[];
|
||||
private updateScheduler: RunOnceScheduler;
|
||||
private debugToolBarMenu: IMenu;
|
||||
private disposeOnUpdate: IDisposable;
|
||||
private disposeOnUpdate: IDisposable | undefined;
|
||||
|
||||
private isVisible: boolean;
|
||||
private isBuilt: boolean;
|
||||
private isVisible = false;
|
||||
private isBuilt = false;
|
||||
|
||||
constructor(
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@@ -126,7 +126,6 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
|
||||
this.registerListeners();
|
||||
|
||||
this.hide();
|
||||
this.isBuilt = false;
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
|
||||
@@ -36,12 +36,12 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
|
||||
export class DebugViewlet extends ViewContainerViewlet {
|
||||
|
||||
private startDebugActionViewItem: StartDebugActionViewItem;
|
||||
private startDebugActionViewItem: StartDebugActionViewItem | undefined;
|
||||
private progressResolve: (() => void) | undefined;
|
||||
private breakpointView: ViewletPanel;
|
||||
private breakpointView: ViewletPanel | undefined;
|
||||
private panelListeners = new Map<string, IDisposable>();
|
||||
private debugToolBarMenu: IMenu;
|
||||
private disposeOnTitleUpdate: IDisposable;
|
||||
private debugToolBarMenu: IMenu | undefined;
|
||||
private disposeOnTitleUpdate: IDisposable | undefined;
|
||||
|
||||
constructor(
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
|
||||
@@ -63,8 +63,8 @@ export class ExceptionWidget extends ZoneWidget {
|
||||
this.setCssClass('exception-widget');
|
||||
// Set the font size and line height to the one from the editor configuration.
|
||||
const fontInfo = this.editor.getConfiguration().fontInfo;
|
||||
this.container.style.fontSize = `${fontInfo.fontSize}px`;
|
||||
this.container.style.lineHeight = `${fontInfo.lineHeight}px`;
|
||||
container.style.fontSize = `${fontInfo.fontSize}px`;
|
||||
container.style.lineHeight = `${fontInfo.lineHeight}px`;
|
||||
|
||||
let title = $('.title');
|
||||
title.textContent = this.exceptionInfo.id ? nls.localize('exceptionThrownWithId', 'Exception has occurred: {0}', this.exceptionInfo.id) : nls.localize('exceptionThrown', 'Exception has occurred.');
|
||||
@@ -87,11 +87,11 @@ export class ExceptionWidget extends ZoneWidget {
|
||||
|
||||
protected _doLayout(_heightInPixel: number | undefined, _widthInPixel: number | undefined): void {
|
||||
// Reload the height with respect to the exception text content and relayout it to match the line count.
|
||||
this.container.style.height = 'initial';
|
||||
this.container!.style.height = 'initial';
|
||||
|
||||
const lineHeight = this.editor.getConfiguration().lineHeight;
|
||||
const arrowHeight = Math.round(lineHeight / 3);
|
||||
const computedLinesNumber = Math.ceil((this.container.offsetHeight + arrowHeight) / lineHeight);
|
||||
const computedLinesNumber = Math.ceil((this.container!.offsetHeight + arrowHeight) / lineHeight);
|
||||
|
||||
this._relayout(computedLinesNumber);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ExtensionHostDebugChannelClient, ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
import { IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
|
||||
class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient {
|
||||
|
||||
constructor(
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
||||
//@IWindowService windowService: IWindowService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService
|
||||
) {
|
||||
const connection = remoteAgentService.getConnection();
|
||||
|
||||
if (!connection) {
|
||||
throw new Error('Missing agent connection');
|
||||
}
|
||||
|
||||
super(connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName));
|
||||
|
||||
this._register(this.onReload(event => {
|
||||
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
|
||||
//windowService.reloadWindow();
|
||||
window.location.reload();
|
||||
}
|
||||
}));
|
||||
this._register(this.onClose(event => {
|
||||
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
|
||||
//this._windowService.closeWindow();
|
||||
window.close();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IExtensionHostDebugService, BrowserExtensionHostDebugService);
|
||||
|
||||
class BrowserDebugHelperService implements IDebugHelperService {
|
||||
|
||||
_serviceBrand!: ServiceIdentifier<IDebugHelperService>;
|
||||
|
||||
createTelemetryService(configurationService: IConfigurationService, args: string[]): TelemetryService | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IDebugHelperService, BrowserDebugHelperService);
|
||||
@@ -46,7 +46,7 @@ class BaseTreeItem {
|
||||
|
||||
private _showedMoreThanOne: boolean;
|
||||
private _children = new Map<string, BaseTreeItem>();
|
||||
private _source: Source;
|
||||
private _source: Source | undefined;
|
||||
|
||||
constructor(private _parent: BaseTreeItem | undefined, private _label: string) {
|
||||
this._showedMoreThanOne = false;
|
||||
@@ -184,7 +184,7 @@ class BaseTreeItem {
|
||||
}
|
||||
|
||||
// skips intermediate single-child nodes
|
||||
getSource(): Source {
|
||||
getSource(): Source | undefined {
|
||||
const child = this.oneChild();
|
||||
if (child) {
|
||||
return child.getSource();
|
||||
@@ -381,13 +381,13 @@ class SessionTreeItem extends BaseTreeItem {
|
||||
|
||||
export class LoadedScriptsView extends ViewletPanel {
|
||||
|
||||
private treeContainer: HTMLElement;
|
||||
private treeContainer!: HTMLElement;
|
||||
private loadedScriptsItemType: IContextKey<string>;
|
||||
private tree: WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
|
||||
private treeLabels: ResourceLabels;
|
||||
private changeScheduler: RunOnceScheduler;
|
||||
private treeNeedsRefreshOnVisible: boolean;
|
||||
private filter: LoadedScriptsFilter;
|
||||
private tree!: WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
|
||||
private treeLabels!: ResourceLabels;
|
||||
private changeScheduler!: RunOnceScheduler;
|
||||
private treeNeedsRefreshOnVisible = false;
|
||||
private filter!: LoadedScriptsFilter;
|
||||
|
||||
constructor(
|
||||
options: IViewletViewOptions,
|
||||
@@ -635,7 +635,7 @@ class LoadedSciptsAccessibilityProvider implements IAccessibilityProvider<Loaded
|
||||
|
||||
class LoadedScriptsFilter implements ITreeFilter<BaseTreeItem, FuzzyScore> {
|
||||
|
||||
private filterText: string;
|
||||
private filterText: string | undefined;
|
||||
|
||||
setFilter(filterText: string) {
|
||||
this.filterText = filterText;
|
||||
|
||||
@@ -37,19 +37,19 @@ interface ILaunchVSCodeArguments {
|
||||
*/
|
||||
export class RawDebugSession {
|
||||
|
||||
private allThreadsContinued: boolean;
|
||||
private _readyForBreakpoints: boolean;
|
||||
private allThreadsContinued = true;
|
||||
private _readyForBreakpoints = false;
|
||||
private _capabilities: DebugProtocol.Capabilities;
|
||||
|
||||
// shutdown
|
||||
private debugAdapterStopped: boolean;
|
||||
private inShutdown: boolean;
|
||||
private terminated: boolean;
|
||||
private firedAdapterExitEvent: boolean;
|
||||
private debugAdapterStopped = false;
|
||||
private inShutdown = false;
|
||||
private terminated = false;
|
||||
private firedAdapterExitEvent = false;
|
||||
|
||||
// telemetry
|
||||
private startTime: number;
|
||||
private didReceiveStoppedEvent: boolean;
|
||||
private startTime = 0;
|
||||
private didReceiveStoppedEvent = false;
|
||||
|
||||
// DAP events
|
||||
private readonly _onDidInitialize: Emitter<DebugProtocol.InitializedEvent>;
|
||||
@@ -78,13 +78,6 @@ export class RawDebugSession {
|
||||
) {
|
||||
this.debugAdapter = debugAdapter;
|
||||
this._capabilities = Object.create(null);
|
||||
this._readyForBreakpoints = false;
|
||||
this.inShutdown = false;
|
||||
this.debugAdapterStopped = false;
|
||||
this.firedAdapterExitEvent = false;
|
||||
this.didReceiveStoppedEvent = false;
|
||||
|
||||
this.allThreadsContinued = true;
|
||||
|
||||
this._onDidInitialize = new Emitter<DebugProtocol.InitializedEvent>();
|
||||
this._onDidStop = new Emitter<DebugProtocol.StoppedEvent>();
|
||||
|
||||
@@ -92,18 +92,18 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
|
||||
private static readonly REPL_INPUT_MAX_HEIGHT = 170;
|
||||
|
||||
private history: HistoryNavigator<string>;
|
||||
private tree: WorkbenchAsyncDataTree<IDebugSession, IReplElement, FuzzyScore>;
|
||||
private replDelegate: ReplDelegate;
|
||||
private container: HTMLElement;
|
||||
private replInput: CodeEditorWidget;
|
||||
private replInputContainer: HTMLElement;
|
||||
private dimension: dom.Dimension;
|
||||
private tree!: WorkbenchAsyncDataTree<IDebugSession, IReplElement, FuzzyScore>;
|
||||
private replDelegate!: ReplDelegate;
|
||||
private container!: HTMLElement;
|
||||
private replInput!: CodeEditorWidget;
|
||||
private replInputContainer!: HTMLElement;
|
||||
private dimension!: dom.Dimension;
|
||||
private replInputHeight: number;
|
||||
private model: ITextModel;
|
||||
private historyNavigationEnablement: IContextKey<boolean>;
|
||||
private scopedInstantiationService: IInstantiationService;
|
||||
private replElementsChangeListener: IDisposable;
|
||||
private styleElement: HTMLStyleElement;
|
||||
private model!: ITextModel;
|
||||
private historyNavigationEnablement!: IContextKey<boolean>;
|
||||
private scopedInstantiationService!: IInstantiationService;
|
||||
private replElementsChangeListener: IDisposable | undefined;
|
||||
private styleElement: HTMLStyleElement | undefined;
|
||||
|
||||
constructor(
|
||||
@IDebugService private readonly debugService: IDebugService,
|
||||
|
||||
@@ -34,7 +34,7 @@ export const STATUS_BAR_DEBUGGING_BORDER = registerColor('statusBar.debuggingBor
|
||||
}, localize('statusBarDebuggingBorder', "Status bar border color separating to the sidebar and editor when a program is being debugged. The status bar is shown in the bottom of the window"));
|
||||
|
||||
export class StatusBarColorProvider extends Themable implements IWorkbenchContribution {
|
||||
private styleElement: HTMLStyleElement;
|
||||
private styleElement: HTMLStyleElement | undefined;
|
||||
|
||||
constructor(
|
||||
@IThemeService themeService: IThemeService,
|
||||
|
||||
@@ -39,8 +39,8 @@ export const variableSetEmitter = new Emitter<void>();
|
||||
export class VariablesView extends ViewletPanel {
|
||||
|
||||
private onFocusStackFrameScheduler: RunOnceScheduler;
|
||||
private needsRefresh: boolean;
|
||||
private tree: WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
|
||||
private needsRefresh = false;
|
||||
private tree!: WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
|
||||
private savedViewState: IAsyncDataTreeViewState | undefined;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -36,8 +36,8 @@ const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024;
|
||||
export class WatchExpressionsView extends ViewletPanel {
|
||||
|
||||
private onWatchExpressionsUpdatedScheduler: RunOnceScheduler;
|
||||
private needsRefresh: boolean;
|
||||
private tree: WorkbenchAsyncDataTree<IDebugService | IExpression, IExpression, FuzzyScore>;
|
||||
private needsRefresh = false;
|
||||
private tree!: WorkbenchAsyncDataTree<IDebugService | IExpression, IExpression, FuzzyScore>;
|
||||
|
||||
constructor(
|
||||
options: IViewletViewOptions,
|
||||
|
||||
Reference in New Issue
Block a user