@codingame/monaco-vscode-debug-service-override 1.85.0 → 1.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +0 -857
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +0 -412
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +0 -1593
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +0 -180
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +0 -1487
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +0 -127
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +0 -31
|
@@ -1,857 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { isSafari } from 'monaco-editor/esm/vs/base/browser/browser.js';
|
|
3
|
-
import { BrowserFeatures } from 'monaco-editor/esm/vs/base/browser/canIUse.js';
|
|
4
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
5
|
-
import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
|
|
6
|
-
import { Action, SubmenuAction, Separator } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
7
|
-
import { distinct } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
8
|
-
import { RunOnceScheduler, timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
9
|
-
import { memoize } from 'monaco-editor/esm/vs/base/common/decorators.js';
|
|
10
|
-
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
11
|
-
import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
12
|
-
import { dispose, disposeIfDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
13
|
-
import * as platform from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
14
|
-
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
15
|
-
import { noBreakWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
16
|
-
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
17
|
-
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
18
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
19
|
-
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
20
|
-
import { GlyphMarginLane, OverviewRulerLane } from 'monaco-editor/esm/vs/editor/common/model.js';
|
|
21
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
22
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
23
|
-
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
24
|
-
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
25
|
-
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
26
|
-
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
27
|
-
import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
28
|
-
import { registerColor } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
29
|
-
import { registerThemingParticipant, themeColorFromId } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
30
|
-
import { GutterActionsRegistry } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/editorLineNumberMenu';
|
|
31
|
-
import { getBreakpointMessageAndIcon } from './breakpointsView.js';
|
|
32
|
-
import { BreakpointWidget } from './breakpointWidget.js';
|
|
33
|
-
import { debugBreakpointHint, allBreakpoints, debugBreakpointUnsupported, breakpoint, debugStackframeFocused, debugStackframe } from 'vscode/vscode/vs/workbench/contrib/debug/browser/debugIcons';
|
|
34
|
-
import { IDebugService, BREAKPOINT_EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINT_WIDGET_VISIBLE, DebuggerString } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
35
|
-
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
36
|
-
|
|
37
|
-
const $ = dom.$;
|
|
38
|
-
const breakpointHelperDecoration = {
|
|
39
|
-
description: 'breakpoint-helper-decoration',
|
|
40
|
-
glyphMarginClassName: ThemeIcon.asClassName(debugBreakpointHint),
|
|
41
|
-
glyphMargin: { position: GlyphMarginLane.Right },
|
|
42
|
-
stickiness: 1
|
|
43
|
-
};
|
|
44
|
-
function createBreakpointDecorations(accessor, model, breakpoints, state, breakpointsActivated, showBreakpointsInOverviewRuler) {
|
|
45
|
-
const result = [];
|
|
46
|
-
breakpoints.forEach((breakpoint) => {
|
|
47
|
-
if (breakpoint.lineNumber > model.getLineCount()) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const hasOtherBreakpointsOnLine = ( breakpoints.some(bp => bp !== breakpoint && bp.lineNumber === breakpoint.lineNumber));
|
|
51
|
-
const column = model.getLineFirstNonWhitespaceColumn(breakpoint.lineNumber);
|
|
52
|
-
const range = model.validateRange(breakpoint.column ? ( new Range(
|
|
53
|
-
breakpoint.lineNumber,
|
|
54
|
-
breakpoint.column,
|
|
55
|
-
breakpoint.lineNumber,
|
|
56
|
-
breakpoint.column + 1
|
|
57
|
-
))
|
|
58
|
-
: ( new Range(breakpoint.lineNumber, column, breakpoint.lineNumber, column + 1))
|
|
59
|
-
);
|
|
60
|
-
result.push({
|
|
61
|
-
options: getBreakpointDecorationOptions(accessor, model, breakpoint, state, breakpointsActivated, showBreakpointsInOverviewRuler, hasOtherBreakpointsOnLine),
|
|
62
|
-
range
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
function getBreakpointDecorationOptions(accessor, model, breakpoint, state, breakpointsActivated, showBreakpointsInOverviewRuler, hasOtherBreakpointsOnLine) {
|
|
68
|
-
const debugService = accessor.get(IDebugService);
|
|
69
|
-
const languageService = accessor.get(ILanguageService);
|
|
70
|
-
const { icon, message, showAdapterUnverifiedMessage } = getBreakpointMessageAndIcon(state, breakpointsActivated, breakpoint, undefined);
|
|
71
|
-
let glyphMarginHoverMessage;
|
|
72
|
-
let unverifiedMessage;
|
|
73
|
-
if (showAdapterUnverifiedMessage) {
|
|
74
|
-
let langId;
|
|
75
|
-
unverifiedMessage = ( debugService.getModel().getSessions().map(s => {
|
|
76
|
-
const dbg = debugService.getAdapterManager().getDebugger(s.configuration.type);
|
|
77
|
-
const message = dbg?.strings?.[DebuggerString.UnverifiedBreakpoints];
|
|
78
|
-
if (message) {
|
|
79
|
-
if (!langId) {
|
|
80
|
-
langId = languageService.guessLanguageIdByFilepathOrFirstLine(breakpoint.uri) ?? undefined;
|
|
81
|
-
}
|
|
82
|
-
return langId && dbg.interestedInLanguage(langId) ? message : undefined;
|
|
83
|
-
}
|
|
84
|
-
return undefined;
|
|
85
|
-
}))
|
|
86
|
-
.find(messages => !!messages);
|
|
87
|
-
}
|
|
88
|
-
if (message) {
|
|
89
|
-
glyphMarginHoverMessage = ( new MarkdownString(undefined, { isTrusted: true, supportThemeIcons: true }));
|
|
90
|
-
if (breakpoint.condition || breakpoint.hitCondition) {
|
|
91
|
-
const languageId = model.getLanguageId();
|
|
92
|
-
glyphMarginHoverMessage.appendCodeblock(languageId, message);
|
|
93
|
-
if (unverifiedMessage) {
|
|
94
|
-
glyphMarginHoverMessage.appendMarkdown('$(warning) ' + unverifiedMessage);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
glyphMarginHoverMessage.appendText(message);
|
|
99
|
-
if (unverifiedMessage) {
|
|
100
|
-
glyphMarginHoverMessage.appendMarkdown('\n\n$(warning) ' + unverifiedMessage);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else if (unverifiedMessage) {
|
|
105
|
-
glyphMarginHoverMessage = ( new MarkdownString(undefined, { isTrusted: true, supportThemeIcons: true })).appendMarkdown(unverifiedMessage);
|
|
106
|
-
}
|
|
107
|
-
let overviewRulerDecoration = null;
|
|
108
|
-
if (showBreakpointsInOverviewRuler) {
|
|
109
|
-
overviewRulerDecoration = {
|
|
110
|
-
color: themeColorFromId(debugIconBreakpointForeground),
|
|
111
|
-
position: OverviewRulerLane.Left
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
const renderInline = breakpoint.column && (hasOtherBreakpointsOnLine || breakpoint.column > model.getLineFirstNonWhitespaceColumn(breakpoint.lineNumber));
|
|
115
|
-
return {
|
|
116
|
-
description: 'breakpoint-decoration',
|
|
117
|
-
glyphMargin: { position: GlyphMarginLane.Right },
|
|
118
|
-
glyphMarginClassName: ThemeIcon.asClassName(icon),
|
|
119
|
-
glyphMarginHoverMessage,
|
|
120
|
-
stickiness: 1 ,
|
|
121
|
-
before: renderInline ? {
|
|
122
|
-
content: noBreakWhitespace,
|
|
123
|
-
inlineClassName: `debug-breakpoint-placeholder`,
|
|
124
|
-
inlineClassNameAffectsLetterSpacing: true
|
|
125
|
-
} : undefined,
|
|
126
|
-
overviewRuler: overviewRulerDecoration,
|
|
127
|
-
zIndex: 9999
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
async function requestBreakpointCandidateLocations(model, lineNumbers, session) {
|
|
131
|
-
if (!session.capabilities.supportsBreakpointLocationsRequest) {
|
|
132
|
-
return [];
|
|
133
|
-
}
|
|
134
|
-
return await Promise.all(( distinct(lineNumbers, l => l).map(async (lineNumber) => {
|
|
135
|
-
try {
|
|
136
|
-
return { lineNumber, positions: await session.breakpointsLocations(model.uri, lineNumber) };
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
return { lineNumber, positions: [] };
|
|
140
|
-
}
|
|
141
|
-
})));
|
|
142
|
-
}
|
|
143
|
-
function createCandidateDecorations(model, breakpointDecorations, lineBreakpoints) {
|
|
144
|
-
const result = [];
|
|
145
|
-
for (const { positions, lineNumber } of lineBreakpoints) {
|
|
146
|
-
if (positions.length === 0) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
const firstColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
|
|
150
|
-
const lastColumn = model.getLineLastNonWhitespaceColumn(lineNumber);
|
|
151
|
-
positions.forEach(p => {
|
|
152
|
-
const range = ( new Range(p.lineNumber, p.column, p.lineNumber, p.column + 1));
|
|
153
|
-
if ((p.column <= firstColumn && !( breakpointDecorations.some(
|
|
154
|
-
bp => bp.range.startColumn > firstColumn && bp.range.startLineNumber === p.lineNumber
|
|
155
|
-
))) || p.column > lastColumn) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const breakpointAtPosition = breakpointDecorations.find(bpd => bpd.range.equalsRange(range));
|
|
159
|
-
if (breakpointAtPosition && breakpointAtPosition.inlineWidget) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
result.push({
|
|
163
|
-
range,
|
|
164
|
-
options: {
|
|
165
|
-
description: 'breakpoint-placeholder-decoration',
|
|
166
|
-
stickiness: 1 ,
|
|
167
|
-
before: breakpointAtPosition ? undefined : {
|
|
168
|
-
content: noBreakWhitespace,
|
|
169
|
-
inlineClassName: `debug-breakpoint-placeholder`,
|
|
170
|
-
inlineClassNameAffectsLetterSpacing: true
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
breakpoint: breakpointAtPosition ? breakpointAtPosition.breakpoint : undefined
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
return result;
|
|
178
|
-
}
|
|
179
|
-
let BreakpointEditorContribution = class BreakpointEditorContribution {
|
|
180
|
-
constructor(editor, debugService, contextMenuService, instantiationService, contextKeyService, dialogService, configurationService, labelService) {
|
|
181
|
-
this.editor = editor;
|
|
182
|
-
this.debugService = debugService;
|
|
183
|
-
this.contextMenuService = contextMenuService;
|
|
184
|
-
this.instantiationService = instantiationService;
|
|
185
|
-
this.dialogService = dialogService;
|
|
186
|
-
this.configurationService = configurationService;
|
|
187
|
-
this.labelService = labelService;
|
|
188
|
-
this.breakpointHintDecoration = null;
|
|
189
|
-
this.toDispose = [];
|
|
190
|
-
this.ignoreDecorationsChangedEvent = false;
|
|
191
|
-
this.ignoreBreakpointsChangeEvent = false;
|
|
192
|
-
this.breakpointDecorations = [];
|
|
193
|
-
this.candidateDecorations = [];
|
|
194
|
-
this.breakpointWidgetVisible = CONTEXT_BREAKPOINT_WIDGET_VISIBLE.bindTo(contextKeyService);
|
|
195
|
-
this.setDecorationsScheduler = ( new RunOnceScheduler(() => this.setDecorations(), 30));
|
|
196
|
-
this.setDecorationsScheduler.schedule();
|
|
197
|
-
this.registerListeners();
|
|
198
|
-
}
|
|
199
|
-
getContextMenuActionsAtPosition(lineNumber, model) {
|
|
200
|
-
if (!this.debugService.getAdapterManager().hasEnabledDebuggers()) {
|
|
201
|
-
return [];
|
|
202
|
-
}
|
|
203
|
-
if (!this.debugService.canSetBreakpointsIn(model)) {
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
const breakpoints = this.debugService.getModel().getBreakpoints({ lineNumber, uri: model.uri });
|
|
207
|
-
return this.getContextMenuActions(breakpoints, model.uri, lineNumber);
|
|
208
|
-
}
|
|
209
|
-
registerListeners() {
|
|
210
|
-
this.toDispose.push(this.editor.onMouseDown(async (e) => {
|
|
211
|
-
if (!this.debugService.getAdapterManager().hasEnabledDebuggers()) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const model = this.editor.getModel();
|
|
215
|
-
if (!e.target.position
|
|
216
|
-
|| !model
|
|
217
|
-
|| e.target.type !== 2
|
|
218
|
-
|| e.target.detail.isAfterLines
|
|
219
|
-
|| !this.marginFreeFromNonDebugDecorations(e.target.position.lineNumber)
|
|
220
|
-
&& !e.target.element?.className.includes('breakpoint')) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const canSetBreakpoints = this.debugService.canSetBreakpointsIn(model);
|
|
224
|
-
const lineNumber = e.target.position.lineNumber;
|
|
225
|
-
const uri = model.uri;
|
|
226
|
-
if (e.event.rightButton || (platform.isMacintosh && e.event.leftButton && e.event.ctrlKey)) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
const breakpoints = this.debugService.getModel().getBreakpoints({ uri, lineNumber });
|
|
231
|
-
if (breakpoints.length) {
|
|
232
|
-
const isShiftPressed = e.event.shiftKey;
|
|
233
|
-
const enabled = ( breakpoints.some(bp => bp.enabled));
|
|
234
|
-
if (isShiftPressed) {
|
|
235
|
-
breakpoints.forEach(bp => this.debugService.enableOrDisableBreakpoints(!enabled, bp));
|
|
236
|
-
}
|
|
237
|
-
else if (!platform.isLinux && ( breakpoints.some(bp => !!bp.condition || !!bp.logMessage || !!bp.hitCondition))) {
|
|
238
|
-
const logPoint = breakpoints.every(bp => !!bp.logMessage);
|
|
239
|
-
const breakpointType = logPoint ? ( nls.localizeWithPath(
|
|
240
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
241
|
-
'logPoint',
|
|
242
|
-
"Logpoint"
|
|
243
|
-
)) : ( nls.localizeWithPath(
|
|
244
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
245
|
-
'breakpoint',
|
|
246
|
-
"Breakpoint"
|
|
247
|
-
));
|
|
248
|
-
const disabledBreakpointDialogMessage = ( nls.localizeWithPath(
|
|
249
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
250
|
-
'breakpointHasConditionDisabled',
|
|
251
|
-
"This {0} has a {1} that will get lost on remove. Consider enabling the {0} instead.",
|
|
252
|
-
breakpointType.toLowerCase(),
|
|
253
|
-
logPoint ? ( nls.localizeWithPath(
|
|
254
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
255
|
-
'message',
|
|
256
|
-
"message"
|
|
257
|
-
)) : ( nls.localizeWithPath(
|
|
258
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
259
|
-
'condition',
|
|
260
|
-
"condition"
|
|
261
|
-
))
|
|
262
|
-
));
|
|
263
|
-
const enabledBreakpointDialogMessage = ( nls.localizeWithPath(
|
|
264
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
265
|
-
'breakpointHasConditionEnabled',
|
|
266
|
-
"This {0} has a {1} that will get lost on remove. Consider disabling the {0} instead.",
|
|
267
|
-
breakpointType.toLowerCase(),
|
|
268
|
-
logPoint ? ( nls.localizeWithPath(
|
|
269
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
270
|
-
'message',
|
|
271
|
-
"message"
|
|
272
|
-
)) : ( nls.localizeWithPath(
|
|
273
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
274
|
-
'condition',
|
|
275
|
-
"condition"
|
|
276
|
-
))
|
|
277
|
-
));
|
|
278
|
-
await this.dialogService.prompt({
|
|
279
|
-
type: Severity.Info,
|
|
280
|
-
message: enabled ? enabledBreakpointDialogMessage : disabledBreakpointDialogMessage,
|
|
281
|
-
buttons: [
|
|
282
|
-
{
|
|
283
|
-
label: ( nls.localizeWithPath(
|
|
284
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
285
|
-
{ key: 'removeLogPoint', comment: ['&& denotes a mnemonic'] },
|
|
286
|
-
"&&Remove {0}",
|
|
287
|
-
breakpointType
|
|
288
|
-
)),
|
|
289
|
-
run: () => breakpoints.forEach(bp => this.debugService.removeBreakpoints(bp.getId()))
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
label: ( nls.localizeWithPath(
|
|
293
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
294
|
-
'disableLogPoint',
|
|
295
|
-
"{0} {1}",
|
|
296
|
-
enabled ? ( nls.localizeWithPath(
|
|
297
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
298
|
-
{ key: 'disable', comment: ['&& denotes a mnemonic'] },
|
|
299
|
-
"&&Disable"
|
|
300
|
-
)) : ( nls.localizeWithPath(
|
|
301
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
302
|
-
{ key: 'enable', comment: ['&& denotes a mnemonic'] },
|
|
303
|
-
"&&Enable"
|
|
304
|
-
)),
|
|
305
|
-
breakpointType
|
|
306
|
-
)),
|
|
307
|
-
run: () => breakpoints.forEach(bp => this.debugService.enableOrDisableBreakpoints(!enabled, bp))
|
|
308
|
-
}
|
|
309
|
-
],
|
|
310
|
-
cancelButton: true
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
if (!enabled) {
|
|
315
|
-
breakpoints.forEach(bp => this.debugService.enableOrDisableBreakpoints(!enabled, bp));
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
breakpoints.forEach(bp => this.debugService.removeBreakpoints(bp.getId()));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
else if (canSetBreakpoints) {
|
|
323
|
-
this.debugService.addBreakpoints(uri, [{ lineNumber }]);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}));
|
|
327
|
-
if (!(BrowserFeatures.pointerEvents && isSafari)) {
|
|
328
|
-
this.toDispose.push(this.editor.onMouseMove((e) => {
|
|
329
|
-
if (!this.debugService.getAdapterManager().hasEnabledDebuggers()) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
let showBreakpointHintAtLineNumber = -1;
|
|
333
|
-
const model = this.editor.getModel();
|
|
334
|
-
if (model && e.target.position && ((e.target.type === 2 || e.target.type === 3) ) && this.debugService.canSetBreakpointsIn(model) &&
|
|
335
|
-
this.marginFreeFromNonDebugDecorations(e.target.position.lineNumber)) {
|
|
336
|
-
const data = e.target.detail;
|
|
337
|
-
if (!data.isAfterLines) {
|
|
338
|
-
showBreakpointHintAtLineNumber = e.target.position.lineNumber;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
this.ensureBreakpointHintDecoration(showBreakpointHintAtLineNumber);
|
|
342
|
-
}));
|
|
343
|
-
this.toDispose.push(this.editor.onMouseLeave(() => {
|
|
344
|
-
this.ensureBreakpointHintDecoration(-1);
|
|
345
|
-
}));
|
|
346
|
-
}
|
|
347
|
-
this.toDispose.push(this.editor.onDidChangeModel(async () => {
|
|
348
|
-
this.closeBreakpointWidget();
|
|
349
|
-
await this.setDecorations();
|
|
350
|
-
}));
|
|
351
|
-
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => {
|
|
352
|
-
if (!this.ignoreBreakpointsChangeEvent && !this.setDecorationsScheduler.isScheduled()) {
|
|
353
|
-
this.setDecorationsScheduler.schedule();
|
|
354
|
-
}
|
|
355
|
-
}));
|
|
356
|
-
this.toDispose.push(this.debugService.onDidChangeState(() => {
|
|
357
|
-
if (!this.setDecorationsScheduler.isScheduled()) {
|
|
358
|
-
this.setDecorationsScheduler.schedule();
|
|
359
|
-
}
|
|
360
|
-
}));
|
|
361
|
-
this.toDispose.push(this.editor.onDidChangeModelDecorations(() => this.onModelDecorationsChanged()));
|
|
362
|
-
this.toDispose.push(this.configurationService.onDidChangeConfiguration(async (e) => {
|
|
363
|
-
if (e.affectsConfiguration('debug.showBreakpointsInOverviewRuler') || e.affectsConfiguration('debug.showInlineBreakpointCandidates')) {
|
|
364
|
-
await this.setDecorations();
|
|
365
|
-
}
|
|
366
|
-
}));
|
|
367
|
-
}
|
|
368
|
-
getContextMenuActions(breakpoints, uri, lineNumber, column) {
|
|
369
|
-
const actions = [];
|
|
370
|
-
if (breakpoints.length === 1) {
|
|
371
|
-
const breakpointType = breakpoints[0].logMessage ? ( nls.localizeWithPath(
|
|
372
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
373
|
-
'logPoint',
|
|
374
|
-
"Logpoint"
|
|
375
|
-
)) : ( nls.localizeWithPath(
|
|
376
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
377
|
-
'breakpoint',
|
|
378
|
-
"Breakpoint"
|
|
379
|
-
));
|
|
380
|
-
actions.push(( new Action('debug.removeBreakpoint', ( nls.localizeWithPath(
|
|
381
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
382
|
-
'removeBreakpoint',
|
|
383
|
-
"Remove {0}",
|
|
384
|
-
breakpointType
|
|
385
|
-
)), undefined, true, async () => {
|
|
386
|
-
await this.debugService.removeBreakpoints(breakpoints[0].getId());
|
|
387
|
-
})));
|
|
388
|
-
actions.push(( new Action('workbench.debug.action.editBreakpointAction', ( nls.localizeWithPath(
|
|
389
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
390
|
-
'editBreakpoint',
|
|
391
|
-
"Edit {0}...",
|
|
392
|
-
breakpointType
|
|
393
|
-
)), undefined, true, () => Promise.resolve(this.showBreakpointWidget(breakpoints[0].lineNumber, breakpoints[0].column)))));
|
|
394
|
-
actions.push(( new Action(
|
|
395
|
-
`workbench.debug.viewlet.action.toggleBreakpoint`,
|
|
396
|
-
breakpoints[0].enabled ? ( nls.localizeWithPath(
|
|
397
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
398
|
-
'disableBreakpoint',
|
|
399
|
-
"Disable {0}",
|
|
400
|
-
breakpointType
|
|
401
|
-
)) : ( nls.localizeWithPath(
|
|
402
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
403
|
-
'enableBreakpoint',
|
|
404
|
-
"Enable {0}",
|
|
405
|
-
breakpointType
|
|
406
|
-
)),
|
|
407
|
-
undefined,
|
|
408
|
-
true,
|
|
409
|
-
() => this.debugService.enableOrDisableBreakpoints(!breakpoints[0].enabled, breakpoints[0])
|
|
410
|
-
)));
|
|
411
|
-
}
|
|
412
|
-
else if (breakpoints.length > 1) {
|
|
413
|
-
const sorted = breakpoints.slice().sort((first, second) => (first.column && second.column) ? first.column - second.column : 1);
|
|
414
|
-
actions.push(( new SubmenuAction('debug.removeBreakpoints', ( nls.localizeWithPath(
|
|
415
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
416
|
-
'removeBreakpoints',
|
|
417
|
-
"Remove Breakpoints"
|
|
418
|
-
)), ( sorted.map(bp => ( new Action('removeInlineBreakpoint', bp.column ? ( nls.localizeWithPath(
|
|
419
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
420
|
-
'removeInlineBreakpointOnColumn',
|
|
421
|
-
"Remove Inline Breakpoint on Column {0}",
|
|
422
|
-
bp.column
|
|
423
|
-
)) : ( nls.localizeWithPath(
|
|
424
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
425
|
-
'removeLineBreakpoint',
|
|
426
|
-
"Remove Line Breakpoint"
|
|
427
|
-
)), undefined, true, () => this.debugService.removeBreakpoints(bp.getId()))))))));
|
|
428
|
-
actions.push(( new SubmenuAction('debug.editBreakpoints', ( nls.localizeWithPath(
|
|
429
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
430
|
-
'editBreakpoints',
|
|
431
|
-
"Edit Breakpoints"
|
|
432
|
-
)), ( sorted.map(bp => ( new Action('editBreakpoint', bp.column ? ( nls.localizeWithPath(
|
|
433
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
434
|
-
'editInlineBreakpointOnColumn',
|
|
435
|
-
"Edit Inline Breakpoint on Column {0}",
|
|
436
|
-
bp.column
|
|
437
|
-
)) : ( nls.localizeWithPath(
|
|
438
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
439
|
-
'editLineBreakpoint',
|
|
440
|
-
"Edit Line Breakpoint"
|
|
441
|
-
)), undefined, true, () => Promise.resolve(this.showBreakpointWidget(bp.lineNumber, bp.column)))))))));
|
|
442
|
-
actions.push(( new SubmenuAction('debug.enableDisableBreakpoints', ( nls.localizeWithPath(
|
|
443
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
444
|
-
'enableDisableBreakpoints',
|
|
445
|
-
"Enable/Disable Breakpoints"
|
|
446
|
-
)), ( sorted.map(bp => ( new Action(
|
|
447
|
-
bp.enabled ? 'disableColumnBreakpoint' : 'enableColumnBreakpoint',
|
|
448
|
-
bp.enabled ? (bp.column ? ( nls.localizeWithPath(
|
|
449
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
450
|
-
'disableInlineColumnBreakpoint',
|
|
451
|
-
"Disable Inline Breakpoint on Column {0}",
|
|
452
|
-
bp.column
|
|
453
|
-
)) : ( nls.localizeWithPath(
|
|
454
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
455
|
-
'disableBreakpointOnLine',
|
|
456
|
-
"Disable Line Breakpoint"
|
|
457
|
-
)))
|
|
458
|
-
: (bp.column ? ( nls.localizeWithPath(
|
|
459
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
460
|
-
'enableBreakpoints',
|
|
461
|
-
"Enable Inline Breakpoint on Column {0}",
|
|
462
|
-
bp.column
|
|
463
|
-
)) : ( nls.localizeWithPath(
|
|
464
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
465
|
-
'enableBreakpointOnLine',
|
|
466
|
-
"Enable Line Breakpoint"
|
|
467
|
-
))),
|
|
468
|
-
undefined,
|
|
469
|
-
true,
|
|
470
|
-
() => this.debugService.enableOrDisableBreakpoints(!bp.enabled, bp)
|
|
471
|
-
)))))));
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
actions.push(( new Action('addBreakpoint', ( nls.localizeWithPath(
|
|
475
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
476
|
-
'addBreakpoint',
|
|
477
|
-
"Add Breakpoint"
|
|
478
|
-
)), undefined, true, () => this.debugService.addBreakpoints(uri, [{ lineNumber, column }]))));
|
|
479
|
-
actions.push(( new Action('addConditionalBreakpoint', ( nls.localizeWithPath(
|
|
480
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
481
|
-
'addConditionalBreakpoint',
|
|
482
|
-
"Add Conditional Breakpoint..."
|
|
483
|
-
)), undefined, true, () => Promise.resolve(this.showBreakpointWidget(lineNumber, column, 0 )))));
|
|
484
|
-
actions.push(( new Action('addLogPoint', ( nls.localizeWithPath(
|
|
485
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
486
|
-
'addLogPoint',
|
|
487
|
-
"Add Logpoint..."
|
|
488
|
-
)), undefined, true, () => Promise.resolve(this.showBreakpointWidget(lineNumber, column, 2 )))));
|
|
489
|
-
}
|
|
490
|
-
if (this.debugService.state === 2 ) {
|
|
491
|
-
actions.push(( new Separator()));
|
|
492
|
-
actions.push(( new Action('runToLine', ( nls.localizeWithPath(
|
|
493
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
494
|
-
'runToLine',
|
|
495
|
-
"Run to Line"
|
|
496
|
-
)), undefined, true, () => this.debugService.runTo(uri, lineNumber).catch(onUnexpectedError))));
|
|
497
|
-
}
|
|
498
|
-
return actions;
|
|
499
|
-
}
|
|
500
|
-
marginFreeFromNonDebugDecorations(line) {
|
|
501
|
-
const decorations = this.editor.getLineDecorations(line);
|
|
502
|
-
if (decorations) {
|
|
503
|
-
for (const { options } of decorations) {
|
|
504
|
-
const clz = options.glyphMarginClassName;
|
|
505
|
-
if (clz && (!clz.includes('codicon-') || clz.includes('codicon-testing-') || clz.includes('codicon-merge-') || clz.includes('codicon-arrow-') || clz.includes('codicon-loading') || clz.includes('codicon-fold') || clz.includes('codicon-inline-chat'))) {
|
|
506
|
-
return false;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
return true;
|
|
511
|
-
}
|
|
512
|
-
ensureBreakpointHintDecoration(showBreakpointHintAtLineNumber) {
|
|
513
|
-
this.editor.changeDecorations((accessor) => {
|
|
514
|
-
if (this.breakpointHintDecoration) {
|
|
515
|
-
accessor.removeDecoration(this.breakpointHintDecoration);
|
|
516
|
-
this.breakpointHintDecoration = null;
|
|
517
|
-
}
|
|
518
|
-
if (showBreakpointHintAtLineNumber !== -1) {
|
|
519
|
-
this.breakpointHintDecoration = accessor.addDecoration({
|
|
520
|
-
startLineNumber: showBreakpointHintAtLineNumber,
|
|
521
|
-
startColumn: 1,
|
|
522
|
-
endLineNumber: showBreakpointHintAtLineNumber,
|
|
523
|
-
endColumn: 1
|
|
524
|
-
}, breakpointHelperDecoration);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
async setDecorations() {
|
|
529
|
-
if (!this.editor.hasModel()) {
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
const setCandidateDecorations = (changeAccessor, desiredCandidatePositions) => {
|
|
533
|
-
const desiredCandidateDecorations = createCandidateDecorations(model, this.breakpointDecorations, desiredCandidatePositions);
|
|
534
|
-
const candidateDecorationIds = changeAccessor.deltaDecorations(( this.candidateDecorations.map(c => c.decorationId)), desiredCandidateDecorations);
|
|
535
|
-
this.candidateDecorations.forEach(candidate => {
|
|
536
|
-
candidate.inlineWidget.dispose();
|
|
537
|
-
});
|
|
538
|
-
this.candidateDecorations = ( candidateDecorationIds.map((decorationId, index) => {
|
|
539
|
-
const candidate = desiredCandidateDecorations[index];
|
|
540
|
-
const icon = candidate.breakpoint ? getBreakpointMessageAndIcon(this.debugService.state, this.debugService.getModel().areBreakpointsActivated(), candidate.breakpoint, this.labelService).icon : breakpoint.disabled;
|
|
541
|
-
const contextMenuActions = () => this.getContextMenuActions(candidate.breakpoint ? [candidate.breakpoint] : [], activeCodeEditor.getModel().uri, candidate.range.startLineNumber, candidate.range.startColumn);
|
|
542
|
-
const inlineWidget = ( new InlineBreakpointWidget(
|
|
543
|
-
activeCodeEditor,
|
|
544
|
-
decorationId,
|
|
545
|
-
ThemeIcon.asClassName(icon),
|
|
546
|
-
candidate.breakpoint,
|
|
547
|
-
this.debugService,
|
|
548
|
-
this.contextMenuService,
|
|
549
|
-
contextMenuActions
|
|
550
|
-
));
|
|
551
|
-
return {
|
|
552
|
-
decorationId,
|
|
553
|
-
inlineWidget
|
|
554
|
-
};
|
|
555
|
-
}));
|
|
556
|
-
};
|
|
557
|
-
const activeCodeEditor = this.editor;
|
|
558
|
-
const model = activeCodeEditor.getModel();
|
|
559
|
-
const breakpoints = this.debugService.getModel().getBreakpoints({ uri: model.uri });
|
|
560
|
-
const debugSettings = this.configurationService.getValue('debug');
|
|
561
|
-
const desiredBreakpointDecorations = this.instantiationService.invokeFunction(accessor => createBreakpointDecorations(accessor, model, breakpoints, this.debugService.state, this.debugService.getModel().areBreakpointsActivated(), debugSettings.showBreakpointsInOverviewRuler));
|
|
562
|
-
const session = this.debugService.getViewModel().focusedSession;
|
|
563
|
-
const desiredCandidatePositions = debugSettings.showInlineBreakpointCandidates && session ? requestBreakpointCandidateLocations(this.editor.getModel(), ( desiredBreakpointDecorations.map(bp => bp.range.startLineNumber)), session) : Promise.resolve([]);
|
|
564
|
-
const desiredCandidatePositionsRaced = await Promise.race([desiredCandidatePositions, timeout(500).then(() => undefined)]);
|
|
565
|
-
if (desiredCandidatePositionsRaced === undefined) {
|
|
566
|
-
desiredCandidatePositions.then(v => activeCodeEditor.changeDecorations(d => setCandidateDecorations(d, v)));
|
|
567
|
-
}
|
|
568
|
-
try {
|
|
569
|
-
this.ignoreDecorationsChangedEvent = true;
|
|
570
|
-
activeCodeEditor.changeDecorations((changeAccessor) => {
|
|
571
|
-
const decorationIds = changeAccessor.deltaDecorations(( this.breakpointDecorations.map(bpd => bpd.decorationId)), desiredBreakpointDecorations);
|
|
572
|
-
this.breakpointDecorations.forEach(bpd => {
|
|
573
|
-
bpd.inlineWidget?.dispose();
|
|
574
|
-
});
|
|
575
|
-
this.breakpointDecorations = ( decorationIds.map((decorationId, index) => {
|
|
576
|
-
let inlineWidget = undefined;
|
|
577
|
-
const breakpoint = breakpoints[index];
|
|
578
|
-
if (desiredBreakpointDecorations[index].options.before) {
|
|
579
|
-
const contextMenuActions = () => this.getContextMenuActions([breakpoint], activeCodeEditor.getModel().uri, breakpoint.lineNumber, breakpoint.column);
|
|
580
|
-
inlineWidget = ( new InlineBreakpointWidget(
|
|
581
|
-
activeCodeEditor,
|
|
582
|
-
decorationId,
|
|
583
|
-
desiredBreakpointDecorations[index].options.glyphMarginClassName,
|
|
584
|
-
breakpoint,
|
|
585
|
-
this.debugService,
|
|
586
|
-
this.contextMenuService,
|
|
587
|
-
contextMenuActions
|
|
588
|
-
));
|
|
589
|
-
}
|
|
590
|
-
return {
|
|
591
|
-
decorationId,
|
|
592
|
-
breakpoint,
|
|
593
|
-
range: desiredBreakpointDecorations[index].range,
|
|
594
|
-
inlineWidget
|
|
595
|
-
};
|
|
596
|
-
}));
|
|
597
|
-
if (desiredCandidatePositionsRaced) {
|
|
598
|
-
setCandidateDecorations(changeAccessor, desiredCandidatePositionsRaced);
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
finally {
|
|
603
|
-
this.ignoreDecorationsChangedEvent = false;
|
|
604
|
-
}
|
|
605
|
-
for (const d of this.breakpointDecorations) {
|
|
606
|
-
if (d.inlineWidget) {
|
|
607
|
-
this.editor.layoutContentWidget(d.inlineWidget);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
async onModelDecorationsChanged() {
|
|
612
|
-
if (this.breakpointDecorations.length === 0 || this.ignoreDecorationsChangedEvent || !this.editor.hasModel()) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
let somethingChanged = false;
|
|
616
|
-
const model = this.editor.getModel();
|
|
617
|
-
this.breakpointDecorations.forEach(breakpointDecoration => {
|
|
618
|
-
if (somethingChanged) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
const newBreakpointRange = model.getDecorationRange(breakpointDecoration.decorationId);
|
|
622
|
-
if (newBreakpointRange && (!breakpointDecoration.range.equalsRange(newBreakpointRange))) {
|
|
623
|
-
somethingChanged = true;
|
|
624
|
-
breakpointDecoration.range = newBreakpointRange;
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
if (!somethingChanged) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
const data = ( new Map());
|
|
631
|
-
for (let i = 0, len = this.breakpointDecorations.length; i < len; i++) {
|
|
632
|
-
const breakpointDecoration = this.breakpointDecorations[i];
|
|
633
|
-
const decorationRange = model.getDecorationRange(breakpointDecoration.decorationId);
|
|
634
|
-
if (decorationRange) {
|
|
635
|
-
if (breakpointDecoration.breakpoint) {
|
|
636
|
-
data.set(breakpointDecoration.breakpoint.getId(), {
|
|
637
|
-
lineNumber: decorationRange.startLineNumber,
|
|
638
|
-
column: breakpointDecoration.breakpoint.column ? decorationRange.startColumn : undefined,
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
try {
|
|
644
|
-
this.ignoreBreakpointsChangeEvent = true;
|
|
645
|
-
await this.debugService.updateBreakpoints(model.uri, data, true);
|
|
646
|
-
}
|
|
647
|
-
finally {
|
|
648
|
-
this.ignoreBreakpointsChangeEvent = false;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
showBreakpointWidget(lineNumber, column, context) {
|
|
652
|
-
this.breakpointWidget?.dispose();
|
|
653
|
-
this.breakpointWidget = this.instantiationService.createInstance(BreakpointWidget, this.editor, lineNumber, column, context);
|
|
654
|
-
this.breakpointWidget.show({ lineNumber, column: 1 });
|
|
655
|
-
this.breakpointWidgetVisible.set(true);
|
|
656
|
-
}
|
|
657
|
-
closeBreakpointWidget() {
|
|
658
|
-
if (this.breakpointWidget) {
|
|
659
|
-
this.breakpointWidget.dispose();
|
|
660
|
-
this.breakpointWidget = undefined;
|
|
661
|
-
this.breakpointWidgetVisible.reset();
|
|
662
|
-
this.editor.focus();
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
dispose() {
|
|
666
|
-
this.breakpointWidget?.dispose();
|
|
667
|
-
this.editor.removeDecorations(( this.breakpointDecorations.map(bpd => bpd.decorationId)));
|
|
668
|
-
dispose(this.toDispose);
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
BreakpointEditorContribution = ( __decorate([
|
|
672
|
-
( __param(1, IDebugService)),
|
|
673
|
-
( __param(2, IContextMenuService)),
|
|
674
|
-
( __param(3, IInstantiationService)),
|
|
675
|
-
( __param(4, IContextKeyService)),
|
|
676
|
-
( __param(5, IDialogService)),
|
|
677
|
-
( __param(6, IConfigurationService)),
|
|
678
|
-
( __param(7, ILabelService))
|
|
679
|
-
], BreakpointEditorContribution));
|
|
680
|
-
GutterActionsRegistry.registerGutterActionsGenerator(({ lineNumber, editor, accessor }, result) => {
|
|
681
|
-
const model = editor.getModel();
|
|
682
|
-
const debugService = accessor.get(IDebugService);
|
|
683
|
-
if (!model || !debugService.getAdapterManager().hasEnabledDebuggers() || !debugService.canSetBreakpointsIn(model)) {
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
const breakpointEditorContribution = editor.getContribution(BREAKPOINT_EDITOR_CONTRIBUTION_ID);
|
|
687
|
-
if (!breakpointEditorContribution) {
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
const actions = breakpointEditorContribution.getContextMenuActionsAtPosition(lineNumber, model);
|
|
691
|
-
for (const action of actions) {
|
|
692
|
-
result.push(action, '2_debug');
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
class InlineBreakpointWidget {
|
|
696
|
-
constructor(editor, decorationId, cssClass, breakpoint, debugService, contextMenuService, getContextMenuActions) {
|
|
697
|
-
this.editor = editor;
|
|
698
|
-
this.decorationId = decorationId;
|
|
699
|
-
this.breakpoint = breakpoint;
|
|
700
|
-
this.debugService = debugService;
|
|
701
|
-
this.contextMenuService = contextMenuService;
|
|
702
|
-
this.getContextMenuActions = getContextMenuActions;
|
|
703
|
-
this.allowEditorOverflow = false;
|
|
704
|
-
this.suppressMouseDown = true;
|
|
705
|
-
this.toDispose = [];
|
|
706
|
-
this.range = this.editor.getModel().getDecorationRange(decorationId);
|
|
707
|
-
this.toDispose.push(this.editor.onDidChangeModelDecorations(() => {
|
|
708
|
-
const model = this.editor.getModel();
|
|
709
|
-
const range = model.getDecorationRange(this.decorationId);
|
|
710
|
-
if (this.range && !this.range.equalsRange(range)) {
|
|
711
|
-
this.range = range;
|
|
712
|
-
this.editor.layoutContentWidget(this);
|
|
713
|
-
}
|
|
714
|
-
}));
|
|
715
|
-
this.create(cssClass);
|
|
716
|
-
this.editor.addContentWidget(this);
|
|
717
|
-
this.editor.layoutContentWidget(this);
|
|
718
|
-
}
|
|
719
|
-
create(cssClass) {
|
|
720
|
-
this.domNode = $('.inline-breakpoint-widget');
|
|
721
|
-
if (cssClass) {
|
|
722
|
-
this.domNode.classList.add(...cssClass.split(' '));
|
|
723
|
-
}
|
|
724
|
-
this.toDispose.push(dom.addDisposableListener(this.domNode, dom.EventType.CLICK, async (e) => {
|
|
725
|
-
switch (this.breakpoint?.enabled) {
|
|
726
|
-
case undefined:
|
|
727
|
-
await this.debugService.addBreakpoints(this.editor.getModel().uri, [{ lineNumber: this.range.startLineNumber, column: this.range.startColumn }]);
|
|
728
|
-
break;
|
|
729
|
-
case true:
|
|
730
|
-
await this.debugService.removeBreakpoints(this.breakpoint.getId());
|
|
731
|
-
break;
|
|
732
|
-
case false:
|
|
733
|
-
this.debugService.enableOrDisableBreakpoints(true, this.breakpoint);
|
|
734
|
-
break;
|
|
735
|
-
}
|
|
736
|
-
}));
|
|
737
|
-
this.toDispose.push(dom.addDisposableListener(this.domNode, dom.EventType.CONTEXT_MENU, e => {
|
|
738
|
-
const event = ( new StandardMouseEvent(dom.getWindow(this.domNode), e));
|
|
739
|
-
const actions = this.getContextMenuActions();
|
|
740
|
-
this.contextMenuService.showContextMenu({
|
|
741
|
-
getAnchor: () => event,
|
|
742
|
-
getActions: () => actions,
|
|
743
|
-
getActionsContext: () => this.breakpoint,
|
|
744
|
-
onHide: () => disposeIfDisposable(actions)
|
|
745
|
-
});
|
|
746
|
-
}));
|
|
747
|
-
const updateSize = () => {
|
|
748
|
-
const lineHeight = this.editor.getOption(66 );
|
|
749
|
-
this.domNode.style.height = `${lineHeight}px`;
|
|
750
|
-
this.domNode.style.width = `${Math.ceil(0.8 * lineHeight)}px`;
|
|
751
|
-
this.domNode.style.marginLeft = `4px`;
|
|
752
|
-
};
|
|
753
|
-
updateSize();
|
|
754
|
-
this.toDispose.push(this.editor.onDidChangeConfiguration(c => {
|
|
755
|
-
if (c.hasChanged(52 ) || c.hasChanged(66 )) {
|
|
756
|
-
updateSize();
|
|
757
|
-
}
|
|
758
|
-
}));
|
|
759
|
-
}
|
|
760
|
-
getId() {
|
|
761
|
-
return generateUuid();
|
|
762
|
-
}
|
|
763
|
-
getDomNode() {
|
|
764
|
-
return this.domNode;
|
|
765
|
-
}
|
|
766
|
-
getPosition() {
|
|
767
|
-
if (!this.range) {
|
|
768
|
-
return null;
|
|
769
|
-
}
|
|
770
|
-
this.domNode.classList.toggle('line-start', this.range.startColumn === 1);
|
|
771
|
-
return {
|
|
772
|
-
position: { lineNumber: this.range.startLineNumber, column: this.range.startColumn - 1 },
|
|
773
|
-
preference: [0 ]
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
dispose() {
|
|
777
|
-
this.editor.removeContentWidget(this);
|
|
778
|
-
dispose(this.toDispose);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
InlineBreakpointWidget.__decorator = ( __decorate([
|
|
782
|
-
memoize
|
|
783
|
-
], InlineBreakpointWidget.prototype, "getId", null));
|
|
784
|
-
registerThemingParticipant((theme, collector) => {
|
|
785
|
-
const debugIconBreakpointColor = theme.getColor(debugIconBreakpointForeground);
|
|
786
|
-
if (debugIconBreakpointColor) {
|
|
787
|
-
collector.addRule(`
|
|
788
|
-
${( allBreakpoints.map(b => `.monaco-workbench ${ThemeIcon.asCSSSelector(b.regular)}`)).join(',\n ')},
|
|
789
|
-
.monaco-workbench ${ThemeIcon.asCSSSelector(debugBreakpointUnsupported)},
|
|
790
|
-
.monaco-workbench ${ThemeIcon.asCSSSelector(debugBreakpointHint)}:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']),
|
|
791
|
-
.monaco-workbench ${ThemeIcon.asCSSSelector(breakpoint.regular)}${ThemeIcon.asCSSSelector(debugStackframeFocused)}::after,
|
|
792
|
-
.monaco-workbench ${ThemeIcon.asCSSSelector(breakpoint.regular)}${ThemeIcon.asCSSSelector(debugStackframe)}::after {
|
|
793
|
-
color: ${debugIconBreakpointColor} !important;
|
|
794
|
-
}
|
|
795
|
-
`);
|
|
796
|
-
}
|
|
797
|
-
const debugIconBreakpointDisabledColor = theme.getColor(debugIconBreakpointDisabledForeground);
|
|
798
|
-
if (debugIconBreakpointDisabledColor) {
|
|
799
|
-
collector.addRule(`
|
|
800
|
-
${( allBreakpoints.map(b => `.monaco-workbench ${ThemeIcon.asCSSSelector(b.disabled)}`)).join(',\n ')} {
|
|
801
|
-
color: ${debugIconBreakpointDisabledColor};
|
|
802
|
-
}
|
|
803
|
-
`);
|
|
804
|
-
}
|
|
805
|
-
const debugIconBreakpointUnverifiedColor = theme.getColor(debugIconBreakpointUnverifiedForeground);
|
|
806
|
-
if (debugIconBreakpointUnverifiedColor) {
|
|
807
|
-
collector.addRule(`
|
|
808
|
-
${( allBreakpoints.map(b => `.monaco-workbench ${ThemeIcon.asCSSSelector(b.unverified)}`)).join(',\n ')} {
|
|
809
|
-
color: ${debugIconBreakpointUnverifiedColor};
|
|
810
|
-
}
|
|
811
|
-
`);
|
|
812
|
-
}
|
|
813
|
-
const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground);
|
|
814
|
-
if (debugIconBreakpointCurrentStackframeForegroundColor) {
|
|
815
|
-
collector.addRule(`
|
|
816
|
-
.monaco-workbench ${ThemeIcon.asCSSSelector(debugStackframe)},
|
|
817
|
-
.monaco-editor .debug-top-stack-frame-column {
|
|
818
|
-
color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important;
|
|
819
|
-
}
|
|
820
|
-
`);
|
|
821
|
-
}
|
|
822
|
-
const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground);
|
|
823
|
-
if (debugIconBreakpointStackframeFocusedColor) {
|
|
824
|
-
collector.addRule(`
|
|
825
|
-
.monaco-workbench ${ThemeIcon.asCSSSelector(debugStackframeFocused)} {
|
|
826
|
-
color: ${debugIconBreakpointStackframeFocusedColor} !important;
|
|
827
|
-
}
|
|
828
|
-
`);
|
|
829
|
-
}
|
|
830
|
-
});
|
|
831
|
-
const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hcDark: '#E51400', hcLight: '#E51400' }, ( nls.localizeWithPath(
|
|
832
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
833
|
-
'debugIcon.breakpointForeground',
|
|
834
|
-
'Icon color for breakpoints.'
|
|
835
|
-
)));
|
|
836
|
-
const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hcDark: '#848484', hcLight: '#848484' }, ( nls.localizeWithPath(
|
|
837
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
838
|
-
'debugIcon.breakpointDisabledForeground',
|
|
839
|
-
'Icon color for disabled breakpoints.'
|
|
840
|
-
)));
|
|
841
|
-
const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hcDark: '#848484', hcLight: '#848484' }, ( nls.localizeWithPath(
|
|
842
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
843
|
-
'debugIcon.breakpointUnverifiedForeground',
|
|
844
|
-
'Icon color for unverified breakpoints.'
|
|
845
|
-
)));
|
|
846
|
-
const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#BE8700', hcDark: '#FFCC00', hcLight: '#BE8700' }, ( nls.localizeWithPath(
|
|
847
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
848
|
-
'debugIcon.breakpointCurrentStackframeForeground',
|
|
849
|
-
'Icon color for the current breakpoint stack frame.'
|
|
850
|
-
)));
|
|
851
|
-
const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hcDark: '#89D185', hcLight: '#89D185' }, ( nls.localizeWithPath(
|
|
852
|
-
'vs/workbench/contrib/debug/browser/breakpointEditorContribution',
|
|
853
|
-
'debugIcon.breakpointStackframeForeground',
|
|
854
|
-
'Icon color for all breakpoint stack frames.'
|
|
855
|
-
)));
|
|
856
|
-
|
|
857
|
-
export { BreakpointEditorContribution, createBreakpointDecorations, debugIconBreakpointForeground };
|