@codingame/monaco-vscode-api 1.69.23 → 1.76.0-next.1

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/dist/polyfill.js CHANGED
@@ -1,47 +1,52 @@
1
1
  import { VSBuffer as VSBuffer$1 } from 'monaco-editor/esm/vs/base/common/buffer.js';
2
2
  import { Disposable, DisposableStore, dispose, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
- import { onUnexpectedError, ErrorHandler as ErrorHandler$1 } from 'monaco-editor/esm/vs/base/common/errors.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 { Color as Color$1, RGBA as RGBA$1 } from 'monaco-editor/esm/vs/base/common/color.js';
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 { DefaultConfigurationModel } from 'monaco-editor/esm/vs/platform/configuration/common/configurations.js';
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, ResourceMap as ResourceMap$1 } from 'monaco-editor/esm/vs/base/common/map.js';
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 { getConfigurationValue, addToValueTree, removeFromValueTree, toValuesTree } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
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 { ListView } from 'monaco-editor/esm/vs/base/browser/ui/list/listView.js';
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, isWindows } from 'monaco-editor/esm/vs/base/common/platform.js';
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 { LogService as LogService$1 } from 'monaco-editor/esm/vs/platform/log/common/log.js';
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 { QuickInputController } from 'monaco-editor/esm/vs/base/parts/quickinput/browser/quickInput.js';
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 { QuickInputController } from 'monaco-editor/esm/vs/platform/quickinput/browser/quickInput.js';
45
50
  import { getSingletonServiceDescriptors } from 'monaco-editor/esm/vs/platform/instantiation/common/extensions.js';
46
51
  import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
