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