@codingame/monaco-vscode-debug-service-override 14.0.6 → 15.0.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.
Files changed (60) hide show
  1. package/index.js +1 -1
  2. package/package.json +14 -16
  3. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.d.ts +1 -2
  4. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +22 -24
  5. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +133 -133
  6. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +8 -7
  7. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.d.ts +1 -1
  8. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +13 -13
  9. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +6 -6
  10. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.d.ts +1 -1
  11. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +2 -2
  12. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +27 -27
  13. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.d.ts +2 -1
  14. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +5 -4
  15. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.d.ts +1 -1
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +23 -16
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +24 -24
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.d.ts +1 -1
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +44 -44
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +3 -3
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +17 -17
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.d.ts +2 -1
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +14 -10
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.d.ts +1 -1
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +7 -7
  26. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.d.ts +1 -1
  27. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +12 -12
  28. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.d.ts +1 -2
  29. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +11 -13
  30. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +5 -5
  31. package/vscode/src/vs/workbench/contrib/debug/browser/repl.d.ts +6 -7
  32. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +36 -45
  33. package/vscode/src/vs/workbench/contrib/debug/browser/replAccessibilityHelp.js +8 -8
  34. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +6 -6
  35. package/vscode/src/vs/workbench/contrib/debug/browser/runAndDebugAccessibilityHelp.js +16 -16
  36. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +4 -4
  37. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.d.ts +1 -2
  38. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +52 -18
  39. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.d.ts +1 -2
  40. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +10 -12
  41. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.d.ts +5 -4
  42. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +7 -7
  43. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +3 -3
  44. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +44 -44
  45. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +2 -7
  46. package/vscode/src/vs/workbench/contrib/debug/common/debugVisualizers.js +1 -1
  47. package/vscode/src/vs/workbench/contrib/debug/common/debugger.d.ts +1 -1
  48. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +12 -12
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +2 -2
  50. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.d.ts +0 -64
  51. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +0 -758
  52. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.d.ts +0 -65
  53. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +0 -419
  54. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.d.ts +0 -18
  55. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +0 -116
  56. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +0 -6
  57. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.d.ts +0 -79
  58. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +0 -730
  59. package/vscode/src/vs/workbench/contrib/debug/common/debugContext.d.ts +0 -6
  60. package/vscode/src/vs/workbench/contrib/debug/common/debugContext.js +0 -17