47
52
  class ErrorHandler {
@@ -108,7 +113,7 @@ class NotImplementedError extends Error {
108
113
  class ErrorNoTelemetry extends Error {
109
114
  constructor(msg) {
110
115
  super(msg);
111
- this.name = 'ErrorNoTelemetry';
116
+ this.name = 'CodeExpectedError';
112
117
  }
113
118
  static fromError(err) {
114
119
  if (err instanceof ErrorNoTelemetry) {
@@ -120,7 +125,7 @@ class ErrorNoTelemetry extends Error {
120
125
  return result;
121
126
  }
122
127
  static isErrorNoTelemetry(err) {
123
- return err.name === 'ErrorNoTelemetry';
128
+ return err.name === 'CodeExpectedError';
124
129
  }
125
130
  }
126
131
  function isReadableStream(obj) {
@@ -452,10 +457,6 @@ const hasBuffer = (typeof Buffer !== 'undefined');
452
457
  let textEncoder;
453
458
  let textDecoder;
454
459
  class VSBuffer {
455
- constructor(buffer) {
456
- this.buffer = buffer;
457
- this.byteLength = this.buffer.byteLength;
458
- }
459
460
  static alloc(byteLength) {
460
461
  if (hasBuffer) {
461
462
  return (
@@ -515,6 +516,10 @@ class VSBuffer {
515
516
  }
516
517
  return ret;
517
518
  }
519
+ constructor(buffer) {
520
+ this.buffer = buffer;
521
+ this.byteLength = this.buffer.byteLength;
522
+ }
518
523
  clone() {
519
524
  const result = VSBuffer.alloc(this.byteLength);
520
525
  result.set(this);
@@ -631,6 +636,87 @@ async function bufferedStreamToBuffer(bufferedStream) {
631
636
  function newWriteableBufferStream(options) {
632
637
  return newWriteableStream(chunks => VSBuffer.concat(chunks), options);
633
638
  }
639
+ const base64Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
640
+ const base64UrlSafeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
641
+ function encodeBase64({ buffer }, padded = true, urlSafe = false) {
642
+ const dictionary = urlSafe ? base64UrlSafeAlphabet : base64Alphabet;
643
+ let output = '';
644
+ const remainder = buffer.byteLength % 3;
645
+ let i = 0;
646
+ for (; i < buffer.byteLength - remainder; i += 3) {
647
+ const a = buffer[i + 0];
648
+ const b = buffer[i + 1];
649
+ const c = buffer[i + 2];
650
+ output += dictionary[a >>> 2];
651
+ output += dictionary[(a << 4 | b >>> 4) & 0b111111];
652
+ output += dictionary[(b << 2 | c >>> 6) & 0b111111];
653
+ output += dictionary[c & 0b111111];
654
+ }
655
+ if (remainder === 1) {
656
+ const a = buffer[i + 0];
657
+ output += dictionary[a >>> 2];
658
+ output += dictionary[(a << 4) & 0b111111];
659
+ if (padded) {
660
+ output += '==';
661
+ }
662
+ }
663
+ else if (remainder === 2) {
664
+ const a = buffer[i + 0];
665
+ const b = buffer[i + 1];
666
+ output += dictionary[a >>> 2];
667
+ output += dictionary[(a << 4 | b >>> 4) & 0b111111];
668
+ output += dictionary[(b << 2) & 0b111111];
669
+ if (padded) {
670
+ output += '=';
671
+ }
672
+ }
673
+ return output;
674
+ }
675
+ function isString(str) {
676
+ return (typeof str === 'string');
677
+ }
678
+ function isStringArray(value) {
679
+ return Array.isArray(value) && value.every(elem => isString(elem));
680
+ }
681
+ function isObject(obj) {
682
+ return typeof obj === 'object'
683
+ && obj !== null
684
+ && !Array.isArray(obj)
685
+ && !(obj instanceof RegExp)
686
+ && !(obj instanceof Date);
687
+ }
688
+ function isUndefined(obj) {
689
+ return (typeof obj === 'undefined');
690
+ }
691
+ function isUndefinedOrNull(obj) {
692
+ return (isUndefined(obj) || obj === null);
693
+ }
694
+ function assertAllDefined(...args) {
695
+ const result = [];
696
+ for (let i = 0; i < args.length; i++) {
697
+ const arg = args[i];
698
+ if (isUndefinedOrNull(arg)) {
699
+ throw new Error(`Assertion Failed: argument at index ${i} is undefined or null`);
700
+ }
701
+ result.push(arg);
702
+ }
703
+ return result;
704
+ }
705
+ const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
706
+ function isEmptyObject(obj) {
707
+ if (!isObject(obj)) {
708
+ return false;
709
+ }
710
+ for (const key in obj) {
711
+ if (hasOwnProperty$1.call(obj, key)) {
712
+ return false;
713
+ }
714
+ }
715
+ return true;
716
+ }
717
+ function withUndefinedAsNull(x) {
718
+ return typeof x === 'undefined' ? null : x;
719
+ }
634
720
  const Extensions$1 = {
635
721
  ThemingContribution: 'base.contributions.theming'
636
722
  };
@@ -658,29 +744,26 @@ class Themable extends Disposable {
658
744
  const Extensions = {
659
745
  JSONContribution: 'base.contributions.json'
660
746
  };
747
+ 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}}
748
+ 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)}}";
749
+ n(css$1,{});
661
750
  const CSS_DONE = 'done';
662
751
  const CSS_ACTIVE = 'active';
663
752
  const CSS_INFINITE = 'infinite';
664
753
  const CSS_INFINITE_LONG_RUNNING = 'infinite-long-running';
665
754
  const CSS_DISCRETE = 'discrete';
666
- const defaultOpts = {
667
- progressBarBackground: ( (Color$1.fromHex('#0E70C0')))
668
- };
669
755
  class ProgressBar extends Disposable {
670
756
  constructor(container, options) {
671
757
  super();
672
- this.options = options || Object.create(null);
673
- mixin(this.options, defaultOpts, false);
674
758
  this.workedVal = 0;
675
- this.progressBarBackground = this.options.progressBarBackground;
676
759
  this.showDelayedScheduler = this._register(( (new RunOnceScheduler(() => show(this.element), 0))));
677
760
  this.longRunningScheduler = this._register(( (new RunOnceScheduler(
678
761
  () => this.infiniteLongRunning(),
679
762
  ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD
680
763
  ))));
681
- this.create(container);
764
+ this.create(container, options);
682
765
  }
683
- create(container) {
766
+ create(container, options) {
684
767
  this.element = document.createElement('div');
685
768
  this.element.classList.add('monaco-progress-container');
686
769
  this.element.setAttribute('role', 'progressbar');
@@ -688,8 +771,8 @@ class ProgressBar extends Disposable {
688
771
  container.appendChild(this.element);
689
772
  this.bit = document.createElement('div');
690
773
  this.bit.classList.add('progress-bit');
774
+ this.bit.style.backgroundColor = options?.progressBarBackground || '#0E70C0';
691
775
  this.element.appendChild(this.bit);
692
- this.applyStyles();
693
776
  }
694
777
  off() {
695
778
  this.bit.style.width = 'inherit';
@@ -781,16 +864,6 @@ class ProgressBar extends Disposable {
781
864
  hide(this.element);
782
865
  this.showDelayedScheduler.cancel();
783
866
  }
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
867
  }
795
868
  ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD = 10000;
796
869
  function sortedDiff(before, after, compare) {
@@ -847,16 +920,6 @@ function delta(before, after, compare) {
847
920
  }
848
921
  return { removed, added };
849
922
  }
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
923
  function flatten(arr) {
861
924
  return [].concat(...arr);
862
925
  }
@@ -1009,7 +1072,7 @@ class LanguageSelection {
1009
1072
  }
1010
1073
  if (!this._emitter) {
1011
1074
  this._emitter = ( (new Emitter({
1012
- onLastListenerRemove: () => {
1075
+ onDidRemoveLastListener: () => {
1013
1076
  this._dispose();
1014
1077
  }
1015
1078
  })));
@@ -1737,1733 +1800,1814 @@ function getNodeType(value) {
1737
1800
  default: return 'null';
1738
1801
  }
1739
1802
  }
1740
- var _a$1, _b$1;
1741
- class StringIterator {
1742
- constructor() {
1743
- this._value = '';
1744
- this._pos = 0;
1803
+ function freeze(data) {
1804
+ return Object.isFrozen(data) ? data : deepFreeze(data);
1805
+ }
1806
+ class ConfigurationModel {
1807
+ constructor(_contents = {}, _keys = [], _overrides = [], raw) {
1808
+ this._contents = _contents;
1809
+ this._keys = _keys;
1810
+ this._overrides = _overrides;
1811
+ this.raw = raw;
1812
+ this.overrideConfigurations = ( (new Map()));
1745
1813
  }
1746
- reset(key) {
1747
- this._value = key;
1748
- this._pos = 0;
1749
- return this;
1814
+ get rawConfiguration() {
1815
+ if (!this._rawConfiguration) {
1816
+ if (this.raw?.length) {
1817
+ const rawConfigurationModels = this.raw.map(raw => {
1818
+ if (raw instanceof ConfigurationModel) {
1819
+ return raw;
1820
+ }
1821
+ const parser = ( (new ConfigurationModelParser('')));
1822
+ parser.parseRaw(raw);
1823
+ return parser.configurationModel;
1824
+ });
1825
+ this._rawConfiguration = rawConfigurationModels.reduce((previous, current) => current === previous ? current : previous.merge(current), rawConfigurationModels[0]);
1826
+ }
1827
+ else {
1828
+ this._rawConfiguration = this;
1829
+ }
1830
+ }
1831
+ return this._rawConfiguration;
1750
1832
  }
1751
- next() {
1752
- this._pos += 1;
1753
- return this;
1833
+ get contents() {
1834
+ return this._contents;
1754
1835
  }
1755
- hasNext() {
1756
- return this._pos < this._value.length - 1;
1836
+ get overrides() {
1837
+ return this._overrides;
1757
1838
  }
1758
- cmp(a) {
1759
- const aCode = a.charCodeAt(0);
1760
- const thisCode = this._value.charCodeAt(this._pos);
1761
- return aCode - thisCode;
1839
+ get keys() {
1840
+ return this._keys;
1762
1841
  }
1763
- value() {
1764
- return this._value[this._pos];
1842
+ isEmpty() {
1843
+ return this._keys.length === 0 && ( (Object.keys(this._contents))).length === 0 && this._overrides.length === 0;
1765
1844
  }
1766
- }
1767
- class ConfigKeysIterator {
1768
- constructor(_caseSensitive = true) {
1769
- this._caseSensitive = _caseSensitive;
1845
+ getValue(section) {
1846
+ return section ? getConfigurationValue(this.contents, section) : this.contents;
1770
1847
  }
1771
- reset(key) {
1772
- this._value = key;
1773
- this._from = 0;
1774
- this._to = 0;
1775
- return this.next();
1848
+ inspect(section, overrideIdentifier) {
1849
+ const value = this.rawConfiguration.getValue(section);
1850
+ const override = overrideIdentifier ? this.rawConfiguration.getOverrideValue(section, overrideIdentifier) : undefined;
1851
+ const merged = overrideIdentifier ? this.rawConfiguration.override(overrideIdentifier).getValue(section) : value;
1852
+ return { value, override, merged };
1776
1853
  }
1777
- hasNext() {
1778
- return this._to < this._value.length;
1854
+ getOverrideValue(section, overrideIdentifier) {
1855
+ const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);
1856
+ return overrideContents
1857
+ ? section ? getConfigurationValue(overrideContents, section) : overrideContents
1858
+ : undefined;
1779
1859
  }
1780
- next() {
1781
- this._from = this._to;
1782
- let justSeps = true;
1783
- for (; this._to < this._value.length; this._to++) {
1784
- const ch = this._value.charCodeAt(this._to);
1785
- if (ch === 46 ) {
1786
- if (justSeps) {
1787
- this._from++;
1860
+ getKeysForOverrideIdentifier(identifier) {
1861
+ const keys = [];
1862
+ for (const override of this.overrides) {
1863
+ if (override.identifiers.includes(identifier)) {
1864
+ keys.push(...override.keys);
1865
+ }
1866
+ }
1867
+ return distinct(keys);
1868
+ }
1869
+ getAllOverrideIdentifiers() {
1870
+ const result = [];
1871
+ for (const override of this.overrides) {
1872
+ result.push(...override.identifiers);
1873
+ }
1874
+ return distinct(result);
1875
+ }
1876
+ override(identifier) {
1877
+ let overrideConfigurationModel = this.overrideConfigurations.get(identifier);
1878
+ if (!overrideConfigurationModel) {
1879
+ overrideConfigurationModel = this.createOverrideConfigurationModel(identifier);
1880
+ this.overrideConfigurations.set(identifier, overrideConfigurationModel);
1881
+ }
1882
+ return overrideConfigurationModel;
1883
+ }
1884
+ merge(...others) {
1885
+ const contents = deepClone(this.contents);
1886
+ const overrides = deepClone(this.overrides);
1887
+ const keys = [...this.keys];
1888
+ const raws = this.raw?.length ? [...this.raw] : [this];
1889
+ for (const other of others) {
1890
+ raws.push(...(other.raw?.length ? other.raw : [other]));
1891
+ if (other.isEmpty()) {
1892
+ continue;
1893
+ }
1894
+ this.mergeContents(contents, other.contents);
1895
+ for (const otherOverride of other.overrides) {
1896
+ const [override] = overrides.filter(o => equals$1(o.identifiers, otherOverride.identifiers));
1897
+ if (override) {
1898
+ this.mergeContents(override.contents, otherOverride.contents);
1899
+ override.keys.push(...otherOverride.keys);
1900
+ override.keys = distinct(override.keys);
1788
1901
  }
1789
1902
  else {
1790
- break;
1903
+ overrides.push(deepClone(otherOverride));
1791
1904
  }
1792
1905
  }
1793
- else {
1794
- justSeps = false;
1906
+ for (const key of other.keys) {
1907
+ if (keys.indexOf(key) === -1) {
1908
+ keys.push(key);
1909
+ }
1795
1910
  }
1796
1911
  }
1797
- return this;
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;
1912
+ return (
1913
+ (new ConfigurationModel(
1914
+ contents,
1915
+ keys,
1916
+ overrides,
1917
+ raws.every(raw => raw instanceof ConfigurationModel) ? undefined : raws
1918
+ ))
1919
+ );
1812
1920
  }
1813
- reset(key) {
1814
- this._from = 0;
1815
- this._to = 0;
1816
- this._value = key;
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;
1921
+ createOverrideConfigurationModel(identifier) {
1922
+ const overrideContents = this.getContentsForOverrideIdentifer(identifier);
1923
+ if (!overrideContents || typeof overrideContents !== 'object' || !( (Object.keys(overrideContents))).length) {
1924
+ return this;
1925
+ }
1926
+ const contents = {};
1927
+ for (const key of distinct([...( (Object.keys(this.contents))), ...( (Object.keys(overrideContents)))])) {
1928
+ let contentsForKey = this.contents[key];
1929
+ const overrideContentsForKey = overrideContents[key];
1930
+ if (overrideContentsForKey) {
1931
+ if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
1932
+ contentsForKey = deepClone(contentsForKey);
1933
+ this.mergeContents(contentsForKey, overrideContentsForKey);
1934
+ }
1935
+ else {
1936
+ contentsForKey = overrideContentsForKey;
1937
+ }
1822
1938
  }
1939
+ contents[key] = contentsForKey;
1823
1940
  }
1824
- return this.next();
1941
+ return (
1942
+ (new ConfigurationModel(contents, this.keys, this.overrides))
1943
+ );
1825
1944
  }
1826
- hasNext() {
1827
- return this._to < this._valueLen;
1945
+ mergeContents(source, target) {
1946
+ for (const key of ( (Object.keys(target)))) {
1947
+ if (key in source) {
1948
+ if (isObject$1(source[key]) && isObject$1(target[key])) {
1949
+ this.mergeContents(source[key], target[key]);
1950
+ continue;
1951
+ }
1952
+ }
1953
+ source[key] = deepClone(target[key]);
1954
+ }
1828
1955
  }
1829
- next() {
1830
- this._from = this._to;
1831
- let justSeps = true;
1832
- for (; this._to < this._valueLen; this._to++) {
1833
- const ch = this._value.charCodeAt(this._to);
1834
- if (ch === 47 || this._splitOnBackslash && ch === 92 ) {
1835
- if (justSeps) {
1836
- this._from++;
1956
+ getContentsForOverrideIdentifer(identifier) {
1957
+ let contentsForIdentifierOnly = null;
1958
+ let contents = null;
1959
+ const mergeContents = (contentsToMerge) => {
1960
+ if (contentsToMerge) {
1961
+ if (contents) {
1962
+ this.mergeContents(contents, contentsToMerge);
1837
1963
  }
1838
1964
  else {
1839
- break;
1965
+ contents = deepClone(contentsToMerge);
1840
1966
  }
1841
1967
  }
1842
- else {
1843
- justSeps = false;
1968
+ };
1969
+ for (const override of this.overrides) {
1970
+ if (equals$1(override.identifiers, [identifier])) {
1971
+ contentsForIdentifierOnly = override.contents;
1972
+ }
1973
+ else if (override.identifiers.includes(identifier)) {
1974
+ mergeContents(override.contents);
1844
1975
  }
1845
1976
  }
1846
- return this;
1977
+ mergeContents(contentsForIdentifierOnly);
1978
+ return contents;
1847
1979
  }
1848
- cmp(a) {
1849
- return this._caseSensitive
1850
- ? compareSubstring(a, this._value, 0, a.length, this._from, this._to)
1851
- : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);
1980
+ toJSON() {
1981
+ return {
1982
+ contents: this.contents,
1983
+ overrides: this.overrides,
1984
+ keys: this.keys
1985
+ };
1852
1986
  }
1853
- value() {
1854
- return this._value.substring(this._from, this._to);
1987
+ addValue(key, value) {
1988
+ this.updateValue(key, value, true);
1855
1989
  }
1856
- }
1857
- class UriIterator {
1858
- constructor(_ignorePathCasing, _ignoreQueryAndFragment) {
1859
- this._ignorePathCasing = _ignorePathCasing;
1860
- this._ignoreQueryAndFragment = _ignoreQueryAndFragment;
1861
- this._states = [];
1862
- this._stateIdx = 0;
1990
+ setValue(key, value) {
1991
+ this.updateValue(key, value, false);
1863
1992
  }
1864
- reset(key) {
1865
- this._value = key;
1866
- this._states = [];
1867
- if (this._value.scheme) {
1868
- this._states.push(1 );
1869
- }
1870
- if (this._value.authority) {
1871
- this._states.push(2 );
1872
- }
1873
- if (this._value.path) {
1874
- this._pathIterator = ( (new PathIterator(false, !this._ignorePathCasing(key))));
1875
- this._pathIterator.reset(key.path);
1876
- if (this._pathIterator.value()) {
1877
- this._states.push(3 );
1878
- }
1993
+ removeValue(key) {
1994
+ const index = this.keys.indexOf(key);
1995
+ if (index === -1) {
1996
+ return;
1879
1997
  }
1880
- if (!this._ignoreQueryAndFragment(key)) {
1881
- if (this._value.query) {
1882
- this._states.push(4 );
1883
- }
1884
- if (this._value.fragment) {
1885
- this._states.push(5 );
1886
- }
1998
+ this.keys.splice(index, 1);
1999
+ removeFromValueTree(this.contents, key);
2000
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
2001
+ this.overrides.splice(this.overrides.findIndex(o => equals$1(o.identifiers, overrideIdentifiersFromKey(key))), 1);
1887
2002
  }
1888
- this._stateIdx = 0;
1889
- return this;
1890
2003
  }
1891
- next() {
1892
- if (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext()) {
1893
- this._pathIterator.next();
2004
+ updateValue(key, value, add) {
2005
+ addToValueTree(this.contents, key, value, e => console.error(e));
2006
+ add = add || this.keys.indexOf(key) === -1;
2007
+ if (add) {
2008
+ this.keys.push(key);
1894
2009
  }
1895
- else {
1896
- this._stateIdx += 1;
2010
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
2011
+ this.overrides.push({
2012
+ identifiers: overrideIdentifiersFromKey(key),
2013
+ keys: ( (Object.keys(this.contents[key]))),
2014
+ contents: toValuesTree(this.contents[key], message => console.error(message)),
2015
+ });
1897
2016
  }
1898
- return this;
1899
2017
  }
1900
- hasNext() {
1901
- return (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext())
1902
- || this._stateIdx < this._states.length - 1;
2018
+ }
2019
+ class ConfigurationModelParser {
2020
+ constructor(_name) {
2021
+ this._name = _name;
2022
+ this._raw = null;
2023
+ this._configurationModel = null;
2024
+ this._restrictedConfigurations = [];
2025
+ this._parseErrors = [];
1903
2026
  }
1904
- cmp(a) {
1905
- if (this._states[this._stateIdx] === 1 ) {
1906
- return compareIgnoreCase(a, this._value.scheme);
1907
- }
1908
- else if (this._states[this._stateIdx] === 2 ) {
1909
- return compareIgnoreCase(a, this._value.authority);
2027
+ get configurationModel() {
2028
+ return this._configurationModel || ( (new ConfigurationModel()));
2029
+ }
2030
+ get restrictedConfigurations() {
2031
+ return this._restrictedConfigurations;
2032
+ }
2033
+ get errors() {
2034
+ return this._parseErrors;
2035
+ }
2036
+ parse(content, options) {
2037
+ if (!isUndefinedOrNull$1(content)) {
2038
+ const raw = this.doParseContent(content);
2039
+ this.parseRaw(raw, options);
1910
2040
  }
1911
- else if (this._states[this._stateIdx] === 3 ) {
1912
- return this._pathIterator.cmp(a);
2041
+ }
2042
+ reparse(options) {
2043
+ if (this._raw) {
2044
+ this.parseRaw(this._raw, options);
1913
2045
  }
1914
- else if (this._states[this._stateIdx] === 4 ) {
1915
- return compare$1(a, this._value.query);
2046
+ }
2047
+ parseRaw(raw, options) {
2048
+ this._raw = raw;
2049
+ const { contents, keys, overrides, restricted, hasExcludedProperties } = this.doParseRaw(raw, options);
2050
+ this._configurationModel = ( (new ConfigurationModel(
2051
+ contents,
2052
+ keys,
2053
+ overrides,
2054
+ hasExcludedProperties ? [raw] : undefined
2055
+ )));
2056
+ this._restrictedConfigurations = restricted || [];
2057
+ }
2058
+ doParseContent(content) {
2059
+ let raw = {};
2060
+ let currentProperty = null;
2061
+ let currentParent = [];
2062
+ const previousParents = [];
2063
+ function onValue(value) {
2064
+ if (Array.isArray(currentParent)) {
2065
+ currentParent.push(value);
2066
+ }
2067
+ else if (currentProperty !== null) {
2068
+ currentParent[currentProperty] = value;
2069
+ }
1916
2070
  }
1917
- else if (this._states[this._stateIdx] === 5 ) {
1918
- return compare$1(a, this._value.fragment);
2071
+ const visitor = {
2072
+ onObjectBegin: () => {
2073
+ const object = {};
2074
+ onValue(object);
2075
+ previousParents.push(currentParent);
2076
+ currentParent = object;
2077
+ currentProperty = null;
2078
+ },
2079
+ onObjectProperty: (name) => {
2080
+ currentProperty = name;
2081
+ },
2082
+ onObjectEnd: () => {
2083
+ currentParent = previousParents.pop();
2084
+ },
2085
+ onArrayBegin: () => {
2086
+ const array = [];
2087
+ onValue(array);
2088
+ previousParents.push(currentParent);
2089
+ currentParent = array;
2090
+ currentProperty = null;
2091
+ },
2092
+ onArrayEnd: () => {
2093
+ currentParent = previousParents.pop();
2094
+ },
2095
+ onLiteralValue: onValue,
2096
+ onError: (error, offset, length) => {
2097
+ }
2098
+ };
2099
+ if (content) {
2100
+ try {
2101
+ visit(content, visitor);
2102
+ raw = currentParent[0] || {};
2103
+ }
2104
+ catch (e) {
2105
+ console.error(`Error while parsing settings file ${this._name}: ${e}`);
2106
+ this._parseErrors = [e];
2107
+ }
1919
2108
  }
1920
- throw new Error();
2109
+ return raw;
1921
2110
  }
1922
- value() {
1923
- if (this._states[this._stateIdx] === 1 ) {
1924
- return this._value.scheme;
2111
+ doParseRaw(raw, options) {
2112
+ const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
2113
+ const filtered = this.filter(raw, configurationProperties, true, options);
2114
+ raw = filtered.raw;
2115
+ const contents = toValuesTree(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
2116
+ const keys = ( (Object.keys(raw)));
2117
+ const overrides = this.toOverrides(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
2118
+ return { contents, keys, overrides, restricted: filtered.restricted, hasExcludedProperties: filtered.hasExcludedProperties };
2119
+ }
2120
+ filter(properties, configurationProperties, filterOverriddenProperties, options) {
2121
+ let hasExcludedProperties = false;
2122
+ if (!options?.scopes && !options?.skipRestricted) {
2123
+ return { raw: properties, restricted: [], hasExcludedProperties };
1925
2124
  }
1926
- else if (this._states[this._stateIdx] === 2 ) {
1927
- return this._value.authority;
2125
+ const raw = {};
2126
+ const restricted = [];
2127
+ for (const key in properties) {
2128
+ if (OVERRIDE_PROPERTY_REGEX.test(key) && filterOverriddenProperties) {
2129
+ const result = this.filter(properties[key], configurationProperties, false, options);
2130
+ raw[key] = result.raw;
2131
+ hasExcludedProperties = hasExcludedProperties || result.hasExcludedProperties;
2132
+ restricted.push(...result.restricted);
2133
+ }
2134
+ else {
2135
+ const propertySchema = configurationProperties[key];
2136
+ const scope = propertySchema ? typeof propertySchema.scope !== 'undefined' ? propertySchema.scope : 3 : undefined;
2137
+ if (propertySchema?.restricted) {
2138
+ restricted.push(key);
2139
+ }
2140
+ if ((scope === undefined || options.scopes === undefined || options.scopes.includes(scope))
2141
+ && !(options.skipRestricted && propertySchema?.restricted)) {
2142
+ raw[key] = properties[key];
2143
+ }
2144
+ else {
2145
+ hasExcludedProperties = true;
2146
+ }
2147
+ }
1928
2148
  }
1929
- else if (this._states[this._stateIdx] === 3 ) {
1930
- return this._pathIterator.value();
2149
+ return { raw, restricted, hasExcludedProperties };
2150
+ }
2151
+ toOverrides(raw, conflictReporter) {
2152
+ const overrides = [];
2153
+ for (const key of ( (Object.keys(raw)))) {
2154
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
2155
+ const overrideRaw = {};
2156
+ for (const keyInOverrideRaw in raw[key]) {
2157
+ overrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];
2158
+ }
2159
+ overrides.push({
2160
+ identifiers: overrideIdentifiersFromKey(key),
2161
+ keys: ( (Object.keys(overrideRaw))),
2162
+ contents: toValuesTree(overrideRaw, conflictReporter)
2163
+ });
2164
+ }
1931
2165
  }
1932
- else if (this._states[this._stateIdx] === 4 ) {
1933
- return this._value.query;
2166
+ return overrides;
2167
+ }
2168
+ }
2169
+ class UserSettings extends Disposable {
2170
+ constructor(userSettingsResource, scopes, extUri, fileService) {
2171
+ super();
2172
+ this.userSettingsResource = userSettingsResource;
2173
+ this.scopes = scopes;
2174
+ this.fileService = fileService;
2175
+ this._onDidChange = this._register(( (new Emitter())));
2176
+ this.onDidChange = this._onDidChange.event;
2177
+ this.parser = ( (new ConfigurationModelParser( (this.userSettingsResource.toString()))));
2178
+ this.parseOptions = { scopes: this.scopes };
2179
+ this._register(this.fileService.watch(extUri.dirname(this.userSettingsResource)));
2180
+ this._register(this.fileService.watch(this.userSettingsResource));
2181
+ 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()));
2182
+ }
2183
+ async loadConfiguration() {
2184
+ try {
2185
+ const content = await this.fileService.readFile(this.userSettingsResource);
2186
+ this.parser.parse(( (content.value.toString())) || '{}', this.parseOptions);
2187
+ return this.parser.configurationModel;
1934
2188
  }
1935
- else if (this._states[this._stateIdx] === 5 ) {
1936
- return this._value.fragment;
2189
+ catch (e) {
2190
+ return (
2191
+ (new ConfigurationModel())
2192
+ );
1937
2193
  }
1938
- throw new Error();
1939
2194
  }
1940
- }
1941
- class TernarySearchTreeNode {
1942
- constructor() {
1943
- this.height = 1;
2195
+ reparse() {
2196
+ this.parser.reparse(this.parseOptions);
2197
+ return this.parser.configurationModel;
1944
2198
  }
1945
- isEmpty() {
1946
- return !this.left && !this.mid && !this.right && !this.value;
2199
+ getRestrictedSettings() {
2200
+ return this.parser.restrictedConfigurations;
1947
2201
  }
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;
2202
+ }
2203
+ class ConfigurationInspectValue {
2204
+ constructor(key, overrides, _value, overrideIdentifiers, defaultConfiguration, policyConfiguration, applicationConfiguration, userConfiguration, localUserConfiguration, remoteUserConfiguration, workspaceConfiguration, folderConfigurationModel, memoryConfigurationModel) {
2205
+ this.key = key;
2206
+ this.overrides = overrides;
2207
+ this._value = _value;
2208
+ this.overrideIdentifiers = overrideIdentifiers;
2209
+ this.defaultConfiguration = defaultConfiguration;
2210
+ this.policyConfiguration = policyConfiguration;
2211
+ this.applicationConfiguration = applicationConfiguration;
2212
+ this.userConfiguration = userConfiguration;
2213
+ this.localUserConfiguration = localUserConfiguration;
2214
+ this.remoteUserConfiguration = remoteUserConfiguration;
2215
+ this.workspaceConfiguration = workspaceConfiguration;
2216
+ this.folderConfigurationModel = folderConfigurationModel;
2217
+ this.memoryConfigurationModel = memoryConfigurationModel;
2218
+ }
2219
+ get value() {
2220
+ return freeze(this._value);
2221
+ }
2222
+ inspect(model, section, overrideIdentifier) {
2223
+ const inspectValue = model.inspect(section, overrideIdentifier);
2224
+ return {
2225
+ get value() { return freeze(inspectValue.value); },
2226
+ get override() { return freeze(inspectValue.override); },
2227
+ get merged() { return freeze(inspectValue.merged); }
2228
+ };
1955
2229
  }
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;
2230
+ get defaultInspectValue() {
2231
+ if (!this._defaultInspectValue) {
2232
+ this._defaultInspectValue = this.inspect(this.defaultConfiguration, this.key, this.overrides.overrideIdentifier);
2233
+ }
2234
+ return this._defaultInspectValue;
1963
2235
  }
1964
- updateHeight() {
1965
- this.height = 1 + Math.max(this.heightLeft, this.heightRight);
2236
+ get defaultValue() {
2237
+ return this.defaultInspectValue.merged;
1966
2238
  }
1967
- balanceFactor() {
1968
- return this.heightRight - this.heightLeft;
2239
+ get default() {
2240
+ return this.defaultInspectValue.value !== undefined || this.defaultInspectValue.override !== undefined ? { value: this.defaultInspectValue.value, override: this.defaultInspectValue.override } : undefined;
1969
2241
  }
1970
- get heightLeft() {
1971
- return this.left?.height ?? 0;
2242
+ get policyInspectValue() {
2243
+ if (this._policyInspectValue === undefined) {
2244
+ this._policyInspectValue = this.policyConfiguration ? this.inspect(this.policyConfiguration, this.key) : null;
2245
+ }
2246
+ return this._policyInspectValue;
1972
2247
  }
1973
- get heightRight() {
1974
- return this.right?.height ?? 0;
2248
+ get policyValue() {
2249
+ return this.policyInspectValue?.merged;
1975
2250
  }
1976
- }
1977
- class TernarySearchTree {
1978
- constructor(segments) {
1979
- this._iter = segments;
2251
+ get policy() {
2252
+ return this.policyInspectValue?.value !== undefined ? { value: this.policyInspectValue.value } : undefined;
1980
2253
  }
1981
- static forUris(ignorePathCasing = () => false, ignoreQueryAndFragment = () => false) {
1982
- return (
1983
- (new TernarySearchTree( (new UriIterator(ignorePathCasing, ignoreQueryAndFragment))))
1984
- );
2254
+ get applicationInspectValue() {
2255
+ if (this._applicationInspectValue === undefined) {
2256
+ this._applicationInspectValue = this.applicationConfiguration ? this.inspect(this.applicationConfiguration, this.key) : null;
2257
+ }
2258
+ return this._applicationInspectValue;
1985
2259
  }
1986
- static forPaths(ignorePathCasing = false) {
1987
- return (
1988
- (new TernarySearchTree( (new PathIterator(undefined, !ignorePathCasing))))
1989
- );
2260
+ get applicationValue() {
2261
+ return this.applicationInspectValue?.merged;
1990
2262
  }
1991
- static forStrings() {
1992
- return (
1993
- (new TernarySearchTree( (new StringIterator())))
1994
- );
2263
+ get application() {
2264
+ return this.applicationInspectValue?.value !== undefined || this.applicationInspectValue?.override !== undefined ? { value: this.applicationInspectValue.value, override: this.applicationInspectValue.override } : undefined;
1995
2265
  }
1996
- static forConfigKeys() {
1997
- return (
1998
- (new TernarySearchTree( (new ConfigKeysIterator())))
1999
- );
2266
+ get userInspectValue() {
2267
+ if (!this._userInspectValue) {
2268
+ this._userInspectValue = this.inspect(this.userConfiguration, this.key, this.overrides.overrideIdentifier);
2269
+ }
2270
+ return this._userInspectValue;
2000
2271
  }
2001
- clear() {
2002
- this._root = undefined;
2272
+ get userValue() {
2273
+ return this.userInspectValue.merged;
2003
2274
  }
2004
- fill(values, keys) {
2005
- if (keys) {
2006
- const arr = keys.slice(0);
2007
- shuffle(arr);
2008
- for (const k of arr) {
2009
- this.set(k, values);
2010
- }
2011
- }
2012
- else {
2013
- const arr = values.slice(0);
2014
- shuffle(arr);
2015
- for (const entry of arr) {
2016
- this.set(entry[0], entry[1]);
2017
- }
2275
+ get user() {
2276
+ return this.userInspectValue.value !== undefined || this.userInspectValue.override !== undefined ? { value: this.userInspectValue.value, override: this.userInspectValue.override } : undefined;
2277
+ }
2278
+ get userLocalInspectValue() {
2279
+ if (!this._userLocalInspectValue) {
2280
+ this._userLocalInspectValue = this.inspect(this.localUserConfiguration, this.key, this.overrides.overrideIdentifier);
2018
2281
  }
2282
+ return this._userLocalInspectValue;
2019
2283
  }
2020
- set(key, element) {
2021
- const iter = this._iter.reset(key);
2022
- let node;
2023
- if (!this._root) {
2024
- this._root = ( (new TernarySearchTreeNode()));
2025
- this._root.segment = iter.value();
2284
+ get userLocalValue() {
2285
+ return this.userLocalInspectValue.merged;
2286
+ }
2287
+ get userLocal() {
2288
+ return this.userLocalInspectValue.value !== undefined || this.userLocalInspectValue.override !== undefined ? { value: this.userLocalInspectValue.value, override: this.userLocalInspectValue.override } : undefined;
2289
+ }
2290
+ get userRemoteInspectValue() {
2291
+ if (!this._userRemoteInspectValue) {
2292
+ this._userRemoteInspectValue = this.inspect(this.remoteUserConfiguration, this.key, this.overrides.overrideIdentifier);
2026
2293
  }
2027
- const stack = [];
2028
- node = this._root;
2029
- while (true) {
2030
- const val = iter.cmp(node.segment);
2031
- if (val > 0) {
2032
- if (!node.left) {
2033
- node.left = ( (new TernarySearchTreeNode()));
2034
- node.left.segment = iter.value();
2035
- }
2036
- stack.push([-1 , node]);
2037
- node = node.left;
2038
- }
2039
- else if (val < 0) {
2040
- if (!node.right) {
2041
- node.right = ( (new TernarySearchTreeNode()));
2042
- node.right.segment = iter.value();
2043
- }
2044
- stack.push([1 , node]);
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;
2055
- }
2056
- else {
2057
- break;
2058
- }
2294
+ return this._userRemoteInspectValue;
2295
+ }
2296
+ get userRemoteValue() {
2297
+ return this.userRemoteInspectValue.merged;
2298
+ }
2299
+ get userRemote() {
2300
+ return this.userRemoteInspectValue.value !== undefined || this.userRemoteInspectValue.override !== undefined ? { value: this.userRemoteInspectValue.value, override: this.userRemoteInspectValue.override } : undefined;
2301
+ }
2302
+ get workspaceInspectValue() {
2303
+ if (this._workspaceInspectValue === undefined) {
2304
+ this._workspaceInspectValue = this.workspaceConfiguration ? this.inspect(this.workspaceConfiguration, this.key, this.overrides.overrideIdentifier) : null;
2059
2305
  }
2060
- const oldElement = node.value;
2061
- node.value = element;
2062
- node.key = key;
2063
- for (let i = stack.length - 1; i >= 0; i--) {
2064
- const node = stack[i][1];
2065
- node.updateHeight();
2066
- const bf = node.balanceFactor();
2067
- if (bf < -1 || bf > 1) {
2068
- const d1 = stack[i][0];
2069
- const d2 = stack[i + 1][0];
2070
- if (d1 === 1 && d2 === 1 ) {
2071
- stack[i][1] = node.rotateLeft();
2072
- }
2073
- else if (d1 === -1 && d2 === -1 ) {
2074
- stack[i][1] = node.rotateRight();
2075
- }
2076
- else if (d1 === 1 && d2 === -1 ) {
2077
- node.right = stack[i + 1][1] = stack[i + 1][1].rotateRight();
2078
- stack[i][1] = node.rotateLeft();
2079
- }
2080
- else if (d1 === -1 && d2 === 1 ) {
2081
- node.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft();
2082
- stack[i][1] = node.rotateRight();
2083
- }
2084
- else {
2085
- throw new Error();
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
- }
2099
- }
2100
- else {
2101
- this._root = stack[0][1];
2102
- }
2103
- }
2306
+ return this._workspaceInspectValue;
2307
+ }
2308
+ get workspaceValue() {
2309
+ return this.workspaceInspectValue?.merged;
2310
+ }
2311
+ get workspace() {
2312
+ return this.workspaceInspectValue?.value !== undefined || this.workspaceInspectValue?.override !== undefined ? { value: this.workspaceInspectValue.value, override: this.workspaceInspectValue.override } : undefined;
2313
+ }
2314
+ get workspaceFolderInspectValue() {
2315
+ if (this._workspaceFolderInspectValue === undefined) {
2316
+ this._workspaceFolderInspectValue = this.folderConfigurationModel ? this.inspect(this.folderConfigurationModel, this.key, this.overrides.overrideIdentifier) : null;
2104
2317
  }
2105
- return oldElement;
2318
+ return this._workspaceFolderInspectValue;
2106
2319
  }
2107
- get(key) {
2108
- return this._getNode(key)?.value;
2320
+ get workspaceFolderValue() {
2321
+ return this.workspaceFolderInspectValue?.merged;
2109
2322
  }
2110
- _getNode(key) {
2111
- const iter = this._iter.reset(key);
2112
- let node = this._root;
2113
- while (node) {
2114
- const val = iter.cmp(node.segment);
2115
- if (val > 0) {
2116
- node = node.left;
2117
- }
2118
- else if (val < 0) {
2119
- node = node.right;
2120
- }
2121
- else if (iter.hasNext()) {
2122
- iter.next();
2123
- node = node.mid;
2124
- }
2125
- else {
2126
- break;
2127
- }
2323
+ get workspaceFolder() {
2324
+ return this.workspaceFolderInspectValue?.value !== undefined || this.workspaceFolderInspectValue?.override !== undefined ? { value: this.workspaceFolderInspectValue.value, override: this.workspaceFolderInspectValue.override } : undefined;
2325
+ }
2326
+ get memoryInspectValue() {
2327
+ if (this._memoryInspectValue === undefined) {
2328
+ this._memoryInspectValue = this.inspect(this.memoryConfigurationModel, this.key, this.overrides.overrideIdentifier);
2128
2329
  }
2129
- return node;
2330
+ return this._memoryInspectValue;
2130
2331
  }
2131
- has(key) {
2132
- const node = this._getNode(key);
2133
- return !(node?.value === undefined && node?.mid === undefined);
2332
+ get memoryValue() {
2333
+ return this.memoryInspectValue.merged;
2134
2334
  }
2135
- delete(key) {
2136
- return this._delete(key, false);
2335
+ get memory() {
2336
+ return this.memoryInspectValue.value !== undefined || this.memoryInspectValue.override !== undefined ? { value: this.memoryInspectValue.value, override: this.memoryInspectValue.override } : undefined;
2137
2337
  }
2138
- deleteSuperstr(key) {
2139
- return this._delete(key, true);
2338
+ }
2339
+ class Configuration {
2340
+ constructor(_defaultConfiguration, _policyConfiguration, _applicationConfiguration, _localUserConfiguration, _remoteUserConfiguration = ( (new ConfigurationModel())), _workspaceConfiguration = ( (new ConfigurationModel())), _folderConfigurations = ( (new ResourceMap())), _memoryConfiguration = ( (new ConfigurationModel())), _memoryConfigurationByResource = ( (new ResourceMap()))) {
2341
+ this._defaultConfiguration = _defaultConfiguration;
2342
+ this._policyConfiguration = _policyConfiguration;
2343
+ this._applicationConfiguration = _applicationConfiguration;
2344
+ this._localUserConfiguration = _localUserConfiguration;
2345
+ this._remoteUserConfiguration = _remoteUserConfiguration;
2346
+ this._workspaceConfiguration = _workspaceConfiguration;
2347
+ this._folderConfigurations = _folderConfigurations;
2348
+ this._memoryConfiguration = _memoryConfiguration;
2349
+ this._memoryConfigurationByResource = _memoryConfigurationByResource;
2350
+ this._workspaceConsolidatedConfiguration = null;
2351
+ this._foldersConsolidatedConfigurations = ( (new ResourceMap()));
2352
+ this._userConfiguration = null;
2140
2353
  }
2141
- _delete(key, superStr) {
2142
- const iter = this._iter.reset(key);
2143
- const stack = [];
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;
2354
+ getValue(section, overrides, workspace) {
2355
+ const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(section, overrides, workspace);
2356
+ return consolidateConfigurationModel.getValue(section);
2357
+ }
2358
+ updateValue(key, value, overrides = {}) {
2359
+ let memoryConfiguration;
2360
+ if (overrides.resource) {
2361
+ memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);
2362
+ if (!memoryConfiguration) {
2363
+ memoryConfiguration = ( (new ConfigurationModel()));
2364
+ this._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);
2162
2365
  }
2163
2366
  }
2164
- if (!node) {
2165
- return;
2367
+ else {
2368
+ memoryConfiguration = this._memoryConfiguration;
2166
2369
  }
2167
- if (superStr) {
2168
- node.left = undefined;
2169
- node.mid = undefined;
2170
- node.right = undefined;
2171
- node.height = 1;
2370
+ if (value === undefined) {
2371
+ memoryConfiguration.removeValue(key);
2172
2372
  }
2173
2373
  else {
2174
- node.key = undefined;
2175
- node.value = undefined;
2374
+ memoryConfiguration.setValue(key, value);
2176
2375
  }
2177
- if (!node.mid && !node.value) {
2178
- if (node.left && node.right) {
2179
- const min = this._min(node.right);
2180
- const { key, value, segment } = min;
2181
- this._delete(min.key, false);
2182
- node.key = key;
2183
- node.value = value;
2184
- node.segment = segment;
2185
- }
2186
- else {
2187
- const newChild = node.left ?? node.right;
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
- }
2376
+ if (!overrides.resource) {
2377
+ this._workspaceConsolidatedConfiguration = null;
2206
2378
  }
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();
2379
+ }
2380
+ inspect(key, overrides, workspace) {
2381
+ const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(key, overrides, workspace);
2382
+ const folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace);
2383
+ const memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration;
2384
+ const overrideIdentifiers = ( (new Set()));
2385
+ for (const override of consolidateConfigurationModel.overrides) {
2386
+ for (const overrideIdentifier of override.identifiers) {
2387
+ if (consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== undefined) {
2388
+ overrideIdentifiers.add(overrideIdentifier);
2218
2389
  }
2219
2390
  }
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
- }
2245
- }
2246
- }
2247
- _min(node) {
2248
- while (node.left) {
2249
- node = node.left;
2250
- }
2251
- return node;
2252
- }
2253
- findSubstr(key) {
2254
- const iter = this._iter.reset(key);
2255
- let node = this._root;
2256
- let candidate = undefined;
2257
- while (node) {
2258
- const val = iter.cmp(node.segment);
2259
- if (val > 0) {
2260
- node = node.left;
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
- }
2273
- }
2274
- return node && node.value || candidate;
2275
- }
2276
- findSuperstr(key) {
2277
- const iter = this._iter.reset(key);
2278
- let node = this._root;
2279
- while (node) {
2280
- const val = iter.cmp(node.segment);
2281
- if (val > 0) {
2282
- node = node.left;
2283
- }
2284
- else if (val < 0) {
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
- }
2299
- }
2300
- return undefined;
2301
- }
2302
- forEach(callback) {
2303
- for (const [key, value] of this) {
2304
- callback(value, key);
2305
- }
2306
- }
2307
- *[Symbol.iterator]() {
2308
- yield* this._entries(this._root);
2309
- }
2310
- _entries(node) {
2311
- const result = [];
2312
- this._dfsEntries(node, result);
2313
- return result[Symbol.iterator]();
2314
- }
2315
- _dfsEntries(node, bucket) {
2316
- if (!node) {
2317
- return;
2318
- }
2319
- if (node.left) {
2320
- this._dfsEntries(node.left, bucket);
2321
- }
2322
- if (node.value) {
2323
- bucket.push([node.key, node.value]);
2324
- }
2325
- if (node.mid) {
2326
- this._dfsEntries(node.mid, bucket);
2327
- }
2328
- if (node.right) {
2329
- this._dfsEntries(node.right, bucket);
2330
2391
  }
2392
+ return (
2393
+ (new ConfigurationInspectValue(
2394
+ key,
2395
+ overrides,
2396
+ consolidateConfigurationModel.getValue(key),
2397
+ overrideIdentifiers.size ? [...overrideIdentifiers] : undefined,
2398
+ this._defaultConfiguration,
2399
+ this._policyConfiguration.isEmpty() ? undefined : this._policyConfiguration,
2400
+ this.applicationConfiguration.isEmpty() ? undefined : this.applicationConfiguration,
2401
+ this.userConfiguration,
2402
+ this.localUserConfiguration,
2403
+ this.remoteUserConfiguration,
2404
+ workspace ? this._workspaceConfiguration : undefined,
2405
+ folderConfigurationModel ? folderConfigurationModel : undefined,
2406
+ memoryConfigurationModel
2407
+ ))
2408
+ );
2331
2409
  }
2332
- _isBalanced() {
2333
- const nodeIsBalanced = (node) => {
2334
- if (!node) {
2335
- return true;
2336
- }
2337
- const bf = node.balanceFactor();
2338
- if (bf < -1 || bf > 1) {
2339
- return false;
2340
- }
2341
- return nodeIsBalanced(node.left) && nodeIsBalanced(node.right);
2410
+ keys(workspace) {
2411
+ const folderConfigurationModel = this.getFolderConfigurationModelForResource(undefined, workspace);
2412
+ return {
2413
+ default: this._defaultConfiguration.keys.slice(0),
2414
+ user: this.userConfiguration.keys.slice(0),
2415
+ workspace: this._workspaceConfiguration.keys.slice(0),
2416
+ workspaceFolder: folderConfigurationModel ? folderConfigurationModel.keys.slice(0) : []
2342
2417
  };
2343
- return nodeIsBalanced(this._root);
2344
2418
  }
2345
- }
2346
- class ResourceMapEntry {
2347
- constructor(uri, value) {
2348
- this.uri = uri;
2349
- this.value = value;
2419
+ updateDefaultConfiguration(defaultConfiguration) {
2420
+ this._defaultConfiguration = defaultConfiguration;
2421
+ this._workspaceConsolidatedConfiguration = null;
2422
+ this._foldersConsolidatedConfigurations.clear();
2350
2423
  }
2351
- }
2352
- class ResourceMap {
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
- }
2424
+ updatePolicyConfiguration(policyConfiguration) {
2425
+ this._policyConfiguration = policyConfiguration;
2363
2426
  }
2364
- set(resource, value) {
2365
- this.map.set(this.toKey(resource), ( (new ResourceMapEntry(resource, value))));
2366
- return this;
2427
+ updateApplicationConfiguration(applicationConfiguration) {
2428
+ this._applicationConfiguration = applicationConfiguration;
2429
+ this._workspaceConsolidatedConfiguration = null;
2430
+ this._foldersConsolidatedConfigurations.clear();
2367
2431
  }
2368
- get(resource) {
2369
- return this.map.get(this.toKey(resource))?.value;
2432
+ updateLocalUserConfiguration(localUserConfiguration) {
2433
+ this._localUserConfiguration = localUserConfiguration;
2434
+ this._userConfiguration = null;
2435
+ this._workspaceConsolidatedConfiguration = null;
2436
+ this._foldersConsolidatedConfigurations.clear();
2370
2437
  }
2371
- has(resource) {
2372
- return this.map.has(this.toKey(resource));
2438
+ updateRemoteUserConfiguration(remoteUserConfiguration) {
2439
+ this._remoteUserConfiguration = remoteUserConfiguration;
2440
+ this._userConfiguration = null;
2441
+ this._workspaceConsolidatedConfiguration = null;
2442
+ this._foldersConsolidatedConfigurations.clear();
2373
2443
  }
2374
- get size() {
2375
- return this.map.size;
2444
+ updateWorkspaceConfiguration(workspaceConfiguration) {
2445
+ this._workspaceConfiguration = workspaceConfiguration;
2446
+ this._workspaceConsolidatedConfiguration = null;
2447
+ this._foldersConsolidatedConfigurations.clear();
2376
2448
  }
2377
- clear() {
2378
- this.map.clear();
2449
+ updateFolderConfiguration(resource, configuration) {
2450
+ this._folderConfigurations.set(resource, configuration);
2451
+ this._foldersConsolidatedConfigurations.delete(resource);
2379
2452
  }
2380
- delete(resource) {
2381
- return this.map.delete(this.toKey(resource));
2453
+ deleteFolderConfiguration(resource) {
2454
+ this.folderConfigurations.delete(resource);
2455
+ this._foldersConsolidatedConfigurations.delete(resource);
2382
2456
  }
2383
- forEach(clb, thisArg) {
2384
- if (typeof thisArg !== 'undefined') {
2385
- clb = clb.bind(thisArg);
2457
+ compareAndUpdateDefaultConfiguration(defaults, keys) {
2458
+ const overrides = [];
2459
+ if (!keys) {
2460
+ const { added, updated, removed } = compare(this._defaultConfiguration, defaults);
2461
+ keys = [...added, ...updated, ...removed];
2386
2462
  }
2387
- for (const [_, entry] of this.map) {
2388
- clb(entry.value, entry.uri, this);
2463
+ for (const key of keys) {
2464
+ for (const overrideIdentifier of overrideIdentifiersFromKey(key)) {
2465
+ const fromKeys = this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier);
2466
+ const toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier);
2467
+ const keys = [
2468
+ ...toKeys.filter(key => fromKeys.indexOf(key) === -1),
2469
+ ...fromKeys.filter(key => toKeys.indexOf(key) === -1),
2470
+ ...fromKeys.filter(key => !equals(this._defaultConfiguration.override(overrideIdentifier).getValue(key), defaults.override(overrideIdentifier).getValue(key)))
2471
+ ];
2472
+ overrides.push([overrideIdentifier, keys]);
2473
+ }
2389
2474
  }
2475
+ this.updateDefaultConfiguration(defaults);
2476
+ return { keys, overrides };
2390
2477
  }
2391
- *values() {
2392
- for (const entry of ( (this.map.values()))) {
2393
- yield entry.value;
2478
+ compareAndUpdatePolicyConfiguration(policyConfiguration) {
2479
+ const { added, updated, removed } = compare(this._policyConfiguration, policyConfiguration);
2480
+ const keys = [...added, ...updated, ...removed];
2481
+ if (keys.length) {
2482
+ this.updatePolicyConfiguration(policyConfiguration);
2394
2483
  }
2484
+ return { keys, overrides: [] };
2395
2485
  }
2396
- *keys() {
2397
- for (const entry of ( (this.map.values()))) {
2398
- yield entry.uri;
2486
+ compareAndUpdateApplicationConfiguration(application) {
2487
+ const { added, updated, removed, overrides } = compare(this.applicationConfiguration, application);
2488
+ const keys = [...added, ...updated, ...removed];
2489
+ if (keys.length) {
2490
+ this.updateApplicationConfiguration(application);
2399
2491
  }
2492
+ return { keys, overrides };
2400
2493
  }
2401
- *entries() {
2402
- for (const entry of ( (this.map.values()))) {
2403
- yield [entry.uri, entry.value];
2494
+ compareAndUpdateLocalUserConfiguration(user) {
2495
+ const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user);
2496
+ const keys = [...added, ...updated, ...removed];
2497
+ if (keys.length) {
2498
+ this.updateLocalUserConfiguration(user);
2404
2499
  }
2500
+ return { keys, overrides };
2405
2501
  }
2406
- *[(_a$1 = Symbol.toStringTag, Symbol.iterator)]() {
2407
- for (const [, entry] of this.map) {
2408
- yield [entry.uri, entry.value];
2502
+ compareAndUpdateRemoteUserConfiguration(user) {
2503
+ const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user);
2504
+ const keys = [...added, ...updated, ...removed];
2505
+ if (keys.length) {
2506
+ this.updateRemoteUserConfiguration(user);
2409
2507
  }
2508
+ return { keys, overrides };
2410
2509
  }
2411
- }
2412
- ResourceMap.defaultToKey = (resource) => ( (resource.toString()));
2413
- class ResourceSet {
2414
- constructor(entriesOrKey, toKey) {
2415
- this[_b$1] = 'ResourceSet';
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);
2510
+ compareAndUpdateWorkspaceConfiguration(workspaceConfiguration) {
2511
+ const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration);
2512
+ const keys = [...added, ...updated, ...removed];
2513
+ if (keys.length) {
2514
+ this.updateWorkspaceConfiguration(workspaceConfiguration);
2422
2515
  }
2516
+ return { keys, overrides };
2423
2517
  }
2424
- get size() {
2425
- return this._map.size;
2518
+ compareAndUpdateFolderConfiguration(resource, folderConfiguration) {
2519
+ const currentFolderConfiguration = this.folderConfigurations.get(resource);
2520
+ const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration);
2521
+ const keys = [...added, ...updated, ...removed];
2522
+ if (keys.length || !currentFolderConfiguration) {
2523
+ this.updateFolderConfiguration(resource, folderConfiguration);
2524
+ }
2525
+ return { keys, overrides };
2426
2526
  }
2427
- add(value) {
2428
- this._map.set(value, value);
2429
- return this;
2527
+ compareAndDeleteFolderConfiguration(folder) {
2528
+ const folderConfig = this.folderConfigurations.get(folder);
2529
+ if (!folderConfig) {
2530
+ throw new Error('Unknown folder');
2531
+ }
2532
+ this.deleteFolderConfiguration(folder);
2533
+ const { added, updated, removed, overrides } = compare(folderConfig, undefined);
2534
+ return { keys: [...added, ...updated, ...removed], overrides };
2430
2535
  }
2431
- clear() {
2432
- this._map.clear();
2536
+ get defaults() {
2537
+ return this._defaultConfiguration;
2433
2538
  }
2434
- delete(value) {
2435
- return this._map.delete(value);
2539
+ get applicationConfiguration() {
2540
+ return this._applicationConfiguration;
2436
2541
  }
2437
- forEach(callbackfn, thisArg) {
2438
- this._map.forEach((_value, key) => callbackfn.call(thisArg, key, key, this));
2542
+ get userConfiguration() {
2543
+ if (!this._userConfiguration) {
2544
+ this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration);
2545
+ }
2546
+ return this._userConfiguration;
2439
2547
  }
2440
- has(value) {
2441
- return this._map.has(value);
2548
+ get localUserConfiguration() {
2549
+ return this._localUserConfiguration;
2442
2550
  }
2443
- entries() {
2444
- return this._map.entries();
2551
+ get remoteUserConfiguration() {
2552
+ return this._remoteUserConfiguration;
2445
2553
  }
2446
- keys() {
2447
- return (
2448
- (this._map.keys())
2449
- );
2554
+ get workspaceConfiguration() {
2555
+ return this._workspaceConfiguration;
2450
2556
  }
2451
- values() {
2452
- return (
2453
- (this._map.keys())
2454
- );
2557
+ get folderConfigurations() {
2558
+ return this._folderConfigurations;
2455
2559
  }
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()));
2469
- }
2470
- get contents() {
2471
- return this.checkAndFreeze(this._contents);
2472
- }
2473
- get overrides() {
2474
- return this.checkAndFreeze(this._overrides);
2475
- }
2476
- get keys() {
2477
- return this.checkAndFreeze(this._keys);
2478
- }
2479
- isEmpty() {
2480
- return this._keys.length === 0 && ( (Object.keys(this._contents))).length === 0 && this._overrides.length === 0;
2481
- }
2482
- isFrozen() {
2483
- return this.frozen;
2484
- }
2485
- getValue(section) {
2486
- return section ? getConfigurationValue(this.contents, section) : this.contents;
2487
- }
2488
- getOverrideValue(section, overrideIdentifier) {
2489
- const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);
2490
- return overrideContents
2491
- ? section ? getConfigurationValue(overrideContents, section) : overrideContents
2492
- : undefined;
2493
- }
2494
- getKeysForOverrideIdentifier(identifier) {
2495
- const keys = [];
2496
- for (const override of this.overrides) {
2497
- if (override.identifiers.includes(identifier)) {
2498
- keys.push(...override.keys);
2499
- }
2560
+ getConsolidatedConfigurationModel(section, overrides, workspace) {
2561
+ let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
2562
+ if (overrides.overrideIdentifier) {
2563
+ configurationModel = configurationModel.override(overrides.overrideIdentifier);
2500
2564
  }
2501
- return distinct(keys);
2565
+ if (!this._policyConfiguration.isEmpty() && this._policyConfiguration.getValue(section) !== undefined) {
2566
+ configurationModel = configurationModel.merge(this._policyConfiguration);
2567
+ }
2568
+ return configurationModel;
2502
2569
  }
2503
- getAllOverrideIdentifiers() {
2504
- const result = [];
2505
- for (const override of this.overrides) {
2506
- result.push(...override.identifiers);
2570
+ getConsolidatedConfigurationModelForResource({ resource }, workspace) {
2571
+ let consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
2572
+ if (workspace && resource) {
2573
+ const root = workspace.getFolder(resource);
2574
+ if (root) {
2575
+ consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;
2576
+ }
2577
+ const memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);
2578
+ if (memoryConfigurationForResource) {
2579
+ consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);
2580
+ }
2507
2581
  }
2508
- return distinct(result);
2582
+ return consolidateConfiguration;
2509
2583
  }
2510
- override(identifier) {
2511
- let overrideConfigurationModel = this.overrideConfigurations.get(identifier);
2512
- if (!overrideConfigurationModel) {
2513
- overrideConfigurationModel = this.createOverrideConfigurationModel(identifier);
2514
- this.overrideConfigurations.set(identifier, overrideConfigurationModel);
2584
+ getWorkspaceConsolidatedConfiguration() {
2585
+ if (!this._workspaceConsolidatedConfiguration) {
2586
+ this._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.applicationConfiguration, this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);
2515
2587
  }
2516
- return overrideConfigurationModel;
2588
+ return this._workspaceConsolidatedConfiguration;
2517
2589
  }
2518
- merge(...others) {
2519
- const contents = deepClone(this.contents);
2520
- const overrides = deepClone(this.overrides);
2521
- const keys = [...this.keys];
2522
- for (const other of others) {
2523
- if (other.isEmpty()) {
2524
- continue;
2590
+ getFolderConsolidatedConfiguration(folder) {
2591
+ let folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);
2592
+ if (!folderConsolidatedConfiguration) {
2593
+ const workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
2594
+ const folderConfiguration = this._folderConfigurations.get(folder);
2595
+ if (folderConfiguration) {
2596
+ folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);
2597
+ this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);
2525
2598
  }
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
- }
2599
+ else {
2600
+ folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
2537
2601
  }
2538
- for (const key of other.keys) {
2539
- if (keys.indexOf(key) === -1) {
2540
- keys.push(key);
2541
- }
2602
+ }
2603
+ return folderConsolidatedConfiguration;
2604
+ }
2605
+ getFolderConfigurationModelForResource(resource, workspace) {
2606
+ if (workspace && resource) {
2607
+ const root = workspace.getFolder(resource);
2608
+ if (root) {
2609
+ return this._folderConfigurations.get(root.uri);
2542
2610
  }
2543
2611
  }
2544
- return (
2545
- (new ConfigurationModel(contents, keys, overrides))
2546
- );
2612
+ return undefined;
2547
2613
  }
2548
- freeze() {
2549
- this.frozen = true;
2550
- return this;
2614
+ toData() {
2615
+ return {
2616
+ defaults: {
2617
+ contents: this._defaultConfiguration.contents,
2618
+ overrides: this._defaultConfiguration.overrides,
2619
+ keys: this._defaultConfiguration.keys
2620
+ },
2621
+ policy: {
2622
+ contents: this._policyConfiguration.contents,
2623
+ overrides: this._policyConfiguration.overrides,
2624
+ keys: this._policyConfiguration.keys
2625
+ },
2626
+ application: {
2627
+ contents: this.applicationConfiguration.contents,
2628
+ overrides: this.applicationConfiguration.overrides,
2629
+ keys: this.applicationConfiguration.keys
2630
+ },
2631
+ user: {
2632
+ contents: this.userConfiguration.contents,
2633
+ overrides: this.userConfiguration.overrides,
2634
+ keys: this.userConfiguration.keys
2635
+ },
2636
+ workspace: {
2637
+ contents: this._workspaceConfiguration.contents,
2638
+ overrides: this._workspaceConfiguration.overrides,
2639
+ keys: this._workspaceConfiguration.keys
2640
+ },
2641
+ folders: [...( (this._folderConfigurations.keys()))].reduce((result, folder) => {
2642
+ const { contents, overrides, keys } = this._folderConfigurations.get(folder);
2643
+ result.push([folder, { contents, overrides, keys }]);
2644
+ return result;
2645
+ }, [])
2646
+ };
2551
2647
  }
2552
- clone() {
2648
+ allKeys() {
2649
+ const keys = ( (new Set()));
2650
+ this._defaultConfiguration.keys.forEach(key => keys.add(key));
2651
+ this.userConfiguration.keys.forEach(key => keys.add(key));
2652
+ this._workspaceConfiguration.keys.forEach(key => keys.add(key));
2653
+ this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.keys.forEach(key => keys.add(key)));
2654
+ return [...( (keys.values()))];
2655
+ }
2656
+ allOverrideIdentifiers() {
2657
+ const keys = ( (new Set()));
2658
+ this._defaultConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));
2659
+ this.userConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));
2660
+ this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));
2661
+ this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.getAllOverrideIdentifiers().forEach(key => keys.add(key)));
2662
+ return [...( (keys.values()))];
2663
+ }
2664
+ getAllKeysForOverrideIdentifier(overrideIdentifier) {
2665
+ const keys = ( (new Set()));
2666
+ this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
2667
+ this.userConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
2668
+ this._workspaceConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
2669
+ this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)));
2670
+ return [...( (keys.values()))];
2671
+ }
2672
+ static parse(data) {
2673
+ const defaultConfiguration = this.parseConfigurationModel(data.defaults);
2674
+ const policyConfiguration = this.parseConfigurationModel(data.policy);
2675
+ const applicationConfiguration = this.parseConfigurationModel(data.application);
2676
+ const userConfiguration = this.parseConfigurationModel(data.user);
2677
+ const workspaceConfiguration = this.parseConfigurationModel(data.workspace);
2678
+ const folders = data.folders.reduce((result, value) => {
2679
+ result.set(URI.revive(value[0]), this.parseConfigurationModel(value[1]));
2680
+ return result;
2681
+ }, ( (new ResourceMap())));
2553
2682
  return (
2554
- (new ConfigurationModel(deepClone(this.contents), [...this.keys], deepClone(this.overrides)))
2683
+ (new Configuration(
2684
+ defaultConfiguration,
2685
+ policyConfiguration,
2686
+ applicationConfiguration,
2687
+ userConfiguration,
2688
+ (new ConfigurationModel()),
2689
+ workspaceConfiguration,
2690
+ folders,
2691
+ (new ConfigurationModel()),
2692
+ (new ResourceMap())
2693
+ ))
2555
2694
  );
2556
2695
  }
2557
- createOverrideConfigurationModel(identifier) {
2558
- const overrideContents = this.getContentsForOverrideIdentifer(identifier);
2559
- if (!overrideContents || typeof overrideContents !== 'object' || !( (Object.keys(overrideContents))).length) {
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;
2576
- }
2696
+ static parseConfigurationModel(model) {
2577
2697
  return (
2578
- (new ConfigurationModel(contents, this.keys, this.overrides))
2698
+ (new ConfigurationModel(model.contents, model.keys, model.overrides))
2579
2699
  );
2580
2700
  }
2581
- mergeContents(source, target) {
2582
- for (const key of ( (Object.keys(target)))) {
2583
- if (key in source) {
2584
- if (isObject(source[key]) && isObject(target[key])) {
2585
- this.mergeContents(source[key], target[key]);
2586
- continue;
2587
- }
2588
- }
2589
- source[key] = deepClone(target[key]);
2701
+ }
2702
+ function compare(from, to) {
2703
+ const { added, removed, updated } = compareConfigurationContents(to?.rawConfiguration, from?.rawConfiguration);
2704
+ const overrides = [];
2705
+ const fromOverrideIdentifiers = from?.getAllOverrideIdentifiers() || [];
2706
+ const toOverrideIdentifiers = to?.getAllOverrideIdentifiers() || [];
2707
+ if (to) {
2708
+ const addedOverrideIdentifiers = toOverrideIdentifiers.filter(key => !fromOverrideIdentifiers.includes(key));
2709
+ for (const identifier of addedOverrideIdentifiers) {
2710
+ overrides.push([identifier, to.getKeysForOverrideIdentifier(identifier)]);
2590
2711
  }
2591
2712
  }
2592
- checkAndFreeze(data) {
2593
- if (this.frozen && !Object.isFrozen(data)) {
2594
- return deepFreeze(data);
2713
+ if (from) {
2714
+ const removedOverrideIdentifiers = fromOverrideIdentifiers.filter(key => !toOverrideIdentifiers.includes(key));
2715
+ for (const identifier of removedOverrideIdentifiers) {
2716
+ overrides.push([identifier, from.getKeysForOverrideIdentifier(identifier)]);
2595
2717
  }
2596
- return data;
2597
2718
  }
2598
- getContentsForOverrideIdentifer(identifier) {
2599
- let contentsForIdentifierOnly = null;
2600
- let contents = null;
2601
- const mergeContents = (contentsToMerge) => {
2602
- if (contentsToMerge) {
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);
2719
+ if (to && from) {
2720
+ for (const identifier of fromOverrideIdentifiers) {
2721
+ if (toOverrideIdentifiers.includes(identifier)) {
2722
+ const result = compareConfigurationContents({ contents: from.getOverrideValue(undefined, identifier) || {}, keys: from.getKeysForOverrideIdentifier(identifier) }, { contents: to.getOverrideValue(undefined, identifier) || {}, keys: to.getKeysForOverrideIdentifier(identifier) });
2723
+ overrides.push([identifier, [...result.added, ...result.removed, ...result.updated]]);
2617
2724
  }
2618
2725
  }
2619
- mergeContents(contentsForIdentifierOnly);
2620
- return contents;
2621
2726
  }
2622
- toJSON() {
2623
- return {
2624
- contents: this.contents,
2625
- overrides: this.overrides,
2626
- keys: this.keys
2627
- };
2727
+ return { added, removed, updated, overrides };
2728
+ }
2729
+ function compareConfigurationContents(to, from) {
2730
+ const added = to
2731
+ ? from ? to.keys.filter(key => from.keys.indexOf(key) === -1) : [...to.keys]
2732
+ : [];
2733
+ const removed = from
2734
+ ? to ? from.keys.filter(key => to.keys.indexOf(key) === -1) : [...from.keys]
2735
+ : [];
2736
+ const updated = [];
2737
+ if (to && from) {
2738
+ for (const key of from.keys) {
2739
+ if (to.keys.indexOf(key) !== -1) {
2740
+ const value1 = getConfigurationValue(from.contents, key);
2741
+ const value2 = getConfigurationValue(to.contents, key);
2742
+ if (!equals(value1, value2)) {
2743
+ updated.push(key);
2744
+ }
2745
+ }
2746
+ }
2628
2747
  }
2629
- setValue(key, value) {
2630
- this.addKey(key);
2631
- addToValueTree(this.contents, key, value, e => { throw new Error(e); });
2748
+ return { added, removed, updated };
2749
+ }
2750
+ class WorkspaceFolder {
2751
+ constructor(data,
2752
+ raw) {
2753
+ this.raw = raw;
2754
+ this.uri = data.uri;
2755
+ this.index = data.index;
2756
+ this.name = data.name;
2632
2757
  }
2633
- removeValue(key) {
2634
- if (this.removeKey(key)) {
2635
- removeFromValueTree(this.contents, key);
2636
- }
2758
+ toResource(relativePath) {
2759
+ return joinPath(this.uri, relativePath);
2637
2760
  }
2638
- addKey(key) {
2639
- let index = this.keys.length;
2640
- for (let i = 0; i < index; i++) {
2641
- if (key.indexOf(this.keys[i]) === 0) {
2642
- index = i;
2643
- }
2644
- }
2645
- this.keys.splice(index, 1, key);
2761
+ toJSON() {
2762
+ return { uri: this.uri, name: this.name, index: this.index };
2646
2763
  }
2647
- removeKey(key) {
2648
- const index = this.keys.indexOf(key);
2649
- if (index !== -1) {
2650
- this.keys.splice(index, 1);
2651
- return true;
2652
- }
2653
- return false;
2764
+ }
2765
+ const IPolicyService = ( (createDecorator('policy')));
2766
+ class NullPolicyService {
2767
+ constructor() {
2768
+ this.onDidChange = Event.None;
2654
2769
  }
2770
+ async updatePolicyDefinitions() { return {}; }
2771
+ getPolicyValue() { return undefined; }
2772
+ serialize() { return undefined; }
2655
2773
  }
2656
- class ConfigurationModelParser {
2657
- constructor(_name) {
2658
- this._name = _name;
2659
- this._raw = null;
2660
- this._configurationModel = null;
2661
- this._restrictedConfigurations = [];
2662
- this._parseErrors = [];
2774
+ class DefaultConfiguration extends Disposable {
2775
+ constructor() {
2776
+ super(...arguments);
2777
+ this._onDidChangeConfiguration = this._register(( (new Emitter())));
2778
+ this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
2779
+ this._configurationModel = ( (new ConfigurationModel$1()));
2663
2780
  }
2664
2781
  get configurationModel() {
2665
- return this._configurationModel || ( (new ConfigurationModel()));
2782
+ return this._configurationModel;
2666
2783
  }
2667
- get restrictedConfigurations() {
2668
- return this._restrictedConfigurations;
2784
+ async initialize() {
2785
+ this.resetConfigurationModel();
2786
+ this._register(( (Registry.as(Extensions$2.Configuration))).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.onDidUpdateConfiguration(Array.from(properties), defaultsOverrides)));
2787
+ return this.configurationModel;
2669
2788
  }
2670
- get errors() {
2671
- return this._parseErrors;
2789
+ reload() {
2790
+ this.resetConfigurationModel();
2791
+ return this.configurationModel;
2672
2792
  }
2673
- parse(content, options) {
2674
- if (!isUndefinedOrNull(content)) {
2675
- const raw = this.doParseContent(content);
2676
- this.parseRaw(raw, options);
2677
- }
2793
+ onDidUpdateConfiguration(properties, defaultsOverrides) {
2794
+ this.updateConfigurationModel(properties, ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties());
2795
+ this._onDidChangeConfiguration.fire({ defaults: this.configurationModel, properties });
2678
2796
  }
2679
- reparse(options) {
2680
- if (this._raw) {
2681
- this.parseRaw(this._raw, options);
2682
- }
2797
+ getConfigurationDefaultOverrides() {
2798
+ return {};
2683
2799
  }
2684
- parseRaw(raw, options) {
2685
- this._raw = raw;
2686
- const { contents, keys, overrides, restricted } = this.doParseRaw(raw, options);
2687
- this._configurationModel = ( (new ConfigurationModel(contents, keys, overrides)));
2688
- this._restrictedConfigurations = restricted || [];
2800
+ resetConfigurationModel() {
2801
+ this._configurationModel = ( (new ConfigurationModel$1()));
2802
+ const properties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
2803
+ this.updateConfigurationModel(( (Object.keys(properties))), properties);
2689
2804
  }
2690
- doParseContent(content) {
2691
- let raw = {};
2692
- let currentProperty = null;
2693
- let currentParent = [];
2694
- const previousParents = [];
2695
- function onValue(value) {
2696
- if (Array.isArray(currentParent)) {
2697
- currentParent.push(value);
2805
+ updateConfigurationModel(properties, configurationProperties) {
2806
+ const configurationDefaultsOverrides = this.getConfigurationDefaultOverrides();
2807
+ for (const key of properties) {
2808
+ const defaultOverrideValue = configurationDefaultsOverrides[key];
2809
+ const propertySchema = configurationProperties[key];
2810
+ if (defaultOverrideValue !== undefined) {
2811
+ this._configurationModel.addValue(key, defaultOverrideValue);
2698
2812
  }
2699
- else if (currentProperty !== null) {
2700
- currentParent[currentProperty] = value;
2813
+ else if (propertySchema) {
2814
+ this._configurationModel.addValue(key, propertySchema.default);
2701
2815
  }
2702
- }
2703
- const visitor = {
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) => {
2816
+ else {
2817
+ this._configurationModel.removeValue(key);
2729
2818
  }
2730
- };
2731
- if (content) {
2732
- try {
2733
- visit(content, visitor);
2734
- raw = currentParent[0] || {};
2819
+ }
2820
+ }
2821
+ }
2822
+ class NullPolicyConfiguration {
2823
+ constructor() {
2824
+ this.onDidChangeConfiguration = Event.None;
2825
+ this.configurationModel = ( (new ConfigurationModel$1()));
2826
+ }
2827
+ async initialize() { return this.configurationModel; }
2828
+ }
2829
+ let PolicyConfiguration = class PolicyConfiguration extends Disposable {
2830
+ get configurationModel() { return this._configurationModel; }
2831
+ constructor(defaultConfiguration, policyService, logService) {
2832
+ super();
2833
+ this.defaultConfiguration = defaultConfiguration;
2834
+ this.policyService = policyService;
2835
+ this.logService = logService;
2836
+ this._onDidChangeConfiguration = this._register(( (new Emitter())));
2837
+ this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
2838
+ this._configurationModel = ( (new ConfigurationModel$1()));
2839
+ }
2840
+ async initialize() {
2841
+ this.logService.trace('PolicyConfiguration#initialize');
2842
+ this.update(await this.updatePolicyDefinitions(this.defaultConfiguration.configurationModel.keys), false);
2843
+ this._register(this.policyService.onDidChange(policyNames => this.onDidChangePolicies(policyNames)));
2844
+ this._register(this.defaultConfiguration.onDidChangeConfiguration(async ({ properties }) => this.update(await this.updatePolicyDefinitions(properties), true)));
2845
+ return this._configurationModel;
2846
+ }
2847
+ async updatePolicyDefinitions(properties) {
2848
+ this.logService.trace('PolicyConfiguration#updatePolicyDefinitions', properties);
2849
+ const policyDefinitions = {};
2850
+ const keys = [];
2851
+ const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
2852
+ for (const key of properties) {
2853
+ const config = configurationProperties[key];
2854
+ if (!config) {
2855
+ keys.push(key);
2856
+ continue;
2735
2857
  }
2736
- catch (e) {
2737
- console.error(`Error while parsing settings file ${this._name}: ${e}`);
2738
- this._parseErrors = [e];
2858
+ if (config.policy) {
2859
+ if (config.type !== 'string' && config.type !== 'number') {
2860
+ this.logService.warn(`Policy ${config.policy.name} has unsupported type ${config.type}`);
2861
+ continue;
2862
+ }
2863
+ keys.push(key);
2864
+ policyDefinitions[config.policy.name] = { type: config.type };
2739
2865
  }
2740
2866
  }
2741
- return raw;
2867
+ if (!isEmptyObject(policyDefinitions)) {
2868
+ await this.policyService.updatePolicyDefinitions(policyDefinitions);
2869
+ }
2870
+ return keys;
2742
2871
  }
2743
- doParseRaw(raw, options) {
2744
- const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
2745
- const filtered = this.filter(raw, configurationProperties, true, options);
2746
- raw = filtered.raw;
2747
- const contents = toValuesTree(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
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 };
2872
+ onDidChangePolicies(policyNames) {
2873
+ this.logService.trace('PolicyConfiguration#onDidChangePolicies', policyNames);
2874
+ const policyConfigurations = ( (Registry.as(Extensions$2.Configuration))).getPolicyConfigurations();
2875
+ const keys = coalesce(policyNames.map(policyName => policyConfigurations.get(policyName)));
2876
+ this.update(keys, true);
2751
2877
  }
2752
- filter(properties, configurationProperties, filterOverriddenProperties, options) {
2753
- if (!options?.scopes && !options?.skipRestricted) {
2754
- return { raw: properties, restricted: [] };
2755
- }
2756
- const raw = {};
2757
- const restricted = [];
2758
- for (const key in properties) {
2759
- if (OVERRIDE_PROPERTY_REGEX.test(key) && filterOverriddenProperties) {
2760
- const result = this.filter(properties[key], configurationProperties, false, options);
2761
- raw[key] = result.raw;
2762
- restricted.push(...result.restricted);
2878
+ update(keys, trigger) {
2879
+ this.logService.trace('PolicyConfiguration#update', keys);
2880
+ const configurationProperties = ( (Registry.as(Extensions$2.Configuration))).getConfigurationProperties();
2881
+ const changed = [];
2882
+ const wasEmpty = this._configurationModel.isEmpty();
2883
+ for (const key of keys) {
2884
+ const policyName = configurationProperties[key]?.policy?.name;
2885
+ if (policyName) {
2886
+ const policyValue = this.policyService.getPolicyValue(policyName);
2887
+ if (wasEmpty ? policyValue !== undefined : !equals(this._configurationModel.getValue(key), policyValue)) {
2888
+ changed.push([key, policyValue]);
2889
+ }
2763
2890
  }
2764
2891
  else {
2765
- const propertySchema = configurationProperties[key];
2766
- const scope = propertySchema ? typeof propertySchema.scope !== 'undefined' ? propertySchema.scope : 3 : undefined;
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
- }
2892
+ if (this._configurationModel.getValue(key) !== undefined) {
2893
+ changed.push([key, undefined]);
2774
2894
  }
2775
2895
  }
2776
2896
  }
2777
- return { raw, restricted };
2778
- }
2779
- toOverrides(raw, conflictReporter) {
2780
- const overrides = [];
2781
- for (const key of ( (Object.keys(raw)))) {
2782
- if (OVERRIDE_PROPERTY_REGEX.test(key)) {
2783
- const overrideRaw = {};
2784
- for (const keyInOverrideRaw in raw[key]) {
2785
- overrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];
2897
+ if (changed.length) {
2898
+ this.logService.trace('PolicyConfiguration#changed', changed);
2899
+ const old = this._configurationModel;
2900
+ this._configurationModel = ( (new ConfigurationModel$1()));
2901
+ for (const key of old.keys) {
2902
+ this._configurationModel.setValue(key, old.getValue(key));
2903
+ }
2904
+ for (const [key, policyValue] of changed) {
2905
+ if (policyValue === undefined) {
2906
+ this._configurationModel.removeValue(key);
2907
+ }
2908
+ else {
2909
+ this._configurationModel.setValue(key, policyValue);
2786
2910
  }
2787
- overrides.push({
2788
- identifiers: overrideIdentifiersFromKey(key),
2789
- keys: ( (Object.keys(overrideRaw))),
2790
- contents: toValuesTree(overrideRaw, conflictReporter)
2791
- });
2911
+ }
2912
+ if (trigger) {
2913
+ this._onDidChangeConfiguration.fire(this._configurationModel);
2792
2914
  }
2793
2915
  }
2794
- return overrides;
2795
2916
  }
2917
+ };
2918
+ PolicyConfiguration = ( (__decorate([
2919
+ ( (__param(1, IPolicyService))),
2920
+ ( (__param(2, ILogService)))
2921
+ ], PolicyConfiguration)));
2922
+ function isConfigurationOverrides(thing) {
2923
+ return thing
2924
+ && typeof thing === 'object'
2925
+ && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')
2926
+ && (!thing.resource || thing.resource instanceof URI);
2796
2927
  }
2797
- class UserSettings extends Disposable {
2798
- constructor(userSettingsResource, scopes, extUri, fileService) {
2799
- super();
2800
- this.userSettingsResource = userSettingsResource;
2801
- this.scopes = scopes;
2802
- this.fileService = fileService;
2803
- this._onDidChange = this._register(( (new Emitter())));
2804
- this.onDidChange = this._onDidChange.event;
2805
- this.parser = ( (new ConfigurationModelParser( (this.userSettingsResource.toString()))));
2806
- this.parseOptions = { scopes: this.scopes };
2807
- this._register(this.fileService.watch(extUri.dirname(this.userSettingsResource)));
2808
- this._register(this.fileService.watch(this.userSettingsResource));
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()));
2928
+ class StandaloneConfigurationService {
2929
+ constructor() {
2930
+ this._onDidChangeConfiguration = ( (new Emitter()));
2931
+ this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
2932
+ const defaultConfiguration = ( (new DefaultConfiguration$1()));
2933
+ this._configuration = ( (new Configuration$1(
2934
+ defaultConfiguration.reload(),
2935
+ (new ConfigurationModel$1()),
2936
+ (new ConfigurationModel$1()),
2937
+ (new ConfigurationModel$1())
2938
+ )));
2939
+ defaultConfiguration.dispose();
2810
2940
  }
2811
- async loadConfiguration() {
2812
- try {
2813
- const content = await this.fileService.readFile(this.userSettingsResource);
2814
- this.parser.parse(( (content.value.toString())) || '{}', this.parseOptions);
2815
- return this.parser.configurationModel;
2941
+ getValue(arg1, arg2) {
2942
+ const section = typeof arg1 === 'string' ? arg1 : undefined;
2943
+ const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
2944
+ return this._configuration.getValue(section, overrides, undefined);
2945
+ }
2946
+ updateValues(values) {
2947
+ const previous = { data: this._configuration.toData() };
2948
+ const changedKeys = [];
2949
+ for (const entry of values) {
2950
+ const [key, value] = entry;
2951
+ if (this.getValue(key) === value) {
2952
+ continue;
2953
+ }
2954
+ this._configuration.updateValue(key, value);
2955
+ changedKeys.push(key);
2816
2956
  }
2817
- catch (e) {
2818
- return (
2819
- (new ConfigurationModel())
2820
- );
2957
+ if (changedKeys.length > 0) {
2958
+ const configurationChangeEvent = ( (new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration)));
2959
+ configurationChangeEvent.source = 8 ;
2960
+ configurationChangeEvent.sourceConfig = null;
2961
+ this._onDidChangeConfiguration.fire(configurationChangeEvent);
2821
2962
  }
2963
+ return Promise.resolve();
2822
2964
  }
2823
- reparse() {
2824
- this.parser.reparse(this.parseOptions);
2825
- return this.parser.configurationModel;
2965
+ updateValue(key, value, arg3, arg4) {
2966
+ return this.updateValues([[key, value]]);
2826
2967
  }
2827
- getRestrictedSettings() {
2828
- return this.parser.restrictedConfigurations;
2968
+ inspect(key, options = {}) {
2969
+ return this._configuration.inspect(key, options, undefined);
2829
2970
  }
2830
- }
2831
- class Configuration {
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;
2971
+ keys() {
2972
+ return (
2973
+ (this._configuration.keys(undefined))
2974
+ );
2846
2975
  }
2847
- getValue(section, overrides, workspace) {
2848
- const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(section, overrides, workspace);
2849
- return consolidateConfigurationModel.getValue(section);
2976
+ reloadConfiguration() {
2977
+ return Promise.resolve(undefined);
2850
2978
  }
2851
- updateValue(key, value, overrides = {}) {
2852
- let memoryConfiguration;
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
- }
2872
- }
2873
- inspect(key, overrides, workspace) {
2874
- const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(key, overrides, workspace);
2875
- const folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace);
2876
- const memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration;
2877
- const defaultValue = overrides.overrideIdentifier ? this._defaultConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._defaultConfiguration.freeze().getValue(key);
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
2979
+ getConfigurationData() {
2980
+ const emptyModel = {
2981
+ contents: {},
2982
+ keys: [],
2983
+ overrides: []
2909
2984
  };
2910
- }
2911
- keys(workspace) {
2912
- const folderConfigurationModel = this.getFolderConfigurationModelForResource(undefined, workspace);
2913
2985
  return {
2914
- default: this._defaultConfiguration.freeze().keys,
2915
- user: this.userConfiguration.freeze().keys,
2916
- workspace: this._workspaceConfiguration.freeze().keys,
2917
- workspaceFolder: folderConfigurationModel ? folderConfigurationModel.freeze().keys : []
2986
+ defaults: emptyModel,
2987
+ policy: emptyModel,
2988
+ application: emptyModel,
2989
+ user: emptyModel,
2990
+ workspace: emptyModel,
2991
+ folders: []
2918
2992
  };
2919
2993
  }
2920
- updateDefaultConfiguration(defaultConfiguration) {
2921
- this._defaultConfiguration = defaultConfiguration;
2922
- this._workspaceConsolidatedConfiguration = null;
2923
- this._foldersConsolidatedConfigurations.clear();
2994
+ }
2995
+ class StringIterator {
2996
+ constructor() {
2997
+ this._value = '';
2998
+ this._pos = 0;
2924
2999
  }
2925
- updatePolicyConfiguration(policyConfiguration) {
2926
- this._policyConfiguration = policyConfiguration;
3000
+ reset(key) {
3001
+ this._value = key;
3002
+ this._pos = 0;
3003
+ return this;
2927
3004
  }
2928
- updateApplicationConfiguration(applicationConfiguration) {
2929
- this._applicationConfiguration = applicationConfiguration;
2930
- this._workspaceConsolidatedConfiguration = null;
2931
- this._foldersConsolidatedConfigurations.clear();
3005
+ next() {
3006
+ this._pos += 1;
3007
+ return this;
2932
3008
  }
2933
- updateLocalUserConfiguration(localUserConfiguration) {
2934
- this._localUserConfiguration = localUserConfiguration;
2935
- this._userConfiguration = null;
2936
- this._workspaceConsolidatedConfiguration = null;
2937
- this._foldersConsolidatedConfigurations.clear();
3009
+ hasNext() {
3010
+ return this._pos < this._value.length - 1;
2938
3011
  }
2939
- updateRemoteUserConfiguration(remoteUserConfiguration) {
2940
- this._remoteUserConfiguration = remoteUserConfiguration;
2941
- this._userConfiguration = null;
2942
- this._workspaceConsolidatedConfiguration = null;
2943
- this._foldersConsolidatedConfigurations.clear();
3012
+ cmp(a) {
3013
+ const aCode = a.charCodeAt(0);
3014
+ const thisCode = this._value.charCodeAt(this._pos);
3015
+ return aCode - thisCode;
2944
3016
  }
2945
- updateWorkspaceConfiguration(workspaceConfiguration) {
2946
- this._workspaceConfiguration = workspaceConfiguration;
2947
- this._workspaceConsolidatedConfiguration = null;
2948
- this._foldersConsolidatedConfigurations.clear();
3017
+ value() {
3018
+ return this._value[this._pos];
2949
3019
  }
2950
- updateFolderConfiguration(resource, configuration) {
2951
- this._folderConfigurations.set(resource, configuration);
2952
- this._foldersConsolidatedConfigurations.delete(resource);
3020
+ }
3021
+ class ConfigKeysIterator {
3022
+ constructor(_caseSensitive = true) {
3023
+ this._caseSensitive = _caseSensitive;
2953
3024
  }
2954
- deleteFolderConfiguration(resource) {
2955
- this.folderConfigurations.delete(resource);
2956
- this._foldersConsolidatedConfigurations.delete(resource);
3025
+ reset(key) {
3026
+ this._value = key;
3027
+ this._from = 0;
3028
+ this._to = 0;
3029
+ return this.next();
2957
3030
  }
2958
- compareAndUpdateDefaultConfiguration(defaults, keys) {
2959
- const overrides = [];
2960
- if (!keys) {
2961
- const { added, updated, removed } = compare(this._defaultConfiguration, defaults);
2962
- keys = [...added, ...updated, ...removed];
2963
- }
2964
- for (const key of keys) {
2965
- for (const overrideIdentifier of overrideIdentifiersFromKey(key)) {
2966
- const fromKeys = this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier);
2967
- const toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier);
2968
- const keys = [
2969
- ...toKeys.filter(key => fromKeys.indexOf(key) === -1),
2970
- ...fromKeys.filter(key => toKeys.indexOf(key) === -1),
2971
- ...fromKeys.filter(key => !equals(this._defaultConfiguration.override(overrideIdentifier).getValue(key), defaults.override(overrideIdentifier).getValue(key)))
2972
- ];
2973
- overrides.push([overrideIdentifier, keys]);
3031
+ hasNext() {
3032
+ return this._to < this._value.length;
3033
+ }
3034
+ next() {
3035
+ this._from = this._to;
3036
+ let justSeps = true;
3037
+ for (; this._to < this._value.length; this._to++) {
3038
+ const ch = this._value.charCodeAt(this._to);
3039
+ if (ch === 46 ) {
3040
+ if (justSeps) {
3041
+ this._from++;
3042
+ }
3043
+ else {
3044
+ break;
3045
+ }
3046
+ }
3047
+ else {
3048
+ justSeps = false;
2974
3049
  }
2975
3050
  }
2976
- this.updateDefaultConfiguration(defaults);
2977
- return { keys, overrides };
3051
+ return this;
2978
3052
  }
2979
- compareAndUpdatePolicyConfiguration(policyConfiguration) {
2980
- const { added, updated, removed } = compare(this._policyConfiguration, policyConfiguration);
2981
- const keys = [...added, ...updated, ...removed];
2982
- if (keys.length) {
2983
- this.updatePolicyConfiguration(policyConfiguration);
2984
- }
2985
- return { keys, overrides: [] };
3053
+ cmp(a) {
3054
+ return this._caseSensitive
3055
+ ? compareSubstring(a, this._value, 0, a.length, this._from, this._to)
3056
+ : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);
2986
3057
  }
2987
- compareAndUpdateApplicationConfiguration(application) {
2988
- const { added, updated, removed, overrides } = compare(this.applicationConfiguration, application);
2989
- const keys = [...added, ...updated, ...removed];
2990
- if (keys.length) {
2991
- this.updateApplicationConfiguration(application);
2992
- }
2993
- return { keys, overrides };
3058
+ value() {
3059
+ return this._value.substring(this._from, this._to);
2994
3060
  }
2995
- compareAndUpdateLocalUserConfiguration(user) {
2996
- const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user);
2997
- const keys = [...added, ...updated, ...removed];
2998
- if (keys.length) {
2999
- this.updateLocalUserConfiguration(user);
3000
- }
3001
- return { keys, overrides };
3061
+ }
3062
+ class PathIterator {
3063
+ constructor(_splitOnBackslash = true, _caseSensitive = true) {
3064
+ this._splitOnBackslash = _splitOnBackslash;
3065
+ this._caseSensitive = _caseSensitive;
3002
3066
  }
3003
- compareAndUpdateRemoteUserConfiguration(user) {
3004
- const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user);
3005
- const keys = [...added, ...updated, ...removed];
3006
- if (keys.length) {
3007
- this.updateRemoteUserConfiguration(user);
3067
+ reset(key) {
3068
+ this._from = 0;
3069
+ this._to = 0;
3070
+ this._value = key;
3071
+ this._valueLen = key.length;
3072
+ for (let pos = key.length - 1; pos >= 0; pos--, this._valueLen--) {
3073
+ const ch = this._value.charCodeAt(pos);
3074
+ if (!((ch === 47 || this._splitOnBackslash && ch === 92) )) {
3075
+ break;
3076
+ }
3008
3077
  }
3009
- return { keys, overrides };
3078
+ return this.next();
3010
3079
  }
3011
- compareAndUpdateWorkspaceConfiguration(workspaceConfiguration) {
3012
- const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration);
3013
- const keys = [...added, ...updated, ...removed];
3014
- if (keys.length) {
3015
- this.updateWorkspaceConfiguration(workspaceConfiguration);
3016
- }
3017
- return { keys, overrides };
3080
+ hasNext() {
3081
+ return this._to < this._valueLen;
3018
3082
  }
3019
- compareAndUpdateFolderConfiguration(resource, folderConfiguration) {
3020
- const currentFolderConfiguration = this.folderConfigurations.get(resource);
3021
- const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration);
3022
- const keys = [...added, ...updated, ...removed];
3023
- if (keys.length || !currentFolderConfiguration) {
3024
- this.updateFolderConfiguration(resource, folderConfiguration);
3083
+ next() {
3084
+ this._from = this._to;
3085
+ let justSeps = true;
3086
+ for (; this._to < this._valueLen; this._to++) {
3087
+ const ch = this._value.charCodeAt(this._to);
3088
+ if (ch === 47 || this._splitOnBackslash && ch === 92 ) {
3089
+ if (justSeps) {
3090
+ this._from++;
3091
+ }
3092
+ else {
3093
+ break;
3094
+ }
3095
+ }
3096
+ else {
3097
+ justSeps = false;
3098
+ }
3025
3099
  }
3026
- return { keys, overrides };
3100
+ return this;
3027
3101
  }
3028
- compareAndDeleteFolderConfiguration(folder) {
3029
- const folderConfig = this.folderConfigurations.get(folder);
3030
- if (!folderConfig) {
3031
- throw new Error('Unknown folder');
3032
- }
3033
- this.deleteFolderConfiguration(folder);
3034
- const { added, updated, removed, overrides } = compare(folderConfig, undefined);
3035
- return { keys: [...added, ...updated, ...removed], overrides };
3102
+ cmp(a) {
3103
+ return this._caseSensitive
3104
+ ? compareSubstring(a, this._value, 0, a.length, this._from, this._to)
3105
+ : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);
3036
3106
  }
3037
- get defaults() {
3038
- return this._defaultConfiguration;
3107
+ value() {
3108
+ return this._value.substring(this._from, this._to);
3039
3109
  }
3040
- get applicationConfiguration() {
3041
- return this._applicationConfiguration;
3110
+ }
3111
+ class UriIterator {
3112
+ constructor(_ignorePathCasing, _ignoreQueryAndFragment) {
3113
+ this._ignorePathCasing = _ignorePathCasing;
3114
+ this._ignoreQueryAndFragment = _ignoreQueryAndFragment;
3115
+ this._states = [];
3116
+ this._stateIdx = 0;
3042
3117
  }
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();
3048
- }
3118
+ reset(key) {
3119
+ this._value = key;
3120
+ this._states = [];
3121
+ if (this._value.scheme) {
3122
+ this._states.push(1 );
3049
3123
  }
3050
- return this._userConfiguration;
3051
- }
3052
- get localUserConfiguration() {
3053
- return this._localUserConfiguration;
3054
- }
3055
- get remoteUserConfiguration() {
3056
- return this._remoteUserConfiguration;
3057
- }
3058
- get workspaceConfiguration() {
3059
- return this._workspaceConfiguration;
3060
- }
3061
- get folderConfigurations() {
3062
- return this._folderConfigurations;
3063
- }
3064
- getConsolidatedConfigurationModel(section, overrides, workspace) {
3065
- let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
3066
- if (overrides.overrideIdentifier) {
3067
- configurationModel = configurationModel.override(overrides.overrideIdentifier);
3124
+ if (this._value.authority) {
3125
+ this._states.push(2 );
3068
3126
  }
3069
- if (!this._policyConfiguration.isEmpty() && this._policyConfiguration.getValue(section) !== undefined) {
3070
- configurationModel = configurationModel.merge(this._policyConfiguration);
3127
+ if (this._value.path) {
3128
+ this._pathIterator = ( (new PathIterator(false, !this._ignorePathCasing(key))));
3129
+ this._pathIterator.reset(key.path);
3130
+ if (this._pathIterator.value()) {
3131
+ this._states.push(3 );
3132
+ }
3071
3133
  }
3072
- return configurationModel;
3073
- }
3074
- getConsolidatedConfigurationModelForResource({ resource }, workspace) {
3075
- let consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
3076
- if (workspace && resource) {
3077
- const root = workspace.getFolder(resource);
3078
- if (root) {
3079
- consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;
3134
+ if (!this._ignoreQueryAndFragment(key)) {
3135
+ if (this._value.query) {
3136
+ this._states.push(4 );
3080
3137
  }
3081
- const memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);
3082
- if (memoryConfigurationForResource) {
3083
- consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);
3138
+ if (this._value.fragment) {
3139
+ this._states.push(5 );
3084
3140
  }
3085
3141
  }
3086
- return consolidateConfiguration;
3142
+ this._stateIdx = 0;
3143
+ return this;
3087
3144
  }
3088
- getWorkspaceConsolidatedConfiguration() {
3089
- if (!this._workspaceConsolidatedConfiguration) {
3090
- this._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.applicationConfiguration, this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);
3091
- if (this._freeze) {
3092
- this._workspaceConfiguration = this._workspaceConfiguration.freeze();
3093
- }
3145
+ next() {
3146
+ if (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext()) {
3147
+ this._pathIterator.next();
3094
3148
  }
3095
- return this._workspaceConsolidatedConfiguration;
3149
+ else {
3150
+ this._stateIdx += 1;
3151
+ }
3152
+ return this;
3096
3153
  }
3097
- getFolderConsolidatedConfiguration(folder) {
3098
- let folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);
3099
- if (!folderConsolidatedConfiguration) {
3100
- const workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
3101
- const folderConfiguration = this._folderConfigurations.get(folder);
3102
- if (folderConfiguration) {
3103
- folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);
3104
- if (this._freeze) {
3105
- folderConsolidatedConfiguration = folderConsolidatedConfiguration.freeze();
3106
- }
3107
- this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);
3108
- }
3109
- else {
3110
- folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
3111
- }
3154
+ hasNext() {
3155
+ return (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext())
3156
+ || this._stateIdx < this._states.length - 1;
3157
+ }
3158
+ cmp(a) {
3159
+ if (this._states[this._stateIdx] === 1 ) {
3160
+ return compareIgnoreCase(a, this._value.scheme);
3112
3161
  }
3113
- return folderConsolidatedConfiguration;
3162
+ else if (this._states[this._stateIdx] === 2 ) {
3163
+ return compareIgnoreCase(a, this._value.authority);
3164
+ }
3165
+ else if (this._states[this._stateIdx] === 3 ) {
3166
+ return this._pathIterator.cmp(a);
3167
+ }
3168
+ else if (this._states[this._stateIdx] === 4 ) {
3169
+ return compare$1(a, this._value.query);
3170
+ }
3171
+ else if (this._states[this._stateIdx] === 5 ) {
3172
+ return compare$1(a, this._value.fragment);
3173
+ }
3174
+ throw new Error();
3114
3175
  }
3115
- getFolderConfigurationModelForResource(resource, workspace) {
3116
- if (workspace && resource) {
3117
- const root = workspace.getFolder(resource);
3118
- if (root) {
3119
- return this._folderConfigurations.get(root.uri);
3120
- }
3176
+ value() {
3177
+ if (this._states[this._stateIdx] === 1 ) {
3178
+ return this._value.scheme;
3121
3179
  }
3122
- return undefined;
3180
+ else if (this._states[this._stateIdx] === 2 ) {
3181
+ return this._value.authority;
3182
+ }
3183
+ else if (this._states[this._stateIdx] === 3 ) {
3184
+ return this._pathIterator.value();
3185
+ }
3186
+ else if (this._states[this._stateIdx] === 4 ) {
3187
+ return this._value.query;
3188
+ }
3189
+ else if (this._states[this._stateIdx] === 5 ) {
3190
+ return this._value.fragment;
3191
+ }
3192
+ throw new Error();
3123
3193
  }
3124
- toData() {
3125
- return {
3126
- defaults: {
3127
- contents: this._defaultConfiguration.contents,
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
- };
3194
+ }
3195
+ class TernarySearchTreeNode {
3196
+ constructor() {
3197
+ this.height = 1;
3157
3198
  }
3158
- allKeys() {
3159
- const keys = ( (new Set()));
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()))];
3199
+ isEmpty() {
3200
+ return !this.left && !this.mid && !this.right && !this.value;
3165
3201
  }
3166
- allOverrideIdentifiers() {
3167
- const keys = ( (new Set()));
3168
- this._defaultConfiguration.freeze().getAllOverrideIdentifiers().forEach(key => keys.add(key));
3169
- this.userConfiguration.freeze().getAllOverrideIdentifiers().forEach(key => keys.add(key));
3170
- this._workspaceConfiguration.freeze().getAllOverrideIdentifiers().forEach(key => keys.add(key));
3171
- this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.freeze().getAllOverrideIdentifiers().forEach(key => keys.add(key)));
3172
- return [...( (keys.values()))];
3202
+ rotateLeft() {
3203
+ const tmp = this.right;
3204
+ this.right = tmp.left;
3205
+ tmp.left = this;
3206
+ this.updateHeight();
3207
+ tmp.updateHeight();
3208
+ return tmp;
3173
3209
  }
3174
- getAllKeysForOverrideIdentifier(overrideIdentifier) {
3175
- const keys = ( (new Set()));
3176
- this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
3177
- this.userConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
3178
- this._workspaceConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));
3179
- this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)));
3180
- return [...( (keys.values()))];
3210
+ rotateRight() {
3211
+ const tmp = this.left;
3212
+ this.left = tmp.right;
3213
+ tmp.right = this;
3214
+ this.updateHeight();
3215
+ tmp.updateHeight();
3216
+ return tmp;
3181
3217
  }
3182
- static parse(data) {
3183
- const defaultConfiguration = this.parseConfigurationModel(data.defaults);
3184
- const policyConfiguration = this.parseConfigurationModel(data.policy);
3185
- const applicationConfiguration = this.parseConfigurationModel(data.application);
3186
- const userConfiguration = this.parseConfigurationModel(data.user);
3187
- const workspaceConfiguration = this.parseConfigurationModel(data.workspace);
3188
- const folders = data.folders.reduce((result, value) => {
3189
- result.set(URI.revive(value[0]), this.parseConfigurationModel(value[1]));
3190
- return result;
3191
- }, ( (new ResourceMap$1())));
3218
+ updateHeight() {
3219
+ this.height = 1 + Math.max(this.heightLeft, this.heightRight);
3220
+ }
3221
+ balanceFactor() {
3222
+ return this.heightRight - this.heightLeft;
3223
+ }
3224
+ get heightLeft() {
3225
+ return this.left?.height ?? 0;
3226
+ }
3227
+ get heightRight() {
3228
+ return this.right?.height ?? 0;
3229
+ }
3230
+ }
3231
+ class TernarySearchTree {
3232
+ static forUris(ignorePathCasing = () => false, ignoreQueryAndFragment = () => false) {
3192
3233
  return (
3193
- (new Configuration(
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
- ))
3234
+ (new TernarySearchTree( (new UriIterator(ignorePathCasing, ignoreQueryAndFragment))))
3205
3235
  );
3206
3236
  }
3207
- static parseConfigurationModel(model) {
3208
- return ( (new ConfigurationModel(model.contents, model.keys, model.overrides))).freeze();
3237
+ static forPaths(ignorePathCasing = false) {
3238
+ return (
3239
+ (new TernarySearchTree( (new PathIterator(undefined, !ignorePathCasing))))
3240
+ );
3209
3241
  }
3210
- }
3211
- function compare(from, to) {
3212
- const { added, removed, updated } = compareConfigurationContents(to, from);
3213
- const overrides = [];
3214
- const fromOverrideIdentifiers = from?.getAllOverrideIdentifiers() || [];
3215
- const toOverrideIdentifiers = to?.getAllOverrideIdentifiers() || [];
3216
- if (to) {
3217
- const addedOverrideIdentifiers = toOverrideIdentifiers.filter(key => !fromOverrideIdentifiers.includes(key));
3218
- for (const identifier of addedOverrideIdentifiers) {
3219
- overrides.push([identifier, to.getKeysForOverrideIdentifier(identifier)]);
3242
+ static forStrings() {
3243
+ return (
3244
+ (new TernarySearchTree( (new StringIterator())))
3245
+ );
3246
+ }
3247
+ static forConfigKeys() {
3248
+ return (
3249
+ (new TernarySearchTree( (new ConfigKeysIterator())))
3250
+ );
3251
+ }
3252
+ constructor(segments) {
3253
+ this._iter = segments;
3254
+ }
3255
+ clear() {
3256
+ this._root = undefined;
3257
+ }
3258
+ fill(values, keys) {
3259
+ if (keys) {
3260
+ const arr = keys.slice(0);
3261
+ shuffle(arr);
3262
+ for (const k of arr) {
3263
+ this.set(k, values);
3264
+ }
3265
+ }
3266
+ else {
3267
+ const arr = values.slice(0);
3268
+ shuffle(arr);
3269
+ for (const entry of arr) {
3270
+ this.set(entry[0], entry[1]);
3271
+ }
3220
3272
  }
3221
3273
  }
3222
- if (from) {
3223
- const removedOverrideIdentifiers = fromOverrideIdentifiers.filter(key => !toOverrideIdentifiers.includes(key));
3224
- for (const identifier of removedOverrideIdentifiers) {
3225
- overrides.push([identifier, from.getKeysForOverrideIdentifier(identifier)]);
3274
+ set(key, element) {
3275
+ const iter = this._iter.reset(key);
3276
+ let node;
3277
+ if (!this._root) {
3278
+ this._root = ( (new TernarySearchTreeNode()));
3279
+ this._root.segment = iter.value();
3280
+ }
3281
+ const stack = [];
3282
+ node = this._root;
3283
+ while (true) {
3284
+ const val = iter.cmp(node.segment);
3285
+ if (val > 0) {
3286
+ if (!node.left) {
3287
+ node.left = ( (new TernarySearchTreeNode()));
3288
+ node.left.segment = iter.value();
3289
+ }
3290
+ stack.push([-1 , node]);
3291
+ node = node.left;
3292
+ }
3293
+ else if (val < 0) {
3294
+ if (!node.right) {
3295
+ node.right = ( (new TernarySearchTreeNode()));
3296
+ node.right.segment = iter.value();
3297
+ }
3298
+ stack.push([1 , node]);
3299
+ node = node.right;
3300
+ }
3301
+ else if (iter.hasNext()) {
3302
+ iter.next();
3303
+ if (!node.mid) {
3304
+ node.mid = ( (new TernarySearchTreeNode()));
3305
+ node.mid.segment = iter.value();
3306
+ }
3307
+ stack.push([0 , node]);
3308
+ node = node.mid;
3309
+ }
3310
+ else {
3311
+ break;
3312
+ }
3313
+ }
3314
+ const oldElement = node.value;
3315
+ node.value = element;
3316
+ node.key = key;
3317
+ for (let i = stack.length - 1; i >= 0; i--) {
3318
+ const node = stack[i][1];
3319
+ node.updateHeight();
3320
+ const bf = node.balanceFactor();
3321
+ if (bf < -1 || bf > 1) {
3322
+ const d1 = stack[i][0];
3323
+ const d2 = stack[i + 1][0];
3324
+ if (d1 === 1 && d2 === 1 ) {
3325
+ stack[i][1] = node.rotateLeft();
3326
+ }
3327
+ else if (d1 === -1 && d2 === -1 ) {
3328
+ stack[i][1] = node.rotateRight();
3329
+ }
3330
+ else if (d1 === 1 && d2 === -1 ) {
3331
+ node.right = stack[i + 1][1] = stack[i + 1][1].rotateRight();
3332
+ stack[i][1] = node.rotateLeft();
3333
+ }
3334
+ else if (d1 === -1 && d2 === 1 ) {
3335
+ node.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft();
3336
+ stack[i][1] = node.rotateRight();
3337
+ }
3338
+ else {
3339
+ throw new Error();
3340
+ }
3341
+ if (i > 0) {
3342
+ switch (stack[i - 1][0]) {
3343
+ case -1 :
3344
+ stack[i - 1][1].left = stack[i][1];
3345
+ break;
3346
+ case 1 :
3347
+ stack[i - 1][1].right = stack[i][1];
3348
+ break;
3349
+ case 0 :
3350
+ stack[i - 1][1].mid = stack[i][1];
3351
+ break;
3352
+ }
3353
+ }
3354
+ else {
3355
+ this._root = stack[0][1];
3356
+ }
3357
+ }
3226
3358
  }
3359
+ return oldElement;
3227
3360
  }
3228
- if (to && from) {
3229
- for (const identifier of fromOverrideIdentifiers) {
3230
- if (toOverrideIdentifiers.includes(identifier)) {
3231
- const result = compareConfigurationContents({ contents: from.getOverrideValue(undefined, identifier) || {}, keys: from.getKeysForOverrideIdentifier(identifier) }, { contents: to.getOverrideValue(undefined, identifier) || {}, keys: to.getKeysForOverrideIdentifier(identifier) });
3232
- overrides.push([identifier, [...result.added, ...result.removed, ...result.updated]]);
3361
+ get(key) {
3362
+ return this._getNode(key)?.value;
3363
+ }
3364
+ _getNode(key) {
3365
+ const iter = this._iter.reset(key);
3366
+ let node = this._root;
3367
+ while (node) {
3368
+ const val = iter.cmp(node.segment);
3369
+ if (val > 0) {
3370
+ node = node.left;
3371
+ }
3372
+ else if (val < 0) {
3373
+ node = node.right;
3374
+ }
3375
+ else if (iter.hasNext()) {
3376
+ iter.next();
3377
+ node = node.mid;
3378
+ }
3379
+ else {
3380
+ break;
3233
3381
  }
3234
3382
  }
3383
+ return node;
3235
3384
  }
3236
- return { added, removed, updated, overrides };
3237
- }
3238
- function compareConfigurationContents(to, from) {
3239
- const added = to
3240
- ? from ? to.keys.filter(key => from.keys.indexOf(key) === -1) : [...to.keys]
3241
- : [];
3242
- const removed = from
3243
- ? to ? from.keys.filter(key => to.keys.indexOf(key) === -1) : [...from.keys]
3244
- : [];
3245
- const updated = [];
3246
- if (to && from) {
3247
- for (const key of from.keys) {
3248
- if (to.keys.indexOf(key) !== -1) {
3249
- const value1 = getConfigurationValue(from.contents, key);
3250
- const value2 = getConfigurationValue(to.contents, key);
3251
- if (!equals(value1, value2)) {
3252
- updated.push(key);
3253
- }
3385
+ has(key) {
3386
+ const node = this._getNode(key);
3387
+ return !(node?.value === undefined && node?.mid === undefined);
3388
+ }
3389
+ delete(key) {
3390
+ return this._delete(key, false);
3391
+ }
3392
+ deleteSuperstr(key) {
3393
+ return this._delete(key, true);
3394
+ }
3395
+ _delete(key, superStr) {
3396
+ const iter = this._iter.reset(key);
3397
+ const stack = [];
3398
+ let node = this._root;
3399
+ while (node) {
3400
+ const val = iter.cmp(node.segment);
3401
+ if (val > 0) {
3402
+ stack.push([-1 , node]);
3403
+ node = node.left;
3404
+ }
3405
+ else if (val < 0) {
3406
+ stack.push([1 , node]);
3407
+ node = node.right;
3408
+ }
3409
+ else if (iter.hasNext()) {
3410
+ iter.next();
3411
+ stack.push([0 , node]);
3412
+ node = node.mid;
3413
+ }
3414
+ else {
3415
+ break;
3254
3416
  }
3255
3417
  }
3256
- }
3257
- return { added, removed, updated };
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);
3418
+ if (!node) {
3419
+ return;
3284
3420
  }
3285
- }
3286
- getLevel() {
3287
- return this.level;
3288
- }
3289
- }
3290
- class ConsoleMainLogger extends AbstractLogger {
3291
- constructor(logLevel = DEFAULT_LOG_LEVEL) {
3292
- super();
3293
- this.setLevel(logLevel);
3294
- this.useColors = !isWindows;
3295
- }
3296
- trace(message, ...args) {
3297
- if (this.getLevel() <= LogLevel.Trace) {
3298
- if (this.useColors) {
3299
- console.log(`\x1b[90m[main ${now()}]\x1b[0m`, message, ...args);
3421
+ if (superStr) {
3422
+ node.left = undefined;
3423
+ node.mid = undefined;
3424
+ node.right = undefined;
3425
+ node.height = 1;
3426
+ }
3427
+ else {
3428
+ node.key = undefined;
3429
+ node.value = undefined;
3430
+ }
3431
+ if (!node.mid && !node.value) {
3432
+ if (node.left && node.right) {
3433
+ const min = this._min(node.right);
3434
+ if (min.key) {
3435
+ const { key, value, segment } = min;
3436
+ this._delete(min.key, false);
3437
+ node.key = key;
3438
+ node.value = value;
3439
+ node.segment = segment;
3440
+ }
3300
3441
  }
3301
3442
  else {
3302
- console.log(`[main ${now()}]`, message, ...args);
3443
+ const newChild = node.left ?? node.right;
3444
+ if (stack.length > 0) {
3445
+ const [dir, parent] = stack[stack.length - 1];
3446
+ switch (dir) {
3447
+ case -1 :
3448
+ parent.left = newChild;
3449
+ break;
3450
+ case 0 :
3451
+ parent.mid = newChild;
3452
+ break;
3453
+ case 1 :
3454
+ parent.right = newChild;
3455
+ break;
3456
+ }
3457
+ }
3458
+ else {
3459
+ this._root = newChild;
3460
+ }
3303
3461
  }
3304
3462
  }
3305
- }
3306
- debug(message, ...args) {
3307
- if (this.getLevel() <= LogLevel.Debug) {
3308
- if (this.useColors) {
3309
- console.log(`\x1b[90m[main ${now()}]\x1b[0m`, message, ...args);
3463
+ for (let i = stack.length - 1; i >= 0; i--) {
3464
+ const node = stack[i][1];
3465
+ node.updateHeight();
3466
+ const bf = node.balanceFactor();
3467
+ if (bf > 1) {
3468
+ if (node.right.balanceFactor() >= 0) {
3469
+ stack[i][1] = node.rotateLeft();
3470
+ }
3471
+ else {
3472
+ node.right = node.right.rotateRight();
3473
+ stack[i][1] = node.rotateLeft();
3474
+ }
3310
3475
  }
3311
- else {
3312
- console.log(`[main ${now()}]`, message, ...args);
3476
+ else if (bf < -1) {
3477
+ if (node.left.balanceFactor() <= 0) {
3478
+ stack[i][1] = node.rotateRight();
3479
+ }
3480
+ else {
3481
+ node.left = node.left.rotateLeft();
3482
+ stack[i][1] = node.rotateRight();
3483
+ }
3313
3484
  }
3314
- }
3315
- }
3316
- info(message, ...args) {
3317
- if (this.getLevel() <= LogLevel.Info) {
3318
- if (this.useColors) {
3319
- console.log(`\x1b[90m[main ${now()}]\x1b[0m`, message, ...args);
3485
+ if (i > 0) {
3486
+ switch (stack[i - 1][0]) {
3487
+ case -1 :
3488
+ stack[i - 1][1].left = stack[i][1];
3489
+ break;
3490
+ case 1 :
3491
+ stack[i - 1][1].right = stack[i][1];
3492
+ break;
3493
+ case 0 :
3494
+ stack[i - 1][1].mid = stack[i][1];
3495
+ break;
3496
+ }
3320
3497
  }
3321
3498
  else {
3322
- console.log(`[main ${now()}]`, message, ...args);
3499
+ this._root = stack[0][1];
3323
3500
  }
3324
3501
  }
3325
3502
  }
3326
- warn(message, ...args) {
3327
- if (this.getLevel() <= LogLevel.Warning) {
3328
- if (this.useColors) {
3329
- console.warn(`\x1b[93m[main ${now()}]\x1b[0m`, message, ...args);
3330
- }
3331
- else {
3332
- console.warn(`[main ${now()}]`, message, ...args);
3333
- }
3503
+ _min(node) {
3504
+ while (node.left) {
3505
+ node = node.left;
3334
3506
  }
3507
+ return node;
3335
3508
  }
3336
- error(message, ...args) {
3337
- if (this.getLevel() <= LogLevel.Error) {
3338
- if (this.useColors) {
3339
- console.error(`\x1b[91m[main ${now()}]\x1b[0m`, message, ...args);
3509
+ findSubstr(key) {
3510
+ const iter = this._iter.reset(key);
3511
+ let node = this._root;
3512
+ let candidate = undefined;
3513
+ while (node) {
3514
+ const val = iter.cmp(node.segment);
3515
+ if (val > 0) {
3516
+ node = node.left;
3517
+ }
3518
+ else if (val < 0) {
3519
+ node = node.right;
3520
+ }
3521
+ else if (iter.hasNext()) {
3522
+ iter.next();
3523
+ candidate = node.value || candidate;
3524
+ node = node.mid;
3340
3525
  }
3341
3526
  else {
3342
- console.error(`[main ${now()}]`, message, ...args);
3527
+ break;
3343
3528
  }
3344
3529
  }
3530
+ return node && node.value || candidate;
3531
+ }
3532
+ findSuperstr(key) {
3533
+ return this._findSuperstrOrElement(key, false);
3345
3534
  }
3346
- critical(message, ...args) {
3347
- if (this.getLevel() <= LogLevel.Critical) {
3348
- if (this.useColors) {
3349
- console.error(`\x1b[90m[main ${now()}]\x1b[0m`, message, ...args);
3535
+ _findSuperstrOrElement(key, allowValue) {
3536
+ const iter = this._iter.reset(key);
3537
+ let node = this._root;
3538
+ while (node) {
3539
+ const val = iter.cmp(node.segment);
3540
+ if (val > 0) {
3541
+ node = node.left;
3542
+ }
3543
+ else if (val < 0) {
3544
+ node = node.right;
3545
+ }
3546
+ else if (iter.hasNext()) {
3547
+ iter.next();
3548
+ node = node.mid;
3350
3549
  }
3351
3550
  else {
3352
- console.error(`[main ${now()}]`, message, ...args);
3551
+ if (!node.mid) {
3552
+ if (allowValue) {
3553
+ return node.value;
3554
+ }
3555
+ else {
3556
+ return undefined;
3557
+ }
3558
+ }
3559
+ else {
3560
+ return this._entries(node.mid);
3561
+ }
3353
3562
  }
3354
3563
  }
3564
+ return undefined;
3355
3565
  }
3356
- dispose() {
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);
3566
+ hasElementOrSubtree(key) {
3567
+ return this._findSuperstrOrElement(key, true) !== undefined;
3393
3568
  }
3394
- flush() {
3395
- this.logger.flush();
3569
+ forEach(callback) {
3570
+ for (const [key, value] of this) {
3571
+ callback(value, key);
3572
+ }
3396
3573
  }
3397
- }
3398
- function isConfigurationOverrides(thing) {
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
- )));
3574
+ *[Symbol.iterator]() {
3575
+ yield* this._entries(this._root);
3414
3576
  }
3415
- getValue(arg1, arg2) {
3416
- const section = typeof arg1 === 'string' ? arg1 : undefined;
3417
- const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
3418
- return this._configuration.getValue(section, overrides, undefined);
3577
+ _entries(node) {
3578
+ const result = [];
3579
+ this._dfsEntries(node, result);
3580
+ return result[Symbol.iterator]();
3419
3581
  }
3420
- updateValues(values) {
3421
- const previous = { data: this._configuration.toData() };
3422
- const changedKeys = [];
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);
3582
+ _dfsEntries(node, bucket) {
3583
+ if (!node) {
3584
+ return;
3430
3585
  }
3431
- if (changedKeys.length > 0) {
3432
- const configurationChangeEvent = ( (new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration)));
3433
- configurationChangeEvent.source = 8 ;
3434
- configurationChangeEvent.sourceConfig = null;
3435
- this._onDidChangeConfiguration.fire(configurationChangeEvent);
3586
+ if (node.left) {
3587
+ this._dfsEntries(node.left, bucket);
3436
3588
  }
3437
- return Promise.resolve();
3438
- }
3439
- updateValue(key, value, arg3, arg4) {
3440
- return this.updateValues([[key, value]]);
3441
- }
3442
- inspect(key, options = {}) {
3443
- return this._configuration.inspect(key, options, undefined);
3444
- }
3445
- keys() {
3446
- return (
3447
- (this._configuration.keys(undefined))
3448
- );
3449
- }
3450
- reloadConfiguration() {
3451
- return Promise.resolve(undefined);
3452
- }
3453
- getConfigurationData() {
3454
- const emptyModel = {
3455
- contents: {},
3456
- keys: [],
3457
- overrides: []
3458
- };
3459
- return {
3460
- defaults: emptyModel,
3461
- policy: emptyModel,
3462
- application: emptyModel,
3463
- user: emptyModel,
3464
- workspace: emptyModel,
3465
- folders: []
3589
+ if (node.value) {
3590
+ bucket.push([node.key, node.value]);
3591
+ }
3592
+ if (node.mid) {
3593
+ this._dfsEntries(node.mid, bucket);
3594
+ }
3595
+ if (node.right) {
3596
+ this._dfsEntries(node.right, bucket);
3597
+ }
3598
+ }
3599
+ _isBalanced() {
3600
+ const nodeIsBalanced = (node) => {
3601
+ if (!node) {
3602
+ return true;
3603
+ }
3604
+ const bf = node.balanceFactor();
3605
+ if (bf < -1 || bf > 1) {
3606
+ return false;
3607
+ }
3608
+ return nodeIsBalanced(node.left) && nodeIsBalanced(node.right);
3466
3609
  };
3610
+ return nodeIsBalanced(this._root);
3467
3611
  }
3468
3612
  }
3469
3613
  const hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -3623,7 +3767,7 @@ class LanguagesRegistry extends Disposable {
3623
3767
  }
3624
3768
  }
3625
3769
  catch (err) {
3626
- onUnexpectedError(err);
3770
+ console.warn(`[${lang.id}]: Invalid regular expression \`${firstLineRegexStr}\`: `, err);
3627
3771
  }
3628
3772
  }
3629
3773
  resolvedLanguage.aliases.push(langId);
@@ -3745,6 +3889,8 @@ class LanguagesRegistry extends Disposable {
3745
3889
  }
3746
3890
  }
3747
3891
  LanguagesRegistry.instanceCount = 0;
3892
+ 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}";
3893
+ n(css,{});
3748
3894
  class TraitRenderer {
3749
3895
  constructor(trait) {
3750
3896
  this.trait = trait;
@@ -3800,6 +3946,12 @@ class TraitRenderer {
3800
3946
  }
3801
3947
  }
3802
3948
  class Trait {
3949
+ get name() { return this._trait; }
3950
+ get renderer() {
3951
+ return (
3952
+ (new TraitRenderer(this))
3953
+ );
3954
+ }
3803
3955
  constructor(_trait) {
3804
3956
  this._trait = _trait;
3805
3957
  this.length = 0;
@@ -3808,12 +3960,6 @@ class Trait {
3808
3960
  this._onChange = ( (new Emitter()));
3809
3961
  this.onChange = this._onChange.event;
3810
3962
  }
3811
- get name() { return this._trait; }
3812
- get renderer() {
3813
- return (
3814
- (new TraitRenderer(this))
3815
- );
3816
- }
3817
3963
  splice(start, deleteCount, elements) {
3818
3964
  deleteCount = Math.max(0, Math.min(deleteCount, this.length - start));
3819
3965
  const diff = elements.length - deleteCount;
@@ -3909,6 +4055,11 @@ function isMonacoEditor(e) {
3909
4055
  return isMonacoEditor(e.parentElement);
3910
4056
  }
3911
4057
  class KeyboardController {
4058
+ get onKeyDown() {
4059
+ return this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event)
4060
+ .filter(e => !isInputElement(e.target))
4061
+ .map(e => ( (new StandardKeyboardEvent(e)))));
4062
+ }
3912
4063
  constructor(list, view, options) {
3913
4064
  this.list = list;
3914
4065
  this.view = view;
@@ -3924,11 +4075,6 @@ class KeyboardController {
3924
4075
  this.onKeyDown.filter(e => (isMacintosh ? e.metaKey : e.ctrlKey) && e.keyCode === 31 ).on(this.onCtrlA, this, this.multipleSelectionDisposables);
3925
4076
  }
3926
4077
  }
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
4078
  updateOptions(optionsUpdate) {
3933
4079
  if (optionsUpdate.multipleSelectionSupport !== undefined) {
3934
4080
  this.multipleSelectionDisposables.clear();
@@ -4059,10 +4205,10 @@ class TypeNavigationController {
4059
4205
  .map(event => ( (new StandardKeyboardEvent(event))))
4060
4206
  .filter(e => typing || this.keyboardNavigationEventFilter(e))
4061
4207
  .filter(e => this.delegate.mightProducePrintableCharacter(e))
4062
- .forEach(stopEvent)
4208
+ .forEach(e => EventHelper.stop(e, true))
4063
4209
  .map(event => event.browserEvent.key)
4064
4210
  .event;
4065
- const onClear = Event.debounce(onChar, () => null, 800, undefined, undefined, this.enabledDisposables);
4211
+ const onClear = Event.debounce(onChar, () => null, 800, undefined, undefined, undefined, this.enabledDisposables);
4066
4212
  const onInput = Event.reduce(Event.any(onChar, onClear), (r, i) => i === null ? null : ((r || '') + i), undefined, this.enabledDisposables);
4067
4213
  onInput(this.onInput, this, this.enabledDisposables);
4068
4214
  onClear(this.onClear, this, this.enabledDisposables);
@@ -4220,7 +4366,7 @@ class MouseController {
4220
4366
  }
4221
4367
  }
4222
4368
  onContextMenu(e) {
4223
- if (isMonacoEditor(e.browserEvent.target)) {
4369
+ if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) {
4224
4370
  return;
4225
4371
  }
4226
4372
  const focus = typeof e.index === 'undefined' ? [] : [e.index];
@@ -4310,12 +4456,7 @@ class DefaultStyleController {
4310
4456
  const suffix = this.selectorSuffix && `.${this.selectorSuffix}`;
4311
4457
  const content = [];
4312
4458
  if (styles.listBackground) {
4313
- if (styles.listBackground.isOpaque()) {
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
- }
4459
+ content.push(`.monaco-list${suffix} .monaco-list-rows { background: ${styles.listBackground}; }`);
4319
4460
  }
4320
4461
  if (styles.listFocusBackground) {
4321
4462
  content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`);
@@ -4334,9 +4475,6 @@ class DefaultStyleController {
4334
4475
  if (styles.listActiveSelectionIconForeground) {
4335
4476
  content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected .codicon { color: ${styles.listActiveSelectionIconForeground}; }`);
4336
4477
  }
4337
- if (styles.listFocusAndSelectionOutline) {
4338
- content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected { outline-color: ${styles.listFocusAndSelectionOutline} !important; }`);
4339
- }
4340
4478
  if (styles.listFocusAndSelectionBackground) {
4341
4479
  content.push(`
4342
4480
  .monaco-drag-image,
@@ -4368,13 +4506,14 @@ class DefaultStyleController {
4368
4506
  content.push(`.monaco-list${suffix} .monaco-list-row.selected { color: ${styles.listInactiveSelectionForeground}; }`);
4369
4507
  }
4370
4508
  if (styles.listHoverBackground) {
4371
- content.push(`.monaco-list${suffix}:not(.drop-target) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`);
4509
+ content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`);
4372
4510
  }
4373
4511
  if (styles.listHoverForeground) {
4374
- content.push(`.monaco-list${suffix} .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`);
4512
+ content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`);
4375
4513
  }
4376
- if (styles.listSelectionOutline) {
4377
- content.push(`.monaco-list${suffix} .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`);
4514
+ const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, styles.listFocusOutline ?? ''));
4515
+ if (focusAndSelectionOutline) {
4516
+ content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`);
4378
4517
  }
4379
4518
  if (styles.listFocusOutline) {
4380
4519
  content.push(`
@@ -4383,6 +4522,13 @@ class DefaultStyleController {
4383
4522
  .monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }
4384
4523
  `);
4385
4524
  }
4525
+ const inactiveFocusAndSelectionOutline = asCssValueWithDefault(styles.listSelectionOutline, styles.listInactiveFocusOutline ?? '');
4526
+ if (inactiveFocusAndSelectionOutline) {
4527
+ content.push(`.monaco-list${suffix} .monaco-list-row.focused.selected { outline: 1px dotted ${inactiveFocusAndSelectionOutline}; outline-offset: -1px; }`);
4528
+ }
4529
+ if (styles.listSelectionOutline) {
4530
+ content.push(`.monaco-list${suffix} .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`);
4531
+ }
4386
4532
  if (styles.listInactiveFocusOutline) {
4387
4533
  content.push(`.monaco-list${suffix} .monaco-list-row.focused { outline: 1px dotted ${styles.listInactiveFocusOutline}; outline-offset: -1px; }`);
4388
4534
  }
@@ -4398,10 +4544,18 @@ class DefaultStyleController {
4398
4544
  }
4399
4545
  if (styles.tableColumnsBorder) {
4400
4546
  content.push(`
4401
- .monaco-table:hover > .monaco-split-view2,
4402
- .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
4547
+ .monaco-table > .monaco-split-view2,
4548
+ .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
4549
+ .monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2,
4550
+ .monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
4403
4551
  border-color: ${styles.tableColumnsBorder};
4404
- }`);
4552
+ }
4553
+
4554
+ .monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2,
4555
+ .monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
4556
+ border-color: transparent;
4557
+ }
4558
+ `);
4405
4559
  }
4406
4560
  if (styles.tableOddRowsBackgroundColor) {
4407
4561
  content.push(`
@@ -4415,22 +4569,6 @@ class DefaultStyleController {
4415
4569
  this.styleElement.textContent = content.join('\n');
4416
4570
  }
4417
4571
  }
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
4572
  const DefaultOptions = {
4435
4573
  keyboardSupport: true,
4436
4574
  mouseSupport: true,
@@ -4603,6 +4741,57 @@ class ListViewDragAndDrop {
4603
4741
  }
4604
4742
  }
4605
4743
  class List {
4744
+ get onDidChangeFocus() {
4745
+ return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), e => this.toListEvent(e), this.disposables);
4746
+ }
4747
+ get onDidChangeSelection() {
4748
+ return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e), this.disposables);
4749
+ }
4750
+ get domId() { return this.view.domId; }
4751
+ get onDidScroll() { return this.view.onDidScroll; }
4752
+ get onMouseClick() { return this.view.onMouseClick; }
4753
+ get onMouseDblClick() { return this.view.onMouseDblClick; }
4754
+ get onMouseMiddleClick() { return this.view.onMouseMiddleClick; }
4755
+ get onPointer() { return this.mouseController.onPointer; }
4756
+ get onMouseUp() { return this.view.onMouseUp; }
4757
+ get onMouseDown() { return this.view.onMouseDown; }
4758
+ get onMouseOver() { return this.view.onMouseOver; }
4759
+ get onMouseMove() { return this.view.onMouseMove; }
4760
+ get onMouseOut() { return this.view.onMouseOut; }
4761
+ get onTouchStart() { return this.view.onTouchStart; }
4762
+ get onTap() { return this.view.onTap; }
4763
+ get onContextMenu() {
4764
+ let didJustPressContextMenuKey = false;
4765
+ const fromKeyDown = this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event))
4766
+ .map(e => ( (new StandardKeyboardEvent(e))))
4767
+ .filter(e => didJustPressContextMenuKey = e.keyCode === 58 || ((e.shiftKey && e.keyCode === 68) ))
4768
+ .map(e => EventHelper.stop(e, true))
4769
+ .filter(() => false)
4770
+ .event;
4771
+ const fromKeyUp = this.disposables.add(Event.chain(this.disposables.add(( (new DomEmitter(this.view.domNode, 'keyup')))).event))
4772
+ .forEach(() => didJustPressContextMenuKey = false)
4773
+ .map(e => ( (new StandardKeyboardEvent(e))))
4774
+ .filter(e => e.keyCode === 58 || ((e.shiftKey && e.keyCode === 68) ))
4775
+ .map(e => EventHelper.stop(e, true))
4776
+ .map(({ browserEvent }) => {
4777
+ const focus = this.getFocus();
4778
+ const index = focus.length ? focus[0] : undefined;
4779
+ const element = typeof index !== 'undefined' ? this.view.element(index) : undefined;
4780
+ const anchor = typeof index !== 'undefined' ? this.view.domElement(index) : this.view.domNode;
4781
+ return { index, element, anchor, browserEvent };
4782
+ })
4783
+ .event;
4784
+ const fromMouse = this.disposables.add(Event.chain(this.view.onContextMenu))
4785
+ .filter(_ => !didJustPressContextMenuKey)
4786
+ .map(({ element, index, browserEvent }) => ({ element, index, anchor: { x: browserEvent.pageX + 1, y: browserEvent.pageY }, browserEvent }))
4787
+ .event;
4788
+ return Event.any(fromKeyDown, fromKeyUp, fromMouse);
4789
+ }
4790
+ get onKeyDown() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keydown')))).event; }
4791
+ get onKeyUp() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keyup')))).event; }
4792
+ get onKeyPress() { return this.disposables.add(( (new DomEmitter(this.view.domNode, 'keypress')))).event; }
4793
+ get onDidFocus() { return Event.signal(this.disposables.add(( (new DomEmitter(this.view.domNode, 'focus', true)))).event); }
4794
+ get onDidBlur() { return Event.signal(this.disposables.add(( (new DomEmitter(this.view.domNode, 'blur', true)))).event); }
4606
4795
  constructor(user, container, virtualDelegate, renderers, _options = DefaultOptions) {
4607
4796
  this.user = user;
4608
4797
  this._options = _options;
@@ -4615,7 +4804,6 @@ class List {
4615
4804
  this.onDidDispose = this._onDidDispose.event;
4616
4805
  const role = this._options.accessibilityProvider && this._options.accessibilityProvider.getWidgetRole ? this._options.accessibilityProvider?.getWidgetRole() : 'list';
4617
4806
  this.selection = ( (new SelectionTrait(role !== 'listbox')));
4618
- mixin(_options, defaultStyles, false);
4619
4807
  const baseRenderers = [this.focus.renderer, this.selection.renderer];
4620
4808
  this.accessibilityProvider = _options.accessibilityProvider;
4621
4809
  if (this.accessibilityProvider) {
@@ -4627,7 +4815,7 @@ class List {
4627
4815
  ..._options,
4628
4816
  dnd: _options.dnd && ( (new ListViewDragAndDrop(this, _options.dnd)))
4629
4817
  };
4630
- this.view = ( (new ListView(container, virtualDelegate, renderers, viewOptions)));
4818
+ this.view = this.createListView(container, virtualDelegate, renderers, viewOptions);
4631
4819
  this.view.domNode.setAttribute('role', role);
4632
4820
  if (_options.styleController) {
4633
4821
  this.styleController = _options.styleController(this.view.domId);
@@ -4674,57 +4862,11 @@ class List {
4674
4862
  this.view.domNode.setAttribute('aria-multiselectable', 'true');
4675
4863
  }
4676
4864
  }
4677
- get onDidChangeFocus() {
4678
- return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), e => this.toListEvent(e), this.disposables);
4679
- }
4680
- get onDidChangeSelection() {
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);
4865
+ createListView(container, virtualDelegate, renderers, viewOptions) {
4866
+ return (
4867
+ (new ListView(container, virtualDelegate, renderers, viewOptions))
4868
+ );
4722
4869
  }
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
4870
  createMouseController(options) {
4729
4871
  return (
4730
4872
  (new MouseController(this))
@@ -4822,9 +4964,7 @@ class List {
4822
4964
  this.view.layout(height, width);
4823
4965
  }
4824
4966
  triggerTypeNavigation() {
4825
- if (this.typeNavigationController) {
4826
- this.typeNavigationController.trigger();
4827
- }
4967
+ this.typeNavigationController?.trigger();
4828
4968
  }
4829
4969
  setSelection(indexes, browserEvent) {
4830
4970
  for (const index of indexes) {
@@ -5245,6 +5385,32 @@ class HSVA {
5245
5385
  }
5246
5386
  }
5247
5387
  class Color {
5388
+ static fromHex(hex) {
5389
+ return Color.Format.CSS.parseHex(hex) || Color.red;
5390
+ }
5391
+ static equals(a, b) {
5392
+ if (!a && !b) {
5393
+ return true;
5394
+ }
5395
+ if (!a || !b) {
5396
+ return false;
5397
+ }
5398
+ return a.equals(b);
5399
+ }
5400
+ get hsla() {
5401
+ if (this._hsla) {
5402
+ return this._hsla;
5403
+ }
5404
+ else {
5405
+ return HSLA.fromRGBA(this.rgba);
5406
+ }
5407
+ }
5408
+ get hsva() {
5409
+ if (this._hsva) {
5410
+ return this._hsva;
5411
+ }
5412
+ return HSVA.fromRGBA(this.rgba);
5413
+ }
5248
5414
  constructor(arg) {
5249
5415
  if (!arg) {
5250
5416
  throw new Error('Color needs a value');
@@ -5264,23 +5430,6 @@ class Color {
5264
5430
  throw new Error('Invalid color ctor argument');
5265
5431
  }
5266
5432
  }
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
5433
  equals(other) {
5285
5434
  return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva);
5286
5435
  }
@@ -5559,6 +5708,112 @@ Color.transparent = ( (new Color( (new RGBA(0, 0, 0, 0)))));
5559
5708
  })(Format.CSS || (Format.CSS = {}))));
5560
5709
  })(Color.Format || (Color.Format = {}))));
5561
5710
  })(Color || (Color = {}))));
5711
+ class LogService extends Disposable {
5712
+ constructor(primaryLogger, otherLoggers = []) {
5713
+ super();
5714
+ this.logger = ( (new MultiplexLogger([primaryLogger, ...otherLoggers])));
5715
+ this._register(primaryLogger.onDidChangeLogLevel(level => this.setLevel(level)));
5716
+ }
5717
+ get onDidChangeLogLevel() {
5718
+ return this.logger.onDidChangeLogLevel;
5719
+ }
5720
+ setLevel(level) {
5721
+ this.logger.setLevel(level);
5722
+ }
5723
+ getLevel() {
5724
+ return this.logger.getLevel();
5725
+ }
5726
+ trace(message, ...args) {
5727
+ this.logger.trace(message, ...args);
5728
+ }
5729
+ debug(message, ...args) {
5730
+ this.logger.debug(message, ...args);
5731
+ }
5732
+ info(message, ...args) {
5733
+ this.logger.info(message, ...args);
5734
+ }
5735
+ warn(message, ...args) {
5736
+ this.logger.warn(message, ...args);
5737
+ }
5738
+ error(message, ...args) {
5739
+ this.logger.error(message, ...args);
5740
+ }
5741
+ flush() {
5742
+ this.logger.flush();
5743
+ }
5744
+ }
5745
+ class KeyCodeChord {
5746
+ constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {
5747
+ this.ctrlKey = ctrlKey;
5748
+ this.shiftKey = shiftKey;
5749
+ this.altKey = altKey;
5750
+ this.metaKey = metaKey;
5751
+ this.keyCode = keyCode;
5752
+ }
5753
+ equals(other) {
5754
+ return (other instanceof KeyCodeChord
5755
+ && this.ctrlKey === other.ctrlKey
5756
+ && this.shiftKey === other.shiftKey
5757
+ && this.altKey === other.altKey
5758
+ && this.metaKey === other.metaKey
5759
+ && this.keyCode === other.keyCode);
5760
+ }
5761
+ getHashCode() {
5762
+ const ctrl = this.ctrlKey ? '1' : '0';
5763
+ const shift = this.shiftKey ? '1' : '0';
5764
+ const alt = this.altKey ? '1' : '0';
5765
+ const meta = this.metaKey ? '1' : '0';
5766
+ return `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;
5767
+ }
5768
+ isModifierKey() {
5769
+ return (this.keyCode === 0
5770
+ || this.keyCode === 5
5771
+ || this.keyCode === 57
5772
+ || this.keyCode === 6 || this.keyCode === 4) ;
5773
+ }
5774
+ toKeybinding() {
5775
+ return (
5776
+ (new Keybinding([this]))
5777
+ );
5778
+ }
5779
+ isDuplicateModifierCase() {
5780
+ return (((this.ctrlKey && this.keyCode === 5) )
5781
+ || ((this.shiftKey && this.keyCode === 4) )
5782
+ || ((this.altKey && this.keyCode === 6) ) || (this.metaKey && this.keyCode === 57)) ;
5783
+ }
5784
+ }
5785
+ class Keybinding {
5786
+ constructor(chords) {
5787
+ if (chords.length === 0) {
5788
+ throw illegalArgument(`chords`);
5789
+ }
5790
+ this.chords = chords;
5791
+ }
5792
+ getHashCode() {
5793
+ let result = '';
5794
+ for (let i = 0, len = this.chords.length; i < len; i++) {
5795
+ if (i !== 0) {
5796
+ result += ';';
5797
+ }
5798
+ result += this.chords[i].getHashCode();
5799
+ }
5800
+ return result;
5801
+ }
5802
+ equals(other) {
5803
+ if (other === null) {
5804
+ return false;
5805
+ }
5806
+ if (this.chords.length !== other.chords.length) {
5807
+ return false;
5808
+ }
5809
+ for (let i = 0; i < this.chords.length; i++) {
5810
+ if (!this.chords[i].equals(other.chords[i])) {
5811
+ return false;
5812
+ }
5813
+ }
5814
+ return true;
5815
+ }
5816
+ }
5562
5817
  var _a, _b;
5563
5818
  if (SnippetParser.prototype.text == null) {
5564
5819
  SnippetParser.prototype.text = function (value) {
@@ -5593,6 +5848,22 @@ polyfillPrototypeSimple(LanguageService$1.prototype, LanguageService.prototype);
5593
5848
  polyfillPrototypeSimple(NoOpNotification.prototype, NoOpNotification$1.prototype);
5594
5849
  polyfillPrototypeSimple(Themable$1.prototype, Themable.prototype);
5595
5850
  polyfillPrototypeSimple(ProgressBar$1.prototype, ProgressBar.prototype);
5851
+ polyfillPrototypeSimple(DefaultConfiguration$1.prototype, DefaultConfiguration.prototype);
5852
+ polyfillPrototypeSimple(Keybinding$1.prototype, Keybinding.prototype);
5853
+ polyfillPrototypeSimple(KeyCodeChord$1.prototype, KeyCodeChord.prototype);
5854
+ Object.defineProperty(DefaultConfiguration$1.prototype, '_onDidChangeConfiguration', {
5855
+ get() {
5856
+ if (this.__onDidChangeConfiguration == null) {
5857
+ this.__onDidChangeConfiguration = this._register(new Emitter());
5858
+ }
5859
+ return this.__onDidChangeConfiguration;
5860
+ }
5861
+ });
5862
+ Object.defineProperty(DefaultConfiguration$1.prototype, 'onDidChangeConfiguration', {
5863
+ get() {
5864
+ return this._onDidChangeConfiguration.event;
5865
+ }
5866
+ });
5596
5867
  const jsonContributionRegistry = ( Registry.as(Extensions.JSONContribution));
5597
5868
  jsonContributionRegistry.getSchemaContributions ?? (jsonContributionRegistry.getSchemaContributions = () => ({
5598
5869
  schemas: jsonContributionRegistry.schemasById
@@ -5654,4 +5925,4 @@ function toVSCodeColor(value) {
5654
5925
  return value;
5655
5926
  }
5656
5927
  polyfillPrototype(Color$1.prototype, Color.prototype, toMonacoColor, toVSCodeColor);
5657
- export { ConsoleMainLogger as C, NotImplementedError as N, ResourceSet as R, UserSettings as U, flatten as a, parse as b, createScanner as c, isReadableStream as d, peekStream as e, findNodeAtLocation as f, getNodeType as g, peekReadable as h, index as i, bufferToReadable as j, consumeStream as k, isReadableBufferedStream as l, listenStream as m, bufferedStreamToBuffer as n, newWriteableBufferStream as o, parseTree as p, newWriteableStream as q, readableToBuffer as r, streamToBuffer as s, transform as t, disposed as u, coalesceInPlace as v, mapArrayOrNot as w, delta as x, readonly as y };
5928
+ export { mapArrayOrNot as A, delta as B, readonly as C, NotImplementedError as D, encodeBase64 as E, IPolicyService as I, NullPolicyService as N, PolicyConfiguration as P, 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 };