@codingame/monaco-vscode-task-service-override 1.85.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.
Files changed (25) hide show
  1. package/external/tslib/tslib.es6.js +11 -0
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  5. package/package.json +24 -0
  6. package/task.d.ts +5 -0
  7. package/task.js +12 -0
  8. package/vscode/src/vs/base/common/parsers.js +44 -0
  9. package/vscode/src/vs/workbench/contrib/tasks/browser/abstractTaskService.js +3851 -0
  10. package/vscode/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.js +167 -0
  11. package/vscode/src/vs/workbench/contrib/tasks/browser/task.contribution.js +694 -0
  12. package/vscode/src/vs/workbench/contrib/tasks/browser/taskQuickPick.js +452 -0
  13. package/vscode/src/vs/workbench/contrib/tasks/browser/taskService.js +36 -0
  14. package/vscode/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.js +191 -0
  15. package/vscode/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.js +121 -0
  16. package/vscode/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.js +1713 -0
  17. package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchemaCommon.js +440 -0
  18. package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchema_v1.js +125 -0
  19. package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.js +901 -0
  20. package/vscode/src/vs/workbench/contrib/tasks/common/problemCollectors.js +464 -0
  21. package/vscode/src/vs/workbench/contrib/tasks/common/problemMatcher.js +1796 -0
  22. package/vscode/src/vs/workbench/contrib/tasks/common/taskConfiguration.js +1581 -0
  23. package/vscode/src/vs/workbench/contrib/tasks/common/taskSystem.js +15 -0
  24. package/vscode/src/vs/workbench/contrib/tasks/common/taskTemplates.js +145 -0
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEscapeSequences.js +13 -0
@@ -0,0 +1,167 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
3
+ import * as resources from 'monaco-editor/esm/vs/base/common/resources.js';
4
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
5
+ import { ITaskService } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskService';
6
+ import { TASKS_CATEGORY, TaskSourceKind, RunOnOptions } from 'vscode/vscode/vs/workbench/contrib/tasks/common/tasks';
7
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
8
+ import { Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
9
+ import { IWorkspaceTrustManagementService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
10
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
11
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
12
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
13
+
14
+ const ALLOW_AUTOMATIC_TASKS = 'task.allowAutomaticTasks';
15
+ let RunAutomaticTasks = class RunAutomaticTasks extends Disposable {
16
+ constructor(_taskService, _configurationService, _workspaceTrustManagementService, _logService) {
17
+ super();
18
+ this._taskService = _taskService;
19
+ this._configurationService = _configurationService;
20
+ this._workspaceTrustManagementService = _workspaceTrustManagementService;
21
+ this._logService = _logService;
22
+ this._hasRunTasks = false;
23
+ if (this._taskService.isReconnected) {
24
+ this._tryRunTasks();
25
+ }
26
+ else {
27
+ this._register(Event.once(this._taskService.onDidReconnectToTasks)(async () => await this._tryRunTasks()));
28
+ }
29
+ this._register(this._workspaceTrustManagementService.onDidChangeTrust(async () => await this._tryRunTasks()));
30
+ }
31
+ async _tryRunTasks() {
32
+ if (!this._workspaceTrustManagementService.isWorkspaceTrusted()) {
33
+ return;
34
+ }
35
+ if (this._hasRunTasks || this._configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'off') {
36
+ return;
37
+ }
38
+ this._hasRunTasks = true;
39
+ this._logService.trace('RunAutomaticTasks: Trying to run tasks.');
40
+ if (!this._taskService.hasTaskSystemInfo) {
41
+ this._logService.trace('RunAutomaticTasks: Awaiting task system info.');
42
+ await Event.toPromise(Event.once(this._taskService.onDidChangeTaskSystemInfo));
43
+ }
44
+ const workspaceTasks = await this._taskService.getWorkspaceTasks(2 );
45
+ this._logService.trace(`RunAutomaticTasks: Found ${workspaceTasks.size} automatic tasks`);
46
+ await this._runWithPermission(this._taskService, this._configurationService, workspaceTasks);
47
+ }
48
+ _runTasks(taskService, tasks) {
49
+ tasks.forEach(task => {
50
+ if (task instanceof Promise) {
51
+ task.then(promiseResult => {
52
+ if (promiseResult) {
53
+ taskService.run(promiseResult);
54
+ }
55
+ });
56
+ }
57
+ else {
58
+ taskService.run(task);
59
+ }
60
+ });
61
+ }
62
+ _getTaskSource(source) {
63
+ const taskKind = TaskSourceKind.toConfigurationTarget(source.kind);
64
+ switch (taskKind) {
65
+ case 6 : {
66
+ return resources.joinPath(source.config.workspaceFolder.uri, source.config.file);
67
+ }
68
+ case 5 : {
69
+ return source.config.workspace?.configuration ?? undefined;
70
+ }
71
+ }
72
+ return undefined;
73
+ }
74
+ _findAutoTasks(taskService, workspaceTaskResult) {
75
+ const tasks = ( new Array());
76
+ const taskNames = ( new Array());
77
+ const locations = ( new Map());
78
+ if (workspaceTaskResult) {
79
+ workspaceTaskResult.forEach(resultElement => {
80
+ if (resultElement.set) {
81
+ resultElement.set.tasks.forEach(task => {
82
+ if (task.runOptions.runOn === RunOnOptions.folderOpen) {
83
+ tasks.push(task);
84
+ taskNames.push(task._label);
85
+ const location = this._getTaskSource(task._source);
86
+ if (location) {
87
+ locations.set(location.fsPath, location);
88
+ }
89
+ }
90
+ });
91
+ }
92
+ if (resultElement.configurations) {
93
+ for (const configuredTask of ( Object.values(resultElement.configurations.byIdentifier))) {
94
+ if (configuredTask.runOptions.runOn === RunOnOptions.folderOpen) {
95
+ tasks.push(( new Promise(resolve => {
96
+ taskService.getTask(resultElement.workspaceFolder, configuredTask._id, true).then(task => resolve(task));
97
+ })));
98
+ if (configuredTask._label) {
99
+ taskNames.push(configuredTask._label);
100
+ }
101
+ else {
102
+ taskNames.push(configuredTask.configures.task);
103
+ }
104
+ const location = this._getTaskSource(configuredTask._source);
105
+ if (location) {
106
+ locations.set(location.fsPath, location);
107
+ }
108
+ }
109
+ }
110
+ }
111
+ });
112
+ }
113
+ return { tasks, taskNames, locations };
114
+ }
115
+ async _runWithPermission(taskService, configurationService, workspaceTaskResult) {
116
+ const { tasks, taskNames } = this._findAutoTasks(taskService, workspaceTaskResult);
117
+ if (taskNames.length === 0) {
118
+ return;
119
+ }
120
+ if (configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'off') {
121
+ return;
122
+ }
123
+ this._runTasks(taskService, tasks);
124
+ }
125
+ };
126
+ RunAutomaticTasks = ( __decorate([
127
+ ( __param(0, ITaskService)),
128
+ ( __param(1, IConfigurationService)),
129
+ ( __param(2, IWorkspaceTrustManagementService)),
130
+ ( __param(3, ILogService))
131
+ ], RunAutomaticTasks));
132
+ class ManageAutomaticTaskRunning extends Action2 {
133
+ static { this.ID = 'workbench.action.tasks.manageAutomaticRunning'; }
134
+ static { this.LABEL = ( nls.localizeWithPath(
135
+ 'vs/workbench/contrib/tasks/browser/runAutomaticTasks',
136
+ 'workbench.action.tasks.manageAutomaticRunning',
137
+ "Manage Automatic Tasks"
138
+ )); }
139
+ constructor() {
140
+ super({
141
+ id: ManageAutomaticTaskRunning.ID,
142
+ title: ManageAutomaticTaskRunning.LABEL,
143
+ category: TASKS_CATEGORY
144
+ });
145
+ }
146
+ async run(accessor) {
147
+ const quickInputService = accessor.get(IQuickInputService);
148
+ const configurationService = accessor.get(IConfigurationService);
149
+ const allowItem = { label: ( nls.localizeWithPath(
150
+ 'vs/workbench/contrib/tasks/browser/runAutomaticTasks',
151
+ 'workbench.action.tasks.allowAutomaticTasks',
152
+ "Allow Automatic Tasks"
153
+ )) };
154
+ const disallowItem = { label: ( nls.localizeWithPath(
155
+ 'vs/workbench/contrib/tasks/browser/runAutomaticTasks',
156
+ 'workbench.action.tasks.disallowAutomaticTasks',
157
+ "Disallow Automatic Tasks"
158
+ )) };
159
+ const value = await quickInputService.pick([allowItem, disallowItem], { canPickMany: false });
160
+ if (!value) {
161
+ return;
162
+ }
163
+ configurationService.updateValue(ALLOW_AUTOMATIC_TASKS, value === allowItem ? 'on' : 'off', 2 );
164
+ }
165
+ }
166
+
167
+ export { ManageAutomaticTaskRunning, RunAutomaticTasks };