@@ -1,758 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { addDisposableListener, isKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
- import { DomEmitter } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/event';
5
- import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
6
- import { RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
7
- import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
8
- import { memoize } from '@codingame/monaco-vscode-api/vscode/vs/base/common/decorators';
9
- import { onUnexpectedExternalError, illegalArgument } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
10
- import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
11
- import { visit } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
12
- import { setProperty } from '@codingame/monaco-vscode-407531d3-fdae-5387-8c41-49ba0e9574b5-common/vscode/vs/base/common/jsonEdit';
13
- import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
14
- import { MutableDisposable, DisposableStore, toDisposable, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
15
- import { clamp } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
16
- import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
17
- import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
18
- import { noBreakWhitespace, format } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
19
- import { isDefined, assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
20
- import { Constants } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uint';
21
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
22
- import { CoreEditingCommands } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/coreCommands';
23
- import { MouseTargetType } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
24
- import { EditorOption } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions';
25
- import { EditOperation } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/editOperation';
26
- import { Position } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/position';
27
- import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
28
- import { DEFAULT_WORD_REGEXP } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/wordHelper';
29
- import { ScrollType } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon';
30
- import { StandardTokenType } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/encodedTokenAttributes';
31
- import { InjectedTextCursorStops } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
32
- import { ILanguageFeatureDebounceService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatureDebounce';
33
- import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures';
34
- import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model';
35
- import { ContentHoverController } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/hover/browser/contentHoverController';
36
- import { HoverStartMode, HoverStartSource } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/hover/browser/hoverOperation';
37
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
38
- import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
39
- import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
40
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
41
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
42
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
43
- import { registerColor } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
44
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
45
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
46
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
47
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
48
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
49
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
50
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
51
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
52
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
53
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
54
- import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
55
- import { DebugHoverWidget, ShowDebugHoverResult } from './debugHover.js';
56
- import { ExceptionWidget } from './exceptionWidget.js';
57
- import { CONTEXT_EXCEPTION_WIDGET_VISIBLE, State } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug';
58
- import { IDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug.service';
59
- import { Expression } from '@codingame/monaco-vscode-88aa9a78-75f5-5aaa-89e9-bbdd580b3b5c-common/vscode/vs/workbench/contrib/debug/common/debugModel';
60
- import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
61
-
62
- const MAX_NUM_INLINE_VALUES = 100;
63
- const MAX_INLINE_DECORATOR_LENGTH = 150;
64
- const MAX_TOKENIZATION_LINE_LEN = 500;
65
- const DEAFULT_INLINE_DEBOUNCE_DELAY = 200;
66
- registerColor('editor.inlineValuesForeground', {
67
- dark: '#ffffff80',
68
- light: '#00000080',
69
- hcDark: '#ffffff80',
70
- hcLight: '#00000080'
71
- }, ( localize(5432, "Color for the debug inline value text.")));
72
- registerColor('editor.inlineValuesBackground', '#ffc80033', ( localize(5433, "Color for the debug inline value background.")));
73
- class InlineSegment {
74
- constructor(column, text) {
75
- this.column = column;
76
- this.text = text;
77
- }
78
- }
79
- function createInlineValueDecoration(lineNumber, contentText, column = Constants.MAX_SAFE_SMALL_INTEGER) {
80
- if (contentText.length > MAX_INLINE_DECORATOR_LENGTH) {
81
- contentText = contentText.substring(0, MAX_INLINE_DECORATOR_LENGTH) + '...';
82
- }
83
- return [
84
- {
85
- range: {
86
- startLineNumber: lineNumber,
87
- endLineNumber: lineNumber,
88
- startColumn: column,
89
- endColumn: column
90
- },
91
- options: {
92
- description: 'debug-inline-value-decoration-spacer',
93
- after: {
94
- content: noBreakWhitespace,
95
- cursorStops: InjectedTextCursorStops.None
96
- },
97
- showIfCollapsed: true,
98
- }
99
- },
100
- {
101
- range: {
102
- startLineNumber: lineNumber,
103
- endLineNumber: lineNumber,
104
- startColumn: column,
105
- endColumn: column
106
- },
107
- options: {
108
- description: 'debug-inline-value-decoration',
109
- after: {
110
- content: replaceWsWithNoBreakWs(contentText),
111
- inlineClassName: 'debug-inline-value',
112
- inlineClassNameAffectsLetterSpacing: true,
113
- cursorStops: InjectedTextCursorStops.None
114
- },
115
- showIfCollapsed: true,
116
- }
117
- },
118
- ];
119
- }
120
- function replaceWsWithNoBreakWs(str) {
121
- return str.replace(/[ \t]/g, noBreakWhitespace);
122
- }
123
- function createInlineValueDecorationsInsideRange(expressions, ranges, model, wordToLineNumbersMap) {
124
- const nameValueMap = ( new Map());
125
- for (const expr of expressions) {
126
- nameValueMap.set(expr.name, expr.value);
127
- if (nameValueMap.size >= MAX_NUM_INLINE_VALUES) {
128
- break;
129
- }
130
- }
131
- const lineToNamesMap = ( new Map());
132
- nameValueMap.forEach((_value, name) => {
133
- const lineNumbers = wordToLineNumbersMap.get(name);
134
- if (lineNumbers) {
135
- for (const lineNumber of lineNumbers) {
136
- if (( ranges.some(r => lineNumber >= r.startLineNumber && lineNumber <= r.endLineNumber))) {
137
- if (!( lineToNamesMap.has(lineNumber))) {
138
- lineToNamesMap.set(lineNumber, []);
139
- }
140
- if (lineToNamesMap.get(lineNumber).indexOf(name) === -1) {
141
- lineToNamesMap.get(lineNumber).push(name);
142
- }
143
- }
144
- }
145
- }
146
- });
147
- return ( [...lineToNamesMap].map(([line, names]) => ({
148
- line,
149
- variables: ( names.sort((first, second) => {
150
- const content = model.getLineContent(line);
151
- return content.indexOf(first) - content.indexOf(second);
152
- }).map(name => ({ name, value: nameValueMap.get(name) })))
153
- })));
154
- }
155
- function getWordToLineNumbersMap(model, lineNumber, result) {
156
- const lineLength = model.getLineLength(lineNumber);
157
- if (lineLength > MAX_TOKENIZATION_LINE_LEN) {
158
- return;
159
- }
160
- const lineContent = model.getLineContent(lineNumber);
161
- model.tokenization.forceTokenization(lineNumber);
162
- const lineTokens = model.tokenization.getLineTokens(lineNumber);
163
- for (let tokenIndex = 0, tokenCount = lineTokens.getCount(); tokenIndex < tokenCount; tokenIndex++) {
164
- const tokenType = lineTokens.getStandardTokenType(tokenIndex);
165
- if (tokenType === StandardTokenType.Other) {
166
- DEFAULT_WORD_REGEXP.lastIndex = 0;
167
- const tokenStartOffset = lineTokens.getStartOffset(tokenIndex);
168
- const tokenEndOffset = lineTokens.getEndOffset(tokenIndex);
169
- const tokenStr = lineContent.substring(tokenStartOffset, tokenEndOffset);
170
- const wordMatch = DEFAULT_WORD_REGEXP.exec(tokenStr);
171
- if (wordMatch) {
172
- const word = wordMatch[0];
173
- if (!( result.has(word))) {
174
- result.set(word, []);
175
- }
176
- result.get(word).push(lineNumber);
177
- }
178
- }
179
- }
180
- }
181
- let DebugEditorContribution = class DebugEditorContribution {
182
- constructor(editor, debugService, instantiationService, commandService, configurationService, hostService, uriIdentityService, contextKeyService, languageFeaturesService, featureDebounceService) {
183
- this.editor = editor;
184
- this.debugService = debugService;
185
- this.instantiationService = instantiationService;
186
- this.commandService = commandService;
187
- this.configurationService = configurationService;
188
- this.hostService = hostService;
189
- this.uriIdentityService = uriIdentityService;
190
- this.languageFeaturesService = languageFeaturesService;
191
- this.mouseDown = false;
192
- this.gutterIsHovered = false;
193
- this.altListener = ( new MutableDisposable());
194
- this.altPressed = false;
195
- this.oldDecorations = this.editor.createDecorationsCollection();
196
- this.displayedStore = ( new DisposableStore());
197
- this.defaultHoverLockout = ( new MutableDisposable());
198
- this.debounceInfo = featureDebounceService.for(languageFeaturesService.inlineValuesProvider, 'InlineValues', { min: DEAFULT_INLINE_DEBOUNCE_DELAY });
199
- this.hoverWidget = this.instantiationService.createInstance(DebugHoverWidget, this.editor);
200
- this.toDispose = [this.defaultHoverLockout, this.altListener, this.displayedStore];
201
- this.registerListeners();
202
- this.exceptionWidgetVisible = CONTEXT_EXCEPTION_WIDGET_VISIBLE.bindTo(contextKeyService);
203
- this.toggleExceptionWidget();
204
- }
205
- registerListeners() {
206
- this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(e => this.onFocusStackFrame(e.stackFrame)));
207
- this.toDispose.push(this.editor.onMouseDown((e) => this.onEditorMouseDown(e)));
208
- this.toDispose.push(this.editor.onMouseUp(() => this.mouseDown = false));
209
- this.toDispose.push(this.editor.onMouseMove((e) => this.onEditorMouseMove(e)));
210
- this.toDispose.push(this.editor.onMouseLeave((e) => {
211
- const hoverDomNode = this.hoverWidget.getDomNode();
212
- if (!hoverDomNode) {
213
- return;
214
- }
215
- const rect = hoverDomNode.getBoundingClientRect();
216
- if (e.event.posx < rect.left || e.event.posx > rect.right || e.event.posy < rect.top || e.event.posy > rect.bottom) {
217
- this.hideHoverWidget();
218
- }
219
- }));
220
- this.toDispose.push(this.editor.onKeyDown((e) => this.onKeyDown(e)));
221
- this.toDispose.push(this.editor.onDidChangeModelContent(() => {
222
- this._wordToLineNumbersMap = undefined;
223
- this.updateInlineValuesScheduler.schedule();
224
- }));
225
- this.toDispose.push(this.debugService.getViewModel().onWillUpdateViews(() => this.updateInlineValuesScheduler.schedule()));
226
- this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(() => this.updateInlineValuesScheduler.schedule()));
227
- this.toDispose.push(this.editor.onDidChangeModel(async () => {
228
- this.addDocumentListeners();
229
- this.toggleExceptionWidget();
230
- this.hideHoverWidget();
231
- this._wordToLineNumbersMap = undefined;
232
- const stackFrame = this.debugService.getViewModel().focusedStackFrame;
233
- await this.updateInlineValueDecorations(stackFrame);
234
- }));
235
- this.toDispose.push(this.editor.onDidScrollChange(() => {
236
- this.hideHoverWidget();
237
- const model = this.editor.getModel();
238
- if (model && ( this.languageFeaturesService.inlineValuesProvider.has(model))) {
239
- this.updateInlineValuesScheduler.schedule();
240
- }
241
- }));
242
- this.toDispose.push(this.configurationService.onDidChangeConfiguration((e) => {
243
- if (e.affectsConfiguration('editor.hover')) {
244
- this.updateHoverConfiguration();
245
- }
246
- }));
247
- this.toDispose.push(this.debugService.onDidChangeState((state) => {
248
- if (state !== State.Stopped) {
249
- this.toggleExceptionWidget();
250
- }
251
- }));
252
- this.updateHoverConfiguration();
253
- }
254
- updateHoverConfiguration() {
255
- const model = this.editor.getModel();
256
- if (model) {
257
- this.editorHoverOptions = this.configurationService.getValue('editor.hover', {
258
- resource: model.uri,
259
- overrideIdentifier: model.getLanguageId()
260
- });
261
- }
262
- }
263
- addDocumentListeners() {
264
- const stackFrame = this.debugService.getViewModel().focusedStackFrame;
265
- const model = this.editor.getModel();
266
- if (model) {
267
- this.applyDocumentListeners(model, stackFrame);
268
- }
269
- }
270
- applyDocumentListeners(model, stackFrame) {
271
- if (!stackFrame || !this.uriIdentityService.extUri.isEqual(model.uri, stackFrame.source.uri)) {
272
- this.altListener.clear();
273
- return;
274
- }
275
- const ownerDocument = this.editor.getContainerDomNode().ownerDocument;
276
- this.altListener.value = addDisposableListener(ownerDocument, 'keydown', keydownEvent => {
277
- const standardKeyboardEvent = ( new StandardKeyboardEvent(keydownEvent));
278
- if (standardKeyboardEvent.keyCode === KeyCode.Alt) {
279
- this.altPressed = true;
280
- const debugHoverWasVisible = this.hoverWidget.isVisible();
281
- this.hoverWidget.hide();
282
- this.defaultHoverLockout.clear();
283
- if (debugHoverWasVisible && this.hoverPosition) {
284
- this.showEditorHover(this.hoverPosition.position, false);
285
- }
286
- const onKeyUp = ( new DomEmitter(ownerDocument, 'keyup'));
287
- const listener = Event.any(this.hostService.onDidChangeFocus, onKeyUp.event)(keyupEvent => {
288
- let standardKeyboardEvent = undefined;
289
- if (isKeyboardEvent(keyupEvent)) {
290
- standardKeyboardEvent = ( new StandardKeyboardEvent(keyupEvent));
291
- }
292
- if (!standardKeyboardEvent || standardKeyboardEvent.keyCode === KeyCode.Alt) {
293
- this.altPressed = false;
294
- this.preventDefaultEditorHover();
295
- listener.dispose();
296
- onKeyUp.dispose();
297
- }
298
- });
299
- }
300
- });
301
- }
302
- async showHover(position, focus, mouseEvent) {
303
- this.preventDefaultEditorHover();
304
- const sf = this.debugService.getViewModel().focusedStackFrame;
305
- const model = this.editor.getModel();
306
- if (sf && model && this.uriIdentityService.extUri.isEqual(sf.source.uri, model.uri)) {
307
- const result = await this.hoverWidget.showAt(position, focus, mouseEvent);
308
- if (result === ShowDebugHoverResult.NOT_AVAILABLE) {
309
- this.showEditorHover(position, focus);
310
- }
311
- }
312
- else {
313
- this.showEditorHover(position, focus);
314
- }
315
- }
316
- preventDefaultEditorHover() {
317
- if (this.defaultHoverLockout.value || this.editorHoverOptions?.enabled === false) {
318
- return;
319
- }
320
- const hoverController = this.editor.getContribution(ContentHoverController.ID);
321
- hoverController?.hideContentHover();
322
- this.editor.updateOptions({ hover: { enabled: false } });
323
- this.defaultHoverLockout.value = {
324
- dispose: () => {
325
- this.editor.updateOptions({
326
- hover: { enabled: this.editorHoverOptions?.enabled ?? true }
327
- });
328
- }
329
- };
330
- }
331
- showEditorHover(position, focus) {
332
- const hoverController = this.editor.getContribution(ContentHoverController.ID);
333
- const range = ( new Range(position.lineNumber, position.column, position.lineNumber, position.column));
334
- this.defaultHoverLockout.clear();
335
- hoverController?.showContentHover(range, HoverStartMode.Immediate, HoverStartSource.Mouse, focus);
336
- }
337
- async onFocusStackFrame(sf) {
338
- const model = this.editor.getModel();
339
- if (model) {
340
- this.applyDocumentListeners(model, sf);
341
- if (sf && this.uriIdentityService.extUri.isEqual(sf.source.uri, model.uri)) {
342
- await this.toggleExceptionWidget();
343
- }
344
- else {
345
- this.hideHoverWidget();
346
- }
347
- }
348
- await this.updateInlineValueDecorations(sf);
349
- }
350
- get hoverDelay() {
351
- const baseDelay = this.editorHoverOptions?.delay || 0;
352
- const delayFactor = clamp(2 - (baseDelay - 300) / 600, 1, 2);
353
- return baseDelay * delayFactor;
354
- }
355
- get showHoverScheduler() {
356
- const scheduler = ( new RunOnceScheduler(() => {
357
- if (this.hoverPosition && !this.altPressed) {
358
- this.showHover(this.hoverPosition.position, false, this.hoverPosition.event);
359
- }
360
- }, this.hoverDelay));
361
- this.toDispose.push(scheduler);
362
- return scheduler;
363
- }
364
- hideHoverWidget() {
365
- if (this.hoverWidget.willBeVisible()) {
366
- this.hoverWidget.hide();
367
- }
368
- this.showHoverScheduler.cancel();
369
- this.defaultHoverLockout.clear();
370
- }
371
- onEditorMouseDown(mouseEvent) {
372
- this.mouseDown = true;
373
- if (mouseEvent.target.type === MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID) {
374
- return;
375
- }
376
- this.hideHoverWidget();
377
- }
378
- onEditorMouseMove(mouseEvent) {
379
- if (this.debugService.state !== State.Stopped) {
380
- return;
381
- }
382
- const target = mouseEvent.target;
383
- const stopKey = isMacintosh ? 'metaKey' : 'ctrlKey';
384
- if (!this.altPressed) {
385
- if (target.type === MouseTargetType.GUTTER_GLYPH_MARGIN) {
386
- this.defaultHoverLockout.clear();
387
- this.gutterIsHovered = true;
388
- }
389
- else if (this.gutterIsHovered) {
390
- this.gutterIsHovered = false;
391
- this.updateHoverConfiguration();
392
- }
393
- }
394
- if ((target.type === MouseTargetType.CONTENT_WIDGET && target.detail === DebugHoverWidget.ID)
395
- || this.hoverWidget.isInSafeTriangle(mouseEvent.event.posx, mouseEvent.event.posy)) {
396
- const sticky = this.editorHoverOptions?.sticky ?? true;
397
- if (sticky || this.hoverWidget.isShowingComplexValue || mouseEvent.event[stopKey]) {
398
- return;
399
- }
400
- }
401
- if (target.type === MouseTargetType.CONTENT_TEXT) {
402
- if (target.position && !Position.equals(target.position, this.hoverPosition?.position || null) && !this.hoverWidget.isInSafeTriangle(mouseEvent.event.posx, mouseEvent.event.posy)) {
403
- this.hoverPosition = { position: target.position, event: mouseEvent.event };
404
- this.preventDefaultEditorHover();
405
- this.showHoverScheduler.schedule(this.hoverDelay);
406
- }
407
- }
408
- else if (!this.mouseDown) {
409
- this.hideHoverWidget();
410
- }
411
- }
412
- onKeyDown(e) {
413
- const stopKey = isMacintosh ? KeyCode.Meta : KeyCode.Ctrl;
414
- if (e.keyCode !== stopKey && e.keyCode !== KeyCode.Alt) {
415
- this.hideHoverWidget();
416
- }
417
- }
418
- async toggleExceptionWidget() {
419
- const model = this.editor.getModel();
420
- const focusedSf = this.debugService.getViewModel().focusedStackFrame;
421
- const callStack = focusedSf ? focusedSf.thread.getCallStack() : null;
422
- if (!model || !focusedSf || !callStack || callStack.length === 0) {
423
- this.closeExceptionWidget();
424
- return;
425
- }
426
- const exceptionSf = callStack.find(sf => !!(sf && sf.source && sf.source.available && sf.source.presentationHint !== 'deemphasize'));
427
- if (!exceptionSf || exceptionSf !== focusedSf) {
428
- this.closeExceptionWidget();
429
- return;
430
- }
431
- const sameUri = this.uriIdentityService.extUri.isEqual(exceptionSf.source.uri, model.uri);
432
- if (this.exceptionWidget && !sameUri) {
433
- this.closeExceptionWidget();
434
- }
435
- else if (sameUri) {
436
- const exceptionInfo = await focusedSf.thread.exceptionInfo;
437
- if (exceptionInfo) {
438
- this.showExceptionWidget(exceptionInfo, this.debugService.getViewModel().focusedSession, exceptionSf.range.startLineNumber, exceptionSf.range.startColumn);
439
- }
440
- }
441
- }
442
- showExceptionWidget(exceptionInfo, debugSession, lineNumber, column) {
443
- if (this.exceptionWidget) {
444
- this.exceptionWidget.dispose();
445
- }
446
- this.exceptionWidget = this.instantiationService.createInstance(ExceptionWidget, this.editor, exceptionInfo, debugSession);
447
- this.exceptionWidget.show({ lineNumber, column }, 0);
448
- this.exceptionWidget.focus();
449
- this.editor.revealRangeInCenter({
450
- startLineNumber: lineNumber,
451
- startColumn: column,
452
- endLineNumber: lineNumber,
453
- endColumn: column,
454
- });
455
- this.exceptionWidgetVisible.set(true);
456
- }
457
- closeExceptionWidget() {
458
- if (this.exceptionWidget) {
459
- const shouldFocusEditor = this.exceptionWidget.hasFocus();
460
- this.exceptionWidget.dispose();
461
- this.exceptionWidget = undefined;
462
- this.exceptionWidgetVisible.set(false);
463
- if (shouldFocusEditor) {
464
- this.editor.focus();
465
- }
466
- }
467
- }
468
- async addLaunchConfiguration() {
469
- const model = this.editor.getModel();
470
- if (!model) {
471
- return;
472
- }
473
- let configurationsArrayPosition;
474
- let lastProperty;
475
- const getConfigurationPosition = () => {
476
- let depthInArray = 0;
477
- visit(model.getValue(), {
478
- onObjectProperty: (property) => {
479
- lastProperty = property;
480
- },
481
- onArrayBegin: (offset) => {
482
- if (lastProperty === 'configurations' && depthInArray === 0) {
483
- configurationsArrayPosition = model.getPositionAt(offset + 1);
484
- }
485
- depthInArray++;
486
- },
487
- onArrayEnd: () => {
488
- depthInArray--;
489
- }
490
- });
491
- };
492
- getConfigurationPosition();
493
- if (!configurationsArrayPosition) {
494
- const { tabSize, insertSpaces } = model.getOptions();
495
- const eol = model.getEOL();
496
- const edit = (basename(model.uri.fsPath) === 'launch.json') ?
497
- setProperty(model.getValue(), ['configurations'], [], { tabSize, insertSpaces, eol })[0] :
498
- setProperty(model.getValue(), ['launch'], { 'configurations': [] }, { tabSize, insertSpaces, eol })[0];
499
- const startPosition = model.getPositionAt(edit.offset);
500
- const lineNumber = startPosition.lineNumber;
501
- const range = ( new Range(
502
- lineNumber,
503
- startPosition.column,
504
- lineNumber,
505
- model.getLineMaxColumn(lineNumber)
506
- ));
507
- model.pushEditOperations(null, [EditOperation.replace(range, edit.content)], () => null);
508
- getConfigurationPosition();
509
- }
510
- if (!configurationsArrayPosition) {
511
- return;
512
- }
513
- this.editor.focus();
514
- const insertLine = (position) => {
515
- if (model.getLineLastNonWhitespaceColumn(position.lineNumber) > position.column) {
516
- this.editor.setPosition(position);
517
- CoreEditingCommands.LineBreakInsert.runEditorCommand(null, this.editor, null);
518
- }
519
- this.editor.setPosition(position);
520
- return this.commandService.executeCommand('editor.action.insertLineAfter');
521
- };
522
- await insertLine(configurationsArrayPosition);
523
- await this.commandService.executeCommand('editor.action.triggerSuggest');
524
- }
525
- get removeInlineValuesScheduler() {
526
- return ( new RunOnceScheduler(() => {
527
- this.displayedStore.clear();
528
- this.oldDecorations.clear();
529
- }, 100));
530
- }
531
- get updateInlineValuesScheduler() {
532
- const model = this.editor.getModel();
533
- return ( new RunOnceScheduler(
534
- async () => await this.updateInlineValueDecorations(this.debugService.getViewModel().focusedStackFrame),
535
- model ? this.debounceInfo.get(model) : DEAFULT_INLINE_DEBOUNCE_DELAY
536
- ));
537
- }
538
- async updateInlineValueDecorations(stackFrame) {
539
- const var_value_format = '{0} = {1}';
540
- const separator = ', ';
541
- const model = this.editor.getModel();
542
- const inlineValuesSetting = this.configurationService.getValue('debug').inlineValues;
543
- const inlineValuesTurnedOn = inlineValuesSetting === true || inlineValuesSetting === 'on' || (inlineValuesSetting === 'auto' && model && ( this.languageFeaturesService.inlineValuesProvider.has(model)));
544
- if (!inlineValuesTurnedOn || !model || !stackFrame || ( model.uri.toString()) !== ( stackFrame.source.uri.toString())) {
545
- if (!this.removeInlineValuesScheduler.isScheduled()) {
546
- this.removeInlineValuesScheduler.schedule();
547
- }
548
- return;
549
- }
550
- this.removeInlineValuesScheduler.cancel();
551
- this.displayedStore.clear();
552
- const viewRanges = this.editor.getVisibleRangesPlusViewportAboveBelow();
553
- let allDecorations;
554
- const cts = ( new CancellationTokenSource());
555
- this.displayedStore.add(toDisposable(() => cts.dispose(true)));
556
- if (( this.languageFeaturesService.inlineValuesProvider.has(model))) {
557
- const findVariable = async (_key, caseSensitiveLookup) => {
558
- const scopes = await stackFrame.getMostSpecificScopes(stackFrame.range);
559
- const key = caseSensitiveLookup ? _key : _key.toLowerCase();
560
- for (const scope of scopes) {
561
- const variables = await scope.getChildren();
562
- const found = variables.find(v => caseSensitiveLookup ? (v.name === key) : (v.name.toLowerCase() === key));
563
- if (found) {
564
- return found.value;
565
- }
566
- }
567
- return undefined;
568
- };
569
- const ctx = {
570
- frameId: stackFrame.frameId,
571
- stoppedLocation: ( new Range(
572
- stackFrame.range.startLineNumber,
573
- stackFrame.range.startColumn + 1,
574
- stackFrame.range.endLineNumber,
575
- stackFrame.range.endColumn + 1
576
- ))
577
- };
578
- const providers = this.languageFeaturesService.inlineValuesProvider.ordered(model).reverse();
579
- allDecorations = [];
580
- const lineDecorations = ( new Map());
581
- const promises = providers.flatMap(provider => ( viewRanges.map(
582
- range => Promise.resolve(provider.provideInlineValues(model, range, ctx, cts.token)).then(async (result) => {
583
- if (result) {
584
- for (const iv of result) {
585
- let text = undefined;
586
- switch (iv.type) {
587
- case 'text':
588
- text = iv.text;
589
- break;
590
- case 'variable': {
591
- let va = iv.variableName;
592
- if (!va) {
593
- const lineContent = model.getLineContent(iv.range.startLineNumber);
594
- va = lineContent.substring(iv.range.startColumn - 1, iv.range.endColumn - 1);
595
- }
596
- const value = await findVariable(va, iv.caseSensitiveLookup);
597
- if (value) {
598
- text = format(var_value_format, va, value);
599
- }
600
- break;
601
- }
602
- case 'expression': {
603
- let expr = iv.expression;
604
- if (!expr) {
605
- const lineContent = model.getLineContent(iv.range.startLineNumber);
606
- expr = lineContent.substring(iv.range.startColumn - 1, iv.range.endColumn - 1);
607
- }
608
- if (expr) {
609
- const expression = ( new Expression(expr));
610
- await expression.evaluate(stackFrame.thread.session, stackFrame, 'watch', true);
611
- if (expression.available) {
612
- text = format(var_value_format, expr, expression.value);
613
- }
614
- }
615
- break;
616
- }
617
- }
618
- if (text) {
619
- const line = iv.range.startLineNumber;
620
- let lineSegments = lineDecorations.get(line);
621
- if (!lineSegments) {
622
- lineSegments = [];
623
- lineDecorations.set(line, lineSegments);
624
- }
625
- if (!( lineSegments.some(iv => iv.text === text))) {
626
- lineSegments.push(( new InlineSegment(iv.range.startColumn, text)));
627
- }
628
- }
629
- }
630
- }
631
- }, err => {
632
- onUnexpectedExternalError(err);
633
- })
634
- )));
635
- const startTime = Date.now();
636
- await Promise.all(promises);
637
- this.updateInlineValuesScheduler.delay = this.debounceInfo.update(model, Date.now() - startTime);
638
- lineDecorations.forEach((segments, line) => {
639
- if (segments.length > 0) {
640
- segments = segments.sort((a, b) => a.column - b.column);
641
- const text = ( segments.map(s => s.text)).join(separator);
642
- allDecorations.push(...createInlineValueDecoration(line, text));
643
- }
644
- });
645
- }
646
- else {
647
- const scopes = await stackFrame.getMostSpecificScopes(stackFrame.range);
648
- const scopesWithVariables = await Promise.all(( scopes.map(async (scope) => ({ scope, variables: await scope.getChildren() }))));
649
- const valuesPerLine = ( new Map());
650
- for (const { scope, variables } of scopesWithVariables) {
651
- let scopeRange = ( new Range(0, 0, stackFrame.range.startLineNumber, stackFrame.range.startColumn));
652
- if (scope.range) {
653
- scopeRange = scopeRange.setStartPosition(scope.range.startLineNumber, scope.range.startColumn);
654
- }
655
- const ownRanges = ( viewRanges.map(r => r.intersectRanges(scopeRange))).filter(isDefined);
656
- this._wordToLineNumbersMap ??= ( new WordsToLineNumbersCache(model));
657
- for (const range of ownRanges) {
658
- this._wordToLineNumbersMap.ensureRangePopulated(range);
659
- }
660
- const mapped = createInlineValueDecorationsInsideRange(variables, ownRanges, model, this._wordToLineNumbersMap.value);
661
- for (const { line, variables } of mapped) {
662
- let values = valuesPerLine.get(line);
663
- if (!values) {
664
- values = ( new Map());
665
- valuesPerLine.set(line, values);
666
- }
667
- for (const { name, value } of variables) {
668
- if (!( values.has(name))) {
669
- values.set(name, value);
670
- }
671
- }
672
- }
673
- }
674
- allDecorations = [...valuesPerLine.entries()].flatMap(([line, values]) => createInlineValueDecoration(line, ( [...values].map(([n, v]) => `${n} = ${v}`)).join(', ')));
675
- }
676
- if (cts.token.isCancellationRequested) {
677
- return;
678
- }
679
- let preservePosition;
680
- if (this.editor.getOption(EditorOption.wordWrap) !== 'off') {
681
- const position = this.editor.getPosition();
682
- if (position && ( this.editor.getVisibleRanges().some(r => r.containsPosition(position)))) {
683
- preservePosition = { position, top: this.editor.getTopForPosition(position.lineNumber, position.column) };
684
- }
685
- }
686
- this.oldDecorations.set(allDecorations);
687
- if (preservePosition) {
688
- const top = this.editor.getTopForPosition(preservePosition.position.lineNumber, preservePosition.position.column);
689
- this.editor.setScrollTop(this.editor.getScrollTop() - (preservePosition.top - top), ScrollType.Immediate);
690
- }
691
- }
692
- dispose() {
693
- if (this.hoverWidget) {
694
- this.hoverWidget.dispose();
695
- }
696
- if (this.configurationWidget) {
697
- this.configurationWidget.dispose();
698
- }
699
- this.toDispose = dispose(this.toDispose);
700
- }
701
- };
702
- DebugEditorContribution.__decorator = ( __decorate([
703
- memoize
704
- ], DebugEditorContribution.prototype, "showHoverScheduler", null));
705
- DebugEditorContribution.__decorator = ( __decorate([
706
- memoize
707
- ], DebugEditorContribution.prototype, "removeInlineValuesScheduler", null));
708
- DebugEditorContribution.__decorator = ( __decorate([
709
- memoize
710
- ], DebugEditorContribution.prototype, "updateInlineValuesScheduler", null));
711
- DebugEditorContribution = ( __decorate([
712
- ( __param(1, IDebugService)),
713
- ( __param(2, IInstantiationService)),
714
- ( __param(3, ICommandService)),
715
- ( __param(4, IConfigurationService)),
716
- ( __param(5, IHostService)),
717
- ( __param(6, IUriIdentityService)),
718
- ( __param(7, IContextKeyService)),
719
- ( __param(8, ILanguageFeaturesService)),
720
- ( __param(9, ILanguageFeatureDebounceService))
721
- ], DebugEditorContribution));
722
- class WordsToLineNumbersCache {
723
- constructor(model) {
724
- this.model = model;
725
- this.value = ( new Map());
726
- this.intervals = ( new Uint8Array(Math.ceil(model.getLineCount() / 8)));
727
- }
728
- ensureRangePopulated(range) {
729
- for (let lineNumber = range.startLineNumber; lineNumber <= range.endLineNumber; lineNumber++) {
730
- const bin = lineNumber >> 3;
731
- const bit = 1 << (lineNumber & 0b111);
732
- if (!(this.intervals[bin] & bit)) {
733
- getWordToLineNumbersMap(this.model, lineNumber, this.value);
734
- this.intervals[bin] |= bit;
735
- }
736
- }
737
- }
738
- }
739
- CommandsRegistry.registerCommand('_executeInlineValueProvider', async (accessor, uri, iRange, context) => {
740
- assertType(URI.isUri(uri));
741
- assertType(Range.isIRange(iRange));
742
- if (!context || typeof context.frameId !== 'number' || !Range.isIRange(context.stoppedLocation)) {
743
- throw illegalArgument('context');
744
- }
745
- const model = accessor.get(IModelService).getModel(uri);
746
- if (!model) {
747
- throw illegalArgument('uri');
748
- }
749
- const range = Range.lift(iRange);
750
- const { inlineValuesProvider } = accessor.get(ILanguageFeaturesService);
751
- const providers = inlineValuesProvider.ordered(model);
752
- const providerResults = await Promise.all(( providers.map(
753
- provider => provider.provideInlineValues(model, range, context, CancellationToken.None)
754
- )));
755
- return providerResults.flat().filter(isDefined);
756
- });
757
-
758
- export { DebugEditorContribution };