@codingame/monaco-vscode-debug-service-override 1.82.4 → 1.82.5-next.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 (73) hide show
  1. package/debug.d.ts +5 -0
  2. package/debug.js +24 -0
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  4. package/external/tslib/tslib.es6.js +11 -0
  5. package/index.d.ts +1 -1
  6. package/index.js +1 -1
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +2 -2
  9. package/vscode/src/vs/editor/common/services/languageFeaturesService.js +44 -0
  10. package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +200 -0
  11. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +785 -0
  12. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +399 -0
  13. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1298 -0
  14. package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
  15. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +960 -0
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +497 -0
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +299 -0
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +400 -0
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +827 -0
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +621 -0
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +60 -0
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +527 -0
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +681 -0
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +356 -0
  26. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
  27. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +82 -0
  28. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +143 -0
  29. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1174 -0
  30. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1144 -0
  31. package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +106 -0
  32. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +68 -0
  33. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +275 -0
  34. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +314 -0
  35. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +168 -0
  36. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +663 -0
  37. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +105 -0
  38. package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +231 -0
  39. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +631 -0
  40. package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +6 -0
  41. package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +6 -0
  42. package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
  43. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
  44. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
  45. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
  46. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
  47. package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
  48. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +695 -0
  49. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +953 -0
  50. package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
  51. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +336 -0
  52. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +98 -0
  53. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +575 -0
  54. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +415 -0
  55. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +102 -0
  56. package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
  57. package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
  58. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +100 -0
  59. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +59 -0
  60. package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1482 -0
  61. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +346 -0
  62. package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +123 -0
  63. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +175 -0
  64. package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
  65. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +117 -0
  66. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +260 -0
  67. package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +27 -0
  68. package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +83 -0
  69. package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +283 -0
  70. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +305 -0
  71. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +28 -0
  72. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +176 -0
  73. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +12 -0
