@codingame/monaco-vscode-debug-service-override 2.0.3 → 2.1.0
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/debug.js +3 -1
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +47 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +7 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +18 -7
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +36 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +137 -121
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +34 -5
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +106 -38
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +123 -56
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +8 -7
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +43 -19
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +2 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +18 -8
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +87 -36
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +45 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +9 -3
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +0 -204
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +0 -287
|
@@ -10,7 +10,8 @@ import { illegalArgument, onUnexpectedExternalError } from 'vscode/vscode/vs/bas
|
|
|
10
10
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
11
11
|
import { visit } from 'vscode/vscode/vs/base/common/json';
|
|
12
12
|
import { setProperty } from 'vscode/vscode/vs/base/common/jsonEdit';
|
|
13
|
-
import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
13
|
+
import { MutableDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
14
|
+
import { clamp } from 'vscode/vscode/vs/base/common/numbers';
|
|
14
15
|
import { basename } from 'vscode/vscode/vs/base/common/path';
|
|
15
16
|
import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
16
17
|
import { format, noBreakWhitespace } from 'vscode/vscode/vs/base/common/strings';
|
|
@@ -25,7 +26,7 @@ import { InjectedTextCursorStops } from 'vscode/vscode/vs/editor/common/model';
|
|
|
25
26
|
import { ILanguageFeatureDebounceService } from 'vscode/vscode/vs/editor/common/services/languageFeatureDebounce';
|
|
26
27
|
import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
|
|
27
28
|
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
28
|
-
import {
|
|
29
|
+
import { HoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/hover';
|
|
29
30
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
30
31
|
import { CommandsRegistry, ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
31
32
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
@@ -113,7 +114,7 @@ function createInlineValueDecoration(lineNumber, contentText, column = 107374182
|
|
|
113
114
|
function replaceWsWithNoBreakWs(str) {
|
|
114
115
|
return str.replace(/[ \t]/g, noBreakWhitespace);
|
|
115
116
|
}
|
|
116
|
-
function createInlineValueDecorationsInsideRange(expressions,
|
|
117
|
+
function createInlineValueDecorationsInsideRange(expressions, ranges, model, wordToLineNumbersMap) {
|
|
117
118
|
const nameValueMap = ( new Map());
|
|
118
119
|
for (const expr of expressions) {
|
|
119
120
|
nameValueMap.set(expr.name, expr.value);
|
|
@@ -126,7 +127,7 @@ function createInlineValueDecorationsInsideRange(expressions, range, model, word
|
|
|
126
127
|
const lineNumbers = wordToLineNumbersMap.get(name);
|
|
127
128
|
if (lineNumbers) {
|
|
128
129
|
for (const lineNumber of lineNumbers) {
|
|
129
|
-
if (
|
|
130
|
+
if (( ranges.some(r => lineNumber >= r.startLineNumber && lineNumber <= r.endLineNumber))) {
|
|
130
131
|
if (!( lineToNamesMap.has(lineNumber))) {
|
|
131
132
|
lineToNamesMap.set(lineNumber, []);
|
|
132
133
|
}
|
|
@@ -147,38 +148,31 @@ function createInlineValueDecorationsInsideRange(expressions, range, model, word
|
|
|
147
148
|
});
|
|
148
149
|
return decorations;
|
|
149
150
|
}
|
|
150
|
-
function getWordToLineNumbersMap(model) {
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
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);
|
|
151
|
+
function getWordToLineNumbersMap(model, lineNumber, result) {
|
|
152
|
+
const lineLength = model.getLineLength(lineNumber);
|
|
153
|
+
if (lineLength > MAX_TOKENIZATION_LINE_LEN) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const lineContent = model.getLineContent(lineNumber);
|
|
157
|
+
model.tokenization.forceTokenization(lineNumber);
|
|
158
|
+
const lineTokens = model.tokenization.getLineTokens(lineNumber);
|
|
159
|
+
for (let tokenIndex = 0, tokenCount = lineTokens.getCount(); tokenIndex < tokenCount; tokenIndex++) {
|
|
160
|
+
const tokenType = lineTokens.getStandardTokenType(tokenIndex);
|
|
161
|
+
if (tokenType === 0 ) {
|
|
162
|
+
DEFAULT_WORD_REGEXP.lastIndex = 0;
|
|
163
|
+
const tokenStartOffset = lineTokens.getStartOffset(tokenIndex);
|
|
164
|
+
const tokenEndOffset = lineTokens.getEndOffset(tokenIndex);
|
|
165
|
+
const tokenStr = lineContent.substring(tokenStartOffset, tokenEndOffset);
|
|
166
|
+
const wordMatch = DEFAULT_WORD_REGEXP.exec(tokenStr);
|
|
167
|
+
if (wordMatch) {
|
|
168
|
+
const word = wordMatch[0];
|
|
169
|
+
if (!( result.has(word))) {
|
|
170
|
+
result.set(word, []);
|
|
177
171
|
}
|
|
172
|
+
result.get(word).push(lineNumber);
|
|
178
173
|
}
|
|
179
174
|
}
|
|
180
175
|
}
|
|
181
|
-
return result;
|
|
182
176
|
}
|
|
183
177
|
let DebugEditorContribution = class DebugEditorContribution {
|
|
184
178
|
constructor(editor, debugService, instantiationService, commandService, configurationService, hostService, uriIdentityService, contextKeyService, languageFeaturesService, featureDebounceService) {
|
|
@@ -193,12 +187,13 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
193
187
|
this.hoverPosition = null;
|
|
194
188
|
this.mouseDown = false;
|
|
195
189
|
this.gutterIsHovered = false;
|
|
190
|
+
this.altListener = ( new MutableDisposable());
|
|
196
191
|
this.altPressed = false;
|
|
197
192
|
this.oldDecorations = this.editor.createDecorationsCollection();
|
|
198
|
-
this.
|
|
193
|
+
this.defaultHoverLockout = ( new MutableDisposable());
|
|
199
194
|
this.debounceInfo = featureDebounceService.for(languageFeaturesService.inlineValuesProvider, 'InlineValues', { min: DEAFULT_INLINE_DEBOUNCE_DELAY });
|
|
200
195
|
this.hoverWidget = this.instantiationService.createInstance(DebugHoverWidget, this.editor);
|
|
201
|
-
this.toDispose = [];
|
|
196
|
+
this.toDispose = [this.defaultHoverLockout, this.altListener];
|
|
202
197
|
this.registerListeners();
|
|
203
198
|
this.exceptionWidgetVisible = CONTEXT_EXCEPTION_WIDGET_VISIBLE.bindTo(contextKeyService);
|
|
204
199
|
this.toggleExceptionWidget();
|
|
@@ -226,7 +221,7 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
226
221
|
this.toDispose.push(this.debugService.getViewModel().onWillUpdateViews(() => this.updateInlineValuesScheduler.schedule()));
|
|
227
222
|
this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(() => this.updateInlineValuesScheduler.schedule()));
|
|
228
223
|
this.toDispose.push(this.editor.onDidChangeModel(async () => {
|
|
229
|
-
this.
|
|
224
|
+
this.addDocumentListeners();
|
|
230
225
|
this.toggleExceptionWidget();
|
|
231
226
|
this.hideHoverWidget();
|
|
232
227
|
this._wordToLineNumbersMap = undefined;
|
|
@@ -240,81 +235,68 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
240
235
|
this.updateInlineValuesScheduler.schedule();
|
|
241
236
|
}
|
|
242
237
|
}));
|
|
238
|
+
this.toDispose.push(this.configurationService.onDidChangeConfiguration((e) => {
|
|
239
|
+
if (e.affectsConfiguration('editor.hover')) {
|
|
240
|
+
this.updateHoverConfiguration();
|
|
241
|
+
}
|
|
242
|
+
}));
|
|
243
243
|
this.toDispose.push(this.debugService.onDidChangeState((state) => {
|
|
244
244
|
if (state !== 2 ) {
|
|
245
245
|
this.toggleExceptionWidget();
|
|
246
246
|
}
|
|
247
247
|
}));
|
|
248
|
+
this.updateHoverConfiguration();
|
|
248
249
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
updateHoverConfiguration() {
|
|
251
|
+
const model = this.editor.getModel();
|
|
252
|
+
if (model) {
|
|
253
|
+
this.editorHoverOptions = this.configurationService.getValue('editor.hover', {
|
|
254
|
+
resource: model.uri,
|
|
255
|
+
overrideIdentifier: model.getLanguageId()
|
|
256
|
+
});
|
|
252
257
|
}
|
|
253
|
-
return this._wordToLineNumbersMap;
|
|
254
258
|
}
|
|
255
|
-
|
|
259
|
+
addDocumentListeners() {
|
|
256
260
|
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
257
261
|
const model = this.editor.getModel();
|
|
258
262
|
if (model) {
|
|
259
|
-
this.
|
|
263
|
+
this.applyDocumentListeners(model, stackFrame);
|
|
260
264
|
}
|
|
261
265
|
}
|
|
262
|
-
|
|
263
|
-
if (stackFrame
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
this.altListener.dispose();
|
|
267
|
-
}
|
|
268
|
-
this.altListener = addDisposableListener(ownerDocument, 'keydown', keydownEvent => {
|
|
269
|
-
const standardKeyboardEvent = ( new StandardKeyboardEvent(keydownEvent));
|
|
270
|
-
if (standardKeyboardEvent.keyCode === 6 ) {
|
|
271
|
-
this.altPressed = true;
|
|
272
|
-
const debugHoverWasVisible = this.hoverWidget.isVisible();
|
|
273
|
-
this.hoverWidget.hide();
|
|
274
|
-
this.enableEditorHover();
|
|
275
|
-
if (debugHoverWasVisible && this.hoverPosition) {
|
|
276
|
-
this.showEditorHover(this.hoverPosition, false);
|
|
277
|
-
}
|
|
278
|
-
const onKeyUp = ( new DomEmitter(ownerDocument, 'keyup'));
|
|
279
|
-
const listener = Event.any(this.hostService.onDidChangeFocus, onKeyUp.event)(keyupEvent => {
|
|
280
|
-
let standardKeyboardEvent = undefined;
|
|
281
|
-
if (isKeyboardEvent(keyupEvent)) {
|
|
282
|
-
standardKeyboardEvent = ( new StandardKeyboardEvent(keyupEvent));
|
|
283
|
-
}
|
|
284
|
-
if (!standardKeyboardEvent || standardKeyboardEvent.keyCode === 6 ) {
|
|
285
|
-
this.altPressed = false;
|
|
286
|
-
this.editor.updateOptions({ hover: { enabled: false } });
|
|
287
|
-
listener.dispose();
|
|
288
|
-
onKeyUp.dispose();
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
this.editor.updateOptions({ hover: { enabled: false } });
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
this.altListener?.dispose();
|
|
297
|
-
this.enableEditorHover();
|
|
266
|
+
applyDocumentListeners(model, stackFrame) {
|
|
267
|
+
if (!stackFrame || !this.uriIdentityService.extUri.isEqual(model.uri, stackFrame.source.uri)) {
|
|
268
|
+
this.altListener.clear();
|
|
269
|
+
return;
|
|
298
270
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
hover: {
|
|
310
|
-
enabled: defaultConfiguration.enabled,
|
|
311
|
-
delay: defaultConfiguration.delay,
|
|
312
|
-
sticky: defaultConfiguration.sticky
|
|
271
|
+
const ownerDocument = this.editor.getContainerDomNode().ownerDocument;
|
|
272
|
+
this.altListener.value = addDisposableListener(ownerDocument, 'keydown', keydownEvent => {
|
|
273
|
+
const standardKeyboardEvent = ( new StandardKeyboardEvent(keydownEvent));
|
|
274
|
+
if (standardKeyboardEvent.keyCode === 6 ) {
|
|
275
|
+
this.altPressed = true;
|
|
276
|
+
const debugHoverWasVisible = this.hoverWidget.isVisible();
|
|
277
|
+
this.hoverWidget.hide();
|
|
278
|
+
this.defaultHoverLockout.clear();
|
|
279
|
+
if (debugHoverWasVisible && this.hoverPosition) {
|
|
280
|
+
this.showEditorHover(this.hoverPosition, false);
|
|
313
281
|
}
|
|
314
|
-
|
|
315
|
-
|
|
282
|
+
const onKeyUp = ( new DomEmitter(ownerDocument, 'keyup'));
|
|
283
|
+
const listener = Event.any(this.hostService.onDidChangeFocus, onKeyUp.event)(keyupEvent => {
|
|
284
|
+
let standardKeyboardEvent = undefined;
|
|
285
|
+
if (isKeyboardEvent(keyupEvent)) {
|
|
286
|
+
standardKeyboardEvent = ( new StandardKeyboardEvent(keyupEvent));
|
|
287
|
+
}
|
|
288
|
+
if (!standardKeyboardEvent || standardKeyboardEvent.keyCode === 6 ) {
|
|
289
|
+
this.altPressed = false;
|
|
290
|
+
this.preventDefaultEditorHover();
|
|
291
|
+
listener.dispose();
|
|
292
|
+
onKeyUp.dispose();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
316
297
|
}
|
|
317
298
|
async showHover(position, focus) {
|
|
299
|
+
this.preventDefaultEditorHover();
|
|
318
300
|
const sf = this.debugService.getViewModel().focusedStackFrame;
|
|
319
301
|
const model = this.editor.getModel();
|
|
320
302
|
if (sf && model && this.uriIdentityService.extUri.isEqual(sf.source.uri, model.uri)) {
|
|
@@ -327,15 +309,31 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
327
309
|
this.showEditorHover(position, focus);
|
|
328
310
|
}
|
|
329
311
|
}
|
|
312
|
+
preventDefaultEditorHover() {
|
|
313
|
+
if (this.defaultHoverLockout.value || this.editorHoverOptions?.enabled === false) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const hoverController = this.editor.getContribution(HoverController.ID);
|
|
317
|
+
hoverController?.hideContentHover();
|
|
318
|
+
this.editor.updateOptions({ hover: { enabled: false } });
|
|
319
|
+
this.defaultHoverLockout.value = {
|
|
320
|
+
dispose: () => {
|
|
321
|
+
this.editor.updateOptions({
|
|
322
|
+
hover: { enabled: this.editorHoverOptions?.enabled ?? true }
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
330
327
|
showEditorHover(position, focus) {
|
|
331
|
-
const hoverController = this.editor.getContribution(
|
|
328
|
+
const hoverController = this.editor.getContribution(HoverController.ID);
|
|
332
329
|
const range = ( new Range(position.lineNumber, position.column, position.lineNumber, position.column));
|
|
330
|
+
this.defaultHoverLockout.clear();
|
|
333
331
|
hoverController?.showContentHover(range, 1 , 0 , focus);
|
|
334
332
|
}
|
|
335
333
|
async onFocusStackFrame(sf) {
|
|
336
334
|
const model = this.editor.getModel();
|
|
337
335
|
if (model) {
|
|
338
|
-
this.
|
|
336
|
+
this.applyDocumentListeners(model, sf);
|
|
339
337
|
if (sf && this.uriIdentityService.extUri.isEqual(sf.source.uri, model.uri)) {
|
|
340
338
|
await this.toggleExceptionWidget();
|
|
341
339
|
}
|
|
@@ -345,30 +343,26 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
345
343
|
}
|
|
346
344
|
await this.updateInlineValueDecorations(sf);
|
|
347
345
|
}
|
|
346
|
+
get hoverDelay() {
|
|
347
|
+
const baseDelay = this.editorHoverOptions?.delay || 0;
|
|
348
|
+
const delayFactor = clamp(2 - (baseDelay - 300) / 600, 1, 2);
|
|
349
|
+
return baseDelay * delayFactor;
|
|
350
|
+
}
|
|
348
351
|
get showHoverScheduler() {
|
|
349
|
-
const hoverOption = this.editor.getOption(60 );
|
|
350
352
|
const scheduler = ( new RunOnceScheduler(() => {
|
|
351
353
|
if (this.hoverPosition && !this.altPressed) {
|
|
352
354
|
this.showHover(this.hoverPosition, false);
|
|
353
355
|
}
|
|
354
|
-
},
|
|
355
|
-
this.toDispose.push(scheduler);
|
|
356
|
-
return scheduler;
|
|
357
|
-
}
|
|
358
|
-
get hideHoverScheduler() {
|
|
359
|
-
const scheduler = ( new RunOnceScheduler(() => {
|
|
360
|
-
if (!this.hoverWidget.isHovered()) {
|
|
361
|
-
this.hoverWidget.hide();
|
|
362
|
-
}
|
|
363
|
-
}, 0));
|
|
356
|
+
}, this.hoverDelay));
|
|
364
357
|
this.toDispose.push(scheduler);
|
|
365
358
|
return scheduler;
|
|
366
359
|
}
|
|
367
360
|
hideHoverWidget() {
|
|
368
|
-
if (
|
|
369
|
-
this.
|
|
361
|
+
if (this.hoverWidget.willBeVisible()) {
|
|
362
|
+
this.hoverWidget.hide();
|
|
370
363
|
}
|
|
371
364
|
this.showHoverScheduler.cancel();
|
|
365
|
+
this.defaultHoverLockout.clear();
|
|
372
366
|
}
|
|
373
367
|
onEditorMouseDown(mouseEvent) {
|
|
374
368
|
this.mouseDown = true;
|
|
@@ -385,7 +379,7 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
385
379
|
const stopKey = isMacintosh ? 'metaKey' : 'ctrlKey';
|
|
386
380
|
if (!this.altPressed) {
|
|
387
381
|
if (target.type === 2 ) {
|
|
388
|
-
this.
|
|
382
|
+
this.defaultHoverLockout.clear();
|
|
389
383
|
this.gutterIsHovered = true;
|
|
390
384
|
}
|
|
391
385
|
else if (this.gutterIsHovered) {
|
|
@@ -394,13 +388,16 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
394
388
|
}
|
|
395
389
|
}
|
|
396
390
|
if (target.type === 9 && target.detail === DebugHoverWidget.ID && !mouseEvent.event[stopKey]) {
|
|
397
|
-
|
|
391
|
+
const sticky = this.editorHoverOptions?.sticky ?? true;
|
|
392
|
+
if (sticky || this.hoverWidget.isShowingComplexValue) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
398
395
|
}
|
|
399
396
|
if (target.type === 6 ) {
|
|
400
397
|
if (target.position && !Position.equals(target.position, this.hoverPosition)) {
|
|
401
398
|
this.hoverPosition = target.position;
|
|
402
|
-
this.
|
|
403
|
-
this.showHoverScheduler.schedule();
|
|
399
|
+
this.preventDefaultEditorHover();
|
|
400
|
+
this.showHoverScheduler.schedule(this.hoverDelay);
|
|
404
401
|
}
|
|
405
402
|
}
|
|
406
403
|
else if (!this.mouseDown) {
|
|
@@ -409,7 +406,7 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
409
406
|
}
|
|
410
407
|
onKeyDown(e) {
|
|
411
408
|
const stopKey = isMacintosh ? 57 : 5 ;
|
|
412
|
-
if (e.keyCode !== stopKey) {
|
|
409
|
+
if (e.keyCode !== stopKey && e.keyCode !== 6 ) {
|
|
413
410
|
this.hideHoverWidget();
|
|
414
411
|
}
|
|
415
412
|
}
|
|
@@ -545,6 +542,7 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
545
542
|
return;
|
|
546
543
|
}
|
|
547
544
|
this.removeInlineValuesScheduler.cancel();
|
|
545
|
+
const viewRanges = this.editor.getVisibleRangesPlusViewportAboveBelow();
|
|
548
546
|
let allDecorations;
|
|
549
547
|
if (( this.languageFeaturesService.inlineValuesProvider.has(model))) {
|
|
550
548
|
const findVariable = async (_key, caseSensitiveLookup) => {
|
|
@@ -569,11 +567,10 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
569
567
|
))
|
|
570
568
|
};
|
|
571
569
|
const token = ( new CancellationTokenSource()).token;
|
|
572
|
-
const ranges = this.editor.getVisibleRangesPlusViewportAboveBelow();
|
|
573
570
|
const providers = this.languageFeaturesService.inlineValuesProvider.ordered(model).reverse();
|
|
574
571
|
allDecorations = [];
|
|
575
572
|
const lineDecorations = ( new Map());
|
|
576
|
-
const promises = flatten(( providers.map(provider => (
|
|
573
|
+
const promises = flatten(( providers.map(provider => ( viewRanges.map(
|
|
577
574
|
range => Promise.resolve(provider.provideInlineValues(model, range, ctx, token)).then(async (result) => {
|
|
578
575
|
if (result) {
|
|
579
576
|
for (const iv of result) {
|
|
@@ -642,11 +639,16 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
642
639
|
const scopes = await stackFrame.getMostSpecificScopes(stackFrame.range);
|
|
643
640
|
const decorationsPerScope = await Promise.all(( scopes.map(async (scope) => {
|
|
644
641
|
const variables = await scope.getChildren();
|
|
645
|
-
let
|
|
642
|
+
let scopeRange = ( new Range(0, 0, stackFrame.range.startLineNumber, stackFrame.range.startColumn));
|
|
646
643
|
if (scope.range) {
|
|
647
|
-
|
|
644
|
+
scopeRange = scopeRange.setStartPosition(scope.range.startLineNumber, scope.range.startColumn);
|
|
645
|
+
}
|
|
646
|
+
const ownRanges = ( viewRanges.map(r => r.intersectRanges(scopeRange))).filter(isDefined);
|
|
647
|
+
this._wordToLineNumbersMap ??= ( new WordsToLineNumbersCache(model));
|
|
648
|
+
for (const range of ownRanges) {
|
|
649
|
+
this._wordToLineNumbersMap.ensureRangePopulated(range);
|
|
648
650
|
}
|
|
649
|
-
return createInlineValueDecorationsInsideRange(variables,
|
|
651
|
+
return createInlineValueDecorationsInsideRange(variables, ownRanges, model, this._wordToLineNumbersMap.value);
|
|
650
652
|
})));
|
|
651
653
|
allDecorations = distinct(decorationsPerScope.reduce((previous, current) => previous.concat(current), []),
|
|
652
654
|
decoration => `${decoration.range.startLineNumber}:${decoration?.options.after?.content}`);
|
|
@@ -667,9 +669,6 @@ let DebugEditorContribution = class DebugEditorContribution {
|
|
|
667
669
|
DebugEditorContribution.__decorator = ( __decorate([
|
|
668
670
|
memoize
|
|
669
671
|
], DebugEditorContribution.prototype, "showHoverScheduler", null));
|
|
670
|
-
DebugEditorContribution.__decorator = ( __decorate([
|
|
671
|
-
memoize
|
|
672
|
-
], DebugEditorContribution.prototype, "hideHoverScheduler", null));
|
|
673
672
|
DebugEditorContribution.__decorator = ( __decorate([
|
|
674
673
|
memoize
|
|
675
674
|
], DebugEditorContribution.prototype, "removeInlineValuesScheduler", null));
|
|
@@ -687,6 +686,23 @@ DebugEditorContribution = ( __decorate([
|
|
|
687
686
|
( __param(8, ILanguageFeaturesService)),
|
|
688
687
|
( __param(9, ILanguageFeatureDebounceService))
|
|
689
688
|
], DebugEditorContribution));
|
|
689
|
+
class WordsToLineNumbersCache {
|
|
690
|
+
constructor(model) {
|
|
691
|
+
this.model = model;
|
|
692
|
+
this.value = ( new Map());
|
|
693
|
+
this.intervals = ( new Uint8Array(Math.ceil(model.getLineCount() / 8)));
|
|
694
|
+
}
|
|
695
|
+
ensureRangePopulated(range) {
|
|
696
|
+
for (let lineNumber = range.startLineNumber; lineNumber <= range.endLineNumber; lineNumber++) {
|
|
697
|
+
const bin = lineNumber >> 3;
|
|
698
|
+
const bit = 1 << (lineNumber & 0b111);
|
|
699
|
+
if (!(this.intervals[bin] & bit)) {
|
|
700
|
+
getWordToLineNumbersMap(this.model, lineNumber, this.value);
|
|
701
|
+
this.intervals[bin] |= bit;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
690
706
|
CommandsRegistry.registerCommand('_executeInlineValueProvider', async (accessor, uri, iRange, context) => {
|
|
691
707
|
assertType(URI.isUri(uri));
|
|
692
708
|
assertType(Range.isIRange(iRange));
|
|
@@ -10,13 +10,16 @@ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
|
10
10
|
import { ModelDecorationOptions } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
11
11
|
import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
|
|
12
12
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
13
|
+
import { MenuId, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
14
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
13
16
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
17
|
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
15
18
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
16
19
|
import { editorHoverBackground, asCssVariable, editorHoverBorder, editorHoverForeground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
|
|
17
|
-
import { renderExpressionValue } from '
|
|
20
|
+
import { renderExpressionValue } from 'vscode/vscode/vs/workbench/contrib/debug/browser/baseDebugView';
|
|
18
21
|
import { LinkDetector } from './linkDetector.js';
|
|
19
|
-
import { VariablesRenderer } from './variablesView.js';
|
|
22
|
+
import { VariablesRenderer, openContextMenuForVariableTreeElement } from './variablesView.js';
|
|
20
23
|
import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
21
24
|
import { Variable, Expression } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
|
|
22
25
|
import { getEvaluatableExpressionAtPosition } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugUtils';
|
|
@@ -48,10 +51,16 @@ async function findExpressionInStackFrame(stackFrame, namesToFind) {
|
|
|
48
51
|
let DebugHoverWidget = class DebugHoverWidget {
|
|
49
52
|
static { DebugHoverWidget_1 = this; }
|
|
50
53
|
static { this.ID = 'debug.hoverWidget'; }
|
|
51
|
-
|
|
54
|
+
get isShowingComplexValue() {
|
|
55
|
+
return this.complexValueContainer?.hidden === false;
|
|
56
|
+
}
|
|
57
|
+
constructor(editor, debugService, instantiationService, menuService, contextKeyService, contextMenuService) {
|
|
52
58
|
this.editor = editor;
|
|
53
59
|
this.debugService = debugService;
|
|
54
60
|
this.instantiationService = instantiationService;
|
|
61
|
+
this.menuService = menuService;
|
|
62
|
+
this.contextKeyService = contextKeyService;
|
|
63
|
+
this.contextMenuService = contextMenuService;
|
|
55
64
|
this.allowEditorOverflow = true;
|
|
56
65
|
this.highlightDecorations = this.editor.createDecorationsCollection();
|
|
57
66
|
this.isUpdatingTree = false;
|
|
@@ -96,6 +105,7 @@ let DebugHoverWidget = class DebugHoverWidget {
|
|
|
96
105
|
this.domNode.style.backgroundColor = asCssVariable(editorHoverBackground);
|
|
97
106
|
this.domNode.style.border = `1px solid ${asCssVariable(editorHoverBorder)}`;
|
|
98
107
|
this.domNode.style.color = asCssVariable(editorHoverForeground);
|
|
108
|
+
this.toDispose.push(this.tree.onContextMenu(async (e) => await this.onContextMenu(e)));
|
|
99
109
|
this.toDispose.push(this.tree.onDidChangeContentHeight(() => {
|
|
100
110
|
if (!this.isUpdatingTree) {
|
|
101
111
|
this.layoutTreeAndContainer();
|
|
@@ -109,6 +119,13 @@ let DebugHoverWidget = class DebugHoverWidget {
|
|
|
109
119
|
this.registerListeners();
|
|
110
120
|
this.editor.addContentWidget(this);
|
|
111
121
|
}
|
|
122
|
+
async onContextMenu(e) {
|
|
123
|
+
const variable = e.element;
|
|
124
|
+
if (!(variable instanceof Variable) || !variable.value) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
return openContextMenuForVariableTreeElement(this.contextKeyService, this.menuService, this.contextMenuService, MenuId.DebugHoverContext, e);
|
|
128
|
+
}
|
|
112
129
|
registerListeners() {
|
|
113
130
|
this.toDispose.push(addStandardDisposableListener(this.domNode, 'keydown', (e) => {
|
|
114
131
|
if (e.equals(9 )) {
|
|
@@ -222,7 +239,16 @@ let DebugHoverWidget = class DebugHoverWidget {
|
|
|
222
239
|
}
|
|
223
240
|
layoutTree() {
|
|
224
241
|
const scrollBarHeight = 10;
|
|
225
|
-
|
|
242
|
+
let maxHeightToAvoidCursorOverlay = Infinity;
|
|
243
|
+
if (this.showAtPosition) {
|
|
244
|
+
const editorTop = this.editor.getDomNode()?.offsetTop || 0;
|
|
245
|
+
const containerTop = this.treeContainer.offsetTop + editorTop;
|
|
246
|
+
const hoveredCharTop = this.editor.getTopForLineNumber(this.showAtPosition.lineNumber, true) - this.editor.getScrollTop();
|
|
247
|
+
if (containerTop < hoveredCharTop) {
|
|
248
|
+
maxHeightToAvoidCursorOverlay = hoveredCharTop + editorTop - 22;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const treeHeight = Math.min(Math.max(266, this.editor.getLayoutInfo().height * 0.55), this.tree.contentHeight + scrollBarHeight, maxHeightToAvoidCursorOverlay);
|
|
226
252
|
const realTreeWidth = this.tree.contentWidth;
|
|
227
253
|
const treeWidth = clamp(realTreeWidth, 400, 550);
|
|
228
254
|
this.tree.layout(treeHeight, treeWidth);
|
|
@@ -273,7 +299,10 @@ let DebugHoverWidget = class DebugHoverWidget {
|
|
|
273
299
|
};
|
|
274
300
|
DebugHoverWidget = DebugHoverWidget_1 = ( __decorate([
|
|
275
301
|
( __param(1, IDebugService)),
|
|
276
|
-
( __param(2, IInstantiationService))
|
|
302
|
+
( __param(2, IInstantiationService)),
|
|
303
|
+
( __param(3, IMenuService)),
|
|
304
|
+
( __param(4, IContextKeyService)),
|
|
305
|
+
( __param(5, IContextMenuService))
|
|
277
306
|
], DebugHoverWidget));
|
|
278
307
|
class DebugHoverAccessibilityProvider {
|
|
279
308
|
getWidgetAriaLabel() {
|
|
@@ -18,7 +18,7 @@ class DebugMemoryFileSystemProvider {
|
|
|
18
18
|
this.capabilities = 0
|
|
19
19
|
| 1024
|
|
20
20
|
| 4 ;
|
|
21
|
-
debugService.onDidEndSession(session => {
|
|
21
|
+
debugService.onDidEndSession(({ session }) => {
|
|
22
22
|
for (const [fd, memory] of this.fdMemory) {
|
|
23
23
|
if (memory.session === session) {
|
|
24
24
|
this.close(fd);
|
|
@@ -3,7 +3,7 @@ import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
|
3
3
|
import { VIEWLET_ID, IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
4
4
|
import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress';
|
|
5
5
|
import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
6
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
7
7
|
import { NotificationPriority } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
8
8
|
|
|
9
9
|
let DebugProgressContribution = class DebugProgressContribution {
|