MCPcopy
hub / github.com/microsoft/vscode / configureTask

Method configureTask

test/automation/src/task.ts:58–93  ·  view source on GitHub ↗
(properties: ITaskConfigurationProperties)

Source from the content-addressed store, hash-verified

56 }
57
58 async configureTask(properties: ITaskConfigurationProperties) {
59 await this.quickaccess.openFileQuickAccessAndWait('tasks.json', 'tasks.json');
60 await this.quickinput.selectQuickInputElement(0);
61 await this.quickaccess.runCommand('editor.action.selectAll');
62 await this.code.dispatchKeybinding('Delete', async () => {
63 // TODO https://github.com/microsoft/vscode/issues/242535
64 await wait(100);
65 });
66 const taskStringLines: string[] = [
67 '{', // Brackets auto close
68 '"version": "2.0.0",',
69 '"tasks": [{' // Brackets auto close
70 ];
71 for (let [key, value] of Object.entries(properties)) {
72 if (typeof value === 'object') {
73 value = JSON.stringify(value);
74 } else if (typeof value === 'boolean') {
75 value = value;
76 } else if (typeof value === 'string') {
77 value = `"${value}"`;
78 } else {
79 throw new Error('Unsupported task property value type');
80 }
81 taskStringLines.push(`"${key}": ${value},`);
82 }
83 for (const [i, line] of taskStringLines.entries()) {
84 await this.editor.waitForTypeInEditor('tasks.json', `${line}`);
85 if (i !== taskStringLines.length - 1) {
86 await this.code.dispatchKeybinding('Enter', async () => {
87 // TODO https://github.com/microsoft/vscode/issues/242535
88 await wait(100);
89 });
90 }
91 }
92 await this.editors.saveOpenedFile();
93 }
94}

Callers 2

setupFunction · 0.80
applyTaskToolsFunction · 0.80

Calls 10

waitFunction · 0.90
dispatchKeybindingMethod · 0.80
stringifyMethod · 0.80
saveOpenedFileMethod · 0.80
runCommandMethod · 0.65
entriesMethod · 0.65
pushMethod · 0.65
waitForTypeInEditorMethod · 0.45

Tested by 1

setupFunction · 0.64