@@ -0,0 +1,283 @@
1
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
2
+ import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
3
+ import { isObject, isString } from 'monaco-editor/esm/vs/base/common/types.js';
4
+ import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
5
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
6
+ import { ExpressionContainer } from './debugModel.js';
7
+
8
+ const MAX_REPL_LENGTH = 10000;
9
+ let topReplElementCounter = 0;
10
+ const getUniqueId = () => `topReplElement:${topReplElementCounter++}`;
11
+ class ReplOutputElement {
12
+ constructor(session, id, value, severity, sourceData, expression) {
13
+ this.session = session;
14
+ this.id = id;
15
+ this.value = value;
16
+ this.severity = severity;
17
+ this.sourceData = sourceData;
18
+ this.expression = expression;
19
+ this._count = 1;
20
+ this._onDidChangeCount = ( new Emitter());
21
+ }
22
+ toString(includeSource = false) {
23
+ let valueRespectCount = this.value;
24
+ for (let i = 1; i < this.count; i++) {
25
+ valueRespectCount += (valueRespectCount.endsWith('\n') ? '' : '\n') + this.value;
26
+ }
27
+ const sourceStr = (this.sourceData && includeSource) ? ` ${this.sourceData.source.name}` : '';
28
+ return valueRespectCount + sourceStr;
29
+ }
30
+ getId() {
31
+ return this.id;
32
+ }
33
+ getChildren() {
34
+ return this.expression?.getChildren() || Promise.resolve([]);
35
+ }
36
+ set count(value) {
37
+ this._count = value;
38
+ this._onDidChangeCount.fire();
39
+ }
40
+ get count() {
41
+ return this._count;
42
+ }
43
+ get onDidChangeCount() {
44
+ return this._onDidChangeCount.event;
45
+ }
46
+ get hasChildren() {
47
+ return !!this.expression?.hasChildren;
48
+ }
49
+ }
50
+ class ReplVariableElement {
51
+ constructor(expression, severity, sourceData) {
52
+ this.expression = expression;
53
+ this.severity = severity;
54
+ this.sourceData = sourceData;
55
+ this.id = generateUuid();
56
+ this.hasChildren = expression.hasChildren;
57
+ }
58
+ getChildren() {
59
+ return this.expression.getChildren();
60
+ }
61
+ toString() {
62
+ return ( this.expression.toString());
63
+ }
64
+ getId() {
65
+ return this.id;
66
+ }
67
+ }
68
+ class RawObjectReplElement {
69
+ static { this.MAX_CHILDREN = 1000; }
70
+ constructor(id, name, valueObj, sourceData, annotation) {
71
+ this.id = id;
72
+ this.name = name;
73
+ this.valueObj = valueObj;
74
+ this.sourceData = sourceData;
75
+ this.annotation = annotation;
76
+ }
77
+ getId() {
78
+ return this.id;
79
+ }
80
+ get value() {
81
+ if (this.valueObj === null) {
82
+ return 'null';
83
+ }
84
+ else if (Array.isArray(this.valueObj)) {
85
+ return `Array[${this.valueObj.length}]`;
86
+ }
87
+ else if (isObject(this.valueObj)) {
88
+ return 'Object';
89
+ }
90
+ else if (isString(this.valueObj)) {
91
+ return `"${this.valueObj}"`;
92
+ }
93
+ return String(this.valueObj) || '';
94
+ }
95
+ get hasChildren() {
96
+ return (Array.isArray(this.valueObj) && this.valueObj.length > 0) || (isObject(this.valueObj) && Object.getOwnPropertyNames(this.valueObj).length > 0);
97
+ }
98
+ evaluateLazy() {
99
+ throw new Error('Method not implemented.');
100
+ }
101
+ getChildren() {
102
+ let result = [];
103
+ if (Array.isArray(this.valueObj)) {
104
+ result = ( this.valueObj.slice(0, RawObjectReplElement.MAX_CHILDREN)
105
+ .map((v, index) => ( new RawObjectReplElement(`${this.id}:${index}`, String(index), v))));
106
+ }
107
+ else if (isObject(this.valueObj)) {
108
+ result = ( Object.getOwnPropertyNames(this.valueObj).slice(0, RawObjectReplElement.MAX_CHILDREN)
109
+ .map((key, index) => ( new RawObjectReplElement(`${this.id}:${index}`, key, this.valueObj[key]))));
110
+ }
111
+ return Promise.resolve(result);
112
+ }
113
+ toString() {
114
+ return `${this.name}\n${this.value}`;
115
+ }
116
+ }
117
+ class ReplEvaluationInput {
118
+ constructor(value) {
119
+ this.value = value;
120
+ this.id = generateUuid();
121
+ }
122
+ toString() {
123
+ return this.value;
124
+ }
125
+ getId() {
126
+ return this.id;
127
+ }
128
+ }
129
+ class ReplEvaluationResult extends ExpressionContainer {
130
+ get available() {
131
+ return this._available;
132
+ }
133
+ constructor(originalExpression) {
134
+ super(undefined, undefined, 0, generateUuid());
135
+ this.originalExpression = originalExpression;
136
+ this._available = true;
137
+ }
138
+ async evaluateExpression(expression, session, stackFrame, context) {
139
+ const result = await super.evaluateExpression(expression, session, stackFrame, context);
140
+ this._available = result;
141
+ return result;
142
+ }
143
+ toString() {
144
+ return `${this.value}`;
145
+ }
146
+ }
147
+ class ReplGroup {
148
+ static { this.COUNTER = 0; }
149
+ constructor(name, autoExpand, sourceData) {
150
+ this.name = name;
151
+ this.autoExpand = autoExpand;
152
+ this.sourceData = sourceData;
153
+ this.children = [];
154
+ this.ended = false;
155
+ this.id = `replGroup:${ReplGroup.COUNTER++}`;
156
+ }
157
+ get hasChildren() {
158
+ return true;
159
+ }
160
+ getId() {
161
+ return this.id;
162
+ }
163
+ toString(includeSource = false) {
164
+ const sourceStr = (includeSource && this.sourceData) ? ` ${this.sourceData.source.name}` : '';
165
+ return this.name + sourceStr;
166
+ }
167
+ addChild(child) {
168
+ const lastElement = this.children.length ? this.children[this.children.length - 1] : undefined;
169
+ if (lastElement instanceof ReplGroup && !lastElement.hasEnded) {
170
+ lastElement.addChild(child);
171
+ }
172
+ else {
173
+ this.children.push(child);
174
+ }
175
+ }
176
+ getChildren() {
177
+ return this.children;
178
+ }
179
+ end() {
180
+ const lastElement = this.children.length ? this.children[this.children.length - 1] : undefined;
181
+ if (lastElement instanceof ReplGroup && !lastElement.hasEnded) {
182
+ lastElement.end();
183
+ }
184
+ else {
185
+ this.ended = true;
186
+ }
187
+ }
188
+ get hasEnded() {
189
+ return this.ended;
190
+ }
191
+ }
192
+ function areSourcesEqual(first, second) {
193
+ if (!first && !second) {
194
+ return true;
195
+ }
196
+ if (first && second) {
197
+ return first.column === second.column && first.lineNumber === second.lineNumber && ( first.source.uri.toString()) === ( second.source.uri.toString());
198
+ }
199
+ return false;
200
+ }
201
+ class ReplModel {
202
+ constructor(configurationService) {
203
+ this.configurationService = configurationService;
204
+ this.replElements = [];
205
+ this._onDidChangeElements = ( new Emitter());
206
+ this.onDidChangeElements = this._onDidChangeElements.event;
207
+ }
208
+ getReplElements() {
209
+ return this.replElements;
210
+ }
211
+ async addReplExpression(session, stackFrame, name) {
212
+ this.addReplElement(( new ReplEvaluationInput(name)));
213
+ const result = ( new ReplEvaluationResult(name));
214
+ await result.evaluateExpression(name, session, stackFrame, 'repl');
215
+ this.addReplElement(result);
216
+ }
217
+ appendToRepl(session, { output, expression, sev, source }) {
218
+ const clearAnsiSequence = '\u001b[2J';
219
+ const clearAnsiIndex = output.lastIndexOf(clearAnsiSequence);
220
+ if (clearAnsiIndex !== -1) {
221
+ this.removeReplExpressions();
222
+ this.appendToRepl(session, { output: ( nls.localize('consoleCleared', "Console was cleared")), sev: Severity.Ignore });
223
+ output = output.substring(clearAnsiIndex + clearAnsiSequence.length);
224
+ }
225
+ if (expression) {
226
+ this.addReplElement(output
227
+ ? ( new ReplOutputElement(session, getUniqueId(), output, sev, source, expression))
228
+ : ( new ReplVariableElement(expression, sev, source)));
229
+ return;
230
+ }
231
+ const previousElement = this.replElements.length ? this.replElements[this.replElements.length - 1] : undefined;
232
+ if (previousElement instanceof ReplOutputElement && previousElement.severity === sev) {
233
+ const config = this.configurationService.getValue('debug');
234
+ if (previousElement.value === output && areSourcesEqual(previousElement.sourceData, source) && config.console.collapseIdenticalLines) {
235
+ previousElement.count++;
236
+ return;
237
+ }
238
+ if (!previousElement.value.endsWith('\n') && !previousElement.value.endsWith('\r\n') && previousElement.count === 1) {
239
+ this.replElements[this.replElements.length - 1] = ( new ReplOutputElement(session, getUniqueId(), previousElement.value + output, sev, source));
240
+ this._onDidChangeElements.fire();
241
+ return;
242
+ }
243
+ }
244
+ const element = ( new ReplOutputElement(session, getUniqueId(), output, sev, source));
245
+ this.addReplElement(element);
246
+ }
247
+ startGroup(name, autoExpand, sourceData) {
248
+ const group = ( new ReplGroup(name, autoExpand, sourceData));
249
+ this.addReplElement(group);
250
+ }
251
+ endGroup() {
252
+ const lastElement = this.replElements[this.replElements.length - 1];
253
+ if (lastElement instanceof ReplGroup) {
254
+ lastElement.end();
255
+ }
256
+ }
257
+ addReplElement(newElement) {
258
+ const lastElement = this.replElements.length ? this.replElements[this.replElements.length - 1] : undefined;
259
+ if (lastElement instanceof ReplGroup && !lastElement.hasEnded) {
260
+ lastElement.addChild(newElement);
261
+ }
262
+ else {
263
+ this.replElements.push(newElement);
264
+ if (this.replElements.length > MAX_REPL_LENGTH) {
265
+ this.replElements.splice(0, this.replElements.length - MAX_REPL_LENGTH);
266
+ }
267
+ }
268
+ this._onDidChangeElements.fire();
269
+ }
270
+ removeReplExpressions() {
271
+ if (this.replElements.length > 0) {
272
+ this.replElements = [];
273
+ this._onDidChangeElements.fire();
274
+ }
275
+ }
276
+ clone() {
277
+ const newRepl = ( new ReplModel(this.configurationService));
278
+ newRepl.replElements = this.replElements.slice();
279
+ return newRepl;
280
+ }
281
+ }
282
+
283
+ export { RawObjectReplElement, ReplEvaluationInput, ReplEvaluationResult, ReplGroup, ReplModel, ReplOutputElement, ReplVariableElement };
@@ -0,0 +1,305 @@
1
+ import { Queue } from 'monaco-editor/esm/vs/base/common/async.js';
2
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
3
+ import * as types from 'monaco-editor/esm/vs/base/common/types.js';
4
+ import { isCodeEditor, isDiffEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
5
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
6
+ import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
7
+ import { AbstractVariableResolverService } from 'vscode/vscode/vs/workbench/services/configurationResolver/common/variableResolver';
8
+
9
+ class BaseConfigurationResolverService extends AbstractVariableResolverService {
10
+ static { this.INPUT_OR_COMMAND_VARIABLES_PATTERN = /\${((input|command):(.*?))}/g; }
11
+ constructor(context, envVariablesPromise, editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService, pathService, extensionService) {
12
+ super({
13
+ getFolderUri: (folderName) => {
14
+ const folder = workspaceContextService.getWorkspace().folders.filter(f => f.name === folderName).pop();
15
+ return folder ? folder.uri : undefined;
16
+ },
17
+ getWorkspaceFolderCount: () => {
18
+ return workspaceContextService.getWorkspace().folders.length;
19
+ },
20
+ getConfigurationValue: (folderUri, suffix) => {
21
+ return configurationService.getValue(suffix, folderUri ? { resource: folderUri } : {});
22
+ },
23
+ getAppRoot: () => {
24
+ return context.getAppRoot();
25
+ },
26
+ getExecPath: () => {
27
+ return context.getExecPath();
28
+ },
29
+ getFilePath: () => {
30
+ const fileResource = EditorResourceAccessor.getOriginalUri(editorService.activeEditor, {
31
+ supportSideBySide: SideBySideEditor.PRIMARY,
32
+ filterByScheme: [Schemas.file, Schemas.vscodeUserData, this.pathService.defaultUriScheme]
33
+ });
34
+ if (!fileResource) {
35
+ return undefined;
36
+ }
37
+ return this.labelService.getUriLabel(fileResource, { noPrefix: true });
38
+ },
39
+ getWorkspaceFolderPathForFile: () => {
40
+ const fileResource = EditorResourceAccessor.getOriginalUri(editorService.activeEditor, {
41
+ supportSideBySide: SideBySideEditor.PRIMARY,
42
+ filterByScheme: [Schemas.file, Schemas.vscodeUserData, this.pathService.defaultUriScheme]
43
+ });
44
+ if (!fileResource) {
45
+ return undefined;
46
+ }
47
+ const wsFolder = workspaceContextService.getWorkspaceFolder(fileResource);
48
+ if (!wsFolder) {
49
+ return undefined;
50
+ }
51
+ return this.labelService.getUriLabel(wsFolder.uri, { noPrefix: true });
52
+ },
53
+ getSelectedText: () => {
54
+ const activeTextEditorControl = editorService.activeTextEditorControl;
55
+ let activeControl = null;
56
+ if (isCodeEditor(activeTextEditorControl)) {
57
+ activeControl = activeTextEditorControl;
58
+ }
59
+ else if (isDiffEditor(activeTextEditorControl)) {
60
+ const original = activeTextEditorControl.getOriginalEditor();
61
+ const modified = activeTextEditorControl.getModifiedEditor();
62
+ activeControl = original.hasWidgetFocus() ? original : modified;
63
+ }
64
+ const activeModel = activeControl?.getModel();
65
+ const activeSelection = activeControl?.getSelection();
66
+ if (activeModel && activeSelection) {
67
+ return activeModel.getValueInRange(activeSelection);
68
+ }
69
+ return undefined;
70
+ },
71
+ getLineNumber: () => {
72
+ const activeTextEditorControl = editorService.activeTextEditorControl;
73
+ if (isCodeEditor(activeTextEditorControl)) {
74
+ const selection = activeTextEditorControl.getSelection();
75
+ if (selection) {
76
+ const lineNumber = selection.positionLineNumber;
77
+ return String(lineNumber);
78
+ }
79
+ }
80
+ return undefined;
81
+ },
82
+ getExtension: id => {
83
+ return extensionService.getExtension(id);
84
+ },
85
+ }, labelService, pathService.userHome().then(home => home.path), envVariablesPromise);
86
+ this.configurationService = configurationService;
87
+ this.commandService = commandService;
88
+ this.workspaceContextService = workspaceContextService;
89
+ this.quickInputService = quickInputService;
90
+ this.labelService = labelService;
91
+ this.pathService = pathService;
92
+ this.userInputAccessQueue = ( new Queue());
93
+ }
94
+ async resolveWithInteractionReplace(folder, config, section, variables, target) {
95
+ config = await this.resolveAnyAsync(folder, config);
96
+ return this.resolveWithInteraction(folder, config, section, variables, target).then(mapping => {
97
+ if (!mapping) {
98
+ return null;
99
+ }
100
+ else if (mapping.size > 0) {
101
+ return this.resolveAnyAsync(folder, config, Object.fromEntries(mapping));
102
+ }
103
+ else {
104
+ return config;
105
+ }
106
+ });
107
+ }
108
+ async resolveWithInteraction(folder, config, section, variables, target) {
109
+ const resolved = await this.resolveAnyMap(folder, config);
110
+ config = resolved.newConfig;
111
+ const allVariableMapping = resolved.resolvedVariables;
112
+ return this.resolveWithInputAndCommands(folder, config, variables, section, target).then(inputOrCommandMapping => {
113
+ if (this.updateMapping(inputOrCommandMapping, allVariableMapping)) {
114
+ return allVariableMapping;
115
+ }
116
+ return undefined;
117
+ });
118
+ }
119
+ updateMapping(newMapping, fullMapping) {
120
+ if (!newMapping) {
121
+ return false;
122
+ }
123
+ for (const [key, value] of Object.entries(newMapping)) {
124
+ fullMapping.set(key, value);
125
+ }
126
+ return true;
127
+ }
128
+ async resolveWithInputAndCommands(folder, configuration, variableToCommandMap, section, target) {
129
+ if (!configuration) {
130
+ return Promise.resolve(undefined);
131
+ }
132
+ let inputs = [];
133
+ if (this.workspaceContextService.getWorkbenchState() !== 1 && section) {
134
+ const overrides = folder ? { resource: folder.uri } : {};
135
+ const result = this.configurationService.inspect(section, overrides);
136
+ if (result && (result.userValue || result.workspaceValue || result.workspaceFolderValue)) {
137
+ switch (target) {
138
+ case 2 :
139
+ inputs = result.userValue?.inputs;
140
+ break;
141
+ case 5 :
142
+ inputs = result.workspaceValue?.inputs;
143
+ break;
144
+ default: inputs = result.workspaceFolderValue?.inputs;
145
+ }
146
+ }
147
+ else {
148
+ const valueResult = this.configurationService.getValue(section, overrides);
149
+ if (valueResult) {
150
+ inputs = valueResult.inputs;
151
+ }
152
+ }
153
+ }
154
+ const variables = [];
155
+ this.findVariables(configuration, variables);
156
+ const variableValues = Object.create(null);
157
+ for (const variable of variables) {
158
+ const [type, name] = variable.split(':', 2);
159
+ let result;
160
+ switch (type) {
161
+ case 'input':
162
+ result = await this.showUserInput(name, inputs);
163
+ break;
164
+ case 'command': {
165
+ const commandId = (variableToCommandMap ? variableToCommandMap[name] : undefined) || name;
166
+ result = await this.commandService.executeCommand(commandId, configuration);
167
+ if (typeof result !== 'string' && !types.isUndefinedOrNull(result)) {
168
+ throw new Error(nls.localize('commandVariable.noStringType', "Cannot substitute command variable '{0}' because command did not return a result of type string.", commandId));
169
+ }
170
+ break;
171
+ }
172
+ default:
173
+ if (( this._contributedVariables.has(variable))) {
174
+ result = await this._contributedVariables.get(variable)();
175
+ }
176
+ }
177
+ if (typeof result === 'string') {
178
+ variableValues[variable] = result;
179
+ }
180
+ else {
181
+ return undefined;
182
+ }
183
+ }
184
+ return variableValues;
185
+ }
186
+ findVariables(object, variables) {
187
+ if (typeof object === 'string') {
188
+ let matches;
189
+ while ((matches = BaseConfigurationResolverService.INPUT_OR_COMMAND_VARIABLES_PATTERN.exec(object)) !== null) {
190
+ if (matches.length === 4) {
191
+ const command = matches[1];
192
+ if (variables.indexOf(command) < 0) {
193
+ variables.push(command);
194
+ }
195
+ }
196
+ }
197
+ for (const contributed of ( this._contributedVariables.keys())) {
198
+ if ((variables.indexOf(contributed) < 0) && (object.indexOf('${' + contributed + '}') >= 0)) {
199
+ variables.push(contributed);
200
+ }
201
+ }
202
+ }
203
+ else if (Array.isArray(object)) {
204
+ for (const value of object) {
205
+ this.findVariables(value, variables);
206
+ }
207
+ }
208
+ else if (object) {
209
+ for (const value of ( Object.values(object))) {
210
+ this.findVariables(value, variables);
211
+ }
212
+ }
213
+ }
214
+ showUserInput(variable, inputInfos) {
215
+ if (!inputInfos) {
216
+ return Promise.reject(( new Error(( nls.localize(
217
+ 'inputVariable.noInputSection',
218
+ "Variable '{0}' must be defined in an '{1}' section of the debug or task configuration.",
219
+ variable,
220
+ 'input'
221
+ )))));
222
+ }
223
+ const info = inputInfos.filter(item => item.id === variable).pop();
224
+ if (info) {
225
+ const missingAttribute = (attrName) => {
226
+ throw new Error(nls.localize('inputVariable.missingAttribute', "Input variable '{0}' is of type '{1}' and must include '{2}'.", variable, info.type, attrName));
227
+ };
228
+ switch (info.type) {
229
+ case 'promptString': {
230
+ if (!types.isString(info.description)) {
231
+ missingAttribute('description');
232
+ }
233
+ const inputOptions = { prompt: info.description, ignoreFocusLost: true };
234
+ if (info.default) {
235
+ inputOptions.value = info.default;
236
+ }
237
+ if (info.password) {
238
+ inputOptions.password = info.password;
239
+ }
240
+ return this.userInputAccessQueue.queue(() => this.quickInputService.input(inputOptions)).then(resolvedInput => {
241
+ return resolvedInput;
242
+ });
243
+ }
244
+ case 'pickString': {
245
+ if (!types.isString(info.description)) {
246
+ missingAttribute('description');
247
+ }
248
+ if (Array.isArray(info.options)) {
249
+ for (const pickOption of info.options) {
250
+ if (!types.isString(pickOption) && !types.isString(pickOption.value)) {
251
+ missingAttribute('value');
252
+ }
253
+ }
254
+ }
255
+ else {
256
+ missingAttribute('options');
257
+ }
258
+ const picks = ( new Array());
259
+ for (const pickOption of info.options) {
260
+ const value = types.isString(pickOption) ? pickOption : pickOption.value;
261
+ const label = types.isString(pickOption) ? undefined : pickOption.label;
262
+ const item = {
263
+ label: label ? `${label}: ${value}` : value,
264
+ value: value
265
+ };
266
+ if (value === info.default) {
267
+ item.description = ( nls.localize('inputVariable.defaultInputValue', "(Default)"));
268
+ picks.unshift(item);
269
+ }
270
+ else {
271
+ picks.push(item);
272
+ }
273
+ }
274
+ const pickOptions = { placeHolder: info.description, matchOnDetail: true, ignoreFocusLost: true };
275
+ return this.userInputAccessQueue.queue(() => this.quickInputService.pick(picks, pickOptions, undefined)).then(resolvedInput => {
276
+ if (resolvedInput) {
277
+ return resolvedInput.value;
278
+ }
279
+ return undefined;
280
+ });
281
+ }
282
+ case 'command': {
283
+ if (!types.isString(info.command)) {
284
+ missingAttribute('command');
285
+ }
286
+ return this.userInputAccessQueue.queue(() => this.commandService.executeCommand(info.command, info.args)).then(result => {
287
+ if (typeof result === 'string' || types.isUndefinedOrNull(result)) {
288
+ return result;
289
+ }
290
+ throw new Error(nls.localize('inputVariable.command.noStringType', "Cannot substitute input variable '{0}' because command '{1}' did not return a result of type string.", variable, info.command));
291
+ });
292
+ }
293
+ default:
294
+ throw new Error(nls.localize('inputVariable.unknownType', "Input variable '{0}' can only be of type 'promptString', 'pickString', or 'command'.", variable));
295
+ }
296
+ }
297
+ return Promise.reject(( new Error(( nls.localize(
298
+ 'inputVariable.undefinedVariable',
299
+ "Undefined input variable '{0}' encountered. Remove or define '{0}' to continue.",
300
+ variable
301
+ )))));
302
+ }
303
+ }
304
+
305
+ export { BaseConfigurationResolverService };
@@ -0,0 +1,28 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
3
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
4
+ import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
5
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
6
+ import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
7
+ import { BaseConfigurationResolverService } from './baseConfigurationResolverService.js';
8
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
9
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
10
+ import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
11
+
12
+ let ConfigurationResolverService = class ConfigurationResolverService extends BaseConfigurationResolverService {
13
+ constructor(editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService, pathService, extensionService) {
14
+ super({ getAppRoot: () => undefined, getExecPath: () => undefined }, Promise.resolve(Object.create(null)), editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService, pathService, extensionService);
15
+ }
16
+ };
17
+ ConfigurationResolverService = ( __decorate([
18
+ ( __param(0, IEditorService)),
19
+ ( __param(1, IConfigurationService)),
20
+ ( __param(2, ICommandService)),
21
+ ( __param(3, IWorkspaceContextService)),
22
+ ( __param(4, IQuickInputService)),
23
+ ( __param(5, ILabelService)),
24
+ ( __param(6, IPathService)),
25
+ ( __param(7, IExtensionService))
26
+ ], ConfigurationResolverService));
27
+
28
+ export { ConfigurationResolverService };