1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.PreferenceScope = void 0;
|
19 |
|
20 | var PreferenceScope;
|
21 | (function (PreferenceScope) {
|
22 | PreferenceScope[PreferenceScope["Default"] = 0] = "Default";
|
23 | PreferenceScope[PreferenceScope["User"] = 1] = "User";
|
24 | PreferenceScope[PreferenceScope["Workspace"] = 2] = "Workspace";
|
25 | PreferenceScope[PreferenceScope["Folder"] = 3] = "Folder";
|
26 | })(PreferenceScope = exports.PreferenceScope || (exports.PreferenceScope = {}));
|
27 | (function (PreferenceScope) {
|
28 | function is(scope) {
|
29 | return typeof scope === 'number' && getScopes().findIndex(s => s === scope) >= 0;
|
30 | }
|
31 | PreferenceScope.is = is;
|
32 | |
33 |
|
34 |
|
35 | function getScopes() {
|
36 | return Object.keys(PreferenceScope)
|
37 | .filter(k => typeof PreferenceScope[k] === 'string')
|
38 | .map(v => Number(v));
|
39 | }
|
40 | PreferenceScope.getScopes = getScopes;
|
41 | |
42 |
|
43 |
|
44 | function getReversedScopes() {
|
45 | return getScopes().reverse();
|
46 | }
|
47 | PreferenceScope.getReversedScopes = getReversedScopes;
|
48 | function getScopeNames(scope) {
|
49 | const names = [];
|
50 | const allNames = Object.keys(PreferenceScope)
|
51 | .filter(k => typeof PreferenceScope[k] === 'number');
|
52 | if (scope) {
|
53 | for (const name of allNames) {
|
54 | if (PreferenceScope[name] <= scope) {
|
55 | names.push(name);
|
56 | }
|
57 | }
|
58 | }
|
59 | return names;
|
60 | }
|
61 | PreferenceScope.getScopeNames = getScopeNames;
|
62 | function fromString(strScope) {
|
63 | switch (strScope) {
|
64 | case 'application':
|
65 | return PreferenceScope.User;
|
66 | case 'window':
|
67 | return PreferenceScope.Folder;
|
68 | case 'resource':
|
69 | return PreferenceScope.Folder;
|
70 | case 'language-overridable':
|
71 | return PreferenceScope.Folder;
|
72 | }
|
73 | }
|
74 | PreferenceScope.fromString = fromString;
|
75 | })(PreferenceScope = exports.PreferenceScope || (exports.PreferenceScope = {}));
|
76 |
|
\ | No newline at end of file |