@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,464 @@
1
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
2
+ import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
3
+ import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { getResource, createLineMatcher, ApplyToKind } from './problemMatcher.js';
5
+ import { IMarkerData } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
6
+ import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
7
+ import { isWindows } from 'monaco-editor/esm/vs/base/common/platform.js';
8
+
9
+ var IProblemCollectorEvent;
10
+ ( (function(IProblemCollectorEvent) {
11
+ function create(kind) {
12
+ return ( Object.freeze({ kind }));
13
+ }
14
+ IProblemCollectorEvent.create = create;
15
+ })(IProblemCollectorEvent || (IProblemCollectorEvent = {})));
16
+ class AbstractProblemCollector extends Disposable {
17
+ constructor(problemMatchers, markerService, modelService, fileService) {
18
+ super();
19
+ this.problemMatchers = problemMatchers;
20
+ this.markerService = markerService;
21
+ this.modelService = modelService;
22
+ this.modelListeners = ( new DisposableStore());
23
+ this._onDidFindFirstMatch = ( new Emitter());
24
+ this.onDidFindFirstMatch = this._onDidFindFirstMatch.event;
25
+ this._onDidFindErrors = ( new Emitter());
26
+ this.onDidFindErrors = this._onDidFindErrors.event;
27
+ this._onDidRequestInvalidateLastMarker = ( new Emitter());
28
+ this.onDidRequestInvalidateLastMarker = this._onDidRequestInvalidateLastMarker.event;
29
+ this.matchers = Object.create(null);
30
+ this.bufferLength = 1;
31
+ ( problemMatchers.map(elem => createLineMatcher(elem, fileService))).forEach((matcher) => {
32
+ const length = matcher.matchLength;
33
+ if (length > this.bufferLength) {
34
+ this.bufferLength = length;
35
+ }
36
+ let value = this.matchers[length];
37
+ if (!value) {
38
+ value = [];
39
+ this.matchers[length] = value;
40
+ }
41
+ value.push(matcher);
42
+ });
43
+ this.buffer = [];
44
+ this.activeMatcher = null;
45
+ this._numberOfMatches = 0;
46
+ this._maxMarkerSeverity = undefined;
47
+ this.openModels = Object.create(null);
48
+ this.applyToByOwner = ( new Map());
49
+ for (const problemMatcher of problemMatchers) {
50
+ const current = this.applyToByOwner.get(problemMatcher.owner);
51
+ if (current === undefined) {
52
+ this.applyToByOwner.set(problemMatcher.owner, problemMatcher.applyTo);
53
+ }
54
+ else {
55
+ this.applyToByOwner.set(problemMatcher.owner, this.mergeApplyTo(current, problemMatcher.applyTo));
56
+ }
57
+ }
58
+ this.resourcesToClean = ( new Map());
59
+ this.markers = ( new Map());
60
+ this.deliveredMarkers = ( new Map());
61
+ this._register(this.modelService.onModelAdded((model) => {
62
+ this.openModels[( model.uri.toString())] = true;
63
+ }, this, this.modelListeners));
64
+ this._register(this.modelService.onModelRemoved((model) => {
65
+ delete this.openModels[( model.uri.toString())];
66
+ }, this, this.modelListeners));
67
+ this.modelService.getModels().forEach(model => this.openModels[( model.uri.toString())] = true);
68
+ this._onDidStateChange = ( new Emitter());
69
+ }
70
+ get onDidStateChange() {
71
+ return this._onDidStateChange.event;
72
+ }
73
+ processLine(line) {
74
+ if (this.tail) {
75
+ const oldTail = this.tail;
76
+ this.tail = oldTail.then(() => {
77
+ return this.processLineInternal(line);
78
+ });
79
+ }
80
+ else {
81
+ this.tail = this.processLineInternal(line);
82
+ }
83
+ }
84
+ dispose() {
85
+ super.dispose();
86
+ this.modelListeners.dispose();
87
+ }
88
+ get numberOfMatches() {
89
+ return this._numberOfMatches;
90
+ }
91
+ get maxMarkerSeverity() {
92
+ return this._maxMarkerSeverity;
93
+ }
94
+ tryFindMarker(line) {
95
+ let result = null;
96
+ if (this.activeMatcher) {
97
+ result = this.activeMatcher.next(line);
98
+ if (result) {
99
+ this.captureMatch(result);
100
+ return result;
101
+ }
102
+ this.clearBuffer();
103
+ this.activeMatcher = null;
104
+ }
105
+ if (this.buffer.length < this.bufferLength) {
106
+ this.buffer.push(line);
107
+ }
108
+ else {
109
+ const end = this.buffer.length - 1;
110
+ for (let i = 0; i < end; i++) {
111
+ this.buffer[i] = this.buffer[i + 1];
112
+ }
113
+ this.buffer[end] = line;
114
+ }
115
+ result = this.tryMatchers();
116
+ if (result) {
117
+ this.clearBuffer();
118
+ }
119
+ return result;
120
+ }
121
+ async shouldApplyMatch(result) {
122
+ switch (result.description.applyTo) {
123
+ case ApplyToKind.allDocuments:
124
+ return true;
125
+ case ApplyToKind.openDocuments:
126
+ return !!this.openModels[( (await result.resource).toString())];
127
+ case ApplyToKind.closedDocuments:
128
+ return !this.openModels[( (await result.resource).toString())];
129
+ default:
130
+ return true;
131
+ }
132
+ }
133
+ mergeApplyTo(current, value) {
134
+ if (current === value || current === ApplyToKind.allDocuments) {
135
+ return current;
136
+ }
137
+ return ApplyToKind.allDocuments;
138
+ }
139
+ tryMatchers() {
140
+ this.activeMatcher = null;
141
+ const length = this.buffer.length;
142
+ for (let startIndex = 0; startIndex < length; startIndex++) {
143
+ const candidates = this.matchers[length - startIndex];
144
+ if (!candidates) {
145
+ continue;
146
+ }
147
+ for (const matcher of candidates) {
148
+ const result = matcher.handle(this.buffer, startIndex);
149
+ if (result.match) {
150
+ this.captureMatch(result.match);
151
+ if (result.continue) {
152
+ this.activeMatcher = matcher;
153
+ }
154
+ return result.match;
155
+ }
156
+ }
157
+ }
158
+ return null;
159
+ }
160
+ captureMatch(match) {
161
+ this._numberOfMatches++;
162
+ if (this._maxMarkerSeverity === undefined || match.marker.severity > this._maxMarkerSeverity) {
163
+ this._maxMarkerSeverity = match.marker.severity;
164
+ }
165
+ }
166
+ clearBuffer() {
167
+ if (this.buffer.length > 0) {
168
+ this.buffer = [];
169
+ }
170
+ }
171
+ recordResourcesToClean(owner) {
172
+ const resourceSetToClean = this.getResourceSetToClean(owner);
173
+ this.markerService.read({ owner: owner }).forEach(marker => resourceSetToClean.set(( marker.resource.toString()), marker.resource));
174
+ }
175
+ recordResourceToClean(owner, resource) {
176
+ this.getResourceSetToClean(owner).set(( resource.toString()), resource);
177
+ }
178
+ removeResourceToClean(owner, resource) {
179
+ const resourceSet = this.resourcesToClean.get(owner);
180
+ resourceSet?.delete(resource);
181
+ }
182
+ getResourceSetToClean(owner) {
183
+ let result = this.resourcesToClean.get(owner);
184
+ if (!result) {
185
+ result = ( new Map());
186
+ this.resourcesToClean.set(owner, result);
187
+ }
188
+ return result;
189
+ }
190
+ cleanAllMarkers() {
191
+ this.resourcesToClean.forEach((value, owner) => {
192
+ this._cleanMarkers(owner, value);
193
+ });
194
+ this.resourcesToClean = ( new Map());
195
+ }
196
+ cleanMarkers(owner) {
197
+ const toClean = this.resourcesToClean.get(owner);
198
+ if (toClean) {
199
+ this._cleanMarkers(owner, toClean);
200
+ this.resourcesToClean.delete(owner);
201
+ }
202
+ }
203
+ _cleanMarkers(owner, toClean) {
204
+ const uris = [];
205
+ const applyTo = this.applyToByOwner.get(owner);
206
+ toClean.forEach((uri, uriAsString) => {
207
+ if (applyTo === ApplyToKind.allDocuments ||
208
+ (applyTo === ApplyToKind.openDocuments && this.openModels[uriAsString]) ||
209
+ (applyTo === ApplyToKind.closedDocuments && !this.openModels[uriAsString])) {
210
+ uris.push(uri);
211
+ }
212
+ });
213
+ this.markerService.remove(owner, uris);
214
+ }
215
+ recordMarker(marker, owner, resourceAsString) {
216
+ let markersPerOwner = this.markers.get(owner);
217
+ if (!markersPerOwner) {
218
+ markersPerOwner = ( new Map());
219
+ this.markers.set(owner, markersPerOwner);
220
+ }
221
+ let markersPerResource = markersPerOwner.get(resourceAsString);
222
+ if (!markersPerResource) {
223
+ markersPerResource = ( new Map());
224
+ markersPerOwner.set(resourceAsString, markersPerResource);
225
+ }
226
+ const key = IMarkerData.makeKeyOptionalMessage(marker, false);
227
+ let existingMarker;
228
+ if (!( markersPerResource.has(key))) {
229
+ markersPerResource.set(key, marker);
230
+ }
231
+ else if (((existingMarker = markersPerResource.get(key)) !== undefined) && (existingMarker.message.length < marker.message.length) && isWindows) {
232
+ markersPerResource.set(key, marker);
233
+ }
234
+ }
235
+ reportMarkers() {
236
+ this.markers.forEach((markersPerOwner, owner) => {
237
+ const deliveredMarkersPerOwner = this.getDeliveredMarkersPerOwner(owner);
238
+ markersPerOwner.forEach((markers, resource) => {
239
+ this.deliverMarkersPerOwnerAndResourceResolved(owner, resource, markers, deliveredMarkersPerOwner);
240
+ });
241
+ });
242
+ }
243
+ deliverMarkersPerOwnerAndResource(owner, resource) {
244
+ const markersPerOwner = this.markers.get(owner);
245
+ if (!markersPerOwner) {
246
+ return;
247
+ }
248
+ const deliveredMarkersPerOwner = this.getDeliveredMarkersPerOwner(owner);
249
+ const markersPerResource = markersPerOwner.get(resource);
250
+ if (!markersPerResource) {
251
+ return;
252
+ }
253
+ this.deliverMarkersPerOwnerAndResourceResolved(owner, resource, markersPerResource, deliveredMarkersPerOwner);
254
+ }
255
+ deliverMarkersPerOwnerAndResourceResolved(owner, resource, markers, reported) {
256
+ if (markers.size !== reported.get(resource)) {
257
+ const toSet = [];
258
+ markers.forEach(value => toSet.push(value));
259
+ this.markerService.changeOne(owner, ( URI.parse(resource)), toSet);
260
+ reported.set(resource, markers.size);
261
+ }
262
+ }
263
+ getDeliveredMarkersPerOwner(owner) {
264
+ let result = this.deliveredMarkers.get(owner);
265
+ if (!result) {
266
+ result = ( new Map());
267
+ this.deliveredMarkers.set(owner, result);
268
+ }
269
+ return result;
270
+ }
271
+ cleanMarkerCaches() {
272
+ this._numberOfMatches = 0;
273
+ this._maxMarkerSeverity = undefined;
274
+ this.markers.clear();
275
+ this.deliveredMarkers.clear();
276
+ }
277
+ done() {
278
+ this.reportMarkers();
279
+ this.cleanAllMarkers();
280
+ }
281
+ }
282
+ class StartStopProblemCollector extends AbstractProblemCollector {
283
+ constructor(problemMatchers, markerService, modelService, _strategy = 0 , fileService) {
284
+ super(problemMatchers, markerService, modelService, fileService);
285
+ const ownerSet = Object.create(null);
286
+ problemMatchers.forEach(description => ownerSet[description.owner] = true);
287
+ this.owners = ( Object.keys(ownerSet));
288
+ this.owners.forEach((owner) => {
289
+ this.recordResourcesToClean(owner);
290
+ });
291
+ }
292
+ async processLineInternal(line) {
293
+ const markerMatch = this.tryFindMarker(line);
294
+ if (!markerMatch) {
295
+ return;
296
+ }
297
+ const owner = markerMatch.description.owner;
298
+ const resource = await markerMatch.resource;
299
+ const resourceAsString = ( resource.toString());
300
+ this.removeResourceToClean(owner, resourceAsString);
301
+ const shouldApplyMatch = await this.shouldApplyMatch(markerMatch);
302
+ if (shouldApplyMatch) {
303
+ this.recordMarker(markerMatch.marker, owner, resourceAsString);
304
+ if (this.currentOwner !== owner || this.currentResource !== resourceAsString) {
305
+ if (this.currentOwner && this.currentResource) {
306
+ this.deliverMarkersPerOwnerAndResource(this.currentOwner, this.currentResource);
307
+ }
308
+ this.currentOwner = owner;
309
+ this.currentResource = resourceAsString;
310
+ }
311
+ }
312
+ }
313
+ }
314
+ class WatchingProblemCollector extends AbstractProblemCollector {
315
+ constructor(problemMatchers, markerService, modelService, fileService) {
316
+ super(problemMatchers, markerService, modelService, fileService);
317
+ this.lines = [];
318
+ this.beginPatterns = [];
319
+ this.resetCurrentResource();
320
+ this.backgroundPatterns = [];
321
+ this._activeBackgroundMatchers = ( new Set());
322
+ this.problemMatchers.forEach(matcher => {
323
+ if (matcher.watching) {
324
+ const key = generateUuid();
325
+ this.backgroundPatterns.push({
326
+ key,
327
+ matcher: matcher,
328
+ begin: matcher.watching.beginsPattern,
329
+ end: matcher.watching.endsPattern
330
+ });
331
+ this.beginPatterns.push(matcher.watching.beginsPattern.regexp);
332
+ }
333
+ });
334
+ this.modelListeners.add(this.modelService.onModelRemoved(modelEvent => {
335
+ let markerChanged = Event.debounce(this.markerService.onMarkerChanged, (last, e) => {
336
+ return (last ?? []).concat(e);
337
+ }, 500)(async (markerEvent) => {
338
+ markerChanged?.dispose();
339
+ markerChanged = undefined;
340
+ if (!markerEvent.includes(modelEvent.uri) || (this.markerService.read({ resource: modelEvent.uri }).length !== 0)) {
341
+ return;
342
+ }
343
+ const oldLines = Array.from(this.lines);
344
+ for (const line of oldLines) {
345
+ await this.processLineInternal(line);
346
+ }
347
+ });
348
+ setTimeout(async () => {
349
+ markerChanged?.dispose();
350
+ markerChanged = undefined;
351
+ }, 600);
352
+ }));
353
+ }
354
+ aboutToStart() {
355
+ for (const background of this.backgroundPatterns) {
356
+ if (background.matcher.watching && background.matcher.watching.activeOnStart) {
357
+ this._activeBackgroundMatchers.add(background.key);
358
+ this._onDidStateChange.fire(IProblemCollectorEvent.create("backgroundProcessingBegins" ));
359
+ this.recordResourcesToClean(background.matcher.owner);
360
+ }
361
+ }
362
+ }
363
+ async processLineInternal(line) {
364
+ if ((await this.tryBegin(line)) || this.tryFinish(line)) {
365
+ return;
366
+ }
367
+ this.lines.push(line);
368
+ const markerMatch = this.tryFindMarker(line);
369
+ if (!markerMatch) {
370
+ return;
371
+ }
372
+ const resource = await markerMatch.resource;
373
+ const owner = markerMatch.description.owner;
374
+ const resourceAsString = ( resource.toString());
375
+ this.removeResourceToClean(owner, resourceAsString);
376
+ const shouldApplyMatch = await this.shouldApplyMatch(markerMatch);
377
+ if (shouldApplyMatch) {
378
+ this.recordMarker(markerMatch.marker, owner, resourceAsString);
379
+ if (this.currentOwner !== owner || this.currentResource !== resourceAsString) {
380
+ this.reportMarkersForCurrentResource();
381
+ this.currentOwner = owner;
382
+ this.currentResource = resourceAsString;
383
+ }
384
+ }
385
+ }
386
+ forceDelivery() {
387
+ this.reportMarkersForCurrentResource();
388
+ }
389
+ async tryBegin(line) {
390
+ let result = false;
391
+ for (const background of this.backgroundPatterns) {
392
+ const matches = background.begin.regexp.exec(line);
393
+ if (matches) {
394
+ if (( this._activeBackgroundMatchers.has(background.key))) {
395
+ continue;
396
+ }
397
+ this._activeBackgroundMatchers.add(background.key);
398
+ result = true;
399
+ this._onDidFindFirstMatch.fire();
400
+ this.lines = [];
401
+ this.lines.push(line);
402
+ this._onDidStateChange.fire(IProblemCollectorEvent.create("backgroundProcessingBegins" ));
403
+ this.cleanMarkerCaches();
404
+ this.resetCurrentResource();
405
+ const owner = background.matcher.owner;
406
+ const file = matches[background.begin.file];
407
+ if (file) {
408
+ const resource = getResource(file, background.matcher);
409
+ this.recordResourceToClean(owner, await resource);
410
+ }
411
+ else {
412
+ this.recordResourcesToClean(owner);
413
+ }
414
+ }
415
+ }
416
+ return result;
417
+ }
418
+ tryFinish(line) {
419
+ let result = false;
420
+ for (const background of this.backgroundPatterns) {
421
+ const matches = background.end.regexp.exec(line);
422
+ if (matches) {
423
+ if (this._numberOfMatches > 0) {
424
+ this._onDidFindErrors.fire();
425
+ }
426
+ else {
427
+ this._onDidRequestInvalidateLastMarker.fire();
428
+ }
429
+ if (( this._activeBackgroundMatchers.has(background.key))) {
430
+ this._activeBackgroundMatchers.delete(background.key);
431
+ this.resetCurrentResource();
432
+ this._onDidStateChange.fire(IProblemCollectorEvent.create("backgroundProcessingEnds" ));
433
+ result = true;
434
+ this.lines.push(line);
435
+ const owner = background.matcher.owner;
436
+ this.cleanMarkers(owner);
437
+ this.cleanMarkerCaches();
438
+ }
439
+ }
440
+ }
441
+ return result;
442
+ }
443
+ resetCurrentResource() {
444
+ this.reportMarkersForCurrentResource();
445
+ this.currentOwner = undefined;
446
+ this.currentResource = undefined;
447
+ }
448
+ reportMarkersForCurrentResource() {
449
+ if (this.currentOwner && this.currentResource) {
450
+ this.deliverMarkersPerOwnerAndResource(this.currentOwner, this.currentResource);
451
+ }
452
+ }
453
+ done() {
454
+ [...( this.applyToByOwner.keys())].forEach(owner => {
455
+ this.recordResourcesToClean(owner);
456
+ });
457
+ super.done();
458
+ }
459
+ isWatching() {
460
+ return this.backgroundPatterns.length > 0;
461
+ }
462
+ }
463
+
464
+ export { AbstractProblemCollector, StartStopProblemCollector, WatchingProblemCollector };