@codingame/monaco-vscode-api 1.67.14 → 1.67.17
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/README.md +36 -3
- package/dist/api.js +1279 -97
- package/dist/async-c7fd4178.js +212 -0
- package/dist/configuration.d.ts +292 -0
- package/dist/configuration.js +2178 -0
- package/dist/messages.d.ts +3 -3
- package/dist/messages.js +14 -6
- package/dist/{missing-services-0f9c8f22.js → missing-services-597951f0.js} +357 -31
- package/dist/modelEditor.d.ts +1 -3
- package/dist/modelEditor.js +25 -20
- package/dist/monaco.d.ts +2683 -0
- package/dist/monaco.js +149 -0
- package/dist/position-291dfe99.js +3 -0
- package/dist/{services-621e567e.js → services-9299c4ca.js} +264 -21
- package/dist/services.d.ts +327 -331
- package/dist/services.js +4 -2
- package/dist/tslib.es6-16b40665.js +21 -0
- package/dist/types-371cc315.js +27 -0
- package/package.json +15 -1
- package/dist/async-9ffe4d42.js +0 -46
package/dist/monaco.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { b as __decorate, c as __param } from './tslib.es6-16b40665.js';
|
|
2
|
+
import { _util, IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
3
|
+
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
4
|
+
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
5
|
+
import { isObject } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
6
|
+
import { deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
7
|
+
import { StandaloneEditor, StandaloneDiffEditor } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
|
|
8
|
+
function equals(one, other) {
|
|
9
|
+
if (one === other) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (one === null || one === undefined || other === null || other === undefined) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (typeof one !== typeof other) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (typeof one !== 'object') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if ((Array.isArray(one)) !== (Array.isArray(other))) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
let i;
|
|
25
|
+
let key;
|
|
26
|
+
if (Array.isArray(one)) {
|
|
27
|
+
if (one.length !== other.length) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
for (i = 0; i < one.length; i++) {
|
|
31
|
+
if (!equals(one[i], other[i])) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const oneKeys = [];
|
|
38
|
+
for (key in one) {
|
|
39
|
+
oneKeys.push(key);
|
|
40
|
+
}
|
|
41
|
+
oneKeys.sort();
|
|
42
|
+
const otherKeys = [];
|
|
43
|
+
for (key in other) {
|
|
44
|
+
otherKeys.push(key);
|
|
45
|
+
}
|
|
46
|
+
otherKeys.sort();
|
|
47
|
+
if (!equals(oneKeys, otherKeys)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
for (i = 0; i < oneKeys.length; i++) {
|
|
51
|
+
if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
function distinct(base, target) {
|
|
59
|
+
const result = Object.create(null);
|
|
60
|
+
if (!base || !target) {
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
const targetKeys = Object.keys(target);
|
|
64
|
+
targetKeys.forEach(k => {
|
|
65
|
+
const baseValue = base[k];
|
|
66
|
+
const targetValue = target[k];
|
|
67
|
+
if (!equals(baseValue, targetValue)) {
|
|
68
|
+
result[k] = targetValue;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
function getInjectedParameters(instantiationService, ctor) {
|
|
74
|
+
return instantiationService.invokeFunction((accessor) => {
|
|
75
|
+
return _util.getServiceDependencies(ctor).sort((a, b) => a.index - b.index).map(d => accessor.get(d.id));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function createInjectedClass(ctor) {
|
|
79
|
+
const _ctor = ctor;
|
|
80
|
+
return class extends _ctor {
|
|
81
|
+
constructor(...args) {
|
|
82
|
+
super(...args.slice(1), ...getInjectedParameters(args[0], ctor));
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function computeConfiguration(configuration, isDiffEditor, overrides) {
|
|
87
|
+
const editorConfiguration = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
|
|
88
|
+
if (isDiffEditor && isObject(configuration.diffEditor)) {
|
|
89
|
+
Object.assign(editorConfiguration, configuration.diffEditor);
|
|
90
|
+
}
|
|
91
|
+
if (isObject(configuration.diffEditor)) {
|
|
92
|
+
Object.assign(editorConfiguration, overrides);
|
|
93
|
+
}
|
|
94
|
+
return editorConfiguration;
|
|
95
|
+
}
|
|
96
|
+
let ConfiguredStandaloneEditor = class ConfiguredStandaloneEditor extends createInjectedClass(StandaloneEditor) {
|
|
97
|
+
constructor(domElement, isDiffEditor, _options, instantiationService, textResourceConfigurationService) {
|
|
98
|
+
const computedOptions = computeConfiguration(textResourceConfigurationService.getValue(_options?.model?.uri), isDiffEditor, _options);
|
|
99
|
+
super(instantiationService, domElement, computedOptions);
|
|
100
|
+
this.isDiffEditor = isDiffEditor;
|
|
101
|
+
this.textResourceConfigurationService = textResourceConfigurationService;
|
|
102
|
+
this.lastAppliedEditorOptions = computedOptions;
|
|
103
|
+
this.optionsOverrides = _options;
|
|
104
|
+
this._register(textResourceConfigurationService.onDidChangeConfiguration(() => this.updateEditorConfiguration()));
|
|
105
|
+
this._register(this.onDidChangeModelLanguage(() => this.updateEditorConfiguration()));
|
|
106
|
+
this._register(this.onDidChangeModel(() => this.updateEditorConfiguration()));
|
|
107
|
+
}
|
|
108
|
+
updateEditorConfiguration() {
|
|
109
|
+
const resource = this.getModel()?.uri;
|
|
110
|
+
if (resource == null) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const configuration = this.textResourceConfigurationService.getValue(resource);
|
|
114
|
+
if (configuration == null) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const editorConfiguration = computeConfiguration(configuration, this.isDiffEditor, this.optionsOverrides);
|
|
118
|
+
let editorSettingsToApply = editorConfiguration;
|
|
119
|
+
if (this.lastAppliedEditorOptions != null) {
|
|
120
|
+
editorSettingsToApply = distinct(this.lastAppliedEditorOptions, editorSettingsToApply);
|
|
121
|
+
}
|
|
122
|
+
if (Object.keys(editorSettingsToApply).length > 0) {
|
|
123
|
+
this.lastAppliedEditorOptions = editorConfiguration;
|
|
124
|
+
super.updateOptions(editorSettingsToApply);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
updateOptions(newOptions) {
|
|
128
|
+
this.optionsOverrides = newOptions;
|
|
129
|
+
this.updateEditorConfiguration();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
ConfiguredStandaloneEditor = __decorate([
|
|
133
|
+
__param(3, IInstantiationService),
|
|
134
|
+
__param(4, ITextResourceConfigurationService)
|
|
135
|
+
], ConfiguredStandaloneEditor);
|
|
136
|
+
class ConfiguredStandaloneDiffEditor extends StandaloneDiffEditor {
|
|
137
|
+
_createInnerEditor(instantiationService, container, options) {
|
|
138
|
+
return instantiationService.createInstance(ConfiguredStandaloneEditor, container, true, options);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const createConfiguredEditor = (domElement, options, override) => {
|
|
142
|
+
const instantiationService = StandaloneServices.initialize(override ?? {});
|
|
143
|
+
return instantiationService.createInstance(ConfiguredStandaloneEditor, domElement, false, options);
|
|
144
|
+
};
|
|
145
|
+
const createConfiguredDiffEditor = (domElement, options, override) => {
|
|
146
|
+
const instantiationService = StandaloneServices.initialize(override ?? {});
|
|
147
|
+
return instantiationService.createInstance(ConfiguredStandaloneDiffEditor, domElement, options);
|
|
148
|
+
};
|
|
149
|
+
export { createConfiguredDiffEditor, createConfiguredEditor };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createDecorator, IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
2
2
|
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
|
|
3
|
+
import { b as __decorate, c as __param } from './tslib.es6-16b40665.js';
|
|
3
4
|
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
4
5
|
import { isWindows, OS } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
5
6
|
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
@@ -13,6 +14,7 @@ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configurati
|
|
|
13
14
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
|
|
14
15
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
15
16
|
import { raceCancellation, Promises } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
17
|
+
import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
16
18
|
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
17
19
|
import { StopWatch } from 'monaco-editor/esm/vs/base/common/stopwatch.js';
|
|
18
20
|
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
@@ -269,6 +271,60 @@ function isValidBasename(name, isWindowsOS = isWindows) {
|
|
|
269
271
|
}
|
|
270
272
|
return true;
|
|
271
273
|
}
|
|
274
|
+
function sortedDiff(before, after, compare) {
|
|
275
|
+
const result = [];
|
|
276
|
+
function pushSplice(start, deleteCount, toInsert) {
|
|
277
|
+
if (deleteCount === 0 && toInsert.length === 0) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const latest = result[result.length - 1];
|
|
281
|
+
if (latest && latest.start + latest.deleteCount === start) {
|
|
282
|
+
latest.deleteCount += deleteCount;
|
|
283
|
+
latest.toInsert.push(...toInsert);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
result.push({ start, deleteCount, toInsert });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
let beforeIdx = 0;
|
|
290
|
+
let afterIdx = 0;
|
|
291
|
+
while (true) {
|
|
292
|
+
if (beforeIdx === before.length) {
|
|
293
|
+
pushSplice(beforeIdx, 0, after.slice(afterIdx));
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
if (afterIdx === after.length) {
|
|
297
|
+
pushSplice(beforeIdx, before.length - beforeIdx, []);
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
const beforeElement = before[beforeIdx];
|
|
301
|
+
const afterElement = after[afterIdx];
|
|
302
|
+
const n = compare(beforeElement, afterElement);
|
|
303
|
+
if (n === 0) {
|
|
304
|
+
beforeIdx += 1;
|
|
305
|
+
afterIdx += 1;
|
|
306
|
+
}
|
|
307
|
+
else if (n < 0) {
|
|
308
|
+
pushSplice(beforeIdx, 1, []);
|
|
309
|
+
beforeIdx += 1;
|
|
310
|
+
}
|
|
311
|
+
else if (n > 0) {
|
|
312
|
+
pushSplice(beforeIdx, 0, [afterElement]);
|
|
313
|
+
afterIdx += 1;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
function delta(before, after, compare) {
|
|
319
|
+
const splices = sortedDiff(before, after, compare);
|
|
320
|
+
const removed = [];
|
|
321
|
+
const added = [];
|
|
322
|
+
for (const splice of splices) {
|
|
323
|
+
removed.push(...before.slice(splice.start, splice.start + splice.deleteCount));
|
|
324
|
+
added.push(...splice.toInsert);
|
|
325
|
+
}
|
|
326
|
+
return { removed, added };
|
|
327
|
+
}
|
|
272
328
|
function coalesceInPlace(array) {
|
|
273
329
|
let to = 0;
|
|
274
330
|
for (let i = 0; i < array.length; i++) {
|
|
@@ -291,6 +347,11 @@ function remove(array, element) {
|
|
|
291
347
|
}
|
|
292
348
|
return undefined;
|
|
293
349
|
}
|
|
350
|
+
function mapArrayOrNot(items, fn) {
|
|
351
|
+
return Array.isArray(items) ?
|
|
352
|
+
items.map(fn) :
|
|
353
|
+
fn(items);
|
|
354
|
+
}
|
|
294
355
|
var NeverShowAgainScope;
|
|
295
356
|
(function(NeverShowAgainScope) {
|
|
296
357
|
NeverShowAgainScope[NeverShowAgainScope["WORKSPACE"] = 0] = "WORKSPACE";
|
|
@@ -319,26 +380,6 @@ class NoOpProgress {
|
|
|
319
380
|
total(value) { }
|
|
320
381
|
worked(value) { }
|
|
321
382
|
}
|
|
322
|
-
function __decorate(decorators, target, key, desc) {
|
|
323
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
324
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
325
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
326
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
327
|
-
}
|
|
328
|
-
function __param(paramIndex, decorator) {
|
|
329
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
330
|
-
}
|
|
331
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
332
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
333
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
334
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
335
|
-
}
|
|
336
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
337
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
338
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
339
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
340
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
341
|
-
}
|
|
342
383
|
const IFileService = createDecorator('fileService');
|
|
343
384
|
var FileType;
|
|
344
385
|
(function(FileType) {
|
|
@@ -351,6 +392,24 @@ var FilePermission;
|
|
|
351
392
|
(function(FilePermission) {
|
|
352
393
|
FilePermission[FilePermission["Readonly"] = 1] = "Readonly";
|
|
353
394
|
})(FilePermission || (FilePermission = {}));
|
|
395
|
+
function hasReadWriteCapability(provider) {
|
|
396
|
+
return !!((provider.capabilities & 2) );
|
|
397
|
+
}
|
|
398
|
+
function hasFileFolderCopyCapability(provider) {
|
|
399
|
+
return !!((provider.capabilities & 8) );
|
|
400
|
+
}
|
|
401
|
+
function hasOpenReadWriteCloseCapability(provider) {
|
|
402
|
+
return !!((provider.capabilities & 4) );
|
|
403
|
+
}
|
|
404
|
+
function hasFileReadStreamCapability(provider) {
|
|
405
|
+
return !!((provider.capabilities & 16) );
|
|
406
|
+
}
|
|
407
|
+
function hasFileAtomicReadCapability(provider) {
|
|
408
|
+
if (!hasReadWriteCapability(provider)) {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
return !!((provider.capabilities & 16384) );
|
|
412
|
+
}
|
|
354
413
|
var FileSystemProviderErrorCode;
|
|
355
414
|
(function(FileSystemProviderErrorCode) {
|
|
356
415
|
FileSystemProviderErrorCode["FileExists"] = "EntryExists";
|
|
@@ -364,10 +423,181 @@ var FileSystemProviderErrorCode;
|
|
|
364
423
|
FileSystemProviderErrorCode["Unavailable"] = "Unavailable";
|
|
365
424
|
FileSystemProviderErrorCode["Unknown"] = "Unknown";
|
|
366
425
|
})(FileSystemProviderErrorCode || (FileSystemProviderErrorCode = {}));
|
|
426
|
+
class FileSystemProviderError extends Error {
|
|
427
|
+
constructor(message, code) {
|
|
428
|
+
super(message);
|
|
429
|
+
this.code = code;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function createFileSystemProviderError(error, code) {
|
|
433
|
+
const providerError = new FileSystemProviderError(error.toString(), code);
|
|
434
|
+
markAsFileSystemProviderError(providerError, code);
|
|
435
|
+
return providerError;
|
|
436
|
+
}
|
|
437
|
+
function ensureFileSystemProviderError(error) {
|
|
438
|
+
if (!error) {
|
|
439
|
+
return createFileSystemProviderError( localize('unknownError', "Unknown Error"), FileSystemProviderErrorCode.Unknown);
|
|
440
|
+
}
|
|
441
|
+
return error;
|
|
442
|
+
}
|
|
367
443
|
function markAsFileSystemProviderError(error, code) {
|
|
368
444
|
error.name = code ? `${code} (FileSystemError)` : `FileSystemError`;
|
|
369
445
|
return error;
|
|
370
446
|
}
|
|
447
|
+
function toFileSystemProviderErrorCode(error) {
|
|
448
|
+
if (!error) {
|
|
449
|
+
return FileSystemProviderErrorCode.Unknown;
|
|
450
|
+
}
|
|
451
|
+
if (error instanceof FileSystemProviderError) {
|
|
452
|
+
return error.code;
|
|
453
|
+
}
|
|
454
|
+
const match = /^(.+) \(FileSystemError\)$/.exec(error.name);
|
|
455
|
+
if (!match) {
|
|
456
|
+
return FileSystemProviderErrorCode.Unknown;
|
|
457
|
+
}
|
|
458
|
+
switch (match[1]) {
|
|
459
|
+
case FileSystemProviderErrorCode.FileExists: return FileSystemProviderErrorCode.FileExists;
|
|
460
|
+
case FileSystemProviderErrorCode.FileIsADirectory: return FileSystemProviderErrorCode.FileIsADirectory;
|
|
461
|
+
case FileSystemProviderErrorCode.FileNotADirectory: return FileSystemProviderErrorCode.FileNotADirectory;
|
|
462
|
+
case FileSystemProviderErrorCode.FileNotFound: return FileSystemProviderErrorCode.FileNotFound;
|
|
463
|
+
case FileSystemProviderErrorCode.FileExceedsMemoryLimit: return FileSystemProviderErrorCode.FileExceedsMemoryLimit;
|
|
464
|
+
case FileSystemProviderErrorCode.FileTooLarge: return FileSystemProviderErrorCode.FileTooLarge;
|
|
465
|
+
case FileSystemProviderErrorCode.FileWriteLocked: return FileSystemProviderErrorCode.FileWriteLocked;
|
|
466
|
+
case FileSystemProviderErrorCode.NoPermissions: return FileSystemProviderErrorCode.NoPermissions;
|
|
467
|
+
case FileSystemProviderErrorCode.Unavailable: return FileSystemProviderErrorCode.Unavailable;
|
|
468
|
+
}
|
|
469
|
+
return FileSystemProviderErrorCode.Unknown;
|
|
470
|
+
}
|
|
471
|
+
function toFileOperationResult(error) {
|
|
472
|
+
if (error instanceof FileOperationError) {
|
|
473
|
+
return error.fileOperationResult;
|
|
474
|
+
}
|
|
475
|
+
switch (toFileSystemProviderErrorCode(error)) {
|
|
476
|
+
case FileSystemProviderErrorCode.FileNotFound:
|
|
477
|
+
return 1 ;
|
|
478
|
+
case FileSystemProviderErrorCode.FileIsADirectory:
|
|
479
|
+
return 0 ;
|
|
480
|
+
case FileSystemProviderErrorCode.FileNotADirectory:
|
|
481
|
+
return 10 ;
|
|
482
|
+
case FileSystemProviderErrorCode.FileWriteLocked:
|
|
483
|
+
return 5 ;
|
|
484
|
+
case FileSystemProviderErrorCode.NoPermissions:
|
|
485
|
+
return 6 ;
|
|
486
|
+
case FileSystemProviderErrorCode.FileExists:
|
|
487
|
+
return 4 ;
|
|
488
|
+
case FileSystemProviderErrorCode.FileExceedsMemoryLimit:
|
|
489
|
+
return 9 ;
|
|
490
|
+
case FileSystemProviderErrorCode.FileTooLarge:
|
|
491
|
+
return 7 ;
|
|
492
|
+
default:
|
|
493
|
+
return 11 ;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
class FileOperationEvent {
|
|
497
|
+
constructor(resource, operation, target) {
|
|
498
|
+
this.resource = resource;
|
|
499
|
+
this.operation = operation;
|
|
500
|
+
this.target = target;
|
|
501
|
+
}
|
|
502
|
+
isOperation(operation) {
|
|
503
|
+
return this.operation === operation;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
class FileChangesEvent {
|
|
507
|
+
constructor(changes, ignorePathCasing) {
|
|
508
|
+
this.added = undefined;
|
|
509
|
+
this.updated = undefined;
|
|
510
|
+
this.deleted = undefined;
|
|
511
|
+
this.rawChanges = [];
|
|
512
|
+
this.rawAdded = [];
|
|
513
|
+
this.rawUpdated = [];
|
|
514
|
+
this.rawDeleted = [];
|
|
515
|
+
this.rawChanges = changes;
|
|
516
|
+
const entriesByType = new Map();
|
|
517
|
+
for (const change of changes) {
|
|
518
|
+
const array = entriesByType.get(change.type);
|
|
519
|
+
if (array) {
|
|
520
|
+
array.push([change.resource, change]);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
entriesByType.set(change.type, [[change.resource, change]]);
|
|
524
|
+
}
|
|
525
|
+
switch (change.type) {
|
|
526
|
+
case 1 :
|
|
527
|
+
this.rawAdded.push(change.resource);
|
|
528
|
+
break;
|
|
529
|
+
case 0 :
|
|
530
|
+
this.rawUpdated.push(change.resource);
|
|
531
|
+
break;
|
|
532
|
+
case 2 :
|
|
533
|
+
this.rawDeleted.push(change.resource);
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
for (const [key, value] of entriesByType) {
|
|
538
|
+
switch (key) {
|
|
539
|
+
case 1 :
|
|
540
|
+
this.added = TernarySearchTree.forUris(() => ignorePathCasing);
|
|
541
|
+
this.added.fill(value);
|
|
542
|
+
break;
|
|
543
|
+
case 0 :
|
|
544
|
+
this.updated = TernarySearchTree.forUris(() => ignorePathCasing);
|
|
545
|
+
this.updated.fill(value);
|
|
546
|
+
break;
|
|
547
|
+
case 2 :
|
|
548
|
+
this.deleted = TernarySearchTree.forUris(() => ignorePathCasing);
|
|
549
|
+
this.deleted.fill(value);
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
contains(resource, ...types) {
|
|
555
|
+
return this.doContains(resource, { includeChildren: false }, ...types);
|
|
556
|
+
}
|
|
557
|
+
affects(resource, ...types) {
|
|
558
|
+
return this.doContains(resource, { includeChildren: true }, ...types);
|
|
559
|
+
}
|
|
560
|
+
doContains(resource, options, ...types) {
|
|
561
|
+
if (!resource) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
const hasTypesFilter = types.length > 0;
|
|
565
|
+
if (!hasTypesFilter || types.includes(1 )) {
|
|
566
|
+
if (this.added?.get(resource)) {
|
|
567
|
+
return true;
|
|
568
|
+
}
|
|
569
|
+
if (options.includeChildren && this.added?.findSuperstr(resource)) {
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
if (!hasTypesFilter || types.includes(0 )) {
|
|
574
|
+
if (this.updated?.get(resource)) {
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
if (options.includeChildren && this.updated?.findSuperstr(resource)) {
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (!hasTypesFilter || types.includes(2 )) {
|
|
582
|
+
if (this.deleted?.findSubstr(resource) ) {
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
if (options.includeChildren && this.deleted?.findSuperstr(resource)) {
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
gotAdded() {
|
|
592
|
+
return !!this.added;
|
|
593
|
+
}
|
|
594
|
+
gotDeleted() {
|
|
595
|
+
return !!this.deleted;
|
|
596
|
+
}
|
|
597
|
+
gotUpdated() {
|
|
598
|
+
return !!this.updated;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
371
601
|
class FileOperationError extends ErrorNoTelemetry {
|
|
372
602
|
constructor(message, fileOperationResult, options) {
|
|
373
603
|
super(message);
|
|
@@ -375,6 +605,19 @@ class FileOperationError extends ErrorNoTelemetry {
|
|
|
375
605
|
this.options = options;
|
|
376
606
|
}
|
|
377
607
|
}
|
|
608
|
+
class NotModifiedSinceFileOperationError extends FileOperationError {
|
|
609
|
+
constructor(message, stat, options) {
|
|
610
|
+
super(message, 2 , options);
|
|
611
|
+
this.stat = stat;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
const ETAG_DISABLED = '';
|
|
615
|
+
function etag(stat) {
|
|
616
|
+
if (typeof stat.size !== 'number' || typeof stat.mtime !== 'number') {
|
|
617
|
+
return undefined;
|
|
618
|
+
}
|
|
619
|
+
return stat.mtime.toString(29) + stat.size.toString(31);
|
|
620
|
+
}
|
|
378
621
|
const IEditorGroupsService = createDecorator('editorGroupsService');
|
|
379
622
|
function isEditorGroup(obj) {
|
|
380
623
|
const group = obj;
|
|
@@ -770,4 +1013,4 @@ var Services;
|
|
|
770
1013
|
}
|
|
771
1014
|
Services.install = install;
|
|
772
1015
|
})(Services || (Services = {}));
|
|
773
|
-
export { ACTIVE_GROUP as A, CancellationTokenSource as C, FileSystemProviderErrorCode as F, IProgressService as I, NoOpNotification as N, SIDE_GROUP as S,
|
|
1016
|
+
export { ACTIVE_GROUP as A, createFileSystemProviderError as B, CancellationTokenSource as C, FileChangesEvent as D, FileOperationError as E, FileSystemProviderErrorCode as F, hasOpenReadWriteCloseCapability as G, hasReadWriteCapability as H, IProgressService as I, hasFileReadStreamCapability as J, toFileSystemProviderErrorCode as K, etag as L, FileOperationEvent as M, NoOpNotification as N, toFileOperationResult as O, ETAG_DISABLED as P, hasFileAtomicReadCapability as Q, NotModifiedSinceFileOperationError as R, SIDE_GROUP as S, hasFileFolderCopyCapability as T, mapArrayOrNot as a, ITextFileService as b, coalesceInPlace as c, delta as d, IFileService as e, IWorkbenchEnvironmentService as f, IUriIdentityService as g, IWorkingCopyFileService as h, IPathService as i, disposed as j, IEditorService as k, IEditorGroupsService as l, markAsFileSystemProviderError as m, IPaneCompositePartService as n, IProductService as o, ILanguageStatusService as p, IHostService as q, readonly as r, Services as s, FileType as t, FilePermission as u, NotificationsFilter as v, refineServiceDecorator as w, NeverShowAgainScope as x, isPreferredGroup as y, ensureFileSystemProviderError as z };
|