@codingame/monaco-vscode-debug-service-override 4.1.0 → 4.1.2
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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/override/vs/platform/dialogs/common/dialogs.js +10 -0
- package/package.json +2 -2
- package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +73 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +1026 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +1004 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +337 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +432 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +1039 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +649 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +64 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +636 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +740 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +408 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +80 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +169 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1271 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1330 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +115 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +77 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +307 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +31 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +387 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +267 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +817 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +131 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +142 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +262 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +669 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +709 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +1002 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +352 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +129 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +734 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +501 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +162 -0
- package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +110 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +62 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +460 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +166 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +150 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +289 -0
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +64 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +311 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +29 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { matchesFuzzy } from 'vscode/vscode/vs/base/common/filters';
|
|
3
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
4
|
+
import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
5
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
6
|
+
import { getIconClasses } from 'vscode/vscode/vs/editor/common/services/getIconClasses';
|
|
7
|
+
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
8
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
9
|
+
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
11
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
12
|
+
|
|
13
|
+
async function showLoadedScriptMenu(accessor) {
|
|
14
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
15
|
+
const debugService = accessor.get(IDebugService);
|
|
16
|
+
const editorService = accessor.get(IEditorService);
|
|
17
|
+
const sessions = debugService.getModel().getSessions(false);
|
|
18
|
+
const modelService = accessor.get(IModelService);
|
|
19
|
+
const languageService = accessor.get(ILanguageService);
|
|
20
|
+
const labelService = accessor.get(ILabelService);
|
|
21
|
+
const localDisposableStore = ( new DisposableStore());
|
|
22
|
+
const quickPick = quickInputService.createQuickPick();
|
|
23
|
+
localDisposableStore.add(quickPick);
|
|
24
|
+
quickPick.matchOnLabel = quickPick.matchOnDescription = quickPick.matchOnDetail = quickPick.sortByLabel = false;
|
|
25
|
+
quickPick.placeholder = ( localizeWithPath(
|
|
26
|
+
'vs/workbench/contrib/debug/common/loadedScriptsPicker',
|
|
27
|
+
'moveFocusedView.selectView',
|
|
28
|
+
"Search loaded scripts by name"
|
|
29
|
+
));
|
|
30
|
+
quickPick.items = await _getPicks(quickPick.value, sessions, editorService, modelService, languageService, labelService);
|
|
31
|
+
localDisposableStore.add(quickPick.onDidChangeValue(async () => {
|
|
32
|
+
quickPick.items = await _getPicks(quickPick.value, sessions, editorService, modelService, languageService, labelService);
|
|
33
|
+
}));
|
|
34
|
+
localDisposableStore.add(quickPick.onDidAccept(() => {
|
|
35
|
+
const selectedItem = quickPick.selectedItems[0];
|
|
36
|
+
selectedItem.accept();
|
|
37
|
+
quickPick.hide();
|
|
38
|
+
localDisposableStore.dispose();
|
|
39
|
+
}));
|
|
40
|
+
quickPick.show();
|
|
41
|
+
}
|
|
42
|
+
async function _getPicksFromSession(session, filter, editorService, modelService, languageService, labelService) {
|
|
43
|
+
const items = [];
|
|
44
|
+
items.push({ type: 'separator', label: session.name });
|
|
45
|
+
const sources = await session.getLoadedSources();
|
|
46
|
+
sources.forEach((element) => {
|
|
47
|
+
const pick = _createPick(element, filter, editorService, modelService, languageService, labelService);
|
|
48
|
+
if (pick) {
|
|
49
|
+
items.push(pick);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return items;
|
|
53
|
+
}
|
|
54
|
+
async function _getPicks(filter, sessions, editorService, modelService, languageService, labelService) {
|
|
55
|
+
const loadedScriptPicks = [];
|
|
56
|
+
const picks = await Promise.all(( sessions.map(
|
|
57
|
+
(session) => _getPicksFromSession(session, filter, editorService, modelService, languageService, labelService)
|
|
58
|
+
)));
|
|
59
|
+
for (const row of picks) {
|
|
60
|
+
for (const elem of row) {
|
|
61
|
+
loadedScriptPicks.push(elem);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return loadedScriptPicks;
|
|
65
|
+
}
|
|
66
|
+
function _createPick(source, filter, editorService, modelService, languageService, labelService) {
|
|
67
|
+
const label = labelService.getUriBasenameLabel(source.uri);
|
|
68
|
+
const desc = labelService.getUriLabel(dirname(source.uri));
|
|
69
|
+
const labelHighlights = matchesFuzzy(filter, label, true);
|
|
70
|
+
const descHighlights = matchesFuzzy(filter, desc, true);
|
|
71
|
+
if (labelHighlights || descHighlights) {
|
|
72
|
+
return {
|
|
73
|
+
label,
|
|
74
|
+
description: desc === '.' ? undefined : desc,
|
|
75
|
+
highlights: { label: labelHighlights ?? undefined, description: descHighlights ?? undefined },
|
|
76
|
+
iconClasses: getIconClasses(modelService, languageService, source.uri),
|
|
77
|
+
accept: () => {
|
|
78
|
+
if (source.available) {
|
|
79
|
+
source.openInEditor(editorService, { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { showLoadedScriptMenu };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
2
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
+
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
6
|
+
import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
|
|
7
|
+
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
8
|
+
|
|
9
|
+
const COPY_NOTEBOOK_VARIABLE_VALUE_ID = 'workbench.debug.viewlet.action.copyWorkspaceVariableValue';
|
|
10
|
+
const COPY_NOTEBOOK_VARIABLE_VALUE_LABEL = ( localizeWithPath(
|
|
11
|
+
'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands',
|
|
12
|
+
'copyWorkspaceVariableValue',
|
|
13
|
+
"Copy Value"
|
|
14
|
+
));
|
|
15
|
+
registerAction2(class extends Action2 {
|
|
16
|
+
constructor() {
|
|
17
|
+
super({
|
|
18
|
+
id: COPY_NOTEBOOK_VARIABLE_VALUE_ID,
|
|
19
|
+
title: COPY_NOTEBOOK_VARIABLE_VALUE_LABEL,
|
|
20
|
+
f1: false,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
run(accessor, context) {
|
|
24
|
+
const clipboardService = accessor.get(IClipboardService);
|
|
25
|
+
if (context.value) {
|
|
26
|
+
clipboardService.writeText(context.value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
registerAction2(class extends Action2 {
|
|
31
|
+
constructor() {
|
|
32
|
+
super({
|
|
33
|
+
id: '_executeNotebookVariableProvider',
|
|
34
|
+
title: ( localizeWithPath(
|
|
35
|
+
'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands',
|
|
36
|
+
'executeNotebookVariableProvider',
|
|
37
|
+
"Execute Notebook Variable Provider"
|
|
38
|
+
)),
|
|
39
|
+
f1: false,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async run(accessor, resource) {
|
|
43
|
+
if (!resource) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
const uri = URI.revive(resource);
|
|
47
|
+
const notebookKernelService = accessor.get(INotebookKernelService);
|
|
48
|
+
const notebookService = accessor.get(INotebookService);
|
|
49
|
+
const notebookTextModel = notebookService.getNotebookTextModel(uri);
|
|
50
|
+
if (!notebookTextModel) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const selectedKernel = notebookKernelService.getMatchingKernel(notebookTextModel).selected;
|
|
54
|
+
if (selectedKernel && selectedKernel.hasVariableProvider) {
|
|
55
|
+
const variables = selectedKernel.provideVariables(notebookTextModel.uri, undefined, 'named', 0, CancellationToken.None);
|
|
56
|
+
return await ( variables
|
|
57
|
+
.map(variable => { return variable; }))
|
|
58
|
+
.toPromise();
|
|
59
|
+
}
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export { COPY_NOTEBOOK_VARIABLE_VALUE_ID, COPY_NOTEBOOK_VARIABLE_VALUE_LABEL };
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { Queue } from 'vscode/vscode/vs/base/common/async';
|
|
2
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
3
|
+
import { isUndefinedOrNull, isString } from 'vscode/vscode/vs/base/common/types';
|
|
4
|
+
import { isCodeEditor, isDiffEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
5
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
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' && !isUndefinedOrNull(result)) {
|
|
168
|
+
throw new Error(localizeWithPath('vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService', '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(( localizeWithPath(
|
|
217
|
+
'vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService',
|
|
218
|
+
'inputVariable.noInputSection',
|
|
219
|
+
"Variable '{0}' must be defined in an '{1}' section of the debug or task configuration.",
|
|
220
|
+
variable,
|
|
221
|
+
'input'
|
|
222
|
+
)))));
|
|
223
|
+
}
|
|
224
|
+
const info = inputInfos.filter(item => item.id === variable).pop();
|
|
225
|
+
if (info) {
|
|
226
|
+
const missingAttribute = (attrName) => {
|
|
227
|
+
throw new Error(localizeWithPath('vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService', 'inputVariable.missingAttribute', "Input variable '{0}' is of type '{1}' and must include '{2}'.", variable, info.type, attrName));
|
|
228
|
+
};
|
|
229
|
+
switch (info.type) {
|
|
230
|
+
case 'promptString': {
|
|
231
|
+
if (!isString(info.description)) {
|
|
232
|
+
missingAttribute('description');
|
|
233
|
+
}
|
|
234
|
+
const inputOptions = { prompt: info.description, ignoreFocusLost: true };
|
|
235
|
+
if (info.default) {
|
|
236
|
+
inputOptions.value = info.default;
|
|
237
|
+
}
|
|
238
|
+
if (info.password) {
|
|
239
|
+
inputOptions.password = info.password;
|
|
240
|
+
}
|
|
241
|
+
return this.userInputAccessQueue.queue(() => this.quickInputService.input(inputOptions)).then(resolvedInput => {
|
|
242
|
+
return resolvedInput;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
case 'pickString': {
|
|
246
|
+
if (!isString(info.description)) {
|
|
247
|
+
missingAttribute('description');
|
|
248
|
+
}
|
|
249
|
+
if (Array.isArray(info.options)) {
|
|
250
|
+
for (const pickOption of info.options) {
|
|
251
|
+
if (!isString(pickOption) && !isString(pickOption.value)) {
|
|
252
|
+
missingAttribute('value');
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
missingAttribute('options');
|
|
258
|
+
}
|
|
259
|
+
const picks = ( new Array());
|
|
260
|
+
for (const pickOption of info.options) {
|
|
261
|
+
const value = isString(pickOption) ? pickOption : pickOption.value;
|
|
262
|
+
const label = isString(pickOption) ? undefined : pickOption.label;
|
|
263
|
+
const item = {
|
|
264
|
+
label: label ? `${label}: ${value}` : value,
|
|
265
|
+
value: value
|
|
266
|
+
};
|
|
267
|
+
if (value === info.default) {
|
|
268
|
+
item.description = ( localizeWithPath(
|
|
269
|
+
'vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService',
|
|
270
|
+
'inputVariable.defaultInputValue',
|
|
271
|
+
"(Default)"
|
|
272
|
+
));
|
|
273
|
+
picks.unshift(item);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
picks.push(item);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const pickOptions = { placeHolder: info.description, matchOnDetail: true, ignoreFocusLost: true };
|
|
280
|
+
return this.userInputAccessQueue.queue(() => this.quickInputService.pick(picks, pickOptions, undefined)).then(resolvedInput => {
|
|
281
|
+
if (resolvedInput) {
|
|
282
|
+
return resolvedInput.value;
|
|
283
|
+
}
|
|
284
|
+
return undefined;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
case 'command': {
|
|
288
|
+
if (!isString(info.command)) {
|
|
289
|
+
missingAttribute('command');
|
|
290
|
+
}
|
|
291
|
+
return this.userInputAccessQueue.queue(() => this.commandService.executeCommand(info.command, info.args)).then(result => {
|
|
292
|
+
if (typeof result === 'string' || isUndefinedOrNull(result)) {
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
throw new Error(localizeWithPath('vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService', 'inputVariable.command.noStringType', "Cannot substitute input variable '{0}' because command '{1}' did not return a result of type string.", variable, info.command));
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
default:
|
|
299
|
+
throw new Error(localizeWithPath('vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService', 'inputVariable.unknownType', "Input variable '{0}' can only be of type 'promptString', 'pickString', or 'command'.", variable));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return Promise.reject(( new Error(( localizeWithPath(
|
|
303
|
+
'vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService',
|
|
304
|
+
'inputVariable.undefinedVariable',
|
|
305
|
+
"Undefined input variable '{0}' encountered. Remove or define '{0}' to continue.",
|
|
306
|
+
variable
|
|
307
|
+
)))));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export { BaseConfigurationResolverService };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
3
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
4
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
5
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
6
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
7
|
+
import { BaseConfigurationResolverService } from './baseConfigurationResolverService.js';
|
|
8
|
+
import 'vscode/vscode/vs/workbench/services/configurationResolver/common/configurationResolver';
|
|
9
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
10
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
11
|
+
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
12
|
+
|
|
13
|
+
let ConfigurationResolverService = class ConfigurationResolverService extends BaseConfigurationResolverService {
|
|
14
|
+
constructor(editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService, pathService, extensionService) {
|
|
15
|
+
super({ getAppRoot: () => undefined, getExecPath: () => undefined }, Promise.resolve(Object.create(null)), editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService, pathService, extensionService);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
ConfigurationResolverService = ( __decorate([
|
|
19
|
+
( __param(0, IEditorService)),
|
|
20
|
+
( __param(1, IConfigurationService)),
|
|
21
|
+
( __param(2, ICommandService)),
|
|
22
|
+
( __param(3, IWorkspaceContextService)),
|
|
23
|
+
( __param(4, IQuickInputService)),
|
|
24
|
+
( __param(5, ILabelService)),
|
|
25
|
+
( __param(6, IPathService)),
|
|
26
|
+
( __param(7, IExtensionService))
|
|
27
|
+
], ConfigurationResolverService));
|
|
28
|
+
|
|
29
|
+
export { ConfigurationResolverService };
|