@codingame/monaco-vscode-api 1.69.24 → 1.76.0-next.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/README.md +1 -3
- package/dist/_.contribution.js +3 -3
- package/dist/api.js +63 -31
- package/dist/async.js +9 -9
- package/dist/configuration.d.ts +109 -21
- package/dist/configuration.js +47 -217
- package/dist/{workspace.js → contextkey.js} +26 -47
- package/dist/dialogs.js +498 -426
- package/dist/extHost.js +1884 -909
- package/dist/files.js +65 -63
- package/dist/keybindings.d.ts +24 -18
- package/dist/keybindings.js +475 -404
- package/dist/languageConfiguration.js +5 -5
- package/dist/languageService.js +11 -3
- package/dist/languages.d.ts +24 -7
- package/dist/languages.js +1 -1
- package/dist/layout.js +104 -166
- package/dist/missing-services.js +230 -77
- package/dist/modelEditor.d.ts +1 -5
- package/dist/modelEditor.js +32 -58
- package/dist/monaco.d.ts +303 -713
- package/dist/monaco.js +2 -2
- package/dist/notifications.js +95 -235
- package/dist/polyfill.js +2022 -1637
- package/dist/services.d.ts +8908 -8467
- package/dist/services.js +1 -1
- package/dist/services2.js +293 -113
- package/dist/snippets.d.ts +24 -7
- package/dist/snippets.js +11 -9
- package/dist/textmate.d.ts +114 -20
- package/dist/textmate.js +825 -453
- package/dist/theme.js +13 -14
- package/dist/tokenClassification.d.ts +24 -7
- package/dist/tokenClassification.js +1 -1
- package/dist/tokenClassificationRegistry.js +1 -1
- package/dist/tools.js +104 -28
- package/package.json +12 -19
- package/dist/messages.d.ts +0 -10
- package/dist/messages.js +0 -11
- package/dist/types.js +0 -46
package/dist/polyfill.js
CHANGED
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
import { VSBuffer as VSBuffer$1 } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
2
|
-
import { Disposable, DisposableStore, dispose, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
-
import {
|
|
2
|
+
import { Disposable, DisposableMap as DisposableMap$1, DisposableStore, dispose as dispose$1, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { ErrorHandler as ErrorHandler$1, illegalArgument, onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
4
4
|
import { Themable as Themable$1 } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
5
5
|
import { ProgressBar as ProgressBar$1 } from 'monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js';
|
|
6
|
-
import { mixin, equals, deepClone, deepFreeze } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
7
6
|
import { RunOnceScheduler, timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
8
|
-
import { show, hide, createStyleSheet } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
9
|
-
import { isNumber, isObject, isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
10
|
-
import {
|
|
7
|
+
import { show, hide, EventHelper, createStyleSheet, asCssValueWithDefault } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
8
|
+
import { isNumber, isObject as isObject$1, isUndefinedOrNull as isUndefinedOrNull$1 } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
9
|
+
import { E as Emitter, R as RawContextKey, e as NoOpNotification$1, _ as __decorate, a as __param } from './contextkey.js';
|
|
11
10
|
import { LanguageService as LanguageService$1 } from 'monaco-editor/esm/vs/editor/common/services/languageService.js';
|
|
12
|
-
import { E as Emitter, W as WorkspaceFolder, R as RawContextKey, e as NoOpNotification$1 } from './workspace.js';
|
|
13
11
|
import { LanguagesRegistry as LanguagesRegistry$1 } from 'monaco-editor/esm/vs/editor/common/services/languagesRegistry.js';
|
|
14
|
-
import { firstOrDefault, distinct, equals as equals$1, binarySearch, range } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
12
|
+
import { firstOrDefault, distinct, equals as equals$1, binarySearch, range, coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
15
13
|
import { PLAINTEXT_LANGUAGE_ID, ModesRegistry } from 'monaco-editor/esm/vs/editor/common/languages/modesRegistry.js';
|
|
16
14
|
import { TokenizationRegistry } from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
17
15
|
import { NoOpNotification } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
18
16
|
import { StandaloneConfigurationService as StandaloneConfigurationService$1 } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
19
17
|
import { Configuration as Configuration$1, ConfigurationModel as ConfigurationModel$1, ConfigurationChangeEvent } from 'monaco-editor/esm/vs/platform/configuration/common/configurationModels.js';
|
|
20
|
-
import {
|
|
18
|
+
import { DefaultConfiguration as DefaultConfiguration$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurations.js';
|
|
21
19
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
22
|
-
import { TernarySearchTree as TernarySearchTree$1
|
|
20
|
+
import { TernarySearchTree as TernarySearchTree$1 } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
|
|
23
21
|
import { regExpLeadsToEndlessLoop, compareIgnoreCase, compareSubstring, compareSubstringIgnoreCase, compare as compare$1 } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
22
|
+
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
24
23
|
import { Extensions as Extensions$2, overrideIdentifiersFromKey, OVERRIDE_PROPERTY_REGEX } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
25
|
-
import {
|
|
24
|
+
import { equals, deepClone, deepFreeze } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
25
|
+
import { getConfigurationValue, removeFromValueTree, addToValueTree, toValuesTree } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
26
26
|
import { Event, EventBufferer } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
27
27
|
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
28
28
|
import { RawContextKey as RawContextKey$1 } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
29
29
|
import { clearPlatformLanguageAssociations, registerPlatformLanguageAssociation, getLanguageIds } from 'monaco-editor/esm/vs/editor/common/services/languagesAssociations.js';
|
|
30
30
|
import { WorkspaceFolder as WorkspaceFolder$1 } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
31
|
+
import { joinPath } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
31
32
|
import { List as List$1 } from 'monaco-editor/esm/vs/base/browser/ui/list/listWidget.js';
|
|
32
|
-
import {
|
|
33
|
-
import { CombinedSpliceable } from 'monaco-editor/esm/vs/base/browser/ui/list/splice.js';
|
|
34
|
-
import { DomEmitter, stopEvent } from 'monaco-editor/esm/vs/base/browser/event.js';
|
|
33
|
+
import { DomEmitter } from 'monaco-editor/esm/vs/base/browser/event.js';
|
|
35
34
|
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
35
|
+
import { CombinedSpliceable } from 'monaco-editor/esm/vs/base/browser/ui/list/splice.js';
|
|
36
|
+
import { ListView } from 'monaco-editor/esm/vs/base/browser/ui/list/listView.js';
|
|
36
37
|
import { ListError } from 'monaco-editor/esm/vs/base/browser/ui/list/list.js';
|
|
37
38
|
import { clamp } from 'monaco-editor/esm/vs/base/common/numbers.js';
|
|
38
|
-
import { isMacintosh
|
|
39
|
+
import { isMacintosh } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
39
40
|
import { alert } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
40
41
|
import { matchesPrefix } from 'monaco-editor/esm/vs/base/common/filters.js';
|
|
41
42
|
import { Gesture } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
42
|
-
import {
|
|
43
|
+
import { Color as Color$1, RGBA as RGBA$1 } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
44
|
+
import { LogService as LogService$1 } from 'monaco-editor/esm/vs/platform/log/common/logService.js';
|
|
45
|
+
import { MultiplexLogger, ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
43
46
|
import { SnippetParser } from 'monaco-editor/esm/vs/editor/contrib/snippet/browser/snippetParser.js';
|
|
44
|
-
import {
|
|
47
|
+
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
48
|
+
import { Keybinding as Keybinding$1, KeyCodeChord as KeyCodeChord$1 } from 'monaco-editor/esm/vs/base/common/keybindings.js';
|
|
49
|
+
import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
|
|
50
|
+
import { once } from 'monaco-editor/esm/vs/base/common/functional.js';
|
|
51
|
+
import { QuickInputController } from 'monaco-editor/esm/vs/platform/quickinput/browser/quickInput.js';
|
|
45
52
|
import { getSingletonServiceDescriptors } from 'monaco-editor/esm/vs/platform/instantiation/common/extensions.js';
|
|
46
53
|
import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
47
54
|
class ErrorHandler {
|
|
@@ -108,7 +115,7 @@ class NotImplementedError extends Error {
|
|
|
108
115
|
class ErrorNoTelemetry extends Error {
|
|
109
116
|
constructor(msg) {
|
|
110
117
|
super(msg);
|
|
111
|
-
this.name = '
|
|
118
|
+
this.name = 'CodeExpectedError';
|
|
112
119
|
}
|
|
113
120
|
static fromError(err) {
|
|
114
121
|
if (err instanceof ErrorNoTelemetry) {
|
|
@@ -120,7 +127,118 @@ class ErrorNoTelemetry extends Error {
|
|
|
120
127
|
return result;
|
|
121
128
|
}
|
|
122
129
|
static isErrorNoTelemetry(err) {
|
|
123
|
-
return err.name === '
|
|
130
|
+
return err.name === 'CodeExpectedError';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function dispose(arg) {
|
|
134
|
+
if (Iterable.is(arg)) {
|
|
135
|
+
const errors = [];
|
|
136
|
+
for (const d of arg) {
|
|
137
|
+
if (d) {
|
|
138
|
+
try {
|
|
139
|
+
d.dispose();
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
errors.push(e);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (errors.length === 1) {
|
|
147
|
+
throw errors[0];
|
|
148
|
+
}
|
|
149
|
+
else if (errors.length > 1) {
|
|
150
|
+
throw new AggregateError(errors, 'Encountered errors while disposing of store');
|
|
151
|
+
}
|
|
152
|
+
return Array.isArray(arg) ? [] : arg;
|
|
153
|
+
}
|
|
154
|
+
else if (arg) {
|
|
155
|
+
arg.dispose();
|
|
156
|
+
return arg;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
class ReferenceCollection {
|
|
160
|
+
constructor() {
|
|
161
|
+
this.references = ( (new Map()));
|
|
162
|
+
}
|
|
163
|
+
acquire(key, ...args) {
|
|
164
|
+
let reference = this.references.get(key);
|
|
165
|
+
if (!reference) {
|
|
166
|
+
reference = { counter: 0, object: this.createReferencedObject(key, ...args) };
|
|
167
|
+
this.references.set(key, reference);
|
|
168
|
+
}
|
|
169
|
+
const { object } = reference;
|
|
170
|
+
const dispose = once(() => {
|
|
171
|
+
if (--reference.counter === 0) {
|
|
172
|
+
this.destroyReferencedObject(key, reference.object);
|
|
173
|
+
this.references.delete(key);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
reference.counter++;
|
|
177
|
+
return { object, dispose };
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
class AsyncReferenceCollection {
|
|
181
|
+
constructor(referenceCollection) {
|
|
182
|
+
this.referenceCollection = referenceCollection;
|
|
183
|
+
}
|
|
184
|
+
async acquire(key, ...args) {
|
|
185
|
+
const ref = this.referenceCollection.acquire(key, ...args);
|
|
186
|
+
try {
|
|
187
|
+
const object = await ref.object;
|
|
188
|
+
return {
|
|
189
|
+
object,
|
|
190
|
+
dispose: () => ref.dispose()
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
ref.dispose();
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
class DisposableMap {
|
|
200
|
+
constructor() {
|
|
201
|
+
this._store = ( (new Map()));
|
|
202
|
+
this._isDisposed = false;
|
|
203
|
+
}
|
|
204
|
+
dispose() {
|
|
205
|
+
this._isDisposed = true;
|
|
206
|
+
this.clearAndDisposeAll();
|
|
207
|
+
}
|
|
208
|
+
clearAndDisposeAll() {
|
|
209
|
+
if (!this._store.size) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
dispose(( (this._store.values())));
|
|
214
|
+
}
|
|
215
|
+
finally {
|
|
216
|
+
this._store.clear();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
has(key) {
|
|
220
|
+
return this._store.has(key);
|
|
221
|
+
}
|
|
222
|
+
get(key) {
|
|
223
|
+
return this._store.get(key);
|
|
224
|
+
}
|
|
225
|
+
set(key, value, skipDisposeOnOverwrite = false) {
|
|
226
|
+
if (this._isDisposed) {
|
|
227
|
+
console.warn(( (new Error(
|
|
228
|
+
'Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!'
|
|
229
|
+
))).stack);
|
|
230
|
+
}
|
|
231
|
+
if (!skipDisposeOnOverwrite) {
|
|
232
|
+
this._store.get(key)?.dispose();
|
|
233
|
+
}
|
|
234
|
+
this._store.set(key, value);
|
|
235
|
+
}
|
|
236
|
+
deleteAndDispose(key) {
|
|
237
|
+
this._store.get(key)?.dispose();
|
|
238
|
+
this._store.delete(key);
|
|
239
|
+
}
|
|
240
|
+
[Symbol.iterator]() {
|
|
241
|
+
return this._store[Symbol.iterator]();
|
|
124
242
|
}
|
|
125
243
|
}
|
|
126
244
|
function isReadableStream(obj) {
|
|
@@ -452,10 +570,6 @@ const hasBuffer = (typeof Buffer !== 'undefined');
|
|
|
452
570
|
let textEncoder;
|
|
453
571
|
let textDecoder;
|
|
454
572
|
class VSBuffer {
|
|
455
|
-
constructor(buffer) {
|
|
456
|
-
this.buffer = buffer;
|
|
457
|
-
this.byteLength = this.buffer.byteLength;
|
|
458
|
-
}
|
|
459
573
|
static alloc(byteLength) {
|
|
460
574
|
if (hasBuffer) {
|
|
461
575
|
return (
|
|
@@ -515,6 +629,10 @@ class VSBuffer {
|
|
|
515
629
|
}
|
|
516
630
|
return ret;
|
|
517
631
|
}
|
|
632
|
+
constructor(buffer) {
|
|
633
|
+
this.buffer = buffer;
|
|
634
|
+
this.byteLength = this.buffer.byteLength;
|
|
635
|
+
}
|
|
518
636
|
clone() {
|
|
519
637
|
const result = VSBuffer.alloc(this.byteLength);
|
|
520
638
|
result.set(this);
|
|
@@ -631,6 +749,87 @@ async function bufferedStreamToBuffer(bufferedStream) {
|
|
|
631
749
|
function newWriteableBufferStream(options) {
|
|
632
750
|
return newWriteableStream(chunks => VSBuffer.concat(chunks), options);
|
|
633
751
|
}
|
|
752
|
+
const base64Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
753
|
+
const base64UrlSafeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
|
754
|
+
function encodeBase64({ buffer }, padded = true, urlSafe = false) {
|
|
755
|
+
const dictionary = urlSafe ? base64UrlSafeAlphabet : base64Alphabet;
|
|
756
|
+
let output = '';
|
|
757
|
+
const remainder = buffer.byteLength % 3;
|
|
758
|
+
let i = 0;
|
|
759
|
+
for (; i < buffer.byteLength - remainder; i += 3) {
|
|
760
|
+
const a = buffer[i + 0];
|
|
761
|
+
const b = buffer[i + 1];
|
|
762
|
+
const c = buffer[i + 2];
|
|
763
|
+
output += dictionary[a >>> 2];
|
|
764
|
+
output += dictionary[(a << 4 | b >>> 4) & 0b111111];
|
|
765
|
+
output += dictionary[(b << 2 | c >>> 6) & 0b111111];
|
|
766
|
+
output += dictionary[c & 0b111111];
|
|
767
|
+
}
|
|
768
|
+
if (remainder === 1) {
|
|
769
|
+
const a = buffer[i + 0];
|
|
770
|
+
output += dictionary[a >>> 2];
|
|
771
|
+
output += dictionary[(a << 4) & 0b111111];
|
|
772
|
+
if (padded) {
|
|
773
|
+
output += '==';
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
else if (remainder === 2) {
|
|
777
|
+
const a = buffer[i + 0];
|
|
778
|
+
const b = buffer[i + 1];
|
|
779
|
+
output += dictionary[a >>> 2];
|
|
780
|
+
output += dictionary[(a << 4 | b >>> 4) & 0b111111];
|
|
781
|
+
output += dictionary[(b << 2) & 0b111111];
|
|
782
|
+
if (padded) {
|
|
783
|
+
output += '=';
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return output;
|
|
787
|
+
}
|
|
788
|
+
function isString(str) {
|
|
789
|
+
return (typeof str === 'string');
|
|
790
|
+
}
|
|
791
|
+
function isStringArray(value) {
|
|
792
|
+
return Array.isArray(value) && value.every(elem => isString(elem));
|
|
793
|
+
}
|
|
794
|
+
function isObject(obj) {
|
|
795
|
+
return typeof obj === 'object'
|
|
796
|
+
&& obj !== null
|
|
797
|
+
&& !Array.isArray(obj)
|
|
798
|
+
&& !(obj instanceof RegExp)
|
|
799
|
+
&& !(obj instanceof Date);
|
|
800
|
+
}
|
|
801
|
+
function isUndefined(obj) {
|
|
802
|
+
return (typeof obj === 'undefined');
|
|
803
|
+
}
|
|
804
|
+
function isUndefinedOrNull(obj) {
|
|
805
|
+
return (isUndefined(obj) || obj === null);
|
|
806
|
+
}
|
|
807
|
+
function assertAllDefined(...args) {
|
|
808
|
+
const result = [];
|
|
809
|
+
for (let i = 0; i < args.length; i++) {
|
|
810
|
+
const arg = args[i];
|
|
811
|
+
if (isUndefinedOrNull(arg)) {
|
|
812
|
+
throw new Error(`Assertion Failed: argument at index ${i} is undefined or null`);
|
|
813
|
+
}
|
|
814
|
+
result.push(arg);
|
|
815
|
+
}
|
|
816
|
+
return result;
|
|
817
|
+
}
|
|
818
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
819
|
+
function isEmptyObject(obj) {
|
|
820
|
+
if (!isObject(obj)) {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
for (const key in obj) {
|
|
824
|
+
if (hasOwnProperty$1.call(obj, key)) {
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return true;
|
|
829
|
+
}
|
|
830
|
+
function withUndefinedAsNull(x) {
|
|
831
|
+
return typeof x === 'undefined' ? null : x;
|
|
832
|
+
}
|
|
634
833
|
const Extensions$1 = {
|
|
635
834
|
ThemingContribution: 'base.contributions.theming'
|
|
636
835
|
};
|
|
@@ -658,29 +857,26 @@ class Themable extends Disposable {
|
|
|
658
857
|
const Extensions = {
|
|
659
858
|
JSONContribution: 'base.contributions.json'
|
|
660
859
|
};
|
|
860
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
861
|
+
var css$1 = ".monaco-progress-container{height:5px;overflow:hidden;width:100%}.monaco-progress-container .progress-bit{display:none;height:5px;left:0;position:absolute;width:2%}.monaco-progress-container.active .progress-bit{display:inherit}.monaco-progress-container.discrete .progress-bit{left:0;transition:width .1s linear}.monaco-progress-container.discrete.done .progress-bit{width:100%}.monaco-progress-container.infinite .progress-bit{animation-duration:4s;animation-iteration-count:infinite;animation-name:progress;animation-timing-function:linear;transform:translateZ(0)}.monaco-progress-container.infinite.infinite-long-running .progress-bit{animation-timing-function:steps(100)}@keyframes progress{0%{transform:translateX(0) scaleX(1)}50%{transform:translateX(2500%) scaleX(3)}to{transform:translateX(4900%) scaleX(1)}}";
|
|
862
|
+
n(css$1,{});
|
|
661
863
|
const CSS_DONE = 'done';
|
|
662
864
|
const CSS_ACTIVE = 'active';
|
|
663
865
|
const CSS_INFINITE = 'infinite';
|
|
664
866
|
const CSS_INFINITE_LONG_RUNNING = 'infinite-long-running';
|
|
665
867
|
const CSS_DISCRETE = 'discrete';
|
|
666
|
-
const defaultOpts = {
|
|
667
|
-
progressBarBackground: ( (Color$1.fromHex('#0E70C0')))
|
|
668
|
-
};
|
|
669
868
|
class ProgressBar extends Disposable {
|
|
670
869
|
constructor(container, options) {
|
|
671
870
|
super();
|
|
672
|
-
this.options = options || Object.create(null);
|
|
673
|
-
mixin(this.options, defaultOpts, false);
|
|
674
871
|
this.workedVal = 0;
|
|
675
|
-
this.progressBarBackground = this.options.progressBarBackground;
|
|
676
872
|
this.showDelayedScheduler = this._register(( (new RunOnceScheduler(() => show(this.element), 0))));
|
|
677
873
|
this.longRunningScheduler = this._register(( (new RunOnceScheduler(
|
|
678
874
|
() => this.infiniteLongRunning(),
|
|
679
875
|
ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD
|
|
680
876
|
))));
|
|
681
|
-
this.create(container);
|
|
877
|
+
this.create(container, options);
|
|
682
878
|
}
|
|
683
|
-
create(container) {
|
|
879
|
+
create(container, options) {
|
|
684
880
|
this.element = document.createElement('div');
|
|
685
881
|
this.element.classList.add('monaco-progress-container');
|
|
686
882
|
this.element.setAttribute('role', 'progressbar');
|
|
@@ -688,8 +884,8 @@ class ProgressBar extends Disposable {
|
|
|
688
884
|
container.appendChild(this.element);
|
|
689
885
|
this.bit = document.createElement('div');
|
|
690
886
|
this.bit.classList.add('progress-bit');
|
|
887
|
+
this.bit.style.backgroundColor = options?.progressBarBackground || '#0E70C0';
|
|
691
888
|
this.element.appendChild(this.bit);
|
|
692
|
-
this.applyStyles();
|
|
693
889
|
}
|
|
694
890
|
off() {
|
|
695
891
|
this.bit.style.width = 'inherit';
|
|
@@ -781,16 +977,6 @@ class ProgressBar extends Disposable {
|
|
|
781
977
|
hide(this.element);
|
|
782
978
|
this.showDelayedScheduler.cancel();
|
|
783
979
|
}
|
|
784
|
-
style(styles) {
|
|
785
|
-
this.progressBarBackground = styles.progressBarBackground;
|
|
786
|
-
this.applyStyles();
|
|
787
|
-
}
|
|
788
|
-
applyStyles() {
|
|
789
|
-
if (this.bit) {
|
|
790
|
-
const background = this.progressBarBackground ? ( (this.progressBarBackground.toString())) : '';
|
|
791
|
-
this.bit.style.backgroundColor = background;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
980
|
}
|
|
795
981
|
ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD = 10000;
|
|
796
982
|
function sortedDiff(before, after, compare) {
|
|
@@ -847,16 +1033,6 @@ function delta(before, after, compare) {
|
|
|
847
1033
|
}
|
|
848
1034
|
return { removed, added };
|
|
849
1035
|
}
|
|
850
|
-
function coalesceInPlace(array) {
|
|
851
|
-
let to = 0;
|
|
852
|
-
for (let i = 0; i < array.length; i++) {
|
|
853
|
-
if (!!array[i]) {
|
|
854
|
-
array[to] = array[i];
|
|
855
|
-
to += 1;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
array.length = to;
|
|
859
|
-
}
|
|
860
1036
|
function flatten(arr) {
|
|
861
1037
|
return [].concat(...arr);
|
|
862
1038
|
}
|
|
@@ -1009,7 +1185,7 @@ class LanguageSelection {
|
|
|
1009
1185
|
}
|
|
1010
1186
|
if (!this._emitter) {
|
|
1011
1187
|
this._emitter = ( (new Emitter({
|
|
1012
|
-
|
|
1188
|
+
onDidRemoveLastListener: () => {
|
|
1013
1189
|
this._dispose();
|
|
1014
1190
|
}
|
|
1015
1191
|
})));
|
|
@@ -1737,1733 +1913,1814 @@ function getNodeType(value) {
|
|
|
1737
1913
|
default: return 'null';
|
|
1738
1914
|
}
|
|
1739
1915
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1916
|
+
function freeze(data) {
|
|
1917
|
+
return Object.isFrozen(data) ? data : deepFreeze(data);
|
|
1918
|
+
}
|
|
1919
|
+
class ConfigurationModel {
|
|
1920
|
+
constructor(_contents = {}, _keys = [], _overrides = [], raw) {
|
|
1921
|
+
this._contents = _contents;
|
|
1922
|
+
this._keys = _keys;
|
|
1923
|
+
this._overrides = _overrides;
|
|
1924
|
+
this.raw = raw;
|
|
1925
|
+
this.overrideConfigurations = ( (new Map()));
|
|
1745
1926
|
}
|
|
1746
|
-
|
|
1747
|
-
this.
|
|
1748
|
-
|
|
1749
|
-
|
|
1927
|
+
get rawConfiguration() {
|
|
1928
|
+
if (!this._rawConfiguration) {
|
|
1929
|
+
if (this.raw?.length) {
|
|
1930
|
+
const rawConfigurationModels = this.raw.map(raw => {
|
|
1931
|
+
if (raw instanceof ConfigurationModel) {
|
|
1932
|
+
return raw;
|
|
1933
|
+
}
|
|
1934
|
+
const parser = ( (new ConfigurationModelParser('')));
|
|
1935
|
+
parser.parseRaw(raw);
|
|
1936
|
+
return parser.configurationModel;
|
|
1937
|
+
});
|
|
1938
|
+
this._rawConfiguration = rawConfigurationModels.reduce((previous, current) => current === previous ? current : previous.merge(current), rawConfigurationModels[0]);
|
|
1939
|
+
}
|
|
1940
|
+
else {
|
|
1941
|
+
this._rawConfiguration = this;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
return this._rawConfiguration;
|
|
1750
1945
|
}
|
|
1751
|
-
|
|
1752
|
-
this.
|
|
1753
|
-
return this;
|
|
1946
|
+
get contents() {
|
|
1947
|
+
return this._contents;
|
|
1754
1948
|
}
|
|
1755
|
-
|
|
1756
|
-
return this.
|
|
1949
|
+
get overrides() {
|
|
1950
|
+
return this._overrides;
|
|
1757
1951
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
const thisCode = this._value.charCodeAt(this._pos);
|
|
1761
|
-
return aCode - thisCode;
|
|
1952
|
+
get keys() {
|
|
1953
|
+
return this._keys;
|
|
1762
1954
|
}
|
|
1763
|
-
|
|
1764
|
-
return this.
|
|
1955
|
+
isEmpty() {
|
|
1956
|
+
return this._keys.length === 0 && ( (Object.keys(this._contents))).length === 0 && this._overrides.length === 0;
|
|
1765
1957
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
constructor(_caseSensitive = true) {
|
|
1769
|
-
this._caseSensitive = _caseSensitive;
|
|
1958
|
+
getValue(section) {
|
|
1959
|
+
return section ? getConfigurationValue(this.contents, section) : this.contents;
|
|
1770
1960
|
}
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
this.
|
|
1774
|
-
this.
|
|
1775
|
-
return
|
|
1961
|
+
inspect(section, overrideIdentifier) {
|
|
1962
|
+
const value = this.rawConfiguration.getValue(section);
|
|
1963
|
+
const override = overrideIdentifier ? this.rawConfiguration.getOverrideValue(section, overrideIdentifier) : undefined;
|
|
1964
|
+
const merged = overrideIdentifier ? this.rawConfiguration.override(overrideIdentifier).getValue(section) : value;
|
|
1965
|
+
return { value, override, merged };
|
|
1776
1966
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1967
|
+
getOverrideValue(section, overrideIdentifier) {
|
|
1968
|
+
const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);
|
|
1969
|
+
return overrideContents
|
|
1970
|
+
? section ? getConfigurationValue(overrideContents, section) : overrideContents
|
|
1971
|
+
: undefined;
|
|
1779
1972
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
if (ch === 46 ) {
|
|
1786
|
-
if (justSeps) {
|
|
1787
|
-
this._from++;
|
|
1788
|
-
}
|
|
1789
|
-
else {
|
|
1790
|
-
break;
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
else {
|
|
1794
|
-
justSeps = false;
|
|
1973
|
+
getKeysForOverrideIdentifier(identifier) {
|
|
1974
|
+
const keys = [];
|
|
1975
|
+
for (const override of this.overrides) {
|
|
1976
|
+
if (override.identifiers.includes(identifier)) {
|
|
1977
|
+
keys.push(...override.keys);
|
|
1795
1978
|
}
|
|
1796
1979
|
}
|
|
1797
|
-
return
|
|
1798
|
-
}
|
|
1799
|
-
cmp(a) {
|
|
1800
|
-
return this._caseSensitive
|
|
1801
|
-
? compareSubstring(a, this._value, 0, a.length, this._from, this._to)
|
|
1802
|
-
: compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);
|
|
1803
|
-
}
|
|
1804
|
-
value() {
|
|
1805
|
-
return this._value.substring(this._from, this._to);
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
class PathIterator {
|
|
1809
|
-
constructor(_splitOnBackslash = true, _caseSensitive = true) {
|
|
1810
|
-
this._splitOnBackslash = _splitOnBackslash;
|
|
1811
|
-
this._caseSensitive = _caseSensitive;
|
|
1980
|
+
return distinct(keys);
|
|
1812
1981
|
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
this.
|
|
1816
|
-
|
|
1817
|
-
this._valueLen = key.length;
|
|
1818
|
-
for (let pos = key.length - 1; pos >= 0; pos--, this._valueLen--) {
|
|
1819
|
-
const ch = this._value.charCodeAt(pos);
|
|
1820
|
-
if (!((ch === 47 || this._splitOnBackslash && ch === 92) )) {
|
|
1821
|
-
break;
|
|
1822
|
-
}
|
|
1982
|
+
getAllOverrideIdentifiers() {
|
|
1983
|
+
const result = [];
|
|
1984
|
+
for (const override of this.overrides) {
|
|
1985
|
+
result.push(...override.identifiers);
|
|
1823
1986
|
}
|
|
1824
|
-
return
|
|
1987
|
+
return distinct(result);
|
|
1825
1988
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1989
|
+
override(identifier) {
|
|
1990
|
+
let overrideConfigurationModel = this.overrideConfigurations.get(identifier);
|
|
1991
|
+
if (!overrideConfigurationModel) {
|
|
1992
|
+
overrideConfigurationModel = this.createOverrideConfigurationModel(identifier);
|
|
1993
|
+
this.overrideConfigurations.set(identifier, overrideConfigurationModel);
|
|
1994
|
+
}
|
|
1995
|
+
return overrideConfigurationModel;
|
|
1828
1996
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1997
|
+
merge(...others) {
|
|
1998
|
+
const contents = deepClone(this.contents);
|
|
1999
|
+
const overrides = deepClone(this.overrides);
|
|
2000
|
+
const keys = [...this.keys];
|
|
2001
|
+
const raws = this.raw?.length ? [...this.raw] : [this];
|
|
2002
|
+
for (const other of others) {
|
|
2003
|
+
raws.push(...(other.raw?.length ? other.raw : [other]));
|
|
2004
|
+
if (other.isEmpty()) {
|
|
2005
|
+
continue;
|
|
2006
|
+
}
|
|
2007
|
+
this.mergeContents(contents, other.contents);
|
|
2008
|
+
for (const otherOverride of other.overrides) {
|
|
2009
|
+
const [override] = overrides.filter(o => equals$1(o.identifiers, otherOverride.identifiers));
|
|
2010
|
+
if (override) {
|
|
2011
|
+
this.mergeContents(override.contents, otherOverride.contents);
|
|
2012
|
+
override.keys.push(...otherOverride.keys);
|
|
2013
|
+
override.keys = distinct(override.keys);
|
|
1837
2014
|
}
|
|
1838
2015
|
else {
|
|
1839
|
-
|
|
2016
|
+
overrides.push(deepClone(otherOverride));
|
|
1840
2017
|
}
|
|
1841
2018
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
2019
|
+
for (const key of other.keys) {
|
|
2020
|
+
if (keys.indexOf(key) === -1) {
|
|
2021
|
+
keys.push(key);
|
|
2022
|
+
}
|
|
1844
2023
|
}
|
|
1845
2024
|
}
|
|
1846
|
-
return
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
return this._value.substring(this._from, this._to);
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
class UriIterator {
|
|
1858
|
-
constructor(_ignorePathCasing, _ignoreQueryAndFragment) {
|
|
1859
|
-
this._ignorePathCasing = _ignorePathCasing;
|
|
1860
|
-
this._ignoreQueryAndFragment = _ignoreQueryAndFragment;
|
|
1861
|
-
this._states = [];
|
|
1862
|
-
this._stateIdx = 0;
|
|
2025
|
+
return (
|
|
2026
|
+
(new ConfigurationModel(
|
|
2027
|
+
contents,
|
|
2028
|
+
keys,
|
|
2029
|
+
overrides,
|
|
2030
|
+
raws.every(raw => raw instanceof ConfigurationModel) ? undefined : raws
|
|
2031
|
+
))
|
|
2032
|
+
);
|
|
1863
2033
|
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
this._states.push(1 );
|
|
2034
|
+
createOverrideConfigurationModel(identifier) {
|
|
2035
|
+
const overrideContents = this.getContentsForOverrideIdentifer(identifier);
|
|
2036
|
+
if (!overrideContents || typeof overrideContents !== 'object' || !( (Object.keys(overrideContents))).length) {
|
|
2037
|
+
return this;
|
|
1869
2038
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
2039
|
+
const contents = {};
|
|
2040
|
+
for (const key of distinct([...( (Object.keys(this.contents))), ...( (Object.keys(overrideContents)))])) {
|
|
2041
|
+
let contentsForKey = this.contents[key];
|
|
2042
|
+
const overrideContentsForKey = overrideContents[key];
|
|
2043
|
+
if (overrideContentsForKey) {
|
|
2044
|
+
if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
|
|
2045
|
+
contentsForKey = deepClone(contentsForKey);
|
|
2046
|
+
this.mergeContents(contentsForKey, overrideContentsForKey);
|
|
2047
|
+
}
|
|
2048
|
+
else {
|
|
2049
|
+
contentsForKey = overrideContentsForKey;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
contents[key] = contentsForKey;
|
|
1872
2053
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
2054
|
+
return (
|
|
2055
|
+
(new ConfigurationModel(contents, this.keys, this.overrides))
|
|
2056
|
+
);
|
|
2057
|
+
}
|
|
2058
|
+
mergeContents(source, target) {
|
|
2059
|
+
for (const key of ( (Object.keys(target)))) {
|
|
2060
|
+
if (key in source) {
|
|
2061
|
+
if (isObject$1(source[key]) && isObject$1(target[key])) {
|
|
2062
|
+
this.mergeContents(source[key], target[key]);
|
|
2063
|
+
continue;
|
|
2064
|
+
}
|
|
1878
2065
|
}
|
|
2066
|
+
source[key] = deepClone(target[key]);
|
|
1879
2067
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2068
|
+
}
|
|
2069
|
+
getContentsForOverrideIdentifer(identifier) {
|
|
2070
|
+
let contentsForIdentifierOnly = null;
|
|
2071
|
+
let contents = null;
|
|
2072
|
+
const mergeContents = (contentsToMerge) => {
|
|
2073
|
+
if (contentsToMerge) {
|
|
2074
|
+
if (contents) {
|
|
2075
|
+
this.mergeContents(contents, contentsToMerge);
|
|
2076
|
+
}
|
|
2077
|
+
else {
|
|
2078
|
+
contents = deepClone(contentsToMerge);
|
|
2079
|
+
}
|
|
1883
2080
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
2081
|
+
};
|
|
2082
|
+
for (const override of this.overrides) {
|
|
2083
|
+
if (equals$1(override.identifiers, [identifier])) {
|
|
2084
|
+
contentsForIdentifierOnly = override.contents;
|
|
2085
|
+
}
|
|
2086
|
+
else if (override.identifiers.includes(identifier)) {
|
|
2087
|
+
mergeContents(override.contents);
|
|
1886
2088
|
}
|
|
1887
2089
|
}
|
|
1888
|
-
|
|
1889
|
-
return
|
|
2090
|
+
mergeContents(contentsForIdentifierOnly);
|
|
2091
|
+
return contents;
|
|
1890
2092
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
this.
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
}
|
|
1898
|
-
return this;
|
|
2093
|
+
toJSON() {
|
|
2094
|
+
return {
|
|
2095
|
+
contents: this.contents,
|
|
2096
|
+
overrides: this.overrides,
|
|
2097
|
+
keys: this.keys
|
|
2098
|
+
};
|
|
1899
2099
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|| this._stateIdx < this._states.length - 1;
|
|
2100
|
+
addValue(key, value) {
|
|
2101
|
+
this.updateValue(key, value, true);
|
|
1903
2102
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
return compareIgnoreCase(a, this._value.scheme);
|
|
1907
|
-
}
|
|
1908
|
-
else if (this._states[this._stateIdx] === 2 ) {
|
|
1909
|
-
return compareIgnoreCase(a, this._value.authority);
|
|
1910
|
-
}
|
|
1911
|
-
else if (this._states[this._stateIdx] === 3 ) {
|
|
1912
|
-
return this._pathIterator.cmp(a);
|
|
1913
|
-
}
|
|
1914
|
-
else if (this._states[this._stateIdx] === 4 ) {
|
|
1915
|
-
return compare$1(a, this._value.query);
|
|
1916
|
-
}
|
|
1917
|
-
else if (this._states[this._stateIdx] === 5 ) {
|
|
1918
|
-
return compare$1(a, this._value.fragment);
|
|
1919
|
-
}
|
|
1920
|
-
throw new Error();
|
|
2103
|
+
setValue(key, value) {
|
|
2104
|
+
this.updateValue(key, value, false);
|
|
1921
2105
|
}
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
else if (this._states[this._stateIdx] === 2 ) {
|
|
1927
|
-
return this._value.authority;
|
|
2106
|
+
removeValue(key) {
|
|
2107
|
+
const index = this.keys.indexOf(key);
|
|
2108
|
+
if (index === -1) {
|
|
2109
|
+
return;
|
|
1928
2110
|
}
|
|
1929
|
-
|
|
1930
|
-
|
|
2111
|
+
this.keys.splice(index, 1);
|
|
2112
|
+
removeFromValueTree(this.contents, key);
|
|
2113
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
2114
|
+
this.overrides.splice(this.overrides.findIndex(o => equals$1(o.identifiers, overrideIdentifiersFromKey(key))), 1);
|
|
1931
2115
|
}
|
|
1932
|
-
|
|
1933
|
-
|
|
2116
|
+
}
|
|
2117
|
+
updateValue(key, value, add) {
|
|
2118
|
+
addToValueTree(this.contents, key, value, e => console.error(e));
|
|
2119
|
+
add = add || this.keys.indexOf(key) === -1;
|
|
2120
|
+
if (add) {
|
|
2121
|
+
this.keys.push(key);
|
|
1934
2122
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
2123
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
2124
|
+
this.overrides.push({
|
|
2125
|
+
identifiers: overrideIdentifiersFromKey(key),
|
|
2126
|
+
keys: ( (Object.keys(this.contents[key]))),
|
|
2127
|
+
contents: toValuesTree(this.contents[key], message => console.error(message)),
|
|
2128
|
+
});
|
|
1937
2129
|
}
|
|
1938
|
-
throw new Error();
|
|
1939
2130
|
}
|
|
1940
2131
|
}
|
|
1941
|
-
class
|
|
1942
|
-
constructor() {
|
|
1943
|
-
this.
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
rotateLeft() {
|
|
1949
|
-
const tmp = this.right;
|
|
1950
|
-
this.right = tmp.left;
|
|
1951
|
-
tmp.left = this;
|
|
1952
|
-
this.updateHeight();
|
|
1953
|
-
tmp.updateHeight();
|
|
1954
|
-
return tmp;
|
|
1955
|
-
}
|
|
1956
|
-
rotateRight() {
|
|
1957
|
-
const tmp = this.left;
|
|
1958
|
-
this.left = tmp.right;
|
|
1959
|
-
tmp.right = this;
|
|
1960
|
-
this.updateHeight();
|
|
1961
|
-
tmp.updateHeight();
|
|
1962
|
-
return tmp;
|
|
1963
|
-
}
|
|
1964
|
-
updateHeight() {
|
|
1965
|
-
this.height = 1 + Math.max(this.heightLeft, this.heightRight);
|
|
1966
|
-
}
|
|
1967
|
-
balanceFactor() {
|
|
1968
|
-
return this.heightRight - this.heightLeft;
|
|
1969
|
-
}
|
|
1970
|
-
get heightLeft() {
|
|
1971
|
-
return this.left?.height ?? 0;
|
|
1972
|
-
}
|
|
1973
|
-
get heightRight() {
|
|
1974
|
-
return this.right?.height ?? 0;
|
|
2132
|
+
class ConfigurationModelParser {
|
|
2133
|
+
constructor(_name) {
|
|
2134
|
+
this._name = _name;
|
|
2135
|
+
this._raw = null;
|
|
2136
|
+
this._configurationModel = null;
|
|
2137
|
+
this._restrictedConfigurations = [];
|
|
2138
|
+
this._parseErrors = [];
|
|
1975
2139
|
}
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
constructor(segments) {
|
|
1979
|
-
this._iter = segments;
|
|
2140
|
+
get configurationModel() {
|
|
2141
|
+
return this._configurationModel || ( (new ConfigurationModel()));
|
|
1980
2142
|
}
|
|
1981
|
-
|
|
1982
|
-
return
|
|
1983
|
-
(new TernarySearchTree( (new UriIterator(ignorePathCasing, ignoreQueryAndFragment))))
|
|
1984
|
-
);
|
|
2143
|
+
get restrictedConfigurations() {
|
|
2144
|
+
return this._restrictedConfigurations;
|
|
1985
2145
|
}
|
|
1986
|
-
|
|
1987
|
-
return
|
|
1988
|
-
(new TernarySearchTree( (new PathIterator(undefined, !ignorePathCasing))))
|
|
1989
|
-
);
|
|
2146
|
+
get errors() {
|
|
2147
|
+
return this._parseErrors;
|
|
1990
2148
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2149
|
+
parse(content, options) {
|
|
2150
|
+
if (!isUndefinedOrNull$1(content)) {
|
|
2151
|
+
const raw = this.doParseContent(content);
|
|
2152
|
+
this.parseRaw(raw, options);
|
|
2153
|
+
}
|
|
1995
2154
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2155
|
+
reparse(options) {
|
|
2156
|
+
if (this._raw) {
|
|
2157
|
+
this.parseRaw(this._raw, options);
|
|
2158
|
+
}
|
|
2000
2159
|
}
|
|
2001
|
-
|
|
2002
|
-
this.
|
|
2160
|
+
parseRaw(raw, options) {
|
|
2161
|
+
this._raw = raw;
|
|
2162
|
+
const { contents, keys, overrides, restricted, hasExcludedProperties } = this.doParseRaw(raw, options);
|
|
2163
|
+
this._configurationModel = ( (new ConfigurationModel(
|
|
2164
|
+
contents,
|
|
2165
|
+
keys,
|
|
2166
|
+
overrides,
|
|
2167
|
+
hasExcludedProperties ? [raw] : undefined
|
|
2168
|
+
)));
|
|
2169
|
+
this._restrictedConfigurations = restricted || [];
|
|
2003
2170
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2171
|
+
doParseContent(content) {
|
|
2172
|
+
let raw = {};
|
|
2173
|
+
let currentProperty = null;
|
|
2174
|
+
let currentParent = [];
|
|
2175
|
+
const previousParents = [];
|
|
2176
|
+
function onValue(value) {
|
|
2177
|
+
if (Array.isArray(currentParent)) {
|
|
2178
|
+
currentParent.push(value);
|
|
2010
2179
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
const arr = values.slice(0);
|
|
2014
|
-
shuffle(arr);
|
|
2015
|
-
for (const entry of arr) {
|
|
2016
|
-
this.set(entry[0], entry[1]);
|
|
2180
|
+
else if (currentProperty !== null) {
|
|
2181
|
+
currentParent[currentProperty] = value;
|
|
2017
2182
|
}
|
|
2018
2183
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
node = node.right;
|
|
2046
|
-
}
|
|
2047
|
-
else if (iter.hasNext()) {
|
|
2048
|
-
iter.next();
|
|
2049
|
-
if (!node.mid) {
|
|
2050
|
-
node.mid = ( (new TernarySearchTreeNode()));
|
|
2051
|
-
node.mid.segment = iter.value();
|
|
2052
|
-
}
|
|
2053
|
-
stack.push([0 , node]);
|
|
2054
|
-
node = node.mid;
|
|
2184
|
+
const visitor = {
|
|
2185
|
+
onObjectBegin: () => {
|
|
2186
|
+
const object = {};
|
|
2187
|
+
onValue(object);
|
|
2188
|
+
previousParents.push(currentParent);
|
|
2189
|
+
currentParent = object;
|
|
2190
|
+
currentProperty = null;
|
|
2191
|
+
},
|
|
2192
|
+
onObjectProperty: (name) => {
|
|
2193
|
+
currentProperty = name;
|
|
2194
|
+
},
|
|
2195
|
+
onObjectEnd: () => {
|
|
2196
|
+
currentParent = previousParents.pop();
|
|
2197
|
+
},
|
|
2198
|
+
onArrayBegin: () => {
|
|
2199
|
+
const array = [];
|
|
2200
|
+
onValue(array);
|
|
2201
|
+
previousParents.push(currentParent);
|
|
2202
|
+
currentParent = array;
|
|
2203
|
+
currentProperty = null;
|
|
2204
|
+
},
|
|
2205
|
+
onArrayEnd: () => {
|
|
2206
|
+
currentParent = previousParents.pop();
|
|
2207
|
+
},
|
|
2208
|
+
onLiteralValue: onValue,
|
|
2209
|
+
onError: (error, offset, length) => {
|
|
2055
2210
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2211
|
+
};
|
|
2212
|
+
if (content) {
|
|
2213
|
+
try {
|
|
2214
|
+
visit(content, visitor);
|
|
2215
|
+
raw = currentParent[0] || {};
|
|
2216
|
+
}
|
|
2217
|
+
catch (e) {
|
|
2218
|
+
console.error(`Error while parsing settings file ${this._name}: ${e}`);
|
|
2219
|
+
this._parseErrors = [e];
|
|
2058
2220
|
}
|
|
2059
2221
|
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2222
|
+
return raw;
|
|
2223
|
+
}
|
|
2224
|
+
doParseRaw(raw, options) {
|
|
2225
|
+
const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
|
|
2226
|
+
const filtered = this.filter(raw, configurationProperties, true, options);
|
|
2227
|
+
raw = filtered.raw;
|
|
2228
|
+
const contents = toValuesTree(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
|
|
2229
|
+
const keys = ( (Object.keys(raw)));
|
|
2230
|
+
const overrides = this.toOverrides(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
|
|
2231
|
+
return { contents, keys, overrides, restricted: filtered.restricted, hasExcludedProperties: filtered.hasExcludedProperties };
|
|
2232
|
+
}
|
|
2233
|
+
filter(properties, configurationProperties, filterOverriddenProperties, options) {
|
|
2234
|
+
let hasExcludedProperties = false;
|
|
2235
|
+
if (!options?.scopes && !options?.skipRestricted) {
|
|
2236
|
+
return { raw: properties, restricted: [], hasExcludedProperties };
|
|
2237
|
+
}
|
|
2238
|
+
const raw = {};
|
|
2239
|
+
const restricted = [];
|
|
2240
|
+
for (const key in properties) {
|
|
2241
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key) && filterOverriddenProperties) {
|
|
2242
|
+
const result = this.filter(properties[key], configurationProperties, false, options);
|
|
2243
|
+
raw[key] = result.raw;
|
|
2244
|
+
hasExcludedProperties = hasExcludedProperties || result.hasExcludedProperties;
|
|
2245
|
+
restricted.push(...result.restricted);
|
|
2246
|
+
}
|
|
2247
|
+
else {
|
|
2248
|
+
const propertySchema = configurationProperties[key];
|
|
2249
|
+
const scope = propertySchema ? typeof propertySchema.scope !== 'undefined' ? propertySchema.scope : 3 : undefined;
|
|
2250
|
+
if (propertySchema?.restricted) {
|
|
2251
|
+
restricted.push(key);
|
|
2079
2252
|
}
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2253
|
+
if ((scope === undefined || options.scopes === undefined || options.scopes.includes(scope))
|
|
2254
|
+
&& !(options.skipRestricted && propertySchema?.restricted)) {
|
|
2255
|
+
raw[key] = properties[key];
|
|
2083
2256
|
}
|
|
2084
2257
|
else {
|
|
2085
|
-
|
|
2086
|
-
}
|
|
2087
|
-
if (i > 0) {
|
|
2088
|
-
switch (stack[i - 1][0]) {
|
|
2089
|
-
case -1 :
|
|
2090
|
-
stack[i - 1][1].left = stack[i][1];
|
|
2091
|
-
break;
|
|
2092
|
-
case 1 :
|
|
2093
|
-
stack[i - 1][1].right = stack[i][1];
|
|
2094
|
-
break;
|
|
2095
|
-
case 0 :
|
|
2096
|
-
stack[i - 1][1].mid = stack[i][1];
|
|
2097
|
-
break;
|
|
2098
|
-
}
|
|
2258
|
+
hasExcludedProperties = true;
|
|
2099
2259
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
return { raw, restricted, hasExcludedProperties };
|
|
2263
|
+
}
|
|
2264
|
+
toOverrides(raw, conflictReporter) {
|
|
2265
|
+
const overrides = [];
|
|
2266
|
+
for (const key of ( (Object.keys(raw)))) {
|
|
2267
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
2268
|
+
const overrideRaw = {};
|
|
2269
|
+
for (const keyInOverrideRaw in raw[key]) {
|
|
2270
|
+
overrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];
|
|
2102
2271
|
}
|
|
2272
|
+
overrides.push({
|
|
2273
|
+
identifiers: overrideIdentifiersFromKey(key),
|
|
2274
|
+
keys: ( (Object.keys(overrideRaw))),
|
|
2275
|
+
contents: toValuesTree(overrideRaw, conflictReporter)
|
|
2276
|
+
});
|
|
2103
2277
|
}
|
|
2104
2278
|
}
|
|
2105
|
-
return
|
|
2279
|
+
return overrides;
|
|
2106
2280
|
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2281
|
+
}
|
|
2282
|
+
class UserSettings extends Disposable {
|
|
2283
|
+
constructor(userSettingsResource, scopes, extUri, fileService) {
|
|
2284
|
+
super();
|
|
2285
|
+
this.userSettingsResource = userSettingsResource;
|
|
2286
|
+
this.scopes = scopes;
|
|
2287
|
+
this.fileService = fileService;
|
|
2288
|
+
this._onDidChange = this._register(( (new Emitter())));
|
|
2289
|
+
this.onDidChange = this._onDidChange.event;
|
|
2290
|
+
this.parser = ( (new ConfigurationModelParser( (this.userSettingsResource.toString()))));
|
|
2291
|
+
this.parseOptions = { scopes: this.scopes };
|
|
2292
|
+
this._register(this.fileService.watch(extUri.dirname(this.userSettingsResource)));
|
|
2293
|
+
this._register(this.fileService.watch(this.userSettingsResource));
|
|
2294
|
+
this._register(Event.any(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.userSettingsResource)), Event.filter(this.fileService.onDidRunOperation, e => (e.isOperation(0 ) || e.isOperation(3 ) || e.isOperation(1 ) || e.isOperation(4 )) && extUri.isEqual(e.resource, userSettingsResource)))(() => this._onDidChange.fire()));
|
|
2109
2295
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
}
|
|
2121
|
-
else if (iter.hasNext()) {
|
|
2122
|
-
iter.next();
|
|
2123
|
-
node = node.mid;
|
|
2124
|
-
}
|
|
2125
|
-
else {
|
|
2126
|
-
break;
|
|
2127
|
-
}
|
|
2296
|
+
async loadConfiguration() {
|
|
2297
|
+
try {
|
|
2298
|
+
const content = await this.fileService.readFile(this.userSettingsResource);
|
|
2299
|
+
this.parser.parse(( (content.value.toString())) || '{}', this.parseOptions);
|
|
2300
|
+
return this.parser.configurationModel;
|
|
2301
|
+
}
|
|
2302
|
+
catch (e) {
|
|
2303
|
+
return (
|
|
2304
|
+
(new ConfigurationModel())
|
|
2305
|
+
);
|
|
2128
2306
|
}
|
|
2129
|
-
return node;
|
|
2130
2307
|
}
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
return
|
|
2308
|
+
reparse() {
|
|
2309
|
+
this.parser.reparse(this.parseOptions);
|
|
2310
|
+
return this.parser.configurationModel;
|
|
2134
2311
|
}
|
|
2135
|
-
|
|
2136
|
-
return this.
|
|
2312
|
+
getRestrictedSettings() {
|
|
2313
|
+
return this.parser.restrictedConfigurations;
|
|
2137
2314
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2315
|
+
}
|
|
2316
|
+
class ConfigurationInspectValue {
|
|
2317
|
+
constructor(key, overrides, _value, overrideIdentifiers, defaultConfiguration, policyConfiguration, applicationConfiguration, userConfiguration, localUserConfiguration, remoteUserConfiguration, workspaceConfiguration, folderConfigurationModel, memoryConfigurationModel) {
|
|
2318
|
+
this.key = key;
|
|
2319
|
+
this.overrides = overrides;
|
|
2320
|
+
this._value = _value;
|
|
2321
|
+
this.overrideIdentifiers = overrideIdentifiers;
|
|
2322
|
+
this.defaultConfiguration = defaultConfiguration;
|
|
2323
|
+
this.policyConfiguration = policyConfiguration;
|
|
2324
|
+
this.applicationConfiguration = applicationConfiguration;
|
|
2325
|
+
this.userConfiguration = userConfiguration;
|
|
2326
|
+
this.localUserConfiguration = localUserConfiguration;
|
|
2327
|
+
this.remoteUserConfiguration = remoteUserConfiguration;
|
|
2328
|
+
this.workspaceConfiguration = workspaceConfiguration;
|
|
2329
|
+
this.folderConfigurationModel = folderConfigurationModel;
|
|
2330
|
+
this.memoryConfigurationModel = memoryConfigurationModel;
|
|
2331
|
+
}
|
|
2332
|
+
get value() {
|
|
2333
|
+
return freeze(this._value);
|
|
2334
|
+
}
|
|
2335
|
+
inspect(model, section, overrideIdentifier) {
|
|
2336
|
+
const inspectValue = model.inspect(section, overrideIdentifier);
|
|
2337
|
+
return {
|
|
2338
|
+
get value() { return freeze(inspectValue.value); },
|
|
2339
|
+
get override() { return freeze(inspectValue.override); },
|
|
2340
|
+
get merged() { return freeze(inspectValue.merged); }
|
|
2341
|
+
};
|
|
2140
2342
|
}
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
let node = this._root;
|
|
2145
|
-
while (node) {
|
|
2146
|
-
const val = iter.cmp(node.segment);
|
|
2147
|
-
if (val > 0) {
|
|
2148
|
-
stack.push([-1 , node]);
|
|
2149
|
-
node = node.left;
|
|
2150
|
-
}
|
|
2151
|
-
else if (val < 0) {
|
|
2152
|
-
stack.push([1 , node]);
|
|
2153
|
-
node = node.right;
|
|
2154
|
-
}
|
|
2155
|
-
else if (iter.hasNext()) {
|
|
2156
|
-
iter.next();
|
|
2157
|
-
stack.push([0 , node]);
|
|
2158
|
-
node = node.mid;
|
|
2159
|
-
}
|
|
2160
|
-
else {
|
|
2161
|
-
break;
|
|
2162
|
-
}
|
|
2343
|
+
get defaultInspectValue() {
|
|
2344
|
+
if (!this._defaultInspectValue) {
|
|
2345
|
+
this._defaultInspectValue = this.inspect(this.defaultConfiguration, this.key, this.overrides.overrideIdentifier);
|
|
2163
2346
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2347
|
+
return this._defaultInspectValue;
|
|
2348
|
+
}
|
|
2349
|
+
get defaultValue() {
|
|
2350
|
+
return this.defaultInspectValue.merged;
|
|
2351
|
+
}
|
|
2352
|
+
get default() {
|
|
2353
|
+
return this.defaultInspectValue.value !== undefined || this.defaultInspectValue.override !== undefined ? { value: this.defaultInspectValue.value, override: this.defaultInspectValue.override } : undefined;
|
|
2354
|
+
}
|
|
2355
|
+
get policyInspectValue() {
|
|
2356
|
+
if (this._policyInspectValue === undefined) {
|
|
2357
|
+
this._policyInspectValue = this.policyConfiguration ? this.inspect(this.policyConfiguration, this.key) : null;
|
|
2166
2358
|
}
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2359
|
+
return this._policyInspectValue;
|
|
2360
|
+
}
|
|
2361
|
+
get policyValue() {
|
|
2362
|
+
return this.policyInspectValue?.merged;
|
|
2363
|
+
}
|
|
2364
|
+
get policy() {
|
|
2365
|
+
return this.policyInspectValue?.value !== undefined ? { value: this.policyInspectValue.value } : undefined;
|
|
2366
|
+
}
|
|
2367
|
+
get applicationInspectValue() {
|
|
2368
|
+
if (this._applicationInspectValue === undefined) {
|
|
2369
|
+
this._applicationInspectValue = this.applicationConfiguration ? this.inspect(this.applicationConfiguration, this.key) : null;
|
|
2172
2370
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2371
|
+
return this._applicationInspectValue;
|
|
2372
|
+
}
|
|
2373
|
+
get applicationValue() {
|
|
2374
|
+
return this.applicationInspectValue?.merged;
|
|
2375
|
+
}
|
|
2376
|
+
get application() {
|
|
2377
|
+
return this.applicationInspectValue?.value !== undefined || this.applicationInspectValue?.override !== undefined ? { value: this.applicationInspectValue.value, override: this.applicationInspectValue.override } : undefined;
|
|
2378
|
+
}
|
|
2379
|
+
get userInspectValue() {
|
|
2380
|
+
if (!this._userInspectValue) {
|
|
2381
|
+
this._userInspectValue = this.inspect(this.userConfiguration, this.key, this.overrides.overrideIdentifier);
|
|
2176
2382
|
}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
if (stack.length > 0) {
|
|
2189
|
-
const [dir, parent] = stack[stack.length - 1];
|
|
2190
|
-
switch (dir) {
|
|
2191
|
-
case -1 :
|
|
2192
|
-
parent.left = newChild;
|
|
2193
|
-
break;
|
|
2194
|
-
case 0 :
|
|
2195
|
-
parent.mid = newChild;
|
|
2196
|
-
break;
|
|
2197
|
-
case 1 :
|
|
2198
|
-
parent.right = newChild;
|
|
2199
|
-
break;
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
else {
|
|
2203
|
-
this._root = newChild;
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
for (let i = stack.length - 1; i >= 0; i--) {
|
|
2208
|
-
const node = stack[i][1];
|
|
2209
|
-
node.updateHeight();
|
|
2210
|
-
const bf = node.balanceFactor();
|
|
2211
|
-
if (bf > 1) {
|
|
2212
|
-
if (node.right.balanceFactor() >= 0) {
|
|
2213
|
-
stack[i][1] = node.rotateLeft();
|
|
2214
|
-
}
|
|
2215
|
-
else {
|
|
2216
|
-
node.right = node.right.rotateRight();
|
|
2217
|
-
stack[i][1] = node.rotateLeft();
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
else if (bf < -1) {
|
|
2221
|
-
if (node.left.balanceFactor() <= 0) {
|
|
2222
|
-
stack[i][1] = node.rotateRight();
|
|
2223
|
-
}
|
|
2224
|
-
else {
|
|
2225
|
-
node.left = node.left.rotateLeft();
|
|
2226
|
-
stack[i][1] = node.rotateRight();
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
if (i > 0) {
|
|
2230
|
-
switch (stack[i - 1][0]) {
|
|
2231
|
-
case -1 :
|
|
2232
|
-
stack[i - 1][1].left = stack[i][1];
|
|
2233
|
-
break;
|
|
2234
|
-
case 1 :
|
|
2235
|
-
stack[i - 1][1].right = stack[i][1];
|
|
2236
|
-
break;
|
|
2237
|
-
case 0 :
|
|
2238
|
-
stack[i - 1][1].mid = stack[i][1];
|
|
2239
|
-
break;
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
else {
|
|
2243
|
-
this._root = stack[0][1];
|
|
2244
|
-
}
|
|
2383
|
+
return this._userInspectValue;
|
|
2384
|
+
}
|
|
2385
|
+
get userValue() {
|
|
2386
|
+
return this.userInspectValue.merged;
|
|
2387
|
+
}
|
|
2388
|
+
get user() {
|
|
2389
|
+
return this.userInspectValue.value !== undefined || this.userInspectValue.override !== undefined ? { value: this.userInspectValue.value, override: this.userInspectValue.override } : undefined;
|
|
2390
|
+
}
|
|
2391
|
+
get userLocalInspectValue() {
|
|
2392
|
+
if (!this._userLocalInspectValue) {
|
|
2393
|
+
this._userLocalInspectValue = this.inspect(this.localUserConfiguration, this.key, this.overrides.overrideIdentifier);
|
|
2245
2394
|
}
|
|
2395
|
+
return this._userLocalInspectValue;
|
|
2246
2396
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2397
|
+
get userLocalValue() {
|
|
2398
|
+
return this.userLocalInspectValue.merged;
|
|
2399
|
+
}
|
|
2400
|
+
get userLocal() {
|
|
2401
|
+
return this.userLocalInspectValue.value !== undefined || this.userLocalInspectValue.override !== undefined ? { value: this.userLocalInspectValue.value, override: this.userLocalInspectValue.override } : undefined;
|
|
2402
|
+
}
|
|
2403
|
+
get userRemoteInspectValue() {
|
|
2404
|
+
if (!this._userRemoteInspectValue) {
|
|
2405
|
+
this._userRemoteInspectValue = this.inspect(this.remoteUserConfiguration, this.key, this.overrides.overrideIdentifier);
|
|
2250
2406
|
}
|
|
2251
|
-
return
|
|
2407
|
+
return this._userRemoteInspectValue;
|
|
2252
2408
|
}
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
else if (val < 0) {
|
|
2263
|
-
node = node.right;
|
|
2264
|
-
}
|
|
2265
|
-
else if (iter.hasNext()) {
|
|
2266
|
-
iter.next();
|
|
2267
|
-
candidate = node.value || candidate;
|
|
2268
|
-
node = node.mid;
|
|
2269
|
-
}
|
|
2270
|
-
else {
|
|
2271
|
-
break;
|
|
2272
|
-
}
|
|
2409
|
+
get userRemoteValue() {
|
|
2410
|
+
return this.userRemoteInspectValue.merged;
|
|
2411
|
+
}
|
|
2412
|
+
get userRemote() {
|
|
2413
|
+
return this.userRemoteInspectValue.value !== undefined || this.userRemoteInspectValue.override !== undefined ? { value: this.userRemoteInspectValue.value, override: this.userRemoteInspectValue.override } : undefined;
|
|
2414
|
+
}
|
|
2415
|
+
get workspaceInspectValue() {
|
|
2416
|
+
if (this._workspaceInspectValue === undefined) {
|
|
2417
|
+
this._workspaceInspectValue = this.workspaceConfiguration ? this.inspect(this.workspaceConfiguration, this.key, this.overrides.overrideIdentifier) : null;
|
|
2273
2418
|
}
|
|
2274
|
-
return
|
|
2419
|
+
return this._workspaceInspectValue;
|
|
2275
2420
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
node = node.right;
|
|
2286
|
-
}
|
|
2287
|
-
else if (iter.hasNext()) {
|
|
2288
|
-
iter.next();
|
|
2289
|
-
node = node.mid;
|
|
2290
|
-
}
|
|
2291
|
-
else {
|
|
2292
|
-
if (!node.mid) {
|
|
2293
|
-
return undefined;
|
|
2294
|
-
}
|
|
2295
|
-
else {
|
|
2296
|
-
return this._entries(node.mid);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2421
|
+
get workspaceValue() {
|
|
2422
|
+
return this.workspaceInspectValue?.merged;
|
|
2423
|
+
}
|
|
2424
|
+
get workspace() {
|
|
2425
|
+
return this.workspaceInspectValue?.value !== undefined || this.workspaceInspectValue?.override !== undefined ? { value: this.workspaceInspectValue.value, override: this.workspaceInspectValue.override } : undefined;
|
|
2426
|
+
}
|
|
2427
|
+
get workspaceFolderInspectValue() {
|
|
2428
|
+
if (this._workspaceFolderInspectValue === undefined) {
|
|
2429
|
+
this._workspaceFolderInspectValue = this.folderConfigurationModel ? this.inspect(this.folderConfigurationModel, this.key, this.overrides.overrideIdentifier) : null;
|
|
2299
2430
|
}
|
|
2300
|
-
return
|
|
2431
|
+
return this._workspaceFolderInspectValue;
|
|
2301
2432
|
}
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2433
|
+
get workspaceFolderValue() {
|
|
2434
|
+
return this.workspaceFolderInspectValue?.merged;
|
|
2435
|
+
}
|
|
2436
|
+
get workspaceFolder() {
|
|
2437
|
+
return this.workspaceFolderInspectValue?.value !== undefined || this.workspaceFolderInspectValue?.override !== undefined ? { value: this.workspaceFolderInspectValue.value, override: this.workspaceFolderInspectValue.override } : undefined;
|
|
2438
|
+
}
|
|
2439
|
+
get memoryInspectValue() {
|
|
2440
|
+
if (this._memoryInspectValue === undefined) {
|
|
2441
|
+
this._memoryInspectValue = this.inspect(this.memoryConfigurationModel, this.key, this.overrides.overrideIdentifier);
|
|
2305
2442
|
}
|
|
2443
|
+
return this._memoryInspectValue;
|
|
2306
2444
|
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2445
|
+
get memoryValue() {
|
|
2446
|
+
return this.memoryInspectValue.merged;
|
|
2309
2447
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
this._dfsEntries(node, result);
|
|
2313
|
-
return result[Symbol.iterator]();
|
|
2448
|
+
get memory() {
|
|
2449
|
+
return this.memoryInspectValue.value !== undefined || this.memoryInspectValue.override !== undefined ? { value: this.memoryInspectValue.value, override: this.memoryInspectValue.override } : undefined;
|
|
2314
2450
|
}
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2451
|
+
}
|
|
2452
|
+
class Configuration {
|
|
2453
|
+
constructor(_defaultConfiguration, _policyConfiguration, _applicationConfiguration, _localUserConfiguration, _remoteUserConfiguration = ( (new ConfigurationModel())), _workspaceConfiguration = ( (new ConfigurationModel())), _folderConfigurations = ( (new ResourceMap())), _memoryConfiguration = ( (new ConfigurationModel())), _memoryConfigurationByResource = ( (new ResourceMap()))) {
|
|
2454
|
+
this._defaultConfiguration = _defaultConfiguration;
|
|
2455
|
+
this._policyConfiguration = _policyConfiguration;
|
|
2456
|
+
this._applicationConfiguration = _applicationConfiguration;
|
|
2457
|
+
this._localUserConfiguration = _localUserConfiguration;
|
|
2458
|
+
this._remoteUserConfiguration = _remoteUserConfiguration;
|
|
2459
|
+
this._workspaceConfiguration = _workspaceConfiguration;
|
|
2460
|
+
this._folderConfigurations = _folderConfigurations;
|
|
2461
|
+
this._memoryConfiguration = _memoryConfiguration;
|
|
2462
|
+
this._memoryConfigurationByResource = _memoryConfigurationByResource;
|
|
2463
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2464
|
+
this._foldersConsolidatedConfigurations = ( (new ResourceMap()));
|
|
2465
|
+
this._userConfiguration = null;
|
|
2466
|
+
}
|
|
2467
|
+
getValue(section, overrides, workspace) {
|
|
2468
|
+
const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(section, overrides, workspace);
|
|
2469
|
+
return consolidateConfigurationModel.getValue(section);
|
|
2470
|
+
}
|
|
2471
|
+
updateValue(key, value, overrides = {}) {
|
|
2472
|
+
let memoryConfiguration;
|
|
2473
|
+
if (overrides.resource) {
|
|
2474
|
+
memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);
|
|
2475
|
+
if (!memoryConfiguration) {
|
|
2476
|
+
memoryConfiguration = ( (new ConfigurationModel()));
|
|
2477
|
+
this._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);
|
|
2478
|
+
}
|
|
2318
2479
|
}
|
|
2319
|
-
|
|
2320
|
-
this.
|
|
2480
|
+
else {
|
|
2481
|
+
memoryConfiguration = this._memoryConfiguration;
|
|
2321
2482
|
}
|
|
2322
|
-
if (
|
|
2323
|
-
|
|
2483
|
+
if (value === undefined) {
|
|
2484
|
+
memoryConfiguration.removeValue(key);
|
|
2324
2485
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2486
|
+
else {
|
|
2487
|
+
memoryConfiguration.setValue(key, value);
|
|
2327
2488
|
}
|
|
2328
|
-
if (
|
|
2329
|
-
this.
|
|
2489
|
+
if (!overrides.resource) {
|
|
2490
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2330
2491
|
}
|
|
2331
2492
|
}
|
|
2332
|
-
|
|
2333
|
-
const
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2493
|
+
inspect(key, overrides, workspace) {
|
|
2494
|
+
const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(key, overrides, workspace);
|
|
2495
|
+
const folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace);
|
|
2496
|
+
const memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration;
|
|
2497
|
+
const overrideIdentifiers = ( (new Set()));
|
|
2498
|
+
for (const override of consolidateConfigurationModel.overrides) {
|
|
2499
|
+
for (const overrideIdentifier of override.identifiers) {
|
|
2500
|
+
if (consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== undefined) {
|
|
2501
|
+
overrideIdentifiers.add(overrideIdentifier);
|
|
2502
|
+
}
|
|
2340
2503
|
}
|
|
2341
|
-
|
|
2504
|
+
}
|
|
2505
|
+
return (
|
|
2506
|
+
(new ConfigurationInspectValue(
|
|
2507
|
+
key,
|
|
2508
|
+
overrides,
|
|
2509
|
+
consolidateConfigurationModel.getValue(key),
|
|
2510
|
+
overrideIdentifiers.size ? [...overrideIdentifiers] : undefined,
|
|
2511
|
+
this._defaultConfiguration,
|
|
2512
|
+
this._policyConfiguration.isEmpty() ? undefined : this._policyConfiguration,
|
|
2513
|
+
this.applicationConfiguration.isEmpty() ? undefined : this.applicationConfiguration,
|
|
2514
|
+
this.userConfiguration,
|
|
2515
|
+
this.localUserConfiguration,
|
|
2516
|
+
this.remoteUserConfiguration,
|
|
2517
|
+
workspace ? this._workspaceConfiguration : undefined,
|
|
2518
|
+
folderConfigurationModel ? folderConfigurationModel : undefined,
|
|
2519
|
+
memoryConfigurationModel
|
|
2520
|
+
))
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
keys(workspace) {
|
|
2524
|
+
const folderConfigurationModel = this.getFolderConfigurationModelForResource(undefined, workspace);
|
|
2525
|
+
return {
|
|
2526
|
+
default: this._defaultConfiguration.keys.slice(0),
|
|
2527
|
+
user: this.userConfiguration.keys.slice(0),
|
|
2528
|
+
workspace: this._workspaceConfiguration.keys.slice(0),
|
|
2529
|
+
workspaceFolder: folderConfigurationModel ? folderConfigurationModel.keys.slice(0) : []
|
|
2342
2530
|
};
|
|
2343
|
-
return nodeIsBalanced(this._root);
|
|
2344
2531
|
}
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
this.
|
|
2349
|
-
this.value = value;
|
|
2532
|
+
updateDefaultConfiguration(defaultConfiguration) {
|
|
2533
|
+
this._defaultConfiguration = defaultConfiguration;
|
|
2534
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2535
|
+
this._foldersConsolidatedConfigurations.clear();
|
|
2350
2536
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
constructor(mapOrKeyFn, toKey) {
|
|
2354
|
-
this[_a$1] = 'ResourceMap';
|
|
2355
|
-
if (mapOrKeyFn instanceof ResourceMap) {
|
|
2356
|
-
this.map = ( (new Map(mapOrKeyFn.map)));
|
|
2357
|
-
this.toKey = toKey ?? ResourceMap.defaultToKey;
|
|
2358
|
-
}
|
|
2359
|
-
else {
|
|
2360
|
-
this.map = ( (new Map()));
|
|
2361
|
-
this.toKey = mapOrKeyFn ?? ResourceMap.defaultToKey;
|
|
2362
|
-
}
|
|
2537
|
+
updatePolicyConfiguration(policyConfiguration) {
|
|
2538
|
+
this._policyConfiguration = policyConfiguration;
|
|
2363
2539
|
}
|
|
2364
|
-
|
|
2365
|
-
this.
|
|
2366
|
-
|
|
2540
|
+
updateApplicationConfiguration(applicationConfiguration) {
|
|
2541
|
+
this._applicationConfiguration = applicationConfiguration;
|
|
2542
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2543
|
+
this._foldersConsolidatedConfigurations.clear();
|
|
2367
2544
|
}
|
|
2368
|
-
|
|
2369
|
-
|
|
2545
|
+
updateLocalUserConfiguration(localUserConfiguration) {
|
|
2546
|
+
this._localUserConfiguration = localUserConfiguration;
|
|
2547
|
+
this._userConfiguration = null;
|
|
2548
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2549
|
+
this._foldersConsolidatedConfigurations.clear();
|
|
2370
2550
|
}
|
|
2371
|
-
|
|
2372
|
-
|
|
2551
|
+
updateRemoteUserConfiguration(remoteUserConfiguration) {
|
|
2552
|
+
this._remoteUserConfiguration = remoteUserConfiguration;
|
|
2553
|
+
this._userConfiguration = null;
|
|
2554
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2555
|
+
this._foldersConsolidatedConfigurations.clear();
|
|
2373
2556
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2557
|
+
updateWorkspaceConfiguration(workspaceConfiguration) {
|
|
2558
|
+
this._workspaceConfiguration = workspaceConfiguration;
|
|
2559
|
+
this._workspaceConsolidatedConfiguration = null;
|
|
2560
|
+
this._foldersConsolidatedConfigurations.clear();
|
|
2376
2561
|
}
|
|
2377
|
-
|
|
2378
|
-
this.
|
|
2562
|
+
updateFolderConfiguration(resource, configuration) {
|
|
2563
|
+
this._folderConfigurations.set(resource, configuration);
|
|
2564
|
+
this._foldersConsolidatedConfigurations.delete(resource);
|
|
2379
2565
|
}
|
|
2380
|
-
|
|
2381
|
-
|
|
2566
|
+
deleteFolderConfiguration(resource) {
|
|
2567
|
+
this.folderConfigurations.delete(resource);
|
|
2568
|
+
this._foldersConsolidatedConfigurations.delete(resource);
|
|
2382
2569
|
}
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2570
|
+
compareAndUpdateDefaultConfiguration(defaults, keys) {
|
|
2571
|
+
const overrides = [];
|
|
2572
|
+
if (!keys) {
|
|
2573
|
+
const { added, updated, removed } = compare(this._defaultConfiguration, defaults);
|
|
2574
|
+
keys = [...added, ...updated, ...removed];
|
|
2386
2575
|
}
|
|
2387
|
-
for (const
|
|
2388
|
-
|
|
2576
|
+
for (const key of keys) {
|
|
2577
|
+
for (const overrideIdentifier of overrideIdentifiersFromKey(key)) {
|
|
2578
|
+
const fromKeys = this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier);
|
|
2579
|
+
const toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier);
|
|
2580
|
+
const keys = [
|
|
2581
|
+
...toKeys.filter(key => fromKeys.indexOf(key) === -1),
|
|
2582
|
+
...fromKeys.filter(key => toKeys.indexOf(key) === -1),
|
|
2583
|
+
...fromKeys.filter(key => !equals(this._defaultConfiguration.override(overrideIdentifier).getValue(key), defaults.override(overrideIdentifier).getValue(key)))
|
|
2584
|
+
];
|
|
2585
|
+
overrides.push([overrideIdentifier, keys]);
|
|
2586
|
+
}
|
|
2389
2587
|
}
|
|
2588
|
+
this.updateDefaultConfiguration(defaults);
|
|
2589
|
+
return { keys, overrides };
|
|
2390
2590
|
}
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2591
|
+
compareAndUpdatePolicyConfiguration(policyConfiguration) {
|
|
2592
|
+
const { added, updated, removed } = compare(this._policyConfiguration, policyConfiguration);
|
|
2593
|
+
const keys = [...added, ...updated, ...removed];
|
|
2594
|
+
if (keys.length) {
|
|
2595
|
+
this.updatePolicyConfiguration(policyConfiguration);
|
|
2394
2596
|
}
|
|
2597
|
+
return { keys, overrides: [] };
|
|
2395
2598
|
}
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2599
|
+
compareAndUpdateApplicationConfiguration(application) {
|
|
2600
|
+
const { added, updated, removed, overrides } = compare(this.applicationConfiguration, application);
|
|
2601
|
+
const keys = [...added, ...updated, ...removed];
|
|
2602
|
+
if (keys.length) {
|
|
2603
|
+
this.updateApplicationConfiguration(application);
|
|
2399
2604
|
}
|
|
2605
|
+
return { keys, overrides };
|
|
2400
2606
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2607
|
+
compareAndUpdateLocalUserConfiguration(user) {
|
|
2608
|
+
const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user);
|
|
2609
|
+
const keys = [...added, ...updated, ...removed];
|
|
2610
|
+
if (keys.length) {
|
|
2611
|
+
this.updateLocalUserConfiguration(user);
|
|
2404
2612
|
}
|
|
2613
|
+
return { keys, overrides };
|
|
2405
2614
|
}
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2615
|
+
compareAndUpdateRemoteUserConfiguration(user) {
|
|
2616
|
+
const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user);
|
|
2617
|
+
const keys = [...added, ...updated, ...removed];
|
|
2618
|
+
if (keys.length) {
|
|
2619
|
+
this.updateRemoteUserConfiguration(user);
|
|
2409
2620
|
}
|
|
2621
|
+
return { keys, overrides };
|
|
2410
2622
|
}
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
if (!entriesOrKey || typeof entriesOrKey === 'function') {
|
|
2417
|
-
this._map = ( (new ResourceMap(entriesOrKey)));
|
|
2418
|
-
}
|
|
2419
|
-
else {
|
|
2420
|
-
this._map = ( (new ResourceMap(toKey)));
|
|
2421
|
-
entriesOrKey.forEach(this.add, this);
|
|
2623
|
+
compareAndUpdateWorkspaceConfiguration(workspaceConfiguration) {
|
|
2624
|
+
const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration);
|
|
2625
|
+
const keys = [...added, ...updated, ...removed];
|
|
2626
|
+
if (keys.length) {
|
|
2627
|
+
this.updateWorkspaceConfiguration(workspaceConfiguration);
|
|
2422
2628
|
}
|
|
2629
|
+
return { keys, overrides };
|
|
2423
2630
|
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
this._map.clear();
|
|
2433
|
-
}
|
|
2434
|
-
delete(value) {
|
|
2435
|
-
return this._map.delete(value);
|
|
2436
|
-
}
|
|
2437
|
-
forEach(callbackfn, thisArg) {
|
|
2438
|
-
this._map.forEach((_value, key) => callbackfn.call(thisArg, key, key, this));
|
|
2439
|
-
}
|
|
2440
|
-
has(value) {
|
|
2441
|
-
return this._map.has(value);
|
|
2442
|
-
}
|
|
2443
|
-
entries() {
|
|
2444
|
-
return this._map.entries();
|
|
2445
|
-
}
|
|
2446
|
-
keys() {
|
|
2447
|
-
return (
|
|
2448
|
-
(this._map.keys())
|
|
2449
|
-
);
|
|
2450
|
-
}
|
|
2451
|
-
values() {
|
|
2452
|
-
return (
|
|
2453
|
-
(this._map.keys())
|
|
2454
|
-
);
|
|
2455
|
-
}
|
|
2456
|
-
[(_b$1 = Symbol.toStringTag, Symbol.iterator)]() {
|
|
2457
|
-
return (
|
|
2458
|
-
(this.keys())
|
|
2459
|
-
);
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
class ConfigurationModel {
|
|
2463
|
-
constructor(_contents = {}, _keys = [], _overrides = []) {
|
|
2464
|
-
this._contents = _contents;
|
|
2465
|
-
this._keys = _keys;
|
|
2466
|
-
this._overrides = _overrides;
|
|
2467
|
-
this.frozen = false;
|
|
2468
|
-
this.overrideConfigurations = ( (new Map()));
|
|
2631
|
+
compareAndUpdateFolderConfiguration(resource, folderConfiguration) {
|
|
2632
|
+
const currentFolderConfiguration = this.folderConfigurations.get(resource);
|
|
2633
|
+
const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration);
|
|
2634
|
+
const keys = [...added, ...updated, ...removed];
|
|
2635
|
+
if (keys.length || !currentFolderConfiguration) {
|
|
2636
|
+
this.updateFolderConfiguration(resource, folderConfiguration);
|
|
2637
|
+
}
|
|
2638
|
+
return { keys, overrides };
|
|
2469
2639
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2640
|
+
compareAndDeleteFolderConfiguration(folder) {
|
|
2641
|
+
const folderConfig = this.folderConfigurations.get(folder);
|
|
2642
|
+
if (!folderConfig) {
|
|
2643
|
+
throw new Error('Unknown folder');
|
|
2644
|
+
}
|
|
2645
|
+
this.deleteFolderConfiguration(folder);
|
|
2646
|
+
const { added, updated, removed, overrides } = compare(folderConfig, undefined);
|
|
2647
|
+
return { keys: [...added, ...updated, ...removed], overrides };
|
|
2472
2648
|
}
|
|
2473
|
-
get
|
|
2474
|
-
return this.
|
|
2649
|
+
get defaults() {
|
|
2650
|
+
return this._defaultConfiguration;
|
|
2475
2651
|
}
|
|
2476
|
-
get
|
|
2477
|
-
return this.
|
|
2652
|
+
get applicationConfiguration() {
|
|
2653
|
+
return this._applicationConfiguration;
|
|
2478
2654
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2655
|
+
get userConfiguration() {
|
|
2656
|
+
if (!this._userConfiguration) {
|
|
2657
|
+
this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration);
|
|
2658
|
+
}
|
|
2659
|
+
return this._userConfiguration;
|
|
2481
2660
|
}
|
|
2482
|
-
|
|
2483
|
-
return this.
|
|
2661
|
+
get localUserConfiguration() {
|
|
2662
|
+
return this._localUserConfiguration;
|
|
2484
2663
|
}
|
|
2485
|
-
|
|
2486
|
-
return
|
|
2664
|
+
get remoteUserConfiguration() {
|
|
2665
|
+
return this._remoteUserConfiguration;
|
|
2487
2666
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
return overrideContents
|
|
2491
|
-
? section ? getConfigurationValue(overrideContents, section) : overrideContents
|
|
2492
|
-
: undefined;
|
|
2667
|
+
get workspaceConfiguration() {
|
|
2668
|
+
return this._workspaceConfiguration;
|
|
2493
2669
|
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
for (const override of this.overrides) {
|
|
2497
|
-
if (override.identifiers.includes(identifier)) {
|
|
2498
|
-
keys.push(...override.keys);
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
return distinct(keys);
|
|
2670
|
+
get folderConfigurations() {
|
|
2671
|
+
return this._folderConfigurations;
|
|
2502
2672
|
}
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2673
|
+
getConsolidatedConfigurationModel(section, overrides, workspace) {
|
|
2674
|
+
let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
|
|
2675
|
+
if (overrides.overrideIdentifier) {
|
|
2676
|
+
configurationModel = configurationModel.override(overrides.overrideIdentifier);
|
|
2507
2677
|
}
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
override(identifier) {
|
|
2511
|
-
let overrideConfigurationModel = this.overrideConfigurations.get(identifier);
|
|
2512
|
-
if (!overrideConfigurationModel) {
|
|
2513
|
-
overrideConfigurationModel = this.createOverrideConfigurationModel(identifier);
|
|
2514
|
-
this.overrideConfigurations.set(identifier, overrideConfigurationModel);
|
|
2678
|
+
if (!this._policyConfiguration.isEmpty() && this._policyConfiguration.getValue(section) !== undefined) {
|
|
2679
|
+
configurationModel = configurationModel.merge(this._policyConfiguration);
|
|
2515
2680
|
}
|
|
2516
|
-
return
|
|
2681
|
+
return configurationModel;
|
|
2517
2682
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
continue;
|
|
2525
|
-
}
|
|
2526
|
-
this.mergeContents(contents, other.contents);
|
|
2527
|
-
for (const otherOverride of other.overrides) {
|
|
2528
|
-
const [override] = overrides.filter(o => equals$1(o.identifiers, otherOverride.identifiers));
|
|
2529
|
-
if (override) {
|
|
2530
|
-
this.mergeContents(override.contents, otherOverride.contents);
|
|
2531
|
-
override.keys.push(...otherOverride.keys);
|
|
2532
|
-
override.keys = distinct(override.keys);
|
|
2533
|
-
}
|
|
2534
|
-
else {
|
|
2535
|
-
overrides.push(deepClone(otherOverride));
|
|
2536
|
-
}
|
|
2683
|
+
getConsolidatedConfigurationModelForResource({ resource }, workspace) {
|
|
2684
|
+
let consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
|
|
2685
|
+
if (workspace && resource) {
|
|
2686
|
+
const root = workspace.getFolder(resource);
|
|
2687
|
+
if (root) {
|
|
2688
|
+
consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;
|
|
2537
2689
|
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
}
|
|
2690
|
+
const memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);
|
|
2691
|
+
if (memoryConfigurationForResource) {
|
|
2692
|
+
consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);
|
|
2542
2693
|
}
|
|
2543
2694
|
}
|
|
2544
|
-
return
|
|
2545
|
-
(new ConfigurationModel(contents, keys, overrides))
|
|
2546
|
-
);
|
|
2547
|
-
}
|
|
2548
|
-
freeze() {
|
|
2549
|
-
this.frozen = true;
|
|
2550
|
-
return this;
|
|
2551
|
-
}
|
|
2552
|
-
clone() {
|
|
2553
|
-
return (
|
|
2554
|
-
(new ConfigurationModel(deepClone(this.contents), [...this.keys], deepClone(this.overrides)))
|
|
2555
|
-
);
|
|
2695
|
+
return consolidateConfiguration;
|
|
2556
2696
|
}
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
return this;
|
|
2561
|
-
}
|
|
2562
|
-
const contents = {};
|
|
2563
|
-
for (const key of distinct([...( (Object.keys(this.contents))), ...( (Object.keys(overrideContents)))])) {
|
|
2564
|
-
let contentsForKey = this.contents[key];
|
|
2565
|
-
const overrideContentsForKey = overrideContents[key];
|
|
2566
|
-
if (overrideContentsForKey) {
|
|
2567
|
-
if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
|
|
2568
|
-
contentsForKey = deepClone(contentsForKey);
|
|
2569
|
-
this.mergeContents(contentsForKey, overrideContentsForKey);
|
|
2570
|
-
}
|
|
2571
|
-
else {
|
|
2572
|
-
contentsForKey = overrideContentsForKey;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
contents[key] = contentsForKey;
|
|
2697
|
+
getWorkspaceConsolidatedConfiguration() {
|
|
2698
|
+
if (!this._workspaceConsolidatedConfiguration) {
|
|
2699
|
+
this._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.applicationConfiguration, this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);
|
|
2576
2700
|
}
|
|
2577
|
-
return
|
|
2578
|
-
(new ConfigurationModel(contents, this.keys, this.overrides))
|
|
2579
|
-
);
|
|
2701
|
+
return this._workspaceConsolidatedConfiguration;
|
|
2580
2702
|
}
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2703
|
+
getFolderConsolidatedConfiguration(folder) {
|
|
2704
|
+
let folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);
|
|
2705
|
+
if (!folderConsolidatedConfiguration) {
|
|
2706
|
+
const workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
|
|
2707
|
+
const folderConfiguration = this._folderConfigurations.get(folder);
|
|
2708
|
+
if (folderConfiguration) {
|
|
2709
|
+
folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);
|
|
2710
|
+
this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);
|
|
2711
|
+
}
|
|
2712
|
+
else {
|
|
2713
|
+
folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
|
|
2588
2714
|
}
|
|
2589
|
-
source[key] = deepClone(target[key]);
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
checkAndFreeze(data) {
|
|
2593
|
-
if (this.frozen && !Object.isFrozen(data)) {
|
|
2594
|
-
return deepFreeze(data);
|
|
2595
2715
|
}
|
|
2596
|
-
return
|
|
2716
|
+
return folderConsolidatedConfiguration;
|
|
2597
2717
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
if (contents) {
|
|
2604
|
-
this.mergeContents(contents, contentsToMerge);
|
|
2605
|
-
}
|
|
2606
|
-
else {
|
|
2607
|
-
contents = deepClone(contentsToMerge);
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
};
|
|
2611
|
-
for (const override of this.overrides) {
|
|
2612
|
-
if (equals$1(override.identifiers, [identifier])) {
|
|
2613
|
-
contentsForIdentifierOnly = override.contents;
|
|
2614
|
-
}
|
|
2615
|
-
else if (override.identifiers.includes(identifier)) {
|
|
2616
|
-
mergeContents(override.contents);
|
|
2718
|
+
getFolderConfigurationModelForResource(resource, workspace) {
|
|
2719
|
+
if (workspace && resource) {
|
|
2720
|
+
const root = workspace.getFolder(resource);
|
|
2721
|
+
if (root) {
|
|
2722
|
+
return this._folderConfigurations.get(root.uri);
|
|
2617
2723
|
}
|
|
2618
2724
|
}
|
|
2619
|
-
|
|
2620
|
-
return contents;
|
|
2725
|
+
return undefined;
|
|
2621
2726
|
}
|
|
2622
|
-
|
|
2727
|
+
toData() {
|
|
2623
2728
|
return {
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2729
|
+
defaults: {
|
|
2730
|
+
contents: this._defaultConfiguration.contents,
|
|
2731
|
+
overrides: this._defaultConfiguration.overrides,
|
|
2732
|
+
keys: this._defaultConfiguration.keys
|
|
2733
|
+
},
|
|
2734
|
+
policy: {
|
|
2735
|
+
contents: this._policyConfiguration.contents,
|
|
2736
|
+
overrides: this._policyConfiguration.overrides,
|
|
2737
|
+
keys: this._policyConfiguration.keys
|
|
2738
|
+
},
|
|
2739
|
+
application: {
|
|
2740
|
+
contents: this.applicationConfiguration.contents,
|
|
2741
|
+
overrides: this.applicationConfiguration.overrides,
|
|
2742
|
+
keys: this.applicationConfiguration.keys
|
|
2743
|
+
},
|
|
2744
|
+
user: {
|
|
2745
|
+
contents: this.userConfiguration.contents,
|
|
2746
|
+
overrides: this.userConfiguration.overrides,
|
|
2747
|
+
keys: this.userConfiguration.keys
|
|
2748
|
+
},
|
|
2749
|
+
workspace: {
|
|
2750
|
+
contents: this._workspaceConfiguration.contents,
|
|
2751
|
+
overrides: this._workspaceConfiguration.overrides,
|
|
2752
|
+
keys: this._workspaceConfiguration.keys
|
|
2753
|
+
},
|
|
2754
|
+
folders: [...( (this._folderConfigurations.keys()))].reduce((result, folder) => {
|
|
2755
|
+
const { contents, overrides, keys } = this._folderConfigurations.get(folder);
|
|
2756
|
+
result.push([folder, { contents, overrides, keys }]);
|
|
2757
|
+
return result;
|
|
2758
|
+
}, [])
|
|
2627
2759
|
};
|
|
2628
2760
|
}
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
}
|
|
2761
|
+
allKeys() {
|
|
2762
|
+
const keys = ( (new Set()));
|
|
2763
|
+
this._defaultConfiguration.keys.forEach(key => keys.add(key));
|
|
2764
|
+
this.userConfiguration.keys.forEach(key => keys.add(key));
|
|
2765
|
+
this._workspaceConfiguration.keys.forEach(key => keys.add(key));
|
|
2766
|
+
this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.keys.forEach(key => keys.add(key)));
|
|
2767
|
+
return [...( (keys.values()))];
|
|
2637
2768
|
}
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
this.keys.splice(index, 1, key);
|
|
2769
|
+
allOverrideIdentifiers() {
|
|
2770
|
+
const keys = ( (new Set()));
|
|
2771
|
+
this._defaultConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));
|
|
2772
|
+
this.userConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));
|
|
2773
|
+
this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));
|
|
2774
|
+
this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.getAllOverrideIdentifiers().forEach(key => keys.add(key)));
|
|
2775
|
+
return [...( (keys.values()))];
|
|
2646
2776
|
}
|
|
2647
|
-
|
|
2648
|
-
const
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2777
|
+
getAllKeysForOverrideIdentifier(overrideIdentifier) {
|
|
2778
|
+
const keys = ( (new Set()));
|
|
2779
|
+
this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
|
|
2780
|
+
this.userConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
|
|
2781
|
+
this._workspaceConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
|
|
2782
|
+
this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)));
|
|
2783
|
+
return [...( (keys.values()))];
|
|
2784
|
+
}
|
|
2785
|
+
static parse(data) {
|
|
2786
|
+
const defaultConfiguration = this.parseConfigurationModel(data.defaults);
|
|
2787
|
+
const policyConfiguration = this.parseConfigurationModel(data.policy);
|
|
2788
|
+
const applicationConfiguration = this.parseConfigurationModel(data.application);
|
|
2789
|
+
const userConfiguration = this.parseConfigurationModel(data.user);
|
|
2790
|
+
const workspaceConfiguration = this.parseConfigurationModel(data.workspace);
|
|
2791
|
+
const folders = data.folders.reduce((result, value) => {
|
|
2792
|
+
result.set(URI.revive(value[0]), this.parseConfigurationModel(value[1]));
|
|
2793
|
+
return result;
|
|
2794
|
+
}, ( (new ResourceMap())));
|
|
2795
|
+
return (
|
|
2796
|
+
(new Configuration(
|
|
2797
|
+
defaultConfiguration,
|
|
2798
|
+
policyConfiguration,
|
|
2799
|
+
applicationConfiguration,
|
|
2800
|
+
userConfiguration,
|
|
2801
|
+
(new ConfigurationModel()),
|
|
2802
|
+
workspaceConfiguration,
|
|
2803
|
+
folders,
|
|
2804
|
+
(new ConfigurationModel()),
|
|
2805
|
+
(new ResourceMap())
|
|
2806
|
+
))
|
|
2807
|
+
);
|
|
2808
|
+
}
|
|
2809
|
+
static parseConfigurationModel(model) {
|
|
2810
|
+
return (
|
|
2811
|
+
(new ConfigurationModel(model.contents, model.keys, model.overrides))
|
|
2812
|
+
);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
function compare(from, to) {
|
|
2816
|
+
const { added, removed, updated } = compareConfigurationContents(to?.rawConfiguration, from?.rawConfiguration);
|
|
2817
|
+
const overrides = [];
|
|
2818
|
+
const fromOverrideIdentifiers = from?.getAllOverrideIdentifiers() || [];
|
|
2819
|
+
const toOverrideIdentifiers = to?.getAllOverrideIdentifiers() || [];
|
|
2820
|
+
if (to) {
|
|
2821
|
+
const addedOverrideIdentifiers = toOverrideIdentifiers.filter(key => !fromOverrideIdentifiers.includes(key));
|
|
2822
|
+
for (const identifier of addedOverrideIdentifiers) {
|
|
2823
|
+
overrides.push([identifier, to.getKeysForOverrideIdentifier(identifier)]);
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
if (from) {
|
|
2827
|
+
const removedOverrideIdentifiers = fromOverrideIdentifiers.filter(key => !toOverrideIdentifiers.includes(key));
|
|
2828
|
+
for (const identifier of removedOverrideIdentifiers) {
|
|
2829
|
+
overrides.push([identifier, from.getKeysForOverrideIdentifier(identifier)]);
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
if (to && from) {
|
|
2833
|
+
for (const identifier of fromOverrideIdentifiers) {
|
|
2834
|
+
if (toOverrideIdentifiers.includes(identifier)) {
|
|
2835
|
+
const result = compareConfigurationContents({ contents: from.getOverrideValue(undefined, identifier) || {}, keys: from.getKeysForOverrideIdentifier(identifier) }, { contents: to.getOverrideValue(undefined, identifier) || {}, keys: to.getKeysForOverrideIdentifier(identifier) });
|
|
2836
|
+
overrides.push([identifier, [...result.added, ...result.removed, ...result.updated]]);
|
|
2837
|
+
}
|
|
2652
2838
|
}
|
|
2653
|
-
return false;
|
|
2654
2839
|
}
|
|
2840
|
+
return { added, removed, updated, overrides };
|
|
2655
2841
|
}
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2842
|
+
function compareConfigurationContents(to, from) {
|
|
2843
|
+
const added = to
|
|
2844
|
+
? from ? to.keys.filter(key => from.keys.indexOf(key) === -1) : [...to.keys]
|
|
2845
|
+
: [];
|
|
2846
|
+
const removed = from
|
|
2847
|
+
? to ? from.keys.filter(key => to.keys.indexOf(key) === -1) : [...from.keys]
|
|
2848
|
+
: [];
|
|
2849
|
+
const updated = [];
|
|
2850
|
+
if (to && from) {
|
|
2851
|
+
for (const key of from.keys) {
|
|
2852
|
+
if (to.keys.indexOf(key) !== -1) {
|
|
2853
|
+
const value1 = getConfigurationValue(from.contents, key);
|
|
2854
|
+
const value2 = getConfigurationValue(to.contents, key);
|
|
2855
|
+
if (!equals(value1, value2)) {
|
|
2856
|
+
updated.push(key);
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
return { added, removed, updated };
|
|
2862
|
+
}
|
|
2863
|
+
class WorkspaceFolder {
|
|
2864
|
+
constructor(data,
|
|
2865
|
+
raw) {
|
|
2866
|
+
this.raw = raw;
|
|
2867
|
+
this.uri = data.uri;
|
|
2868
|
+
this.index = data.index;
|
|
2869
|
+
this.name = data.name;
|
|
2870
|
+
}
|
|
2871
|
+
toResource(relativePath) {
|
|
2872
|
+
return joinPath(this.uri, relativePath);
|
|
2873
|
+
}
|
|
2874
|
+
toJSON() {
|
|
2875
|
+
return { uri: this.uri, name: this.name, index: this.index };
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
const IPolicyService = ( (createDecorator('policy')));
|
|
2879
|
+
class NullPolicyService {
|
|
2880
|
+
constructor() {
|
|
2881
|
+
this.onDidChange = Event.None;
|
|
2882
|
+
}
|
|
2883
|
+
async updatePolicyDefinitions() { return {}; }
|
|
2884
|
+
getPolicyValue() { return undefined; }
|
|
2885
|
+
serialize() { return undefined; }
|
|
2886
|
+
}
|
|
2887
|
+
class DefaultConfiguration extends Disposable {
|
|
2888
|
+
constructor() {
|
|
2889
|
+
super(...arguments);
|
|
2890
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
2891
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
2892
|
+
this._configurationModel = ( (new ConfigurationModel$1()));
|
|
2663
2893
|
}
|
|
2664
2894
|
get configurationModel() {
|
|
2665
|
-
return this._configurationModel
|
|
2895
|
+
return this._configurationModel;
|
|
2666
2896
|
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2897
|
+
async initialize() {
|
|
2898
|
+
this.resetConfigurationModel();
|
|
2899
|
+
this._register(( (Registry.as(Extensions$2.Configuration))).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.onDidUpdateConfiguration(Array.from(properties), defaultsOverrides)));
|
|
2900
|
+
return this.configurationModel;
|
|
2669
2901
|
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2902
|
+
reload() {
|
|
2903
|
+
this.resetConfigurationModel();
|
|
2904
|
+
return this.configurationModel;
|
|
2672
2905
|
}
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
this.parseRaw(raw, options);
|
|
2677
|
-
}
|
|
2906
|
+
onDidUpdateConfiguration(properties, defaultsOverrides) {
|
|
2907
|
+
this.updateConfigurationModel(properties, ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties());
|
|
2908
|
+
this._onDidChangeConfiguration.fire({ defaults: this.configurationModel, properties });
|
|
2678
2909
|
}
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
this.parseRaw(this._raw, options);
|
|
2682
|
-
}
|
|
2910
|
+
getConfigurationDefaultOverrides() {
|
|
2911
|
+
return {};
|
|
2683
2912
|
}
|
|
2684
|
-
|
|
2685
|
-
this.
|
|
2686
|
-
const
|
|
2687
|
-
this.
|
|
2688
|
-
this._restrictedConfigurations = restricted || [];
|
|
2913
|
+
resetConfigurationModel() {
|
|
2914
|
+
this._configurationModel = ( (new ConfigurationModel$1()));
|
|
2915
|
+
const properties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
|
|
2916
|
+
this.updateConfigurationModel(( (Object.keys(properties))), properties);
|
|
2689
2917
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
currentParent.push(value);
|
|
2918
|
+
updateConfigurationModel(properties, configurationProperties) {
|
|
2919
|
+
const configurationDefaultsOverrides = this.getConfigurationDefaultOverrides();
|
|
2920
|
+
for (const key of properties) {
|
|
2921
|
+
const defaultOverrideValue = configurationDefaultsOverrides[key];
|
|
2922
|
+
const propertySchema = configurationProperties[key];
|
|
2923
|
+
if (defaultOverrideValue !== undefined) {
|
|
2924
|
+
this._configurationModel.addValue(key, defaultOverrideValue);
|
|
2698
2925
|
}
|
|
2699
|
-
else if (
|
|
2700
|
-
|
|
2926
|
+
else if (propertySchema) {
|
|
2927
|
+
this._configurationModel.addValue(key, propertySchema.default);
|
|
2701
2928
|
}
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
onObjectBegin: () => {
|
|
2705
|
-
const object = {};
|
|
2706
|
-
onValue(object);
|
|
2707
|
-
previousParents.push(currentParent);
|
|
2708
|
-
currentParent = object;
|
|
2709
|
-
currentProperty = null;
|
|
2710
|
-
},
|
|
2711
|
-
onObjectProperty: (name) => {
|
|
2712
|
-
currentProperty = name;
|
|
2713
|
-
},
|
|
2714
|
-
onObjectEnd: () => {
|
|
2715
|
-
currentParent = previousParents.pop();
|
|
2716
|
-
},
|
|
2717
|
-
onArrayBegin: () => {
|
|
2718
|
-
const array = [];
|
|
2719
|
-
onValue(array);
|
|
2720
|
-
previousParents.push(currentParent);
|
|
2721
|
-
currentParent = array;
|
|
2722
|
-
currentProperty = null;
|
|
2723
|
-
},
|
|
2724
|
-
onArrayEnd: () => {
|
|
2725
|
-
currentParent = previousParents.pop();
|
|
2726
|
-
},
|
|
2727
|
-
onLiteralValue: onValue,
|
|
2728
|
-
onError: (error, offset, length) => {
|
|
2929
|
+
else {
|
|
2930
|
+
this._configurationModel.removeValue(key);
|
|
2729
2931
|
}
|
|
2730
|
-
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
class NullPolicyConfiguration {
|
|
2936
|
+
constructor() {
|
|
2937
|
+
this.onDidChangeConfiguration = Event.None;
|
|
2938
|
+
this.configurationModel = ( (new ConfigurationModel$1()));
|
|
2939
|
+
}
|
|
2940
|
+
async initialize() { return this.configurationModel; }
|
|
2941
|
+
}
|
|
2942
|
+
let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
2943
|
+
get configurationModel() { return this._configurationModel; }
|
|
2944
|
+
constructor(defaultConfiguration, policyService, logService) {
|
|
2945
|
+
super();
|
|
2946
|
+
this.defaultConfiguration = defaultConfiguration;
|
|
2947
|
+
this.policyService = policyService;
|
|
2948
|
+
this.logService = logService;
|
|
2949
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
2950
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
2951
|
+
this._configurationModel = ( (new ConfigurationModel$1()));
|
|
2952
|
+
}
|
|
2953
|
+
async initialize() {
|
|
2954
|
+
this.logService.trace('PolicyConfiguration#initialize');
|
|
2955
|
+
this.update(await this.updatePolicyDefinitions(this.defaultConfiguration.configurationModel.keys), false);
|
|
2956
|
+
this._register(this.policyService.onDidChange(policyNames => this.onDidChangePolicies(policyNames)));
|
|
2957
|
+
this._register(this.defaultConfiguration.onDidChangeConfiguration(async ({ properties }) => this.update(await this.updatePolicyDefinitions(properties), true)));
|
|
2958
|
+
return this._configurationModel;
|
|
2959
|
+
}
|
|
2960
|
+
async updatePolicyDefinitions(properties) {
|
|
2961
|
+
this.logService.trace('PolicyConfiguration#updatePolicyDefinitions', properties);
|
|
2962
|
+
const policyDefinitions = {};
|
|
2963
|
+
const keys = [];
|
|
2964
|
+
const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
|
|
2965
|
+
for (const key of properties) {
|
|
2966
|
+
const config = configurationProperties[key];
|
|
2967
|
+
if (!config) {
|
|
2968
|
+
keys.push(key);
|
|
2969
|
+
continue;
|
|
2735
2970
|
}
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2971
|
+
if (config.policy) {
|
|
2972
|
+
if (config.type !== 'string' && config.type !== 'number') {
|
|
2973
|
+
this.logService.warn(`Policy ${config.policy.name} has unsupported type ${config.type}`);
|
|
2974
|
+
continue;
|
|
2975
|
+
}
|
|
2976
|
+
keys.push(key);
|
|
2977
|
+
policyDefinitions[config.policy.name] = { type: config.type };
|
|
2739
2978
|
}
|
|
2740
2979
|
}
|
|
2741
|
-
|
|
2980
|
+
if (!isEmptyObject(policyDefinitions)) {
|
|
2981
|
+
await this.policyService.updatePolicyDefinitions(policyDefinitions);
|
|
2982
|
+
}
|
|
2983
|
+
return keys;
|
|
2742
2984
|
}
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
const
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
const keys = ( (Object.keys(raw)));
|
|
2749
|
-
const overrides = this.toOverrides(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
|
|
2750
|
-
return { contents, keys, overrides, restricted: filtered.restricted };
|
|
2985
|
+
onDidChangePolicies(policyNames) {
|
|
2986
|
+
this.logService.trace('PolicyConfiguration#onDidChangePolicies', policyNames);
|
|
2987
|
+
const policyConfigurations = ( (Registry.as(Extensions$2.Configuration))).getPolicyConfigurations();
|
|
2988
|
+
const keys = coalesce(policyNames.map(policyName => policyConfigurations.get(policyName)));
|
|
2989
|
+
this.update(keys, true);
|
|
2751
2990
|
}
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
const
|
|
2757
|
-
const
|
|
2758
|
-
|
|
2759
|
-
if (
|
|
2760
|
-
const
|
|
2761
|
-
|
|
2762
|
-
|
|
2991
|
+
update(keys, trigger) {
|
|
2992
|
+
this.logService.trace('PolicyConfiguration#update', keys);
|
|
2993
|
+
const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
|
|
2994
|
+
const changed = [];
|
|
2995
|
+
const wasEmpty = this._configurationModel.isEmpty();
|
|
2996
|
+
for (const key of keys) {
|
|
2997
|
+
const policyName = configurationProperties[key]?.policy?.name;
|
|
2998
|
+
if (policyName) {
|
|
2999
|
+
const policyValue = this.policyService.getPolicyValue(policyName);
|
|
3000
|
+
if (wasEmpty ? policyValue !== undefined : !equals(this._configurationModel.getValue(key), policyValue)) {
|
|
3001
|
+
changed.push([key, policyValue]);
|
|
3002
|
+
}
|
|
2763
3003
|
}
|
|
2764
3004
|
else {
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
if (propertySchema?.restricted) {
|
|
2768
|
-
restricted.push(key);
|
|
2769
|
-
}
|
|
2770
|
-
if (scope === undefined || options.scopes === undefined || options.scopes.includes(scope)) {
|
|
2771
|
-
if (!(options.skipRestricted && propertySchema?.restricted)) {
|
|
2772
|
-
raw[key] = properties[key];
|
|
2773
|
-
}
|
|
3005
|
+
if (this._configurationModel.getValue(key) !== undefined) {
|
|
3006
|
+
changed.push([key, undefined]);
|
|
2774
3007
|
}
|
|
2775
3008
|
}
|
|
2776
3009
|
}
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
3010
|
+
if (changed.length) {
|
|
3011
|
+
this.logService.trace('PolicyConfiguration#changed', changed);
|
|
3012
|
+
const old = this._configurationModel;
|
|
3013
|
+
this._configurationModel = ( (new ConfigurationModel$1()));
|
|
3014
|
+
for (const key of old.keys) {
|
|
3015
|
+
this._configurationModel.setValue(key, old.getValue(key));
|
|
3016
|
+
}
|
|
3017
|
+
for (const [key, policyValue] of changed) {
|
|
3018
|
+
if (policyValue === undefined) {
|
|
3019
|
+
this._configurationModel.removeValue(key);
|
|
2786
3020
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
3021
|
+
else {
|
|
3022
|
+
this._configurationModel.setValue(key, policyValue);
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
if (trigger) {
|
|
3026
|
+
this._onDidChangeConfiguration.fire(this._configurationModel);
|
|
2792
3027
|
}
|
|
2793
3028
|
}
|
|
2794
|
-
return overrides;
|
|
2795
3029
|
}
|
|
3030
|
+
};
|
|
3031
|
+
PolicyConfiguration = ( (__decorate([
|
|
3032
|
+
( (__param(1, IPolicyService))),
|
|
3033
|
+
( (__param(2, ILogService)))
|
|
3034
|
+
], PolicyConfiguration)));
|
|
3035
|
+
function isConfigurationOverrides(thing) {
|
|
3036
|
+
return thing
|
|
3037
|
+
&& typeof thing === 'object'
|
|
3038
|
+
&& (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')
|
|
3039
|
+
&& (!thing.resource || thing.resource instanceof URI);
|
|
2796
3040
|
}
|
|
2797
|
-
class
|
|
2798
|
-
constructor(
|
|
2799
|
-
|
|
2800
|
-
this.
|
|
2801
|
-
|
|
2802
|
-
this.
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
this._register(Event.any(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.userSettingsResource)), Event.filter(this.fileService.onDidRunOperation, e => (e.isOperation(0 ) || e.isOperation(3 ) || e.isOperation(1 ) || e.isOperation(4 )) && extUri.isEqual(e.resource, userSettingsResource)))(() => this._onDidChange.fire()));
|
|
3041
|
+
class StandaloneConfigurationService {
|
|
3042
|
+
constructor() {
|
|
3043
|
+
this._onDidChangeConfiguration = ( (new Emitter()));
|
|
3044
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
3045
|
+
const defaultConfiguration = ( (new DefaultConfiguration$1()));
|
|
3046
|
+
this._configuration = ( (new Configuration$1(
|
|
3047
|
+
defaultConfiguration.reload(),
|
|
3048
|
+
(new ConfigurationModel$1()),
|
|
3049
|
+
(new ConfigurationModel$1()),
|
|
3050
|
+
(new ConfigurationModel$1())
|
|
3051
|
+
)));
|
|
3052
|
+
defaultConfiguration.dispose();
|
|
2810
3053
|
}
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
return this.parser.configurationModel;
|
|
2816
|
-
}
|
|
2817
|
-
catch (e) {
|
|
2818
|
-
return (
|
|
2819
|
-
(new ConfigurationModel())
|
|
2820
|
-
);
|
|
2821
|
-
}
|
|
3054
|
+
getValue(arg1, arg2) {
|
|
3055
|
+
const section = typeof arg1 === 'string' ? arg1 : undefined;
|
|
3056
|
+
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
|
|
3057
|
+
return this._configuration.getValue(section, overrides, undefined);
|
|
2822
3058
|
}
|
|
2823
|
-
|
|
2824
|
-
this.
|
|
2825
|
-
|
|
3059
|
+
updateValues(values) {
|
|
3060
|
+
const previous = { data: this._configuration.toData() };
|
|
3061
|
+
const changedKeys = [];
|
|
3062
|
+
for (const entry of values) {
|
|
3063
|
+
const [key, value] = entry;
|
|
3064
|
+
if (this.getValue(key) === value) {
|
|
3065
|
+
continue;
|
|
3066
|
+
}
|
|
3067
|
+
this._configuration.updateValue(key, value);
|
|
3068
|
+
changedKeys.push(key);
|
|
3069
|
+
}
|
|
3070
|
+
if (changedKeys.length > 0) {
|
|
3071
|
+
const configurationChangeEvent = ( (new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration)));
|
|
3072
|
+
configurationChangeEvent.source = 8 ;
|
|
3073
|
+
configurationChangeEvent.sourceConfig = null;
|
|
3074
|
+
this._onDidChangeConfiguration.fire(configurationChangeEvent);
|
|
3075
|
+
}
|
|
3076
|
+
return Promise.resolve();
|
|
2826
3077
|
}
|
|
2827
|
-
|
|
2828
|
-
return this.
|
|
3078
|
+
updateValue(key, value, arg3, arg4) {
|
|
3079
|
+
return this.updateValues([[key, value]]);
|
|
2829
3080
|
}
|
|
2830
|
-
}
|
|
2831
|
-
|
|
2832
|
-
constructor(_defaultConfiguration, _policyConfiguration, _applicationConfiguration, _localUserConfiguration, _remoteUserConfiguration = ( (new ConfigurationModel())), _workspaceConfiguration = ( (new ConfigurationModel())), _folderConfigurations = ( (new ResourceMap$1())), _memoryConfiguration = ( (new ConfigurationModel())), _memoryConfigurationByResource = ( (new ResourceMap$1())), _freeze = true) {
|
|
2833
|
-
this._defaultConfiguration = _defaultConfiguration;
|
|
2834
|
-
this._policyConfiguration = _policyConfiguration;
|
|
2835
|
-
this._applicationConfiguration = _applicationConfiguration;
|
|
2836
|
-
this._localUserConfiguration = _localUserConfiguration;
|
|
2837
|
-
this._remoteUserConfiguration = _remoteUserConfiguration;
|
|
2838
|
-
this._workspaceConfiguration = _workspaceConfiguration;
|
|
2839
|
-
this._folderConfigurations = _folderConfigurations;
|
|
2840
|
-
this._memoryConfiguration = _memoryConfiguration;
|
|
2841
|
-
this._memoryConfigurationByResource = _memoryConfigurationByResource;
|
|
2842
|
-
this._freeze = _freeze;
|
|
2843
|
-
this._workspaceConsolidatedConfiguration = null;
|
|
2844
|
-
this._foldersConsolidatedConfigurations = ( (new ResourceMap$1()));
|
|
2845
|
-
this._userConfiguration = null;
|
|
3081
|
+
inspect(key, options = {}) {
|
|
3082
|
+
return this._configuration.inspect(key, options, undefined);
|
|
2846
3083
|
}
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
3084
|
+
keys() {
|
|
3085
|
+
return (
|
|
3086
|
+
(this._configuration.keys(undefined))
|
|
3087
|
+
);
|
|
2850
3088
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
if (overrides.resource) {
|
|
2854
|
-
memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);
|
|
2855
|
-
if (!memoryConfiguration) {
|
|
2856
|
-
memoryConfiguration = ( (new ConfigurationModel()));
|
|
2857
|
-
this._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);
|
|
2858
|
-
}
|
|
2859
|
-
}
|
|
2860
|
-
else {
|
|
2861
|
-
memoryConfiguration = this._memoryConfiguration;
|
|
2862
|
-
}
|
|
2863
|
-
if (value === undefined) {
|
|
2864
|
-
memoryConfiguration.removeValue(key);
|
|
2865
|
-
}
|
|
2866
|
-
else {
|
|
2867
|
-
memoryConfiguration.setValue(key, value);
|
|
2868
|
-
}
|
|
2869
|
-
if (!overrides.resource) {
|
|
2870
|
-
this._workspaceConsolidatedConfiguration = null;
|
|
2871
|
-
}
|
|
3089
|
+
reloadConfiguration() {
|
|
3090
|
+
return Promise.resolve(undefined);
|
|
2872
3091
|
}
|
|
2873
|
-
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
const policyValue = this._policyConfiguration.isEmpty() ? undefined : this._policyConfiguration.freeze().getValue(key);
|
|
2879
|
-
const applicationValue = this.applicationConfiguration.isEmpty() ? undefined : this.applicationConfiguration.freeze().getValue(key);
|
|
2880
|
-
const userValue = overrides.overrideIdentifier ? this.userConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.userConfiguration.freeze().getValue(key);
|
|
2881
|
-
const userLocalValue = overrides.overrideIdentifier ? this.localUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.localUserConfiguration.freeze().getValue(key);
|
|
2882
|
-
const userRemoteValue = overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.remoteUserConfiguration.freeze().getValue(key);
|
|
2883
|
-
const workspaceValue = workspace ? overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._workspaceConfiguration.freeze().getValue(key) : undefined;
|
|
2884
|
-
const workspaceFolderValue = folderConfigurationModel ? overrides.overrideIdentifier ? folderConfigurationModel.freeze().override(overrides.overrideIdentifier).getValue(key) : folderConfigurationModel.freeze().getValue(key) : undefined;
|
|
2885
|
-
const memoryValue = overrides.overrideIdentifier ? memoryConfigurationModel.override(overrides.overrideIdentifier).getValue(key) : memoryConfigurationModel.getValue(key);
|
|
2886
|
-
const value = consolidateConfigurationModel.getValue(key);
|
|
2887
|
-
const overrideIdentifiers = distinct(consolidateConfigurationModel.overrides.map(override => override.identifiers).flat()).filter(overrideIdentifier => consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== undefined);
|
|
2888
|
-
return {
|
|
2889
|
-
defaultValue,
|
|
2890
|
-
policyValue,
|
|
2891
|
-
applicationValue,
|
|
2892
|
-
userValue,
|
|
2893
|
-
userLocalValue,
|
|
2894
|
-
userRemoteValue,
|
|
2895
|
-
workspaceValue,
|
|
2896
|
-
workspaceFolderValue,
|
|
2897
|
-
memoryValue,
|
|
2898
|
-
value,
|
|
2899
|
-
default: defaultValue !== undefined ? { value: this._defaultConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2900
|
-
policy: policyValue !== undefined ? { value: policyValue } : undefined,
|
|
2901
|
-
application: applicationValue !== undefined ? { value: applicationValue, override: overrides.overrideIdentifier ? this.applicationConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2902
|
-
user: userValue !== undefined ? { value: this.userConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.userConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2903
|
-
userLocal: userLocalValue !== undefined ? { value: this.localUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.localUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2904
|
-
userRemote: userRemoteValue !== undefined ? { value: this.remoteUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2905
|
-
workspace: workspaceValue !== undefined ? { value: this._workspaceConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2906
|
-
workspaceFolder: workspaceFolderValue !== undefined ? { value: folderConfigurationModel?.freeze().getValue(key), override: overrides.overrideIdentifier ? folderConfigurationModel?.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2907
|
-
memory: memoryValue !== undefined ? { value: memoryConfigurationModel.getValue(key), override: overrides.overrideIdentifier ? memoryConfigurationModel.getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
|
|
2908
|
-
overrideIdentifiers: overrideIdentifiers.length ? overrideIdentifiers : undefined
|
|
3092
|
+
getConfigurationData() {
|
|
3093
|
+
const emptyModel = {
|
|
3094
|
+
contents: {},
|
|
3095
|
+
keys: [],
|
|
3096
|
+
overrides: []
|
|
2909
3097
|
};
|
|
2910
|
-
}
|
|
2911
|
-
keys(workspace) {
|
|
2912
|
-
const folderConfigurationModel = this.getFolderConfigurationModelForResource(undefined, workspace);
|
|
2913
3098
|
return {
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
3099
|
+
defaults: emptyModel,
|
|
3100
|
+
policy: emptyModel,
|
|
3101
|
+
application: emptyModel,
|
|
3102
|
+
user: emptyModel,
|
|
3103
|
+
workspace: emptyModel,
|
|
3104
|
+
folders: []
|
|
2918
3105
|
};
|
|
2919
3106
|
}
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
this.
|
|
3107
|
+
}
|
|
3108
|
+
class StringIterator {
|
|
3109
|
+
constructor() {
|
|
3110
|
+
this._value = '';
|
|
3111
|
+
this._pos = 0;
|
|
2924
3112
|
}
|
|
2925
|
-
|
|
2926
|
-
this.
|
|
3113
|
+
reset(key) {
|
|
3114
|
+
this._value = key;
|
|
3115
|
+
this._pos = 0;
|
|
3116
|
+
return this;
|
|
2927
3117
|
}
|
|
2928
|
-
|
|
2929
|
-
this.
|
|
2930
|
-
this
|
|
2931
|
-
this._foldersConsolidatedConfigurations.clear();
|
|
3118
|
+
next() {
|
|
3119
|
+
this._pos += 1;
|
|
3120
|
+
return this;
|
|
2932
3121
|
}
|
|
2933
|
-
|
|
2934
|
-
this.
|
|
2935
|
-
this._userConfiguration = null;
|
|
2936
|
-
this._workspaceConsolidatedConfiguration = null;
|
|
2937
|
-
this._foldersConsolidatedConfigurations.clear();
|
|
3122
|
+
hasNext() {
|
|
3123
|
+
return this._pos < this._value.length - 1;
|
|
2938
3124
|
}
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
this._foldersConsolidatedConfigurations.clear();
|
|
3125
|
+
cmp(a) {
|
|
3126
|
+
const aCode = a.charCodeAt(0);
|
|
3127
|
+
const thisCode = this._value.charCodeAt(this._pos);
|
|
3128
|
+
return aCode - thisCode;
|
|
2944
3129
|
}
|
|
2945
|
-
|
|
2946
|
-
this.
|
|
2947
|
-
this._workspaceConsolidatedConfiguration = null;
|
|
2948
|
-
this._foldersConsolidatedConfigurations.clear();
|
|
3130
|
+
value() {
|
|
3131
|
+
return this._value[this._pos];
|
|
2949
3132
|
}
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
3133
|
+
}
|
|
3134
|
+
class ConfigKeysIterator {
|
|
3135
|
+
constructor(_caseSensitive = true) {
|
|
3136
|
+
this._caseSensitive = _caseSensitive;
|
|
2953
3137
|
}
|
|
2954
|
-
|
|
2955
|
-
this.
|
|
2956
|
-
this.
|
|
3138
|
+
reset(key) {
|
|
3139
|
+
this._value = key;
|
|
3140
|
+
this._from = 0;
|
|
3141
|
+
this._to = 0;
|
|
3142
|
+
return this.next();
|
|
2957
3143
|
}
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
for (
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3144
|
+
hasNext() {
|
|
3145
|
+
return this._to < this._value.length;
|
|
3146
|
+
}
|
|
3147
|
+
next() {
|
|
3148
|
+
this._from = this._to;
|
|
3149
|
+
let justSeps = true;
|
|
3150
|
+
for (; this._to < this._value.length; this._to++) {
|
|
3151
|
+
const ch = this._value.charCodeAt(this._to);
|
|
3152
|
+
if (ch === 46 ) {
|
|
3153
|
+
if (justSeps) {
|
|
3154
|
+
this._from++;
|
|
3155
|
+
}
|
|
3156
|
+
else {
|
|
3157
|
+
break;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
else {
|
|
3161
|
+
justSeps = false;
|
|
2974
3162
|
}
|
|
2975
3163
|
}
|
|
2976
|
-
this
|
|
2977
|
-
return { keys, overrides };
|
|
3164
|
+
return this;
|
|
2978
3165
|
}
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
this.updatePolicyConfiguration(policyConfiguration);
|
|
2984
|
-
}
|
|
2985
|
-
return { keys, overrides: [] };
|
|
3166
|
+
cmp(a) {
|
|
3167
|
+
return this._caseSensitive
|
|
3168
|
+
? compareSubstring(a, this._value, 0, a.length, this._from, this._to)
|
|
3169
|
+
: compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);
|
|
2986
3170
|
}
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
const keys = [...added, ...updated, ...removed];
|
|
2990
|
-
if (keys.length) {
|
|
2991
|
-
this.updateApplicationConfiguration(application);
|
|
2992
|
-
}
|
|
2993
|
-
return { keys, overrides };
|
|
3171
|
+
value() {
|
|
3172
|
+
return this._value.substring(this._from, this._to);
|
|
2994
3173
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
}
|
|
3001
|
-
return { keys, overrides };
|
|
3174
|
+
}
|
|
3175
|
+
class PathIterator {
|
|
3176
|
+
constructor(_splitOnBackslash = true, _caseSensitive = true) {
|
|
3177
|
+
this._splitOnBackslash = _splitOnBackslash;
|
|
3178
|
+
this._caseSensitive = _caseSensitive;
|
|
3002
3179
|
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3180
|
+
reset(key) {
|
|
3181
|
+
this._from = 0;
|
|
3182
|
+
this._to = 0;
|
|
3183
|
+
this._value = key;
|
|
3184
|
+
this._valueLen = key.length;
|
|
3185
|
+
for (let pos = key.length - 1; pos >= 0; pos--, this._valueLen--) {
|
|
3186
|
+
const ch = this._value.charCodeAt(pos);
|
|
3187
|
+
if (!((ch === 47 || this._splitOnBackslash && ch === 92) )) {
|
|
3188
|
+
break;
|
|
3189
|
+
}
|
|
3008
3190
|
}
|
|
3009
|
-
return
|
|
3191
|
+
return this.next();
|
|
3010
3192
|
}
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
const keys = [...added, ...updated, ...removed];
|
|
3014
|
-
if (keys.length) {
|
|
3015
|
-
this.updateWorkspaceConfiguration(workspaceConfiguration);
|
|
3016
|
-
}
|
|
3017
|
-
return { keys, overrides };
|
|
3193
|
+
hasNext() {
|
|
3194
|
+
return this._to < this._valueLen;
|
|
3018
3195
|
}
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
this.
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
const { added, updated, removed, overrides } = compare(folderConfig, undefined);
|
|
3035
|
-
return { keys: [...added, ...updated, ...removed], overrides };
|
|
3036
|
-
}
|
|
3037
|
-
get defaults() {
|
|
3038
|
-
return this._defaultConfiguration;
|
|
3039
|
-
}
|
|
3040
|
-
get applicationConfiguration() {
|
|
3041
|
-
return this._applicationConfiguration;
|
|
3042
|
-
}
|
|
3043
|
-
get userConfiguration() {
|
|
3044
|
-
if (!this._userConfiguration) {
|
|
3045
|
-
this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration);
|
|
3046
|
-
if (this._freeze) {
|
|
3047
|
-
this._userConfiguration.freeze();
|
|
3196
|
+
next() {
|
|
3197
|
+
this._from = this._to;
|
|
3198
|
+
let justSeps = true;
|
|
3199
|
+
for (; this._to < this._valueLen; this._to++) {
|
|
3200
|
+
const ch = this._value.charCodeAt(this._to);
|
|
3201
|
+
if (ch === 47 || this._splitOnBackslash && ch === 92 ) {
|
|
3202
|
+
if (justSeps) {
|
|
3203
|
+
this._from++;
|
|
3204
|
+
}
|
|
3205
|
+
else {
|
|
3206
|
+
break;
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
else {
|
|
3210
|
+
justSeps = false;
|
|
3048
3211
|
}
|
|
3049
3212
|
}
|
|
3050
|
-
return this
|
|
3051
|
-
}
|
|
3052
|
-
get localUserConfiguration() {
|
|
3053
|
-
return this._localUserConfiguration;
|
|
3213
|
+
return this;
|
|
3054
3214
|
}
|
|
3055
|
-
|
|
3056
|
-
return this.
|
|
3215
|
+
cmp(a) {
|
|
3216
|
+
return this._caseSensitive
|
|
3217
|
+
? compareSubstring(a, this._value, 0, a.length, this._from, this._to)
|
|
3218
|
+
: compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);
|
|
3057
3219
|
}
|
|
3058
|
-
|
|
3059
|
-
return this.
|
|
3220
|
+
value() {
|
|
3221
|
+
return this._value.substring(this._from, this._to);
|
|
3060
3222
|
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3223
|
+
}
|
|
3224
|
+
class UriIterator {
|
|
3225
|
+
constructor(_ignorePathCasing, _ignoreQueryAndFragment) {
|
|
3226
|
+
this._ignorePathCasing = _ignorePathCasing;
|
|
3227
|
+
this._ignoreQueryAndFragment = _ignoreQueryAndFragment;
|
|
3228
|
+
this._states = [];
|
|
3229
|
+
this._stateIdx = 0;
|
|
3063
3230
|
}
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3231
|
+
reset(key) {
|
|
3232
|
+
this._value = key;
|
|
3233
|
+
this._states = [];
|
|
3234
|
+
if (this._value.scheme) {
|
|
3235
|
+
this._states.push(1 );
|
|
3068
3236
|
}
|
|
3069
|
-
if (
|
|
3070
|
-
|
|
3237
|
+
if (this._value.authority) {
|
|
3238
|
+
this._states.push(2 );
|
|
3071
3239
|
}
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
const root = workspace.getFolder(resource);
|
|
3078
|
-
if (root) {
|
|
3079
|
-
consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;
|
|
3240
|
+
if (this._value.path) {
|
|
3241
|
+
this._pathIterator = ( (new PathIterator(false, !this._ignorePathCasing(key))));
|
|
3242
|
+
this._pathIterator.reset(key.path);
|
|
3243
|
+
if (this._pathIterator.value()) {
|
|
3244
|
+
this._states.push(3 );
|
|
3080
3245
|
}
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3246
|
+
}
|
|
3247
|
+
if (!this._ignoreQueryAndFragment(key)) {
|
|
3248
|
+
if (this._value.query) {
|
|
3249
|
+
this._states.push(4 );
|
|
3250
|
+
}
|
|
3251
|
+
if (this._value.fragment) {
|
|
3252
|
+
this._states.push(5 );
|
|
3084
3253
|
}
|
|
3085
3254
|
}
|
|
3086
|
-
|
|
3255
|
+
this._stateIdx = 0;
|
|
3256
|
+
return this;
|
|
3087
3257
|
}
|
|
3088
|
-
|
|
3089
|
-
if (
|
|
3090
|
-
this.
|
|
3091
|
-
if (this._freeze) {
|
|
3092
|
-
this._workspaceConfiguration = this._workspaceConfiguration.freeze();
|
|
3093
|
-
}
|
|
3258
|
+
next() {
|
|
3259
|
+
if (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext()) {
|
|
3260
|
+
this._pathIterator.next();
|
|
3094
3261
|
}
|
|
3095
|
-
|
|
3262
|
+
else {
|
|
3263
|
+
this._stateIdx += 1;
|
|
3264
|
+
}
|
|
3265
|
+
return this;
|
|
3096
3266
|
}
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
if (this._freeze) {
|
|
3105
|
-
folderConsolidatedConfiguration = folderConsolidatedConfiguration.freeze();
|
|
3106
|
-
}
|
|
3107
|
-
this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);
|
|
3108
|
-
}
|
|
3109
|
-
else {
|
|
3110
|
-
folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
|
|
3111
|
-
}
|
|
3267
|
+
hasNext() {
|
|
3268
|
+
return (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext())
|
|
3269
|
+
|| this._stateIdx < this._states.length - 1;
|
|
3270
|
+
}
|
|
3271
|
+
cmp(a) {
|
|
3272
|
+
if (this._states[this._stateIdx] === 1 ) {
|
|
3273
|
+
return compareIgnoreCase(a, this._value.scheme);
|
|
3112
3274
|
}
|
|
3113
|
-
|
|
3275
|
+
else if (this._states[this._stateIdx] === 2 ) {
|
|
3276
|
+
return compareIgnoreCase(a, this._value.authority);
|
|
3277
|
+
}
|
|
3278
|
+
else if (this._states[this._stateIdx] === 3 ) {
|
|
3279
|
+
return this._pathIterator.cmp(a);
|
|
3280
|
+
}
|
|
3281
|
+
else if (this._states[this._stateIdx] === 4 ) {
|
|
3282
|
+
return compare$1(a, this._value.query);
|
|
3283
|
+
}
|
|
3284
|
+
else if (this._states[this._stateIdx] === 5 ) {
|
|
3285
|
+
return compare$1(a, this._value.fragment);
|
|
3286
|
+
}
|
|
3287
|
+
throw new Error();
|
|
3114
3288
|
}
|
|
3115
|
-
|
|
3116
|
-
if (
|
|
3117
|
-
|
|
3118
|
-
if (root) {
|
|
3119
|
-
return this._folderConfigurations.get(root.uri);
|
|
3120
|
-
}
|
|
3289
|
+
value() {
|
|
3290
|
+
if (this._states[this._stateIdx] === 1 ) {
|
|
3291
|
+
return this._value.scheme;
|
|
3121
3292
|
}
|
|
3122
|
-
|
|
3293
|
+
else if (this._states[this._stateIdx] === 2 ) {
|
|
3294
|
+
return this._value.authority;
|
|
3295
|
+
}
|
|
3296
|
+
else if (this._states[this._stateIdx] === 3 ) {
|
|
3297
|
+
return this._pathIterator.value();
|
|
3298
|
+
}
|
|
3299
|
+
else if (this._states[this._stateIdx] === 4 ) {
|
|
3300
|
+
return this._value.query;
|
|
3301
|
+
}
|
|
3302
|
+
else if (this._states[this._stateIdx] === 5 ) {
|
|
3303
|
+
return this._value.fragment;
|
|
3304
|
+
}
|
|
3305
|
+
throw new Error();
|
|
3123
3306
|
}
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
overrides: this._defaultConfiguration.overrides,
|
|
3129
|
-
keys: this._defaultConfiguration.keys
|
|
3130
|
-
},
|
|
3131
|
-
policy: {
|
|
3132
|
-
contents: this._policyConfiguration.contents,
|
|
3133
|
-
overrides: this._policyConfiguration.overrides,
|
|
3134
|
-
keys: this._policyConfiguration.keys
|
|
3135
|
-
},
|
|
3136
|
-
application: {
|
|
3137
|
-
contents: this.applicationConfiguration.contents,
|
|
3138
|
-
overrides: this.applicationConfiguration.overrides,
|
|
3139
|
-
keys: this.applicationConfiguration.keys
|
|
3140
|
-
},
|
|
3141
|
-
user: {
|
|
3142
|
-
contents: this.userConfiguration.contents,
|
|
3143
|
-
overrides: this.userConfiguration.overrides,
|
|
3144
|
-
keys: this.userConfiguration.keys
|
|
3145
|
-
},
|
|
3146
|
-
workspace: {
|
|
3147
|
-
contents: this._workspaceConfiguration.contents,
|
|
3148
|
-
overrides: this._workspaceConfiguration.overrides,
|
|
3149
|
-
keys: this._workspaceConfiguration.keys
|
|
3150
|
-
},
|
|
3151
|
-
folders: [...( (this._folderConfigurations.keys()))].reduce((result, folder) => {
|
|
3152
|
-
const { contents, overrides, keys } = this._folderConfigurations.get(folder);
|
|
3153
|
-
result.push([folder, { contents, overrides, keys }]);
|
|
3154
|
-
return result;
|
|
3155
|
-
}, [])
|
|
3156
|
-
};
|
|
3307
|
+
}
|
|
3308
|
+
class TernarySearchTreeNode {
|
|
3309
|
+
constructor() {
|
|
3310
|
+
this.height = 1;
|
|
3157
3311
|
}
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
this._defaultConfiguration.freeze().keys.forEach(key => keys.add(key));
|
|
3161
|
-
this.userConfiguration.freeze().keys.forEach(key => keys.add(key));
|
|
3162
|
-
this._workspaceConfiguration.freeze().keys.forEach(key => keys.add(key));
|
|
3163
|
-
this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.freeze().keys.forEach(key => keys.add(key)));
|
|
3164
|
-
return [...( (keys.values()))];
|
|
3312
|
+
isEmpty() {
|
|
3313
|
+
return !this.left && !this.mid && !this.right && !this.value;
|
|
3165
3314
|
}
|
|
3166
|
-
|
|
3167
|
-
const
|
|
3168
|
-
this.
|
|
3169
|
-
|
|
3170
|
-
this.
|
|
3171
|
-
|
|
3172
|
-
return
|
|
3315
|
+
rotateLeft() {
|
|
3316
|
+
const tmp = this.right;
|
|
3317
|
+
this.right = tmp.left;
|
|
3318
|
+
tmp.left = this;
|
|
3319
|
+
this.updateHeight();
|
|
3320
|
+
tmp.updateHeight();
|
|
3321
|
+
return tmp;
|
|
3173
3322
|
}
|
|
3174
|
-
|
|
3175
|
-
const
|
|
3176
|
-
this.
|
|
3177
|
-
|
|
3178
|
-
this.
|
|
3179
|
-
|
|
3180
|
-
return
|
|
3323
|
+
rotateRight() {
|
|
3324
|
+
const tmp = this.left;
|
|
3325
|
+
this.left = tmp.right;
|
|
3326
|
+
tmp.right = this;
|
|
3327
|
+
this.updateHeight();
|
|
3328
|
+
tmp.updateHeight();
|
|
3329
|
+
return tmp;
|
|
3181
3330
|
}
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3331
|
+
updateHeight() {
|
|
3332
|
+
this.height = 1 + Math.max(this.heightLeft, this.heightRight);
|
|
3333
|
+
}
|
|
3334
|
+
balanceFactor() {
|
|
3335
|
+
return this.heightRight - this.heightLeft;
|
|
3336
|
+
}
|
|
3337
|
+
get heightLeft() {
|
|
3338
|
+
return this.left?.height ?? 0;
|
|
3339
|
+
}
|
|
3340
|
+
get heightRight() {
|
|
3341
|
+
return this.right?.height ?? 0;
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
class TernarySearchTree {
|
|
3345
|
+
static forUris(ignorePathCasing = () => false, ignoreQueryAndFragment = () => false) {
|
|
3192
3346
|
return (
|
|
3193
|
-
(new
|
|
3194
|
-
defaultConfiguration,
|
|
3195
|
-
policyConfiguration,
|
|
3196
|
-
applicationConfiguration,
|
|
3197
|
-
userConfiguration,
|
|
3198
|
-
(new ConfigurationModel()),
|
|
3199
|
-
workspaceConfiguration,
|
|
3200
|
-
folders,
|
|
3201
|
-
(new ConfigurationModel()),
|
|
3202
|
-
(new ResourceMap$1()),
|
|
3203
|
-
false
|
|
3204
|
-
))
|
|
3347
|
+
(new TernarySearchTree( (new UriIterator(ignorePathCasing, ignoreQueryAndFragment))))
|
|
3205
3348
|
);
|
|
3206
3349
|
}
|
|
3207
|
-
static
|
|
3208
|
-
return (
|
|
3350
|
+
static forPaths(ignorePathCasing = false) {
|
|
3351
|
+
return (
|
|
3352
|
+
(new TernarySearchTree( (new PathIterator(undefined, !ignorePathCasing))))
|
|
3353
|
+
);
|
|
3209
3354
|
}
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3355
|
+
static forStrings() {
|
|
3356
|
+
return (
|
|
3357
|
+
(new TernarySearchTree( (new StringIterator())))
|
|
3358
|
+
);
|
|
3359
|
+
}
|
|
3360
|
+
static forConfigKeys() {
|
|
3361
|
+
return (
|
|
3362
|
+
(new TernarySearchTree( (new ConfigKeysIterator())))
|
|
3363
|
+
);
|
|
3364
|
+
}
|
|
3365
|
+
constructor(segments) {
|
|
3366
|
+
this._iter = segments;
|
|
3367
|
+
}
|
|
3368
|
+
clear() {
|
|
3369
|
+
this._root = undefined;
|
|
3370
|
+
}
|
|
3371
|
+
fill(values, keys) {
|
|
3372
|
+
if (keys) {
|
|
3373
|
+
const arr = keys.slice(0);
|
|
3374
|
+
shuffle(arr);
|
|
3375
|
+
for (const k of arr) {
|
|
3376
|
+
this.set(k, values);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
else {
|
|
3380
|
+
const arr = values.slice(0);
|
|
3381
|
+
shuffle(arr);
|
|
3382
|
+
for (const entry of arr) {
|
|
3383
|
+
this.set(entry[0], entry[1]);
|
|
3384
|
+
}
|
|
3220
3385
|
}
|
|
3221
3386
|
}
|
|
3222
|
-
|
|
3223
|
-
const
|
|
3224
|
-
|
|
3225
|
-
|
|
3387
|
+
set(key, element) {
|
|
3388
|
+
const iter = this._iter.reset(key);
|
|
3389
|
+
let node;
|
|
3390
|
+
if (!this._root) {
|
|
3391
|
+
this._root = ( (new TernarySearchTreeNode()));
|
|
3392
|
+
this._root.segment = iter.value();
|
|
3393
|
+
}
|
|
3394
|
+
const stack = [];
|
|
3395
|
+
node = this._root;
|
|
3396
|
+
while (true) {
|
|
3397
|
+
const val = iter.cmp(node.segment);
|
|
3398
|
+
if (val > 0) {
|
|
3399
|
+
if (!node.left) {
|
|
3400
|
+
node.left = ( (new TernarySearchTreeNode()));
|
|
3401
|
+
node.left.segment = iter.value();
|
|
3402
|
+
}
|
|
3403
|
+
stack.push([-1 , node]);
|
|
3404
|
+
node = node.left;
|
|
3405
|
+
}
|
|
3406
|
+
else if (val < 0) {
|
|
3407
|
+
if (!node.right) {
|
|
3408
|
+
node.right = ( (new TernarySearchTreeNode()));
|
|
3409
|
+
node.right.segment = iter.value();
|
|
3410
|
+
}
|
|
3411
|
+
stack.push([1 , node]);
|
|
3412
|
+
node = node.right;
|
|
3413
|
+
}
|
|
3414
|
+
else if (iter.hasNext()) {
|
|
3415
|
+
iter.next();
|
|
3416
|
+
if (!node.mid) {
|
|
3417
|
+
node.mid = ( (new TernarySearchTreeNode()));
|
|
3418
|
+
node.mid.segment = iter.value();
|
|
3419
|
+
}
|
|
3420
|
+
stack.push([0 , node]);
|
|
3421
|
+
node = node.mid;
|
|
3422
|
+
}
|
|
3423
|
+
else {
|
|
3424
|
+
break;
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
const oldElement = node.value;
|
|
3428
|
+
node.value = element;
|
|
3429
|
+
node.key = key;
|
|
3430
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
3431
|
+
const node = stack[i][1];
|
|
3432
|
+
node.updateHeight();
|
|
3433
|
+
const bf = node.balanceFactor();
|
|
3434
|
+
if (bf < -1 || bf > 1) {
|
|
3435
|
+
const d1 = stack[i][0];
|
|
3436
|
+
const d2 = stack[i + 1][0];
|
|
3437
|
+
if (d1 === 1 && d2 === 1 ) {
|
|
3438
|
+
stack[i][1] = node.rotateLeft();
|
|
3439
|
+
}
|
|
3440
|
+
else if (d1 === -1 && d2 === -1 ) {
|
|
3441
|
+
stack[i][1] = node.rotateRight();
|
|
3442
|
+
}
|
|
3443
|
+
else if (d1 === 1 && d2 === -1 ) {
|
|
3444
|
+
node.right = stack[i + 1][1] = stack[i + 1][1].rotateRight();
|
|
3445
|
+
stack[i][1] = node.rotateLeft();
|
|
3446
|
+
}
|
|
3447
|
+
else if (d1 === -1 && d2 === 1 ) {
|
|
3448
|
+
node.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft();
|
|
3449
|
+
stack[i][1] = node.rotateRight();
|
|
3450
|
+
}
|
|
3451
|
+
else {
|
|
3452
|
+
throw new Error();
|
|
3453
|
+
}
|
|
3454
|
+
if (i > 0) {
|
|
3455
|
+
switch (stack[i - 1][0]) {
|
|
3456
|
+
case -1 :
|
|
3457
|
+
stack[i - 1][1].left = stack[i][1];
|
|
3458
|
+
break;
|
|
3459
|
+
case 1 :
|
|
3460
|
+
stack[i - 1][1].right = stack[i][1];
|
|
3461
|
+
break;
|
|
3462
|
+
case 0 :
|
|
3463
|
+
stack[i - 1][1].mid = stack[i][1];
|
|
3464
|
+
break;
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
else {
|
|
3468
|
+
this._root = stack[0][1];
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3226
3471
|
}
|
|
3472
|
+
return oldElement;
|
|
3227
3473
|
}
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3474
|
+
get(key) {
|
|
3475
|
+
return this._getNode(key)?.value;
|
|
3476
|
+
}
|
|
3477
|
+
_getNode(key) {
|
|
3478
|
+
const iter = this._iter.reset(key);
|
|
3479
|
+
let node = this._root;
|
|
3480
|
+
while (node) {
|
|
3481
|
+
const val = iter.cmp(node.segment);
|
|
3482
|
+
if (val > 0) {
|
|
3483
|
+
node = node.left;
|
|
3484
|
+
}
|
|
3485
|
+
else if (val < 0) {
|
|
3486
|
+
node = node.right;
|
|
3487
|
+
}
|
|
3488
|
+
else if (iter.hasNext()) {
|
|
3489
|
+
iter.next();
|
|
3490
|
+
node = node.mid;
|
|
3491
|
+
}
|
|
3492
|
+
else {
|
|
3493
|
+
break;
|
|
3233
3494
|
}
|
|
3234
3495
|
}
|
|
3496
|
+
return node;
|
|
3235
3497
|
}
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3498
|
+
has(key) {
|
|
3499
|
+
const node = this._getNode(key);
|
|
3500
|
+
return !(node?.value === undefined && node?.mid === undefined);
|
|
3501
|
+
}
|
|
3502
|
+
delete(key) {
|
|
3503
|
+
return this._delete(key, false);
|
|
3504
|
+
}
|
|
3505
|
+
deleteSuperstr(key) {
|
|
3506
|
+
return this._delete(key, true);
|
|
3507
|
+
}
|
|
3508
|
+
_delete(key, superStr) {
|
|
3509
|
+
const iter = this._iter.reset(key);
|
|
3510
|
+
const stack = [];
|
|
3511
|
+
let node = this._root;
|
|
3512
|
+
while (node) {
|
|
3513
|
+
const val = iter.cmp(node.segment);
|
|
3514
|
+
if (val > 0) {
|
|
3515
|
+
stack.push([-1 , node]);
|
|
3516
|
+
node = node.left;
|
|
3517
|
+
}
|
|
3518
|
+
else if (val < 0) {
|
|
3519
|
+
stack.push([1 , node]);
|
|
3520
|
+
node = node.right;
|
|
3521
|
+
}
|
|
3522
|
+
else if (iter.hasNext()) {
|
|
3523
|
+
iter.next();
|
|
3524
|
+
stack.push([0 , node]);
|
|
3525
|
+
node = node.mid;
|
|
3526
|
+
}
|
|
3527
|
+
else {
|
|
3528
|
+
break;
|
|
3254
3529
|
}
|
|
3255
3530
|
}
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
}
|
|
3259
|
-
function now() {
|
|
3260
|
-
return ( (new Date())).toISOString();
|
|
3261
|
-
}
|
|
3262
|
-
var LogLevel;
|
|
3263
|
-
( ((function(LogLevel) {
|
|
3264
|
-
LogLevel[LogLevel["Trace"] = 0] = "Trace";
|
|
3265
|
-
LogLevel[LogLevel["Debug"] = 1] = "Debug";
|
|
3266
|
-
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
3267
|
-
LogLevel[LogLevel["Warning"] = 3] = "Warning";
|
|
3268
|
-
LogLevel[LogLevel["Error"] = 4] = "Error";
|
|
3269
|
-
LogLevel[LogLevel["Critical"] = 5] = "Critical";
|
|
3270
|
-
LogLevel[LogLevel["Off"] = 6] = "Off";
|
|
3271
|
-
})(LogLevel || (LogLevel = {}))));
|
|
3272
|
-
const DEFAULT_LOG_LEVEL = LogLevel.Info;
|
|
3273
|
-
class AbstractLogger extends Disposable {
|
|
3274
|
-
constructor() {
|
|
3275
|
-
super(...arguments);
|
|
3276
|
-
this.level = DEFAULT_LOG_LEVEL;
|
|
3277
|
-
this._onDidChangeLogLevel = this._register(( (new Emitter())));
|
|
3278
|
-
this.onDidChangeLogLevel = this._onDidChangeLogLevel.event;
|
|
3279
|
-
}
|
|
3280
|
-
setLevel(level) {
|
|
3281
|
-
if (this.level !== level) {
|
|
3282
|
-
this.level = level;
|
|
3283
|
-
this._onDidChangeLogLevel.fire(this.level);
|
|
3531
|
+
if (!node) {
|
|
3532
|
+
return;
|
|
3284
3533
|
}
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3534
|
+
if (superStr) {
|
|
3535
|
+
node.left = undefined;
|
|
3536
|
+
node.mid = undefined;
|
|
3537
|
+
node.right = undefined;
|
|
3538
|
+
node.height = 1;
|
|
3539
|
+
}
|
|
3540
|
+
else {
|
|
3541
|
+
node.key = undefined;
|
|
3542
|
+
node.value = undefined;
|
|
3543
|
+
}
|
|
3544
|
+
if (!node.mid && !node.value) {
|
|
3545
|
+
if (node.left && node.right) {
|
|
3546
|
+
const min = this._min(node.right);
|
|
3547
|
+
if (min.key) {
|
|
3548
|
+
const { key, value, segment } = min;
|
|
3549
|
+
this._delete(min.key, false);
|
|
3550
|
+
node.key = key;
|
|
3551
|
+
node.value = value;
|
|
3552
|
+
node.segment = segment;
|
|
3553
|
+
}
|
|
3300
3554
|
}
|
|
3301
3555
|
else {
|
|
3302
|
-
|
|
3556
|
+
const newChild = node.left ?? node.right;
|
|
3557
|
+
if (stack.length > 0) {
|
|
3558
|
+
const [dir, parent] = stack[stack.length - 1];
|
|
3559
|
+
switch (dir) {
|
|
3560
|
+
case -1 :
|
|
3561
|
+
parent.left = newChild;
|
|
3562
|
+
break;
|
|
3563
|
+
case 0 :
|
|
3564
|
+
parent.mid = newChild;
|
|
3565
|
+
break;
|
|
3566
|
+
case 1 :
|
|
3567
|
+
parent.right = newChild;
|
|
3568
|
+
break;
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
else {
|
|
3572
|
+
this._root = newChild;
|
|
3573
|
+
}
|
|
3303
3574
|
}
|
|
3304
3575
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3576
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
3577
|
+
const node = stack[i][1];
|
|
3578
|
+
node.updateHeight();
|
|
3579
|
+
const bf = node.balanceFactor();
|
|
3580
|
+
if (bf > 1) {
|
|
3581
|
+
if (node.right.balanceFactor() >= 0) {
|
|
3582
|
+
stack[i][1] = node.rotateLeft();
|
|
3583
|
+
}
|
|
3584
|
+
else {
|
|
3585
|
+
node.right = node.right.rotateRight();
|
|
3586
|
+
stack[i][1] = node.rotateLeft();
|
|
3587
|
+
}
|
|
3310
3588
|
}
|
|
3311
|
-
else {
|
|
3312
|
-
|
|
3589
|
+
else if (bf < -1) {
|
|
3590
|
+
if (node.left.balanceFactor() <= 0) {
|
|
3591
|
+
stack[i][1] = node.rotateRight();
|
|
3592
|
+
}
|
|
3593
|
+
else {
|
|
3594
|
+
node.left = node.left.rotateLeft();
|
|
3595
|
+
stack[i][1] = node.rotateRight();
|
|
3596
|
+
}
|
|
3313
3597
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3598
|
+
if (i > 0) {
|
|
3599
|
+
switch (stack[i - 1][0]) {
|
|
3600
|
+
case -1 :
|
|
3601
|
+
stack[i - 1][1].left = stack[i][1];
|
|
3602
|
+
break;
|
|
3603
|
+
case 1 :
|
|
3604
|
+
stack[i - 1][1].right = stack[i][1];
|
|
3605
|
+
break;
|
|
3606
|
+
case 0 :
|
|
3607
|
+
stack[i - 1][1].mid = stack[i][1];
|
|
3608
|
+
break;
|
|
3609
|
+
}
|
|
3320
3610
|
}
|
|
3321
3611
|
else {
|
|
3322
|
-
|
|
3612
|
+
this._root = stack[0][1];
|
|
3323
3613
|
}
|
|
3324
3614
|
}
|
|
3325
3615
|
}
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
console.warn(`\x1b[93m[main ${now()}]\x1b[0m`, message, ...args);
|
|
3330
|
-
}
|
|
3331
|
-
else {
|
|
3332
|
-
console.warn(`[main ${now()}]`, message, ...args);
|
|
3333
|
-
}
|
|
3616
|
+
_min(node) {
|
|
3617
|
+
while (node.left) {
|
|
3618
|
+
node = node.left;
|
|
3334
3619
|
}
|
|
3620
|
+
return node;
|
|
3335
3621
|
}
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3622
|
+
findSubstr(key) {
|
|
3623
|
+
const iter = this._iter.reset(key);
|
|
3624
|
+
let node = this._root;
|
|
3625
|
+
let candidate = undefined;
|
|
3626
|
+
while (node) {
|
|
3627
|
+
const val = iter.cmp(node.segment);
|
|
3628
|
+
if (val > 0) {
|
|
3629
|
+
node = node.left;
|
|
3630
|
+
}
|
|
3631
|
+
else if (val < 0) {
|
|
3632
|
+
node = node.right;
|
|
3633
|
+
}
|
|
3634
|
+
else if (iter.hasNext()) {
|
|
3635
|
+
iter.next();
|
|
3636
|
+
candidate = node.value || candidate;
|
|
3637
|
+
node = node.mid;
|
|
3340
3638
|
}
|
|
3341
3639
|
else {
|
|
3342
|
-
|
|
3640
|
+
break;
|
|
3343
3641
|
}
|
|
3344
3642
|
}
|
|
3643
|
+
return node && node.value || candidate;
|
|
3644
|
+
}
|
|
3645
|
+
findSuperstr(key) {
|
|
3646
|
+
return this._findSuperstrOrElement(key, false);
|
|
3345
3647
|
}
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3648
|
+
_findSuperstrOrElement(key, allowValue) {
|
|
3649
|
+
const iter = this._iter.reset(key);
|
|
3650
|
+
let node = this._root;
|
|
3651
|
+
while (node) {
|
|
3652
|
+
const val = iter.cmp(node.segment);
|
|
3653
|
+
if (val > 0) {
|
|
3654
|
+
node = node.left;
|
|
3655
|
+
}
|
|
3656
|
+
else if (val < 0) {
|
|
3657
|
+
node = node.right;
|
|
3658
|
+
}
|
|
3659
|
+
else if (iter.hasNext()) {
|
|
3660
|
+
iter.next();
|
|
3661
|
+
node = node.mid;
|
|
3350
3662
|
}
|
|
3351
3663
|
else {
|
|
3352
|
-
|
|
3664
|
+
if (!node.mid) {
|
|
3665
|
+
if (allowValue) {
|
|
3666
|
+
return node.value;
|
|
3667
|
+
}
|
|
3668
|
+
else {
|
|
3669
|
+
return undefined;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
else {
|
|
3673
|
+
return this._entries(node.mid);
|
|
3674
|
+
}
|
|
3353
3675
|
}
|
|
3354
3676
|
}
|
|
3677
|
+
return undefined;
|
|
3355
3678
|
}
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
flush() {
|
|
3359
|
-
}
|
|
3360
|
-
}
|
|
3361
|
-
class LogService extends Disposable {
|
|
3362
|
-
constructor(logger) {
|
|
3363
|
-
super();
|
|
3364
|
-
this.logger = logger;
|
|
3365
|
-
this._register(logger);
|
|
3366
|
-
}
|
|
3367
|
-
get onDidChangeLogLevel() {
|
|
3368
|
-
return this.logger.onDidChangeLogLevel;
|
|
3369
|
-
}
|
|
3370
|
-
setLevel(level) {
|
|
3371
|
-
this.logger.setLevel(level);
|
|
3372
|
-
}
|
|
3373
|
-
getLevel() {
|
|
3374
|
-
return this.logger.getLevel();
|
|
3375
|
-
}
|
|
3376
|
-
trace(message, ...args) {
|
|
3377
|
-
this.logger.trace(message, ...args);
|
|
3378
|
-
}
|
|
3379
|
-
debug(message, ...args) {
|
|
3380
|
-
this.logger.debug(message, ...args);
|
|
3381
|
-
}
|
|
3382
|
-
info(message, ...args) {
|
|
3383
|
-
this.logger.info(message, ...args);
|
|
3384
|
-
}
|
|
3385
|
-
warn(message, ...args) {
|
|
3386
|
-
this.logger.warn(message, ...args);
|
|
3387
|
-
}
|
|
3388
|
-
error(message, ...args) {
|
|
3389
|
-
this.logger.error(message, ...args);
|
|
3390
|
-
}
|
|
3391
|
-
critical(message, ...args) {
|
|
3392
|
-
this.logger.critical(message, ...args);
|
|
3679
|
+
hasElementOrSubtree(key) {
|
|
3680
|
+
return this._findSuperstrOrElement(key, true) !== undefined;
|
|
3393
3681
|
}
|
|
3394
|
-
|
|
3395
|
-
this
|
|
3682
|
+
forEach(callback) {
|
|
3683
|
+
for (const [key, value] of this) {
|
|
3684
|
+
callback(value, key);
|
|
3685
|
+
}
|
|
3396
3686
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
return thing
|
|
3400
|
-
&& typeof thing === 'object'
|
|
3401
|
-
&& (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')
|
|
3402
|
-
&& (!thing.resource || thing.resource instanceof URI);
|
|
3403
|
-
}
|
|
3404
|
-
class StandaloneConfigurationService {
|
|
3405
|
-
constructor() {
|
|
3406
|
-
this._onDidChangeConfiguration = ( (new Emitter()));
|
|
3407
|
-
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
3408
|
-
this._configuration = ( (new Configuration$1(
|
|
3409
|
-
(new DefaultConfigurationModel()),
|
|
3410
|
-
(new ConfigurationModel$1()),
|
|
3411
|
-
(new ConfigurationModel$1()),
|
|
3412
|
-
(new ConfigurationModel$1())
|
|
3413
|
-
)));
|
|
3687
|
+
*[Symbol.iterator]() {
|
|
3688
|
+
yield* this._entries(this._root);
|
|
3414
3689
|
}
|
|
3415
|
-
|
|
3416
|
-
const
|
|
3417
|
-
|
|
3418
|
-
return
|
|
3690
|
+
_entries(node) {
|
|
3691
|
+
const result = [];
|
|
3692
|
+
this._dfsEntries(node, result);
|
|
3693
|
+
return result[Symbol.iterator]();
|
|
3419
3694
|
}
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
for (const entry of values) {
|
|
3424
|
-
const [key, value] = entry;
|
|
3425
|
-
if (this.getValue(key) === value) {
|
|
3426
|
-
continue;
|
|
3427
|
-
}
|
|
3428
|
-
this._configuration.updateValue(key, value);
|
|
3429
|
-
changedKeys.push(key);
|
|
3695
|
+
_dfsEntries(node, bucket) {
|
|
3696
|
+
if (!node) {
|
|
3697
|
+
return;
|
|
3430
3698
|
}
|
|
3431
|
-
if (
|
|
3432
|
-
|
|
3433
|
-
configurationChangeEvent.source = 8 ;
|
|
3434
|
-
configurationChangeEvent.sourceConfig = null;
|
|
3435
|
-
this._onDidChangeConfiguration.fire(configurationChangeEvent);
|
|
3699
|
+
if (node.left) {
|
|
3700
|
+
this._dfsEntries(node.left, bucket);
|
|
3436
3701
|
}
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
)
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
overrides: []
|
|
3458
|
-
};
|
|
3459
|
-
return {
|
|
3460
|
-
defaults: emptyModel,
|
|
3461
|
-
policy: emptyModel,
|
|
3462
|
-
application: emptyModel,
|
|
3463
|
-
user: emptyModel,
|
|
3464
|
-
workspace: emptyModel,
|
|
3465
|
-
folders: []
|
|
3702
|
+
if (node.value) {
|
|
3703
|
+
bucket.push([node.key, node.value]);
|
|
3704
|
+
}
|
|
3705
|
+
if (node.mid) {
|
|
3706
|
+
this._dfsEntries(node.mid, bucket);
|
|
3707
|
+
}
|
|
3708
|
+
if (node.right) {
|
|
3709
|
+
this._dfsEntries(node.right, bucket);
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
_isBalanced() {
|
|
3713
|
+
const nodeIsBalanced = (node) => {
|
|
3714
|
+
if (!node) {
|
|
3715
|
+
return true;
|
|
3716
|
+
}
|
|
3717
|
+
const bf = node.balanceFactor();
|
|
3718
|
+
if (bf < -1 || bf > 1) {
|
|
3719
|
+
return false;
|
|
3720
|
+
}
|
|
3721
|
+
return nodeIsBalanced(node.left) && nodeIsBalanced(node.right);
|
|
3466
3722
|
};
|
|
3723
|
+
return nodeIsBalanced(this._root);
|
|
3467
3724
|
}
|
|
3468
3725
|
}
|
|
3469
3726
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -3623,7 +3880,7 @@ class LanguagesRegistry extends Disposable {
|
|
|
3623
3880
|
}
|
|
3624
3881
|
}
|
|
3625
3882
|
catch (err) {
|
|
3626
|
-
|
|
3883
|
+
console.warn(`[${lang.id}]: Invalid regular expression \`${firstLineRegexStr}\`: `, err);
|
|
3627
3884
|
}
|
|
3628
3885
|
}
|
|
3629
3886
|
resolvedLanguage.aliases.push(langId);
|
|
@@ -3745,6 +4002,8 @@ class LanguagesRegistry extends Disposable {
|
|
|
3745
4002
|
}
|
|
3746
4003
|
}
|
|
3747
4004
|
LanguagesRegistry.instanceCount = 0;
|
|
4005
|
+
var css = ".monaco-list{height:100%;position:relative;white-space:nowrap;width:100%}.monaco-list.mouse-support{user-select:none;-webkit-user-select:none}.monaco-list>.monaco-scrollable-element{height:100%}.monaco-list-rows{height:100%;position:relative;width:100%}.monaco-list.horizontal-scrolling .monaco-list-rows{min-width:100%;width:auto}.monaco-list-row{box-sizing:border-box;overflow:hidden;position:absolute;width:100%}.monaco-list.mouse-support .monaco-list-row{cursor:pointer;touch-action:none}.monaco-list-row.scrolling{display:none!important}.monaco-list.element-focused,.monaco-list.selection-multiple,.monaco-list.selection-single{outline:0!important}.monaco-drag-image{border-radius:10px;display:inline-block;font-size:12px;padding:1px 7px;position:absolute;z-index:1000}.monaco-list-type-filter-message{box-sizing:border-box;height:100%;left:0;opacity:.7;padding:40px 1em 1em;pointer-events:none;position:absolute;text-align:center;top:0;white-space:normal;width:100%}.monaco-list-type-filter-message:empty{display:none}";
|
|
4006
|
+
n(css,{});
|
|
3748
4007
|
class TraitRenderer {
|
|
3749
4008
|
constructor(trait) {
|
|
3750
4009
|
this.trait = trait;
|
|
@@ -3800,6 +4059,12 @@ class TraitRenderer {
|
|
|
3800
4059
|
}
|
|
3801
4060
|
}
|
|
3802
4061
|
class Trait {
|
|
4062
|
+
get name() { return this._trait; }
|
|
4063
|
+
get renderer() {
|
|
4064
|
+
return (
|
|
4065
|
+
(new TraitRenderer(this))
|
|
4066
|
+
);
|
|
4067
|
+
}
|
|
3803
4068
|
constructor(_trait) {
|
|
3804
4069
|
this._trait = _trait;
|
|
3805
4070
|
this.length = 0;
|
|
@@ -3808,12 +4073,6 @@ class Trait {
|
|
|
3808
4073
|
this._onChange = ( (new Emitter()));
|
|
3809
4074
|
this.onChange = this._onChange.event;
|
|
3810
4075
|
}
|
|
3811
|
-
get name() { return this._trait; }
|
|
3812
|
-
get renderer() {
|
|
3813
|
-
return (
|
|
3814
|
-
(new TraitRenderer(this))
|
|
3815
|
-
);
|
|
3816
|
-
}
|
|
3817
4076
|
splice(start, deleteCount, elements) {
|
|
3818
4077
|
deleteCount = Math.max(0, Math.min(deleteCount, this.length - start));
|
|
3819
4078
|
const diff = elements.length - deleteCount;
|
|
@@ -3858,7 +4117,7 @@ class Trait {
|
|
|
3858
4117
|
return binarySearch(this.sortedIndexes, index, numericSort) >= 0;
|
|
3859
4118
|
}
|
|
3860
4119
|
dispose() {
|
|
3861
|
-
dispose(this._onChange);
|
|
4120
|
+
dispose$1(this._onChange);
|
|
3862
4121
|
}
|
|
3863
4122
|
}
|
|
3864
4123
|
class SelectionTrait extends Trait {
|
|
@@ -3909,6 +4168,11 @@ function isMonacoEditor(e) {
|
|
|
3909
4168
|
return isMonacoEditor(e.parentElement);
|
|
3910
4169
|
}
|
|
3911
4170
|
class KeyboardController {
|
|
4171
|
+
get onKeyDown() {
|
|
4172
|
+
return this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event)
|
|
4173
|
+
.filter(e => !isInputElement(e.target))
|
|
4174
|
+
.map(e => ( (new StandardKeyboardEvent(e)))));
|
|
4175
|
+
}
|
|
3912
4176
|
constructor(list, view, options) {
|
|
3913
4177
|
this.list = list;
|
|
3914
4178
|
this.view = view;
|
|
@@ -3924,11 +4188,6 @@ class KeyboardController {
|
|
|
3924
4188
|
this.onKeyDown.filter(e => (isMacintosh ? e.metaKey : e.ctrlKey) && e.keyCode === 31 ).on(this.onCtrlA, this, this.multipleSelectionDisposables);
|
|
3925
4189
|
}
|
|
3926
4190
|
}
|
|
3927
|
-
get onKeyDown() {
|
|
3928
|
-
return this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event)
|
|
3929
|
-
.filter(e => !isInputElement(e.target))
|
|
3930
|
-
.map(e => ( (new StandardKeyboardEvent(e)))));
|
|
3931
|
-
}
|
|
3932
4191
|
updateOptions(optionsUpdate) {
|
|
3933
4192
|
if (optionsUpdate.multipleSelectionSupport !== undefined) {
|
|
3934
4193
|
this.multipleSelectionDisposables.clear();
|
|
@@ -4059,10 +4318,10 @@ class TypeNavigationController {
|
|
|
4059
4318
|
.map(event => ( (new StandardKeyboardEvent(event))))
|
|
4060
4319
|
.filter(e => typing || this.keyboardNavigationEventFilter(e))
|
|
4061
4320
|
.filter(e => this.delegate.mightProducePrintableCharacter(e))
|
|
4062
|
-
.forEach(
|
|
4321
|
+
.forEach(e => EventHelper.stop(e, true))
|
|
4063
4322
|
.map(event => event.browserEvent.key)
|
|
4064
4323
|
.event;
|
|
4065
|
-
const onClear = Event.debounce(onChar, () => null, 800, undefined, undefined, this.enabledDisposables);
|
|
4324
|
+
const onClear = Event.debounce(onChar, () => null, 800, undefined, undefined, undefined, this.enabledDisposables);
|
|
4066
4325
|
const onInput = Event.reduce(Event.any(onChar, onClear), (r, i) => i === null ? null : ((r || '') + i), undefined, this.enabledDisposables);
|
|
4067
4326
|
onInput(this.onInput, this, this.enabledDisposables);
|
|
4068
4327
|
onClear(this.onClear, this, this.enabledDisposables);
|
|
@@ -4220,7 +4479,7 @@ class MouseController {
|
|
|
4220
4479
|
}
|
|
4221
4480
|
}
|
|
4222
4481
|
onContextMenu(e) {
|
|
4223
|
-
if (isMonacoEditor(e.browserEvent.target)) {
|
|
4482
|
+
if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) {
|
|
4224
4483
|
return;
|
|
4225
4484
|
}
|
|
4226
4485
|
const focus = typeof e.index === 'undefined' ? [] : [e.index];
|
|
@@ -4310,12 +4569,7 @@ class DefaultStyleController {
|
|
|
4310
4569
|
const suffix = this.selectorSuffix && `.${this.selectorSuffix}`;
|
|
4311
4570
|
const content = [];
|
|
4312
4571
|
if (styles.listBackground) {
|
|
4313
|
-
|
|
4314
|
-
content.push(`.monaco-list${suffix} .monaco-list-rows { background: ${styles.listBackground}; }`);
|
|
4315
|
-
}
|
|
4316
|
-
else if (!isMacintosh) {
|
|
4317
|
-
console.warn(`List with id '${this.selectorSuffix}' was styled with a non-opaque background color. This will break sub-pixel antialiasing.`);
|
|
4318
|
-
}
|
|
4572
|
+
content.push(`.monaco-list${suffix} .monaco-list-rows { background: ${styles.listBackground}; }`);
|
|
4319
4573
|
}
|
|
4320
4574
|
if (styles.listFocusBackground) {
|
|
4321
4575
|
content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`);
|
|
@@ -4334,9 +4588,6 @@ class DefaultStyleController {
|
|
|
4334
4588
|
if (styles.listActiveSelectionIconForeground) {
|
|
4335
4589
|
content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected .codicon { color: ${styles.listActiveSelectionIconForeground}; }`);
|
|
4336
4590
|
}
|
|
4337
|
-
if (styles.listFocusAndSelectionOutline) {
|
|
4338
|
-
content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected { outline-color: ${styles.listFocusAndSelectionOutline} !important; }`);
|
|
4339
|
-
}
|
|
4340
4591
|
if (styles.listFocusAndSelectionBackground) {
|
|
4341
4592
|
content.push(`
|
|
4342
4593
|
.monaco-drag-image,
|
|
@@ -4368,13 +4619,14 @@ class DefaultStyleController {
|
|
|
4368
4619
|
content.push(`.monaco-list${suffix} .monaco-list-row.selected { color: ${styles.listInactiveSelectionForeground}; }`);
|
|
4369
4620
|
}
|
|
4370
4621
|
if (styles.listHoverBackground) {
|
|
4371
|
-
content.push(`.monaco-list${suffix}:not(.drop-target) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`);
|
|
4622
|
+
content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`);
|
|
4372
4623
|
}
|
|
4373
4624
|
if (styles.listHoverForeground) {
|
|
4374
|
-
content.push(`.monaco-list${suffix} .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`);
|
|
4625
|
+
content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`);
|
|
4375
4626
|
}
|
|
4376
|
-
|
|
4377
|
-
|
|
4627
|
+
const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, styles.listFocusOutline ?? ''));
|
|
4628
|
+
if (focusAndSelectionOutline) {
|
|
4629
|
+
content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`);
|
|
4378
4630
|
}
|
|
4379
4631
|
if (styles.listFocusOutline) {
|
|
4380
4632
|
content.push(`
|
|
@@ -4383,6 +4635,13 @@ class DefaultStyleController {
|
|
|
4383
4635
|
.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }
|
|
4384
4636
|
`);
|
|
4385
4637
|
}
|
|
4638
|
+
const inactiveFocusAndSelectionOutline = asCssValueWithDefault(styles.listSelectionOutline, styles.listInactiveFocusOutline ?? '');
|
|
4639
|
+
if (inactiveFocusAndSelectionOutline) {
|
|
4640
|
+
content.push(`.monaco-list${suffix} .monaco-list-row.focused.selected { outline: 1px dotted ${inactiveFocusAndSelectionOutline}; outline-offset: -1px; }`);
|
|
4641
|
+
}
|
|
4642
|
+
if (styles.listSelectionOutline) {
|
|
4643
|
+
content.push(`.monaco-list${suffix} .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`);
|
|
4644
|
+
}
|
|
4386
4645
|
if (styles.listInactiveFocusOutline) {
|
|
4387
4646
|
content.push(`.monaco-list${suffix} .monaco-list-row.focused { outline: 1px dotted ${styles.listInactiveFocusOutline}; outline-offset: -1px; }`);
|
|
4388
4647
|
}
|
|
@@ -4398,10 +4657,18 @@ class DefaultStyleController {
|
|
|
4398
4657
|
}
|
|
4399
4658
|
if (styles.tableColumnsBorder) {
|
|
4400
4659
|
content.push(`
|
|
4401
|
-
.monaco-table
|
|
4402
|
-
.monaco-table
|
|
4660
|
+
.monaco-table > .monaco-split-view2,
|
|
4661
|
+
.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
|
|
4662
|
+
.monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2,
|
|
4663
|
+
.monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
|
|
4403
4664
|
border-color: ${styles.tableColumnsBorder};
|
|
4404
|
-
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2,
|
|
4668
|
+
.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
|
|
4669
|
+
border-color: transparent;
|
|
4670
|
+
}
|
|
4671
|
+
`);
|
|
4405
4672
|
}
|
|
4406
4673
|
if (styles.tableOddRowsBackgroundColor) {
|
|
4407
4674
|
content.push(`
|
|
@@ -4415,22 +4682,6 @@ class DefaultStyleController {
|
|
|
4415
4682
|
this.styleElement.textContent = content.join('\n');
|
|
4416
4683
|
}
|
|
4417
4684
|
}
|
|
4418
|
-
const defaultStyles = {
|
|
4419
|
-
listFocusBackground: ( (Color$1.fromHex('#7FB0D0'))),
|
|
4420
|
-
listActiveSelectionBackground: ( (Color$1.fromHex('#0E639C'))),
|
|
4421
|
-
listActiveSelectionForeground: ( (Color$1.fromHex('#FFFFFF'))),
|
|
4422
|
-
listActiveSelectionIconForeground: ( (Color$1.fromHex('#FFFFFF'))),
|
|
4423
|
-
listFocusAndSelectionOutline: ( (Color$1.fromHex('#90C2F9'))),
|
|
4424
|
-
listFocusAndSelectionBackground: ( (Color$1.fromHex('#094771'))),
|
|
4425
|
-
listFocusAndSelectionForeground: ( (Color$1.fromHex('#FFFFFF'))),
|
|
4426
|
-
listInactiveSelectionBackground: ( (Color$1.fromHex('#3F3F46'))),
|
|
4427
|
-
listInactiveSelectionIconForeground: ( (Color$1.fromHex('#FFFFFF'))),
|
|
4428
|
-
listHoverBackground: ( (Color$1.fromHex('#2A2D2E'))),
|
|
4429
|
-
listDropBackground: ( (Color$1.fromHex('#383B3D'))),
|
|
4430
|
-
treeIndentGuidesStroke: ( (Color$1.fromHex('#a9a9a9'))),
|
|
4431
|
-
tableColumnsBorder: ( (( (Color$1.fromHex('#cccccc'))).transparent(0.2))),
|
|
4432
|
-
tableOddRowsBackgroundColor: ( (( (Color$1.fromHex('#cccccc'))).transparent(0.04)))
|
|
4433
|
-
};
|
|
4434
4685
|
const DefaultOptions = {
|
|
4435
4686
|
keyboardSupport: true,
|
|
4436
4687
|
mouseSupport: true,
|
|
@@ -4603,6 +4854,57 @@ class ListViewDragAndDrop {
|
|
|
4603
4854
|
}
|
|
4604
4855
|
}
|
|
4605
4856
|
class List {
|
|
4857
|
+
get onDidChangeFocus() {
|
|
4858
|
+
return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), e => this.toListEvent(e), this.disposables);
|
|
4859
|
+
}
|
|
4860
|
+
get onDidChangeSelection() {
|
|
4861
|
+
return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e), this.disposables);
|
|
4862
|
+
}
|
|
4863
|
+
get domId() { return this.view.domId; }
|
|
4864
|
+
get onDidScroll() { return this.view.onDidScroll; }
|
|
4865
|
+
get onMouseClick() { return this.view.onMouseClick; }
|
|
4866
|
+
get onMouseDblClick() { return this.view.onMouseDblClick; }
|
|
4867
|
+
get onMouseMiddleClick() { return this.view.onMouseMiddleClick; }
|
|
4868
|
+
get onPointer() { return this.mouseController.onPointer; }
|
|
4869
|
+
get onMouseUp() { return this.view.onMouseUp; }
|
|
4870
|
+
get onMouseDown() { return this.view.onMouseDown; }
|
|
4871
|
+
get onMouseOver() { return this.view.onMouseOver; }
|
|
4872
|
+
get onMouseMove() { return this.view.onMouseMove; }
|
|
4873
|
+
get onMouseOut() { return this.view.onMouseOut; }
|
|
4874
|
+
get onTouchStart() { return this.view.onTouchStart; }
|
|
4875
|
+
get onTap() { return this.view.onTap; }
|
|
4876
|
+
get onContextMenu() {
|
|
4877
|
+
let didJustPressContextMenuKey = false;
|
|
4878
|
+
const fromKeyDown = this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event))
|
|
4879
|
+
.map(e => ( (new StandardKeyboardEvent(e))))
|
|
4880
|
+
.filter(e => didJustPressContextMenuKey = e.keyCode === 58 || ((e.shiftKey && e.keyCode === 68) ))
|
|
4881
|
+
.map(e => EventHelper.stop(e, true))
|
|
4882
|
+
.filter(() => false)
|
|
4883
|
+
.event;
|
|
4884
|
+
const fromKeyUp = this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keyup')))).event))
|
|
4885
|
+
.forEach(() => didJustPressContextMenuKey = false)
|
|
4886
|
+
.map(e => ( (new StandardKeyboardEvent(e))))
|
|
4887
|
+
.filter(e => e.keyCode === 58 || ((e.shiftKey && e.keyCode === 68) ))
|
|
4888
|
+
.map(e => EventHelper.stop(e, true))
|
|
4889
|
+
.map(({ browserEvent }) => {
|
|
4890
|
+
const focus = this.getFocus();
|
|
4891
|
+
const index = focus.length ? focus[0] : undefined;
|
|
4892
|
+
const element = typeof index !== 'undefined' ? this.view.element(index) : undefined;
|
|
4893
|
+
const anchor = typeof index !== 'undefined' ? this.view.domElement(index) : this.view.domNode;
|
|
4894
|
+
return { index, element, anchor, browserEvent };
|
|
4895
|
+
})
|
|
4896
|
+
.event;
|
|
4897
|
+
const fromMouse = this.disposables.add(Event.chain(this.view.onContextMenu))
|
|
4898
|
+
.filter(_ => !didJustPressContextMenuKey)
|
|
4899
|
+
.map(({ element, index, browserEvent }) => ({ element, index, anchor: { x: browserEvent.pageX + 1, y: browserEvent.pageY }, browserEvent }))
|
|
4900
|
+
.event;
|
|
4901
|
+
return Event.any(fromKeyDown, fromKeyUp, fromMouse);
|
|
4902
|
+
}
|
|
4903
|
+
get onKeyDown() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event; }
|
|
4904
|
+
get onKeyUp() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keyup')))).event; }
|
|
4905
|
+
get onKeyPress() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keypress')))).event; }
|
|
4906
|
+
get onDidFocus() { return Event.signal(this.disposables.add(( (new DomEmitter(this.view.domNode, 'focus', true)))).event); }
|
|
4907
|
+
get onDidBlur() { return Event.signal(this.disposables.add(( (new DomEmitter(this.view.domNode, 'blur', true)))).event); }
|
|
4606
4908
|
constructor(user, container, virtualDelegate, renderers, _options = DefaultOptions) {
|
|
4607
4909
|
this.user = user;
|
|
4608
4910
|
this._options = _options;
|
|
@@ -4615,7 +4917,6 @@ class List {
|
|
|
4615
4917
|
this.onDidDispose = this._onDidDispose.event;
|
|
4616
4918
|
const role = this._options.accessibilityProvider && this._options.accessibilityProvider.getWidgetRole ? this._options.accessibilityProvider?.getWidgetRole() : 'list';
|
|
4617
4919
|
this.selection = ( (new SelectionTrait(role !== 'listbox')));
|
|
4618
|
-
mixin(_options, defaultStyles, false);
|
|
4619
4920
|
const baseRenderers = [this.focus.renderer, this.selection.renderer];
|
|
4620
4921
|
this.accessibilityProvider = _options.accessibilityProvider;
|
|
4621
4922
|
if (this.accessibilityProvider) {
|
|
@@ -4627,7 +4928,7 @@ class List {
|
|
|
4627
4928
|
..._options,
|
|
4628
4929
|
dnd: _options.dnd && ( (new ListViewDragAndDrop(this, _options.dnd)))
|
|
4629
4930
|
};
|
|
4630
|
-
this.view = (
|
|
4931
|
+
this.view = this.createListView(container, virtualDelegate, renderers, viewOptions);
|
|
4631
4932
|
this.view.domNode.setAttribute('role', role);
|
|
4632
4933
|
if (_options.styleController) {
|
|
4633
4934
|
this.styleController = _options.styleController(this.view.domId);
|
|
@@ -4674,57 +4975,11 @@ class List {
|
|
|
4674
4975
|
this.view.domNode.setAttribute('aria-multiselectable', 'true');
|
|
4675
4976
|
}
|
|
4676
4977
|
}
|
|
4677
|
-
|
|
4678
|
-
return
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e), this.disposables);
|
|
4682
|
-
}
|
|
4683
|
-
get domId() { return this.view.domId; }
|
|
4684
|
-
get onDidScroll() { return this.view.onDidScroll; }
|
|
4685
|
-
get onMouseClick() { return this.view.onMouseClick; }
|
|
4686
|
-
get onMouseDblClick() { return this.view.onMouseDblClick; }
|
|
4687
|
-
get onMouseMiddleClick() { return this.view.onMouseMiddleClick; }
|
|
4688
|
-
get onPointer() { return this.mouseController.onPointer; }
|
|
4689
|
-
get onMouseUp() { return this.view.onMouseUp; }
|
|
4690
|
-
get onMouseDown() { return this.view.onMouseDown; }
|
|
4691
|
-
get onMouseOver() { return this.view.onMouseOver; }
|
|
4692
|
-
get onMouseMove() { return this.view.onMouseMove; }
|
|
4693
|
-
get onMouseOut() { return this.view.onMouseOut; }
|
|
4694
|
-
get onTouchStart() { return this.view.onTouchStart; }
|
|
4695
|
-
get onTap() { return this.view.onTap; }
|
|
4696
|
-
get onContextMenu() {
|
|
4697
|
-
let didJustPressContextMenuKey = false;
|
|
4698
|
-
const fromKeyDown = this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event))
|
|
4699
|
-
.map(e => ( (new StandardKeyboardEvent(e))))
|
|
4700
|
-
.filter(e => didJustPressContextMenuKey = e.keyCode === 58 || ((e.shiftKey && e.keyCode === 68) ))
|
|
4701
|
-
.map(stopEvent)
|
|
4702
|
-
.filter(() => false)
|
|
4703
|
-
.event;
|
|
4704
|
-
const fromKeyUp = this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keyup')))).event))
|
|
4705
|
-
.forEach(() => didJustPressContextMenuKey = false)
|
|
4706
|
-
.map(e => ( (new StandardKeyboardEvent(e))))
|
|
4707
|
-
.filter(e => e.keyCode === 58 || ((e.shiftKey && e.keyCode === 68) ))
|
|
4708
|
-
.map(stopEvent)
|
|
4709
|
-
.map(({ browserEvent }) => {
|
|
4710
|
-
const focus = this.getFocus();
|
|
4711
|
-
const index = focus.length ? focus[0] : undefined;
|
|
4712
|
-
const element = typeof index !== 'undefined' ? this.view.element(index) : undefined;
|
|
4713
|
-
const anchor = typeof index !== 'undefined' ? this.view.domElement(index) : this.view.domNode;
|
|
4714
|
-
return { index, element, anchor, browserEvent };
|
|
4715
|
-
})
|
|
4716
|
-
.event;
|
|
4717
|
-
const fromMouse = this.disposables.add(Event.chain(this.view.onContextMenu))
|
|
4718
|
-
.filter(_ => !didJustPressContextMenuKey)
|
|
4719
|
-
.map(({ element, index, browserEvent }) => ({ element, index, anchor: { x: browserEvent.pageX + 1, y: browserEvent.pageY }, browserEvent }))
|
|
4720
|
-
.event;
|
|
4721
|
-
return Event.any(fromKeyDown, fromKeyUp, fromMouse);
|
|
4978
|
+
createListView(container, virtualDelegate, renderers, viewOptions) {
|
|
4979
|
+
return (
|
|
4980
|
+
(new ListView(container, virtualDelegate, renderers, viewOptions))
|
|
4981
|
+
);
|
|
4722
4982
|
}
|
|
4723
|
-
get onKeyDown() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event; }
|
|
4724
|
-
get onKeyUp() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keyup')))).event; }
|
|
4725
|
-
get onKeyPress() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keypress')))).event; }
|
|
4726
|
-
get onDidFocus() { return Event.signal(this.disposables.add(( (new DomEmitter(this.view.domNode, 'focus', true)))).event); }
|
|
4727
|
-
get onDidBlur() { return Event.signal(this.disposables.add(( (new DomEmitter(this.view.domNode, 'blur', true)))).event); }
|
|
4728
4983
|
createMouseController(options) {
|
|
4729
4984
|
return (
|
|
4730
4985
|
(new MouseController(this))
|
|
@@ -4822,9 +5077,7 @@ class List {
|
|
|
4822
5077
|
this.view.layout(height, width);
|
|
4823
5078
|
}
|
|
4824
5079
|
triggerTypeNavigation() {
|
|
4825
|
-
|
|
4826
|
-
this.typeNavigationController.trigger();
|
|
4827
|
-
}
|
|
5080
|
+
this.typeNavigationController?.trigger();
|
|
4828
5081
|
}
|
|
4829
5082
|
setSelection(indexes, browserEvent) {
|
|
4830
5083
|
for (const index of indexes) {
|
|
@@ -5245,6 +5498,32 @@ class HSVA {
|
|
|
5245
5498
|
}
|
|
5246
5499
|
}
|
|
5247
5500
|
class Color {
|
|
5501
|
+
static fromHex(hex) {
|
|
5502
|
+
return Color.Format.CSS.parseHex(hex) || Color.red;
|
|
5503
|
+
}
|
|
5504
|
+
static equals(a, b) {
|
|
5505
|
+
if (!a && !b) {
|
|
5506
|
+
return true;
|
|
5507
|
+
}
|
|
5508
|
+
if (!a || !b) {
|
|
5509
|
+
return false;
|
|
5510
|
+
}
|
|
5511
|
+
return a.equals(b);
|
|
5512
|
+
}
|
|
5513
|
+
get hsla() {
|
|
5514
|
+
if (this._hsla) {
|
|
5515
|
+
return this._hsla;
|
|
5516
|
+
}
|
|
5517
|
+
else {
|
|
5518
|
+
return HSLA.fromRGBA(this.rgba);
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5521
|
+
get hsva() {
|
|
5522
|
+
if (this._hsva) {
|
|
5523
|
+
return this._hsva;
|
|
5524
|
+
}
|
|
5525
|
+
return HSVA.fromRGBA(this.rgba);
|
|
5526
|
+
}
|
|
5248
5527
|
constructor(arg) {
|
|
5249
5528
|
if (!arg) {
|
|
5250
5529
|
throw new Error('Color needs a value');
|
|
@@ -5264,23 +5543,6 @@ class Color {
|
|
|
5264
5543
|
throw new Error('Invalid color ctor argument');
|
|
5265
5544
|
}
|
|
5266
5545
|
}
|
|
5267
|
-
static fromHex(hex) {
|
|
5268
|
-
return Color.Format.CSS.parseHex(hex) || Color.red;
|
|
5269
|
-
}
|
|
5270
|
-
get hsla() {
|
|
5271
|
-
if (this._hsla) {
|
|
5272
|
-
return this._hsla;
|
|
5273
|
-
}
|
|
5274
|
-
else {
|
|
5275
|
-
return HSLA.fromRGBA(this.rgba);
|
|
5276
|
-
}
|
|
5277
|
-
}
|
|
5278
|
-
get hsva() {
|
|
5279
|
-
if (this._hsva) {
|
|
5280
|
-
return this._hsva;
|
|
5281
|
-
}
|
|
5282
|
-
return HSVA.fromRGBA(this.rgba);
|
|
5283
|
-
}
|
|
5284
5546
|
equals(other) {
|
|
5285
5547
|
return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva);
|
|
5286
5548
|
}
|
|
@@ -5559,6 +5821,112 @@ Color.transparent = ( (new Color( (new RGBA(0, 0, 0, 0)))));
|
|
|
5559
5821
|
})(Format.CSS || (Format.CSS = {}))));
|
|
5560
5822
|
})(Color.Format || (Color.Format = {}))));
|
|
5561
5823
|
})(Color || (Color = {}))));
|
|
5824
|
+
class LogService extends Disposable {
|
|
5825
|
+
constructor(primaryLogger, otherLoggers = []) {
|
|
5826
|
+
super();
|
|
5827
|
+
this.logger = ( (new MultiplexLogger([primaryLogger, ...otherLoggers])));
|
|
5828
|
+
this._register(primaryLogger.onDidChangeLogLevel(level => this.setLevel(level)));
|
|
5829
|
+
}
|
|
5830
|
+
get onDidChangeLogLevel() {
|
|
5831
|
+
return this.logger.onDidChangeLogLevel;
|
|
5832
|
+
}
|
|
5833
|
+
setLevel(level) {
|
|
5834
|
+
this.logger.setLevel(level);
|
|
5835
|
+
}
|
|
5836
|
+
getLevel() {
|
|
5837
|
+
return this.logger.getLevel();
|
|
5838
|
+
}
|
|
5839
|
+
trace(message, ...args) {
|
|
5840
|
+
this.logger.trace(message, ...args);
|
|
5841
|
+
}
|
|
5842
|
+
debug(message, ...args) {
|
|
5843
|
+
this.logger.debug(message, ...args);
|
|
5844
|
+
}
|
|
5845
|
+
info(message, ...args) {
|
|
5846
|
+
this.logger.info(message, ...args);
|
|
5847
|
+
}
|
|
5848
|
+
warn(message, ...args) {
|
|
5849
|
+
this.logger.warn(message, ...args);
|
|
5850
|
+
}
|
|
5851
|
+
error(message, ...args) {
|
|
5852
|
+
this.logger.error(message, ...args);
|
|
5853
|
+
}
|
|
5854
|
+
flush() {
|
|
5855
|
+
this.logger.flush();
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
class KeyCodeChord {
|
|
5859
|
+
constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {
|
|
5860
|
+
this.ctrlKey = ctrlKey;
|
|
5861
|
+
this.shiftKey = shiftKey;
|
|
5862
|
+
this.altKey = altKey;
|
|
5863
|
+
this.metaKey = metaKey;
|
|
5864
|
+
this.keyCode = keyCode;
|
|
5865
|
+
}
|
|
5866
|
+
equals(other) {
|
|
5867
|
+
return (other instanceof KeyCodeChord
|
|
5868
|
+
&& this.ctrlKey === other.ctrlKey
|
|
5869
|
+
&& this.shiftKey === other.shiftKey
|
|
5870
|
+
&& this.altKey === other.altKey
|
|
5871
|
+
&& this.metaKey === other.metaKey
|
|
5872
|
+
&& this.keyCode === other.keyCode);
|
|
5873
|
+
}
|
|
5874
|
+
getHashCode() {
|
|
5875
|
+
const ctrl = this.ctrlKey ? '1' : '0';
|
|
5876
|
+
const shift = this.shiftKey ? '1' : '0';
|
|
5877
|
+
const alt = this.altKey ? '1' : '0';
|
|
5878
|
+
const meta = this.metaKey ? '1' : '0';
|
|
5879
|
+
return `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;
|
|
5880
|
+
}
|
|
5881
|
+
isModifierKey() {
|
|
5882
|
+
return (this.keyCode === 0
|
|
5883
|
+
|| this.keyCode === 5
|
|
5884
|
+
|| this.keyCode === 57
|
|
5885
|
+
|| this.keyCode === 6 || this.keyCode === 4) ;
|
|
5886
|
+
}
|
|
5887
|
+
toKeybinding() {
|
|
5888
|
+
return (
|
|
5889
|
+
(new Keybinding([this]))
|
|
5890
|
+
);
|
|
5891
|
+
}
|
|
5892
|
+
isDuplicateModifierCase() {
|
|
5893
|
+
return (((this.ctrlKey && this.keyCode === 5) )
|
|
5894
|
+
|| ((this.shiftKey && this.keyCode === 4) )
|
|
5895
|
+
|| ((this.altKey && this.keyCode === 6) ) || (this.metaKey && this.keyCode === 57)) ;
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5898
|
+
class Keybinding {
|
|
5899
|
+
constructor(chords) {
|
|
5900
|
+
if (chords.length === 0) {
|
|
5901
|
+
throw illegalArgument(`chords`);
|
|
5902
|
+
}
|
|
5903
|
+
this.chords = chords;
|
|
5904
|
+
}
|
|
5905
|
+
getHashCode() {
|
|
5906
|
+
let result = '';
|
|
5907
|
+
for (let i = 0, len = this.chords.length; i < len; i++) {
|
|
5908
|
+
if (i !== 0) {
|
|
5909
|
+
result += ';';
|
|
5910
|
+
}
|
|
5911
|
+
result += this.chords[i].getHashCode();
|
|
5912
|
+
}
|
|
5913
|
+
return result;
|
|
5914
|
+
}
|
|
5915
|
+
equals(other) {
|
|
5916
|
+
if (other === null) {
|
|
5917
|
+
return false;
|
|
5918
|
+
}
|
|
5919
|
+
if (this.chords.length !== other.chords.length) {
|
|
5920
|
+
return false;
|
|
5921
|
+
}
|
|
5922
|
+
for (let i = 0; i < this.chords.length; i++) {
|
|
5923
|
+
if (!this.chords[i].equals(other.chords[i])) {
|
|
5924
|
+
return false;
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
return true;
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5562
5930
|
var _a, _b;
|
|
5563
5931
|
if (SnippetParser.prototype.text == null) {
|
|
5564
5932
|
SnippetParser.prototype.text = function (value) {
|
|
@@ -5593,6 +5961,23 @@ polyfillPrototypeSimple(LanguageService$1.prototype, LanguageService.prototype);
|
|
|
5593
5961
|
polyfillPrototypeSimple(NoOpNotification.prototype, NoOpNotification$1.prototype);
|
|
5594
5962
|
polyfillPrototypeSimple(Themable$1.prototype, Themable.prototype);
|
|
5595
5963
|
polyfillPrototypeSimple(ProgressBar$1.prototype, ProgressBar.prototype);
|
|
5964
|
+
polyfillPrototypeSimple(DefaultConfiguration$1.prototype, DefaultConfiguration.prototype);
|
|
5965
|
+
polyfillPrototypeSimple(Keybinding$1.prototype, Keybinding.prototype);
|
|
5966
|
+
polyfillPrototypeSimple(KeyCodeChord$1.prototype, KeyCodeChord.prototype);
|
|
5967
|
+
polyfillPrototypeSimple(DisposableMap$1.prototype, DisposableMap.prototype);
|
|
5968
|
+
Object.defineProperty(DefaultConfiguration$1.prototype, '_onDidChangeConfiguration', {
|
|
5969
|
+
get() {
|
|
5970
|
+
if (this.__onDidChangeConfiguration == null) {
|
|
5971
|
+
this.__onDidChangeConfiguration = this._register(new Emitter());
|
|
5972
|
+
}
|
|
5973
|
+
return this.__onDidChangeConfiguration;
|
|
5974
|
+
}
|
|
5975
|
+
});
|
|
5976
|
+
Object.defineProperty(DefaultConfiguration$1.prototype, 'onDidChangeConfiguration', {
|
|
5977
|
+
get() {
|
|
5978
|
+
return this._onDidChangeConfiguration.event;
|
|
5979
|
+
}
|
|
5980
|
+
});
|
|
5596
5981
|
const jsonContributionRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
5597
5982
|
jsonContributionRegistry.getSchemaContributions ?? (jsonContributionRegistry.getSchemaContributions = () => ({
|
|
5598
5983
|
schemas: jsonContributionRegistry.schemasById
|
|
@@ -5654,4 +6039,4 @@ function toVSCodeColor(value) {
|
|
|
5654
6039
|
return value;
|
|
5655
6040
|
}
|
|
5656
6041
|
polyfillPrototype(Color$1.prototype, Color.prototype, toMonacoColor, toVSCodeColor);
|
|
5657
|
-
export {
|
|
6042
|
+
export { AsyncReferenceCollection as A, mapArrayOrNot as B, delta as C, readonly as D, NotImplementedError as E, encodeBase64 as F, IPolicyService as I, NullPolicyService as N, PolicyConfiguration as P, ReferenceCollection as R, UserSettings as U, assertAllDefined as a, NullPolicyConfiguration as b, parseTree as c, findNodeAtLocation as d, createScanner as e, flatten as f, getNodeType as g, isStringArray as h, index as i, isReadableStream as j, peekStream as k, peekReadable as l, bufferToReadable as m, n, consumeStream as o, parse as p, isReadableBufferedStream as q, listenStream as r, streamToBuffer as s, transform as t, bufferedStreamToBuffer as u, readableToBuffer as v, withUndefinedAsNull as w, newWriteableBufferStream as x, newWriteableStream as y, disposed as z };
|