@codingame/monaco-vscode-debug-service-override 4.0.0 → 4.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 +4 -4
- package/package.json +2 -2
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/override/vs/platform/dialogs/common/dialogs.js +0 -10
- package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +0 -73
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +0 -1026
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +0 -1004
- package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +0 -347
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +0 -337
- package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +0 -432
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +0 -1039
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +0 -649
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +0 -64
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +0 -636
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +0 -740
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +0 -408
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +0 -206
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +0 -80
- package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +0 -169
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +0 -1271
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +0 -1330
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +0 -115
- package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +0 -77
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +0 -307
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +0 -31
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +0 -387
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +0 -267
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +0 -817
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +0 -131
- package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +0 -142
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +0 -262
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +0 -669
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +0 -709
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +0 -1002
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +0 -48
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +0 -352
- package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +0 -129
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +0 -734
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +0 -501
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +0 -162
- package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +0 -21
- package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +0 -17
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +0 -110
- package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +0 -62
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +0 -460
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +0 -166
- package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +0 -36
- package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +0 -150
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +0 -289
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +0 -87
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +0 -64
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +0 -311
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -29
|
@@ -1,1002 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { clearNode, Dimension, isActiveElement, append, getWindow, createStyleSheet, addStandardDisposableListener, EventType, getActiveWindow, $ as $$1 } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { status } from 'vscode/vscode/vs/base/browser/ui/aria/aria';
|
|
4
|
-
import { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from 'vscode/vscode/vs/base/browser/ui/mouseCursor/mouseCursor';
|
|
5
|
-
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
6
|
-
import { memoize } from 'vscode/vscode/vs/base/common/decorators';
|
|
7
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
8
|
-
import { HistoryNavigator } from 'vscode/vscode/vs/base/common/history';
|
|
9
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
10
|
-
import { removeAnsiEscapeCodes } from 'vscode/vscode/vs/base/common/strings';
|
|
11
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
12
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
13
|
-
import './media/repl.css.js';
|
|
14
|
-
import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
15
|
-
import { registerEditorAction, EditorAction } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
16
|
-
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
17
|
-
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
18
|
-
import { EDITOR_FONT_DEFAULTS } from 'vscode/vscode/vs/editor/common/config/editorOptions';
|
|
19
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
20
|
-
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
21
|
-
import { CompletionItemKinds } from 'vscode/vscode/vs/editor/common/languages';
|
|
22
|
-
import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
|
|
23
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
24
|
-
import { ITextResourcePropertiesService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
25
|
-
import { SuggestController } from 'vscode/vscode/vs/editor/contrib/suggest/browser/suggestController';
|
|
26
|
-
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
27
|
-
import { createAndFillInContextMenuActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
28
|
-
import { MenuId, registerAction2, Action2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
29
|
-
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
30
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
31
|
-
import { IContextKeyService, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
32
|
-
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
33
|
-
import { registerAndCreateHistoryNavigationContext } from 'vscode/vscode/vs/platform/history/browser/contextScopedHistoryWidget';
|
|
34
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
35
|
-
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
36
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
37
|
-
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
38
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
39
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
40
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
41
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
42
|
-
import { resolveColorValue } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
43
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
44
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
45
|
-
import { editorForeground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
46
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
47
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
48
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
49
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
50
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
51
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
52
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
53
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
54
|
-
import { FilterViewPane, ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
55
|
-
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
56
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
57
|
-
import { getSimpleEditorOptions, getSimpleCodeEditorWidgetOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
|
58
|
-
import { FocusSessionActionViewItem } from './debugActionViewItems.js';
|
|
59
|
-
import { debugConsoleEvaluationPrompt, debugConsoleClearAll } from 'vscode/vscode/vs/workbench/contrib/debug/browser/debugIcons';
|
|
60
|
-
import { LinkDetector } from './linkDetector.js';
|
|
61
|
-
import { ReplFilter } from './replFilter.js';
|
|
62
|
-
import { ReplDelegate, ReplVariablesRenderer, ReplOutputElementRenderer, ReplEvaluationInputsRenderer, ReplGroupRenderer, ReplEvaluationResultsRenderer, ReplRawObjectsRenderer, ReplDataSource, ReplAccessibilityProvider } from './replViewer.js';
|
|
63
|
-
import { DEBUG_SCHEME, CONTEXT_MULTI_SESSION_REPL, CONTEXT_IN_DEBUG_REPL, REPL_VIEW_ID, IDebugService, CONTEXT_DEBUG_STATE, getStateLabel } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
64
|
-
import { Variable } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
|
|
65
|
-
import { ReplEvaluationResult, ReplGroup } from 'vscode/vscode/vs/workbench/contrib/debug/common/replModel';
|
|
66
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
67
|
-
import { registerNavigableContainer } from 'vscode/vscode/vs/workbench/browser/actions/widgetNavigationCommands';
|
|
68
|
-
import { IAccessibilitySignalService, AccessibilitySignal } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
69
|
-
|
|
70
|
-
var Repl_1, ReplOptions_1;
|
|
71
|
-
const $ = $$1;
|
|
72
|
-
const HISTORY_STORAGE_KEY = 'debug.repl.history';
|
|
73
|
-
const FILTER_HISTORY_STORAGE_KEY = 'debug.repl.filterHistory';
|
|
74
|
-
const FILTER_VALUE_STORAGE_KEY = 'debug.repl.filterValue';
|
|
75
|
-
const DECORATION_KEY = 'replinputdecoration';
|
|
76
|
-
function revealLastElement(tree) {
|
|
77
|
-
tree.scrollTop = tree.scrollHeight - tree.renderHeight;
|
|
78
|
-
}
|
|
79
|
-
const sessionsToIgnore = ( (new Set()));
|
|
80
|
-
const identityProvider = { getId: (element) => element.getId() };
|
|
81
|
-
let Repl = class Repl extends FilterViewPane {
|
|
82
|
-
static { Repl_1 = this; }
|
|
83
|
-
static { this.REFRESH_DELAY = 50; }
|
|
84
|
-
static { this.URI = ( URI.parse(`${DEBUG_SCHEME}:replinput`)); }
|
|
85
|
-
constructor(options, debugService, instantiationService, storageService, themeService, modelService, contextKeyService, codeEditorService, viewDescriptorService, contextMenuService, configurationService, textResourcePropertiesService, editorService, keybindingService, openerService, telemetryService, menuService, languageFeaturesService, logService) {
|
|
86
|
-
const filterText = storageService.get(FILTER_VALUE_STORAGE_KEY, 1 , '');
|
|
87
|
-
super({
|
|
88
|
-
...options,
|
|
89
|
-
filterOptions: {
|
|
90
|
-
placeholder: ( (localizeWithPath(
|
|
91
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
92
|
-
{ key: 'workbench.debug.filter.placeholder', comment: ['Text in the brackets after e.g. is not localizable'] },
|
|
93
|
-
"Filter (e.g. text, !exclude)"
|
|
94
|
-
))),
|
|
95
|
-
text: filterText,
|
|
96
|
-
history: JSON.parse(storageService.get(FILTER_HISTORY_STORAGE_KEY, 1 , '[]')),
|
|
97
|
-
}
|
|
98
|
-
}, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
99
|
-
this.debugService = debugService;
|
|
100
|
-
this.storageService = storageService;
|
|
101
|
-
this.modelService = modelService;
|
|
102
|
-
this.textResourcePropertiesService = textResourcePropertiesService;
|
|
103
|
-
this.editorService = editorService;
|
|
104
|
-
this.languageFeaturesService = languageFeaturesService;
|
|
105
|
-
this.logService = logService;
|
|
106
|
-
this.previousTreeScrollHeight = 0;
|
|
107
|
-
this.replInputLineCount = 1;
|
|
108
|
-
this.styleChangedWhenInvisible = false;
|
|
109
|
-
this.modelChangeListener = Disposable.None;
|
|
110
|
-
this.menu = menuService.createMenu(MenuId.DebugConsoleContext, contextKeyService);
|
|
111
|
-
this._register(this.menu);
|
|
112
|
-
this.history = ( (new HistoryNavigator(
|
|
113
|
-
JSON.parse(this.storageService.get(HISTORY_STORAGE_KEY, 1 , '[]')),
|
|
114
|
-
50
|
|
115
|
-
)));
|
|
116
|
-
this.filter = ( (new ReplFilter()));
|
|
117
|
-
this.filter.filterQuery = filterText;
|
|
118
|
-
this.multiSessionRepl = CONTEXT_MULTI_SESSION_REPL.bindTo(contextKeyService);
|
|
119
|
-
this.replOptions = this._register(this.instantiationService.createInstance(ReplOptions, this.id, () => this.getBackgroundColor()));
|
|
120
|
-
this._register(this.replOptions.onDidChange(() => this.onDidStyleChange()));
|
|
121
|
-
codeEditorService.registerDecorationType('repl-decoration', DECORATION_KEY, {});
|
|
122
|
-
this.multiSessionRepl.set(this.isMultiSessionView);
|
|
123
|
-
this.registerListeners();
|
|
124
|
-
}
|
|
125
|
-
registerListeners() {
|
|
126
|
-
if (this.debugService.getViewModel().focusedSession) {
|
|
127
|
-
this.onDidFocusSession(this.debugService.getViewModel().focusedSession);
|
|
128
|
-
}
|
|
129
|
-
this._register(this.debugService.getViewModel().onDidFocusSession(async (session) => this.onDidFocusSession(session)));
|
|
130
|
-
this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async (e) => {
|
|
131
|
-
if (e instanceof Variable && this.tree?.hasNode(e)) {
|
|
132
|
-
await this.tree.updateChildren(e, false, true);
|
|
133
|
-
await this.tree.expand(e);
|
|
134
|
-
}
|
|
135
|
-
}));
|
|
136
|
-
this._register(this.debugService.onWillNewSession(async (newSession) => {
|
|
137
|
-
const input = this.tree?.getInput();
|
|
138
|
-
if (!input || input.state === 0 ) {
|
|
139
|
-
await this.selectSession(newSession);
|
|
140
|
-
}
|
|
141
|
-
this.multiSessionRepl.set(this.isMultiSessionView);
|
|
142
|
-
}));
|
|
143
|
-
this._register(this.debugService.onDidEndSession(async () => {
|
|
144
|
-
await Promise.resolve();
|
|
145
|
-
this.multiSessionRepl.set(this.isMultiSessionView);
|
|
146
|
-
}));
|
|
147
|
-
this._register(this.themeService.onDidColorThemeChange(() => {
|
|
148
|
-
this.refreshReplElements(false);
|
|
149
|
-
if (this.isVisible()) {
|
|
150
|
-
this.updateInputDecoration();
|
|
151
|
-
}
|
|
152
|
-
}));
|
|
153
|
-
this._register(this.onDidChangeBodyVisibility(visible => {
|
|
154
|
-
if (visible) {
|
|
155
|
-
if (!this.model) {
|
|
156
|
-
this.model = this.modelService.getModel(Repl_1.URI) || this.modelService.createModel('', null, Repl_1.URI, true);
|
|
157
|
-
}
|
|
158
|
-
this.setMode();
|
|
159
|
-
this.replInput.setModel(this.model);
|
|
160
|
-
this.updateInputDecoration();
|
|
161
|
-
this.refreshReplElements(true);
|
|
162
|
-
if (this.styleChangedWhenInvisible) {
|
|
163
|
-
this.styleChangedWhenInvisible = false;
|
|
164
|
-
this.onDidStyleChange();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}));
|
|
168
|
-
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
169
|
-
if (e.affectsConfiguration('debug.console.wordWrap') && this.tree) {
|
|
170
|
-
this.tree.dispose();
|
|
171
|
-
this.treeContainer.innerText = '';
|
|
172
|
-
clearNode(this.treeContainer);
|
|
173
|
-
this.createReplTree();
|
|
174
|
-
}
|
|
175
|
-
if (e.affectsConfiguration('debug.console.acceptSuggestionOnEnter')) {
|
|
176
|
-
const config = this.configurationService.getValue('debug');
|
|
177
|
-
this.replInput.updateOptions({
|
|
178
|
-
acceptSuggestionOnEnter: config.console.acceptSuggestionOnEnter === 'on' ? 'on' : 'off'
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}));
|
|
182
|
-
this._register(this.editorService.onDidActiveEditorChange(() => {
|
|
183
|
-
this.setMode();
|
|
184
|
-
}));
|
|
185
|
-
this._register(this.filterWidget.onDidChangeFilterText(() => {
|
|
186
|
-
this.filter.filterQuery = this.filterWidget.getFilterText();
|
|
187
|
-
if (this.tree) {
|
|
188
|
-
this.tree.refilter();
|
|
189
|
-
revealLastElement(this.tree);
|
|
190
|
-
}
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
async onDidFocusSession(session) {
|
|
194
|
-
if (session) {
|
|
195
|
-
sessionsToIgnore.delete(session);
|
|
196
|
-
this.completionItemProvider?.dispose();
|
|
197
|
-
if (session.capabilities.supportsCompletionsRequest) {
|
|
198
|
-
this.completionItemProvider = this.languageFeaturesService.completionProvider.register({ scheme: DEBUG_SCHEME, pattern: '**/replinput', hasAccessToAllModels: true }, {
|
|
199
|
-
_debugDisplayName: 'debugConsole',
|
|
200
|
-
triggerCharacters: session.capabilities.completionTriggerCharacters || ['.'],
|
|
201
|
-
provideCompletionItems: async (_, position, _context, token) => {
|
|
202
|
-
this.setHistoryNavigationEnablement(false);
|
|
203
|
-
const model = this.replInput.getModel();
|
|
204
|
-
if (model) {
|
|
205
|
-
const word = model.getWordAtPosition(position);
|
|
206
|
-
const overwriteBefore = word ? word.word.length : 0;
|
|
207
|
-
const text = model.getValue();
|
|
208
|
-
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
209
|
-
const frameId = focusedStackFrame ? focusedStackFrame.frameId : undefined;
|
|
210
|
-
const response = await session.completions(frameId, focusedStackFrame?.thread.threadId || 0, text, position, overwriteBefore, token);
|
|
211
|
-
const suggestions = [];
|
|
212
|
-
const computeRange = (length) => Range.fromPositions(position.delta(0, -length), position);
|
|
213
|
-
if (response && response.body && response.body.targets) {
|
|
214
|
-
response.body.targets.forEach(item => {
|
|
215
|
-
if (item && item.label) {
|
|
216
|
-
let insertTextRules = undefined;
|
|
217
|
-
let insertText = item.text || item.label;
|
|
218
|
-
if (typeof item.selectionStart === 'number') {
|
|
219
|
-
insertTextRules = 4 ;
|
|
220
|
-
const selectionLength = typeof item.selectionLength === 'number' ? item.selectionLength : 0;
|
|
221
|
-
const placeholder = selectionLength > 0 ? '${1:' + insertText.substring(item.selectionStart, item.selectionStart + selectionLength) + '}$0' : '$0';
|
|
222
|
-
insertText = insertText.substring(0, item.selectionStart) + placeholder + insertText.substring(item.selectionStart + selectionLength);
|
|
223
|
-
}
|
|
224
|
-
suggestions.push({
|
|
225
|
-
label: item.label,
|
|
226
|
-
insertText,
|
|
227
|
-
detail: item.detail,
|
|
228
|
-
kind: CompletionItemKinds.fromString(item.type || 'property'),
|
|
229
|
-
filterText: (item.start && item.length) ? text.substring(item.start, item.start + item.length).concat(item.label) : undefined,
|
|
230
|
-
range: computeRange(item.length || overwriteBefore),
|
|
231
|
-
sortText: item.sortText,
|
|
232
|
-
insertTextRules
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
if (this.configurationService.getValue('debug').console.historySuggestions) {
|
|
238
|
-
const history = this.history.getHistory();
|
|
239
|
-
const idxLength = String(history.length).length;
|
|
240
|
-
history.forEach((h, i) => suggestions.push({
|
|
241
|
-
label: h,
|
|
242
|
-
insertText: h,
|
|
243
|
-
kind: 18 ,
|
|
244
|
-
range: computeRange(h.length),
|
|
245
|
-
sortText: 'ZZZ' + String(history.length - i).padStart(idxLength, '0')
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
248
|
-
return { suggestions };
|
|
249
|
-
}
|
|
250
|
-
return Promise.resolve({ suggestions: [] });
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
await this.selectSession();
|
|
256
|
-
}
|
|
257
|
-
getFilterStats() {
|
|
258
|
-
return {
|
|
259
|
-
total: this.tree?.getNode().children.length ?? 0,
|
|
260
|
-
filtered: this.tree?.getNode().children.filter(c => c.visible).length ?? 0
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
get isReadonly() {
|
|
264
|
-
const session = this.tree?.getInput();
|
|
265
|
-
if (session && session.state !== 0 ) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
showPreviousValue() {
|
|
271
|
-
if (!this.isReadonly) {
|
|
272
|
-
this.navigateHistory(true);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
showNextValue() {
|
|
276
|
-
if (!this.isReadonly) {
|
|
277
|
-
this.navigateHistory(false);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
focusFilter() {
|
|
281
|
-
this.filterWidget.focus();
|
|
282
|
-
}
|
|
283
|
-
setMode() {
|
|
284
|
-
if (!this.isVisible()) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
const activeEditorControl = this.editorService.activeTextEditorControl;
|
|
288
|
-
if (isCodeEditor(activeEditorControl)) {
|
|
289
|
-
this.modelChangeListener.dispose();
|
|
290
|
-
this.modelChangeListener = activeEditorControl.onDidChangeModelLanguage(() => this.setMode());
|
|
291
|
-
if (this.model && activeEditorControl.hasModel()) {
|
|
292
|
-
this.model.setLanguage(activeEditorControl.getModel().getLanguageId());
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
onDidStyleChange() {
|
|
297
|
-
if (!this.isVisible()) {
|
|
298
|
-
this.styleChangedWhenInvisible = true;
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
if (this.styleElement) {
|
|
302
|
-
this.replInput.updateOptions({
|
|
303
|
-
fontSize: this.replOptions.replConfiguration.fontSize,
|
|
304
|
-
lineHeight: this.replOptions.replConfiguration.lineHeight,
|
|
305
|
-
fontFamily: this.replOptions.replConfiguration.fontFamily === 'default' ? EDITOR_FONT_DEFAULTS.fontFamily : this.replOptions.replConfiguration.fontFamily
|
|
306
|
-
});
|
|
307
|
-
const replInputLineHeight = this.replInput.getOption(67 );
|
|
308
|
-
this.styleElement.textContent = `
|
|
309
|
-
.repl .repl-input-wrapper .repl-input-chevron {
|
|
310
|
-
line-height: ${replInputLineHeight}px
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.repl .repl-input-wrapper .monaco-editor .lines-content {
|
|
314
|
-
background-color: ${this.replOptions.replConfiguration.backgroundColor};
|
|
315
|
-
}
|
|
316
|
-
`;
|
|
317
|
-
const cssFontFamily = this.replOptions.replConfiguration.fontFamily === 'default' ? 'var(--monaco-monospace-font)' : this.replOptions.replConfiguration.fontFamily;
|
|
318
|
-
this.container.style.setProperty(`--vscode-repl-font-family`, cssFontFamily);
|
|
319
|
-
this.container.style.setProperty(`--vscode-repl-font-size`, `${this.replOptions.replConfiguration.fontSize}px`);
|
|
320
|
-
this.container.style.setProperty(`--vscode-repl-font-size-for-twistie`, `${this.replOptions.replConfiguration.fontSizeForTwistie}px`);
|
|
321
|
-
this.container.style.setProperty(`--vscode-repl-line-height`, this.replOptions.replConfiguration.cssLineHeight);
|
|
322
|
-
this.tree?.rerender();
|
|
323
|
-
if (this.bodyContentDimension) {
|
|
324
|
-
this.layoutBodyContent(this.bodyContentDimension.height, this.bodyContentDimension.width);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
navigateHistory(previous) {
|
|
329
|
-
const historyInput = (previous ?
|
|
330
|
-
(this.history.previous() ?? this.history.first()) : this.history.next())
|
|
331
|
-
?? '';
|
|
332
|
-
this.replInput.setValue(historyInput);
|
|
333
|
-
status(historyInput);
|
|
334
|
-
this.replInput.setPosition({ lineNumber: 1, column: historyInput.length + 1 });
|
|
335
|
-
this.setHistoryNavigationEnablement(true);
|
|
336
|
-
}
|
|
337
|
-
async selectSession(session) {
|
|
338
|
-
const treeInput = this.tree?.getInput();
|
|
339
|
-
if (!session) {
|
|
340
|
-
const focusedSession = this.debugService.getViewModel().focusedSession;
|
|
341
|
-
if (focusedSession) {
|
|
342
|
-
session = focusedSession;
|
|
343
|
-
}
|
|
344
|
-
else if (!treeInput || ( (sessionsToIgnore.has(treeInput)))) {
|
|
345
|
-
session = this.debugService.getModel().getSessions(true).find(s => !( (sessionsToIgnore.has(s))));
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (session) {
|
|
349
|
-
this.replElementsChangeListener?.dispose();
|
|
350
|
-
this.replElementsChangeListener = session.onDidChangeReplElements(() => {
|
|
351
|
-
this.refreshReplElements(session.getReplElements().length === 0);
|
|
352
|
-
});
|
|
353
|
-
if (this.tree && treeInput !== session) {
|
|
354
|
-
try {
|
|
355
|
-
await this.tree.setInput(session);
|
|
356
|
-
}
|
|
357
|
-
catch (err) {
|
|
358
|
-
this.logService.error(err);
|
|
359
|
-
}
|
|
360
|
-
revealLastElement(this.tree);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
this.replInput?.updateOptions({ readOnly: this.isReadonly });
|
|
364
|
-
this.updateInputDecoration();
|
|
365
|
-
}
|
|
366
|
-
async clearRepl() {
|
|
367
|
-
const session = this.tree?.getInput();
|
|
368
|
-
if (session) {
|
|
369
|
-
session.removeReplExpressions();
|
|
370
|
-
if (session.state === 0 ) {
|
|
371
|
-
sessionsToIgnore.add(session);
|
|
372
|
-
await this.selectSession();
|
|
373
|
-
this.multiSessionRepl.set(this.isMultiSessionView);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
this.replInput.focus();
|
|
377
|
-
}
|
|
378
|
-
acceptReplInput() {
|
|
379
|
-
const session = this.tree?.getInput();
|
|
380
|
-
if (session && !this.isReadonly) {
|
|
381
|
-
session.addReplExpression(this.debugService.getViewModel().focusedStackFrame, this.replInput.getValue());
|
|
382
|
-
revealLastElement(this.tree);
|
|
383
|
-
this.history.add(this.replInput.getValue());
|
|
384
|
-
this.replInput.setValue('');
|
|
385
|
-
const shouldRelayout = this.replInputLineCount > 1;
|
|
386
|
-
this.replInputLineCount = 1;
|
|
387
|
-
if (shouldRelayout && this.bodyContentDimension) {
|
|
388
|
-
this.layoutBodyContent(this.bodyContentDimension.height, this.bodyContentDimension.width);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
getVisibleContent() {
|
|
393
|
-
let text = '';
|
|
394
|
-
if (this.model && this.tree) {
|
|
395
|
-
const lineDelimiter = this.textResourcePropertiesService.getEOL(this.model.uri);
|
|
396
|
-
const traverseAndAppend = (node) => {
|
|
397
|
-
node.children.forEach(child => {
|
|
398
|
-
if (child.visible) {
|
|
399
|
-
text += ( (child.element.toString())).trimRight() + lineDelimiter;
|
|
400
|
-
if (!child.collapsed && child.children.length) {
|
|
401
|
-
traverseAndAppend(child);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
};
|
|
406
|
-
traverseAndAppend(this.tree.getNode());
|
|
407
|
-
}
|
|
408
|
-
return removeAnsiEscapeCodes(text);
|
|
409
|
-
}
|
|
410
|
-
layoutBodyContent(height, width) {
|
|
411
|
-
this.bodyContentDimension = new Dimension(width, height);
|
|
412
|
-
const replInputHeight = Math.min(this.replInput.getContentHeight(), height);
|
|
413
|
-
if (this.tree) {
|
|
414
|
-
const lastElementVisible = this.tree.scrollTop + this.tree.renderHeight >= this.tree.scrollHeight;
|
|
415
|
-
const treeHeight = height - replInputHeight;
|
|
416
|
-
this.tree.getHTMLElement().style.height = `${treeHeight}px`;
|
|
417
|
-
this.tree.layout(treeHeight, width);
|
|
418
|
-
if (lastElementVisible) {
|
|
419
|
-
revealLastElement(this.tree);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
this.replInputContainer.style.height = `${replInputHeight}px`;
|
|
423
|
-
this.replInput.layout({ width: width - 30, height: replInputHeight });
|
|
424
|
-
}
|
|
425
|
-
collapseAll() {
|
|
426
|
-
this.tree?.collapseAll();
|
|
427
|
-
}
|
|
428
|
-
getReplInput() {
|
|
429
|
-
return this.replInput;
|
|
430
|
-
}
|
|
431
|
-
focus() {
|
|
432
|
-
super.focus();
|
|
433
|
-
setTimeout(() => this.replInput.focus(), 0);
|
|
434
|
-
}
|
|
435
|
-
getActionViewItem(action) {
|
|
436
|
-
if (action.id === selectReplCommandId) {
|
|
437
|
-
const session = (this.tree ? this.tree.getInput() : undefined) ?? this.debugService.getViewModel().focusedSession;
|
|
438
|
-
return this.instantiationService.createInstance(SelectReplActionViewItem, action, session);
|
|
439
|
-
}
|
|
440
|
-
return super.getActionViewItem(action);
|
|
441
|
-
}
|
|
442
|
-
get isMultiSessionView() {
|
|
443
|
-
return this.debugService.getModel().getSessions(true).filter(s => s.hasSeparateRepl() && !( (sessionsToIgnore.has(s)))).length > 1;
|
|
444
|
-
}
|
|
445
|
-
get refreshScheduler() {
|
|
446
|
-
const autoExpanded = ( (new Set()));
|
|
447
|
-
return (
|
|
448
|
-
(new RunOnceScheduler(async () => {
|
|
449
|
-
if (!this.tree) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
if (!this.tree.getInput()) {
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
await this.tree.updateChildren(undefined, true, false, { diffIdentityProvider: identityProvider });
|
|
456
|
-
const session = this.tree.getInput();
|
|
457
|
-
if (session) {
|
|
458
|
-
const autoExpandElements = async (elements) => {
|
|
459
|
-
for (const element of elements) {
|
|
460
|
-
if (element instanceof ReplGroup) {
|
|
461
|
-
if (element.autoExpand && !( (autoExpanded.has(element.getId())))) {
|
|
462
|
-
autoExpanded.add(element.getId());
|
|
463
|
-
await this.tree.expand(element);
|
|
464
|
-
}
|
|
465
|
-
if (!this.tree.isCollapsed(element)) {
|
|
466
|
-
await autoExpandElements(element.getChildren());
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
await autoExpandElements(session.getReplElements());
|
|
472
|
-
}
|
|
473
|
-
const { total, filtered } = this.getFilterStats();
|
|
474
|
-
this.filterWidget.updateBadge(total === filtered || total === 0 ? undefined : ( (localizeWithPath(
|
|
475
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
476
|
-
'showing filtered repl lines',
|
|
477
|
-
"Showing {0} of {1}",
|
|
478
|
-
filtered,
|
|
479
|
-
total
|
|
480
|
-
))));
|
|
481
|
-
}, Repl_1.REFRESH_DELAY))
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
render() {
|
|
485
|
-
super.render();
|
|
486
|
-
this._register(registerNavigableContainer({
|
|
487
|
-
focusNotifiers: [this, this.filterWidget],
|
|
488
|
-
focusNextWidget: () => {
|
|
489
|
-
const element = this.tree?.getHTMLElement();
|
|
490
|
-
if (this.filterWidget.hasFocus()) {
|
|
491
|
-
this.tree?.domFocus();
|
|
492
|
-
}
|
|
493
|
-
else if (element && isActiveElement(element)) {
|
|
494
|
-
this.focus();
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
focusPreviousWidget: () => {
|
|
498
|
-
const element = this.tree?.getHTMLElement();
|
|
499
|
-
if (this.replInput.hasTextFocus()) {
|
|
500
|
-
this.tree?.domFocus();
|
|
501
|
-
}
|
|
502
|
-
else if (element && isActiveElement(element)) {
|
|
503
|
-
this.focusFilter();
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}));
|
|
507
|
-
}
|
|
508
|
-
renderBody(parent) {
|
|
509
|
-
super.renderBody(parent);
|
|
510
|
-
this.container = append(parent, $('.repl'));
|
|
511
|
-
this.treeContainer = append(this.container, $(`.repl-tree.${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`));
|
|
512
|
-
this.createReplInput(this.container);
|
|
513
|
-
this.createReplTree();
|
|
514
|
-
}
|
|
515
|
-
createReplTree() {
|
|
516
|
-
this.replDelegate = ( (new ReplDelegate(this.configurationService, this.replOptions)));
|
|
517
|
-
const wordWrap = this.configurationService.getValue('debug').console.wordWrap;
|
|
518
|
-
this.treeContainer.classList.toggle('word-wrap', wordWrap);
|
|
519
|
-
const linkDetector = this.instantiationService.createInstance(LinkDetector);
|
|
520
|
-
const tree = this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'DebugRepl', this.treeContainer, this.replDelegate, [
|
|
521
|
-
this.instantiationService.createInstance(ReplVariablesRenderer, linkDetector),
|
|
522
|
-
this.instantiationService.createInstance(ReplOutputElementRenderer, linkDetector),
|
|
523
|
-
( (new ReplEvaluationInputsRenderer())),
|
|
524
|
-
this.instantiationService.createInstance(ReplGroupRenderer, linkDetector),
|
|
525
|
-
( (new ReplEvaluationResultsRenderer(linkDetector))),
|
|
526
|
-
( (new ReplRawObjectsRenderer(linkDetector))),
|
|
527
|
-
],
|
|
528
|
-
(
|
|
529
|
-
(new ReplDataSource())), {
|
|
530
|
-
filter: this.filter,
|
|
531
|
-
accessibilityProvider: ( (new ReplAccessibilityProvider())),
|
|
532
|
-
identityProvider,
|
|
533
|
-
mouseSupport: false,
|
|
534
|
-
findWidgetEnabled: false,
|
|
535
|
-
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e) => ( (e.toString(true))) },
|
|
536
|
-
horizontalScrolling: !wordWrap,
|
|
537
|
-
setRowLineHeight: false,
|
|
538
|
-
supportDynamicHeights: wordWrap,
|
|
539
|
-
overrideStyles: {
|
|
540
|
-
listBackground: this.getBackgroundColor()
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
this._register(tree.onDidChangeContentHeight(() => {
|
|
544
|
-
if (tree.scrollHeight !== this.previousTreeScrollHeight) {
|
|
545
|
-
const lastElementWasVisible = tree.scrollTop + tree.renderHeight >= this.previousTreeScrollHeight - 2;
|
|
546
|
-
if (lastElementWasVisible) {
|
|
547
|
-
setTimeout(() => {
|
|
548
|
-
revealLastElement(tree);
|
|
549
|
-
}, 0);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
this.previousTreeScrollHeight = tree.scrollHeight;
|
|
553
|
-
}));
|
|
554
|
-
this._register(tree.onContextMenu(e => this.onContextMenu(e)));
|
|
555
|
-
let lastSelectedString;
|
|
556
|
-
this._register(tree.onMouseClick(() => {
|
|
557
|
-
const selection = getWindow(this.treeContainer).getSelection();
|
|
558
|
-
if (!selection || selection.type !== 'Range' || lastSelectedString === ( (selection.toString()))) {
|
|
559
|
-
this.replInput.focus();
|
|
560
|
-
}
|
|
561
|
-
lastSelectedString = selection ? ( (selection.toString())) : '';
|
|
562
|
-
}));
|
|
563
|
-
this.selectSession();
|
|
564
|
-
this.styleElement = createStyleSheet(this.container);
|
|
565
|
-
this.onDidStyleChange();
|
|
566
|
-
}
|
|
567
|
-
createReplInput(container) {
|
|
568
|
-
this.replInputContainer = append(container, $('.repl-input-wrapper'));
|
|
569
|
-
append(this.replInputContainer, $('.repl-input-chevron' + ThemeIcon.asCSSSelector(debugConsoleEvaluationPrompt)));
|
|
570
|
-
const { historyNavigationBackwardsEnablement, historyNavigationForwardsEnablement } = this._register(registerAndCreateHistoryNavigationContext(this.scopedContextKeyService, this));
|
|
571
|
-
this.setHistoryNavigationEnablement = enabled => {
|
|
572
|
-
historyNavigationBackwardsEnablement.set(enabled);
|
|
573
|
-
historyNavigationForwardsEnablement.set(enabled);
|
|
574
|
-
};
|
|
575
|
-
CONTEXT_IN_DEBUG_REPL.bindTo(this.scopedContextKeyService).set(true);
|
|
576
|
-
this.scopedInstantiationService = this.instantiationService.createChild(( (new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
|
|
577
|
-
const options = getSimpleEditorOptions(this.configurationService);
|
|
578
|
-
options.readOnly = true;
|
|
579
|
-
options.suggest = { showStatusBar: true };
|
|
580
|
-
const config = this.configurationService.getValue('debug');
|
|
581
|
-
options.acceptSuggestionOnEnter = config.console.acceptSuggestionOnEnter === 'on' ? 'on' : 'off';
|
|
582
|
-
options.ariaLabel = ( (localizeWithPath('vs/workbench/contrib/debug/browser/repl', 'debugConsole', "Debug Console")));
|
|
583
|
-
this.replInput = this.scopedInstantiationService.createInstance(CodeEditorWidget, this.replInputContainer, options, getSimpleCodeEditorWidgetOptions());
|
|
584
|
-
this._register(this.replInput.onDidChangeModelContent(() => {
|
|
585
|
-
const model = this.replInput.getModel();
|
|
586
|
-
this.setHistoryNavigationEnablement(!!model && model.getValue() === '');
|
|
587
|
-
const lineCount = model ? Math.min(10, model.getLineCount()) : 1;
|
|
588
|
-
if (lineCount !== this.replInputLineCount) {
|
|
589
|
-
this.replInputLineCount = lineCount;
|
|
590
|
-
if (this.bodyContentDimension) {
|
|
591
|
-
this.layoutBodyContent(this.bodyContentDimension.height, this.bodyContentDimension.width);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
}));
|
|
595
|
-
this._register(this.replInput.onDidFocusEditorText(() => this.updateInputDecoration()));
|
|
596
|
-
this._register(this.replInput.onDidBlurEditorText(() => this.updateInputDecoration()));
|
|
597
|
-
this._register(addStandardDisposableListener(this.replInputContainer, EventType.FOCUS, () => this.replInputContainer.classList.add('synthetic-focus')));
|
|
598
|
-
this._register(addStandardDisposableListener(this.replInputContainer, EventType.BLUR, () => this.replInputContainer.classList.remove('synthetic-focus')));
|
|
599
|
-
}
|
|
600
|
-
onContextMenu(e) {
|
|
601
|
-
const actions = [];
|
|
602
|
-
createAndFillInContextMenuActions(this.menu, { arg: e.element, shouldForwardArgs: false }, actions);
|
|
603
|
-
this.contextMenuService.showContextMenu({
|
|
604
|
-
getAnchor: () => e.anchor,
|
|
605
|
-
getActions: () => actions,
|
|
606
|
-
getActionsContext: () => e.element
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
refreshReplElements(noDelay) {
|
|
610
|
-
if (this.tree && this.isVisible()) {
|
|
611
|
-
if (this.refreshScheduler.isScheduled()) {
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
this.refreshScheduler.schedule(noDelay ? 0 : undefined);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
updateInputDecoration() {
|
|
618
|
-
if (!this.replInput) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
const decorations = [];
|
|
622
|
-
if (this.isReadonly && this.replInput.hasTextFocus() && !this.replInput.getValue()) {
|
|
623
|
-
const transparentForeground = resolveColorValue(editorForeground, this.themeService.getColorTheme())?.transparent(0.4);
|
|
624
|
-
decorations.push({
|
|
625
|
-
range: {
|
|
626
|
-
startLineNumber: 0,
|
|
627
|
-
endLineNumber: 0,
|
|
628
|
-
startColumn: 0,
|
|
629
|
-
endColumn: 1
|
|
630
|
-
},
|
|
631
|
-
renderOptions: {
|
|
632
|
-
after: {
|
|
633
|
-
contentText: ( (localizeWithPath(
|
|
634
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
635
|
-
'startDebugFirst',
|
|
636
|
-
"Please start a debug session to evaluate expressions"
|
|
637
|
-
))),
|
|
638
|
-
color: transparentForeground ? ( (transparentForeground.toString())) : undefined
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
this.replInput.setDecorationsByType('repl-decoration', DECORATION_KEY, decorations);
|
|
644
|
-
}
|
|
645
|
-
saveState() {
|
|
646
|
-
const replHistory = this.history.getHistory();
|
|
647
|
-
if (replHistory.length) {
|
|
648
|
-
this.storageService.store(HISTORY_STORAGE_KEY, JSON.stringify(replHistory), 1 , 1 );
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
this.storageService.remove(HISTORY_STORAGE_KEY, 1 );
|
|
652
|
-
}
|
|
653
|
-
const filterHistory = this.filterWidget.getHistory();
|
|
654
|
-
if (filterHistory.length) {
|
|
655
|
-
this.storageService.store(FILTER_HISTORY_STORAGE_KEY, JSON.stringify(filterHistory), 1 , 1 );
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
this.storageService.remove(FILTER_HISTORY_STORAGE_KEY, 1 );
|
|
659
|
-
}
|
|
660
|
-
const filterValue = this.filterWidget.getFilterText();
|
|
661
|
-
if (filterValue) {
|
|
662
|
-
this.storageService.store(FILTER_VALUE_STORAGE_KEY, filterValue, 1 , 1 );
|
|
663
|
-
}
|
|
664
|
-
else {
|
|
665
|
-
this.storageService.remove(FILTER_VALUE_STORAGE_KEY, 1 );
|
|
666
|
-
}
|
|
667
|
-
super.saveState();
|
|
668
|
-
}
|
|
669
|
-
dispose() {
|
|
670
|
-
this.replInput?.dispose();
|
|
671
|
-
this.replElementsChangeListener?.dispose();
|
|
672
|
-
this.refreshScheduler.dispose();
|
|
673
|
-
this.modelChangeListener.dispose();
|
|
674
|
-
super.dispose();
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
Repl.__decorator = ( (__decorate([
|
|
678
|
-
memoize
|
|
679
|
-
], Repl.prototype, "refreshScheduler", null)));
|
|
680
|
-
Repl = Repl_1 = ( (__decorate([
|
|
681
|
-
( (__param(1, IDebugService))),
|
|
682
|
-
( (__param(2, IInstantiationService))),
|
|
683
|
-
( (__param(3, IStorageService))),
|
|
684
|
-
( (__param(4, IThemeService))),
|
|
685
|
-
( (__param(5, IModelService))),
|
|
686
|
-
( (__param(6, IContextKeyService))),
|
|
687
|
-
( (__param(7, ICodeEditorService))),
|
|
688
|
-
( (__param(8, IViewDescriptorService))),
|
|
689
|
-
( (__param(9, IContextMenuService))),
|
|
690
|
-
( (__param(10, IConfigurationService))),
|
|
691
|
-
( (__param(11, ITextResourcePropertiesService))),
|
|
692
|
-
( (__param(12, IEditorService))),
|
|
693
|
-
( (__param(13, IKeybindingService))),
|
|
694
|
-
( (__param(14, IOpenerService))),
|
|
695
|
-
( (__param(15, ITelemetryService))),
|
|
696
|
-
( (__param(16, IMenuService))),
|
|
697
|
-
( (__param(17, ILanguageFeaturesService))),
|
|
698
|
-
( (__param(18, ILogService)))
|
|
699
|
-
], Repl)));
|
|
700
|
-
let ReplOptions = class ReplOptions extends Disposable {
|
|
701
|
-
static { ReplOptions_1 = this; }
|
|
702
|
-
static { this.lineHeightEm = 1.4; }
|
|
703
|
-
get replConfiguration() {
|
|
704
|
-
return this._replConfig;
|
|
705
|
-
}
|
|
706
|
-
constructor(viewId, backgroundColorDelegate, configurationService, themeService, viewDescriptorService) {
|
|
707
|
-
super();
|
|
708
|
-
this.backgroundColorDelegate = backgroundColorDelegate;
|
|
709
|
-
this.configurationService = configurationService;
|
|
710
|
-
this.themeService = themeService;
|
|
711
|
-
this.viewDescriptorService = viewDescriptorService;
|
|
712
|
-
this._onDidChange = this._register(( (new Emitter())));
|
|
713
|
-
this.onDidChange = this._onDidChange.event;
|
|
714
|
-
this._register(this.themeService.onDidColorThemeChange(e => this.update()));
|
|
715
|
-
this._register(this.viewDescriptorService.onDidChangeLocation(e => {
|
|
716
|
-
if (( (e.views.some(v => v.id === viewId)))) {
|
|
717
|
-
this.update();
|
|
718
|
-
}
|
|
719
|
-
}));
|
|
720
|
-
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
721
|
-
if (e.affectsConfiguration('debug.console.lineHeight') || e.affectsConfiguration('debug.console.fontSize') || e.affectsConfiguration('debug.console.fontFamily')) {
|
|
722
|
-
this.update();
|
|
723
|
-
}
|
|
724
|
-
}));
|
|
725
|
-
this.update();
|
|
726
|
-
}
|
|
727
|
-
update() {
|
|
728
|
-
const debugConsole = this.configurationService.getValue('debug').console;
|
|
729
|
-
this._replConfig = {
|
|
730
|
-
fontSize: debugConsole.fontSize,
|
|
731
|
-
fontFamily: debugConsole.fontFamily,
|
|
732
|
-
lineHeight: debugConsole.lineHeight ? debugConsole.lineHeight : ReplOptions_1.lineHeightEm * debugConsole.fontSize,
|
|
733
|
-
cssLineHeight: debugConsole.lineHeight ? `${debugConsole.lineHeight}px` : `${ReplOptions_1.lineHeightEm}em`,
|
|
734
|
-
backgroundColor: this.themeService.getColorTheme().getColor(this.backgroundColorDelegate()),
|
|
735
|
-
fontSizeForTwistie: debugConsole.fontSize * ReplOptions_1.lineHeightEm / 2 - 8
|
|
736
|
-
};
|
|
737
|
-
this._onDidChange.fire();
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
ReplOptions = ReplOptions_1 = ( (__decorate([
|
|
741
|
-
( (__param(2, IConfigurationService))),
|
|
742
|
-
( (__param(3, IThemeService))),
|
|
743
|
-
( (__param(4, IViewDescriptorService)))
|
|
744
|
-
], ReplOptions)));
|
|
745
|
-
class AcceptReplInputAction extends EditorAction {
|
|
746
|
-
constructor() {
|
|
747
|
-
super({
|
|
748
|
-
id: 'repl.action.acceptInput',
|
|
749
|
-
label: ( (localizeWithPath(
|
|
750
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
751
|
-
{ key: 'actions.repl.acceptInput', comment: ['Apply input from the debug console input box'] },
|
|
752
|
-
"REPL Accept Input"
|
|
753
|
-
))),
|
|
754
|
-
alias: 'REPL Accept Input',
|
|
755
|
-
precondition: CONTEXT_IN_DEBUG_REPL,
|
|
756
|
-
kbOpts: {
|
|
757
|
-
kbExpr: EditorContextKeys.textInputFocus,
|
|
758
|
-
primary: 3 ,
|
|
759
|
-
weight: 100
|
|
760
|
-
}
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
run(accessor, editor) {
|
|
764
|
-
SuggestController.get(editor)?.cancelSuggestWidget();
|
|
765
|
-
const repl = getReplView(accessor.get(IViewsService));
|
|
766
|
-
repl?.acceptReplInput();
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
class FilterReplAction extends EditorAction {
|
|
770
|
-
constructor() {
|
|
771
|
-
super({
|
|
772
|
-
id: 'repl.action.filter',
|
|
773
|
-
label: ( (localizeWithPath(
|
|
774
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
775
|
-
'repl.action.filter',
|
|
776
|
-
"REPL Focus Content to Filter"
|
|
777
|
-
))),
|
|
778
|
-
alias: 'REPL Filter',
|
|
779
|
-
precondition: CONTEXT_IN_DEBUG_REPL,
|
|
780
|
-
kbOpts: {
|
|
781
|
-
kbExpr: EditorContextKeys.textInputFocus,
|
|
782
|
-
primary: 2048 | 36 ,
|
|
783
|
-
weight: 100
|
|
784
|
-
}
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
run(accessor, editor) {
|
|
788
|
-
const repl = getReplView(accessor.get(IViewsService));
|
|
789
|
-
repl?.focusFilter();
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
class ReplCopyAllAction extends EditorAction {
|
|
793
|
-
constructor() {
|
|
794
|
-
super({
|
|
795
|
-
id: 'repl.action.copyAll',
|
|
796
|
-
label: ( (localizeWithPath(
|
|
797
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
798
|
-
'actions.repl.copyAll',
|
|
799
|
-
"Debug: Console Copy All"
|
|
800
|
-
))),
|
|
801
|
-
alias: 'Debug Console Copy All',
|
|
802
|
-
precondition: CONTEXT_IN_DEBUG_REPL,
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
run(accessor, editor) {
|
|
806
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
807
|
-
const repl = getReplView(accessor.get(IViewsService));
|
|
808
|
-
if (repl) {
|
|
809
|
-
return clipboardService.writeText(repl.getVisibleContent());
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
registerEditorAction(AcceptReplInputAction);
|
|
814
|
-
registerEditorAction(ReplCopyAllAction);
|
|
815
|
-
registerEditorAction(FilterReplAction);
|
|
816
|
-
class SelectReplActionViewItem extends FocusSessionActionViewItem {
|
|
817
|
-
getSessions() {
|
|
818
|
-
return this.debugService.getModel().getSessions(true).filter(s => s.hasSeparateRepl() && !( (sessionsToIgnore.has(s))));
|
|
819
|
-
}
|
|
820
|
-
mapFocusedSessionToSelected(focusedSession) {
|
|
821
|
-
while (focusedSession.parentSession && !focusedSession.hasSeparateRepl()) {
|
|
822
|
-
focusedSession = focusedSession.parentSession;
|
|
823
|
-
}
|
|
824
|
-
return focusedSession;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
function getReplView(viewsService) {
|
|
828
|
-
return viewsService.getActiveViewWithId(REPL_VIEW_ID) ?? undefined;
|
|
829
|
-
}
|
|
830
|
-
const selectReplCommandId = 'workbench.action.debug.selectRepl';
|
|
831
|
-
registerAction2(class extends ViewAction {
|
|
832
|
-
constructor() {
|
|
833
|
-
super({
|
|
834
|
-
id: selectReplCommandId,
|
|
835
|
-
viewId: REPL_VIEW_ID,
|
|
836
|
-
title: ( (localizeWithPath(
|
|
837
|
-
'vs/workbench/contrib/debug/browser/repl',
|
|
838
|
-
'selectRepl',
|
|
839
|
-
"Select Debug Console"
|
|
840
|
-
))),
|
|
841
|
-
f1: false,
|
|
842
|
-
menu: {
|
|
843
|
-
id: MenuId.ViewTitle,
|
|
844
|
-
group: 'navigation',
|
|
845
|
-
when: ( (ContextKeyExpr.and(
|
|
846
|
-
(ContextKeyExpr.equals('view', REPL_VIEW_ID)),
|
|
847
|
-
CONTEXT_MULTI_SESSION_REPL
|
|
848
|
-
))),
|
|
849
|
-
order: 20
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
async runInView(accessor, view, session) {
|
|
854
|
-
const debugService = accessor.get(IDebugService);
|
|
855
|
-
if (session && session.state !== 0 && session !== debugService.getViewModel().focusedSession) {
|
|
856
|
-
if (session.state !== 2 ) {
|
|
857
|
-
const stopppedChildSession = debugService.getModel().getSessions().find(s => s.parentSession === session && s.state === 2 );
|
|
858
|
-
if (stopppedChildSession) {
|
|
859
|
-
session = stopppedChildSession;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
await debugService.focusStackFrame(undefined, undefined, session, { explicit: true });
|
|
863
|
-
}
|
|
864
|
-
await view.selectSession(session);
|
|
865
|
-
}
|
|
866
|
-
});
|
|
867
|
-
registerAction2(class extends ViewAction {
|
|
868
|
-
constructor() {
|
|
869
|
-
super({
|
|
870
|
-
id: 'workbench.debug.panel.action.clearReplAction',
|
|
871
|
-
viewId: REPL_VIEW_ID,
|
|
872
|
-
title: ( (localize2WithPath('vs/workbench/contrib/debug/browser/repl', 'clearRepl', 'Clear Console'))),
|
|
873
|
-
f1: true,
|
|
874
|
-
icon: debugConsoleClearAll,
|
|
875
|
-
menu: [{
|
|
876
|
-
id: MenuId.ViewTitle,
|
|
877
|
-
group: 'navigation',
|
|
878
|
-
when: ( (ContextKeyExpr.equals('view', REPL_VIEW_ID))),
|
|
879
|
-
order: 30
|
|
880
|
-
}, {
|
|
881
|
-
id: MenuId.DebugConsoleContext,
|
|
882
|
-
group: 'z_commands',
|
|
883
|
-
order: 20
|
|
884
|
-
}]
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
runInView(_accessor, view) {
|
|
888
|
-
const accessibilitySignalService = _accessor.get(IAccessibilitySignalService);
|
|
889
|
-
view.clearRepl();
|
|
890
|
-
accessibilitySignalService.playSignal(AccessibilitySignal.clear);
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
registerAction2(class extends ViewAction {
|
|
894
|
-
constructor() {
|
|
895
|
-
super({
|
|
896
|
-
id: 'debug.collapseRepl',
|
|
897
|
-
title: ( (localizeWithPath('vs/workbench/contrib/debug/browser/repl', 'collapse', "Collapse All"))),
|
|
898
|
-
viewId: REPL_VIEW_ID,
|
|
899
|
-
menu: {
|
|
900
|
-
id: MenuId.DebugConsoleContext,
|
|
901
|
-
group: 'z_commands',
|
|
902
|
-
order: 10
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
|
-
runInView(_accessor, view) {
|
|
907
|
-
view.collapseAll();
|
|
908
|
-
view.focus();
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
registerAction2(class extends ViewAction {
|
|
912
|
-
constructor() {
|
|
913
|
-
super({
|
|
914
|
-
id: 'debug.replPaste',
|
|
915
|
-
title: ( (localizeWithPath('vs/workbench/contrib/debug/browser/repl', 'paste', "Paste"))),
|
|
916
|
-
viewId: REPL_VIEW_ID,
|
|
917
|
-
precondition: ( (CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(0 )))),
|
|
918
|
-
menu: {
|
|
919
|
-
id: MenuId.DebugConsoleContext,
|
|
920
|
-
group: '2_cutcopypaste',
|
|
921
|
-
order: 30
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
async runInView(accessor, view) {
|
|
926
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
927
|
-
const clipboardText = await clipboardService.readText();
|
|
928
|
-
if (clipboardText) {
|
|
929
|
-
const replInput = view.getReplInput();
|
|
930
|
-
replInput.setValue(replInput.getValue().concat(clipboardText));
|
|
931
|
-
view.focus();
|
|
932
|
-
const model = replInput.getModel();
|
|
933
|
-
const lineNumber = model ? model.getLineCount() : 0;
|
|
934
|
-
const column = model?.getLineMaxColumn(lineNumber);
|
|
935
|
-
if (typeof lineNumber === 'number' && typeof column === 'number') {
|
|
936
|
-
replInput.setPosition({ lineNumber, column });
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
registerAction2(class extends ViewAction {
|
|
942
|
-
constructor() {
|
|
943
|
-
super({
|
|
944
|
-
id: 'workbench.debug.action.copyAll',
|
|
945
|
-
title: ( (localizeWithPath('vs/workbench/contrib/debug/browser/repl', 'copyAll', "Copy All"))),
|
|
946
|
-
viewId: REPL_VIEW_ID,
|
|
947
|
-
menu: {
|
|
948
|
-
id: MenuId.DebugConsoleContext,
|
|
949
|
-
group: '2_cutcopypaste',
|
|
950
|
-
order: 20
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
async runInView(accessor, view) {
|
|
955
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
956
|
-
await clipboardService.writeText(view.getVisibleContent());
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
registerAction2(class extends Action2 {
|
|
960
|
-
constructor() {
|
|
961
|
-
super({
|
|
962
|
-
id: 'debug.replCopy',
|
|
963
|
-
title: ( (localizeWithPath('vs/workbench/contrib/debug/browser/repl', 'copy', "Copy"))),
|
|
964
|
-
menu: {
|
|
965
|
-
id: MenuId.DebugConsoleContext,
|
|
966
|
-
group: '2_cutcopypaste',
|
|
967
|
-
order: 10
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
async run(accessor, element) {
|
|
972
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
973
|
-
const debugService = accessor.get(IDebugService);
|
|
974
|
-
const nativeSelection = getActiveWindow().getSelection();
|
|
975
|
-
const selectedText = nativeSelection?.toString();
|
|
976
|
-
if (selectedText && selectedText.length > 0) {
|
|
977
|
-
return clipboardService.writeText(selectedText);
|
|
978
|
-
}
|
|
979
|
-
else if (element) {
|
|
980
|
-
return clipboardService.writeText((await this.tryEvaluateAndCopy(debugService, element)) || ( (element.toString())));
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
async tryEvaluateAndCopy(debugService, element) {
|
|
984
|
-
if (!(element instanceof ReplEvaluationResult)) {
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
const stackFrame = debugService.getViewModel().focusedStackFrame;
|
|
988
|
-
const session = debugService.getViewModel().focusedSession;
|
|
989
|
-
if (!stackFrame || !session || !session.capabilities.supportsClipboardContext) {
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
try {
|
|
993
|
-
const evaluation = await session.evaluate(element.originalExpression, stackFrame.frameId, 'clipboard');
|
|
994
|
-
return evaluation?.body.result;
|
|
995
|
-
}
|
|
996
|
-
catch (e) {
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
});
|
|
1001
|
-
|
|
1002
|
-
export { Repl };
|