@theia/preferences 1.45.0 → 1.46.0-next.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +81 -81
  2. package/lib/browser/abstract-resource-preference-provider.d.ts +47 -47
  3. package/lib/browser/abstract-resource-preference-provider.js +240 -240
  4. package/lib/browser/abstract-resource-preference-provider.spec.d.ts +1 -1
  5. package/lib/browser/abstract-resource-preference-provider.spec.js +83 -83
  6. package/lib/browser/folder-preference-provider.d.ts +20 -20
  7. package/lib/browser/folder-preference-provider.js +59 -59
  8. package/lib/browser/folders-preferences-provider.d.ts +27 -27
  9. package/lib/browser/folders-preferences-provider.js +245 -245
  10. package/lib/browser/index.d.ts +7 -7
  11. package/lib/browser/index.js +34 -34
  12. package/lib/browser/monaco-jsonc-editor.d.ts +9 -9
  13. package/lib/browser/monaco-jsonc-editor.js +80 -80
  14. package/lib/browser/package.spec.js +25 -25
  15. package/lib/browser/preference-bindings.d.ts +4 -4
  16. package/lib/browser/preference-bindings.js +63 -63
  17. package/lib/browser/preference-frontend-module.d.ts +6 -6
  18. package/lib/browser/preference-frontend-module.js +52 -52
  19. package/lib/browser/preference-open-handler.d.ts +9 -9
  20. package/lib/browser/preference-open-handler.js +64 -64
  21. package/lib/browser/preference-transaction-manager.d.ts +100 -100
  22. package/lib/browser/preference-transaction-manager.js +293 -293
  23. package/lib/browser/preference-tree-model.d.ts +60 -60
  24. package/lib/browser/preference-tree-model.js +243 -243
  25. package/lib/browser/preferences-contribution.d.ts +37 -37
  26. package/lib/browser/preferences-contribution.js +280 -280
  27. package/lib/browser/preferences-json-schema-contribution.d.ts +17 -17
  28. package/lib/browser/preferences-json-schema-contribution.js +91 -91
  29. package/lib/browser/preferences-monaco-contribution.d.ts +1 -1
  30. package/lib/browser/preferences-monaco-contribution.js +27 -27
  31. package/lib/browser/section-preference-provider.d.ts +21 -21
  32. package/lib/browser/section-preference-provider.js +96 -96
  33. package/lib/browser/user-configs-preference-provider.d.ts +22 -22
  34. package/lib/browser/user-configs-preference-provider.js +137 -137
  35. package/lib/browser/user-preference-provider.d.ts +13 -13
  36. package/lib/browser/user-preference-provider.js +41 -41
  37. package/lib/browser/util/preference-scope-command-manager.d.ts +17 -17
  38. package/lib/browser/util/preference-scope-command-manager.js +87 -87
  39. package/lib/browser/util/preference-tree-generator.d.ts +31 -31
  40. package/lib/browser/util/preference-tree-generator.js +237 -237
  41. package/lib/browser/util/preference-tree-label-provider.d.ts +11 -11
  42. package/lib/browser/util/preference-tree-label-provider.js +77 -77
  43. package/lib/browser/util/preference-tree-label-provider.spec.d.ts +1 -1
  44. package/lib/browser/util/preference-tree-label-provider.spec.js +87 -87
  45. package/lib/browser/util/preference-types.d.ts +62 -62
  46. package/lib/browser/util/preference-types.js +128 -128
  47. package/lib/browser/views/components/preference-array-input.d.ts +28 -28
  48. package/lib/browser/views/components/preference-array-input.js +180 -180
  49. package/lib/browser/views/components/preference-boolean-input.d.ts +17 -17
  50. package/lib/browser/views/components/preference-boolean-input.js +79 -79
  51. package/lib/browser/views/components/preference-file-input.d.ts +29 -29
  52. package/lib/browser/views/components/preference-file-input.js +110 -110
  53. package/lib/browser/views/components/preference-json-input.d.ts +19 -19
  54. package/lib/browser/views/components/preference-json-input.js +93 -93
  55. package/lib/browser/views/components/preference-markdown-renderer.d.ts +12 -12
  56. package/lib/browser/views/components/preference-markdown-renderer.js +81 -81
  57. package/lib/browser/views/components/preference-node-renderer-creator.d.ts +48 -48
  58. package/lib/browser/views/components/preference-node-renderer-creator.js +132 -132
  59. package/lib/browser/views/components/preference-node-renderer.d.ts +112 -112
  60. package/lib/browser/views/components/preference-node-renderer.js +441 -441
  61. package/lib/browser/views/components/preference-number-input.d.ts +34 -34
  62. package/lib/browser/views/components/preference-number-input.js +142 -142
  63. package/lib/browser/views/components/preference-select-input.d.ts +28 -28
  64. package/lib/browser/views/components/preference-select-input.js +138 -138
  65. package/lib/browser/views/components/preference-string-input.d.ts +17 -17
  66. package/lib/browser/views/components/preference-string-input.js +89 -89
  67. package/lib/browser/views/preference-editor-widget.d.ts +67 -67
  68. package/lib/browser/views/preference-editor-widget.js +363 -363
  69. package/lib/browser/views/preference-scope-tabbar-widget.d.ts +54 -54
  70. package/lib/browser/views/preference-scope-tabbar-widget.js +343 -343
  71. package/lib/browser/views/preference-searchbar-widget.d.ts +53 -53
  72. package/lib/browser/views/preference-searchbar-widget.js +173 -173
  73. package/lib/browser/views/preference-tree-widget.d.ts +17 -17
  74. package/lib/browser/views/preference-tree-widget.js +104 -104
  75. package/lib/browser/views/preference-widget-bindings.d.ts +3 -3
  76. package/lib/browser/views/preference-widget-bindings.js +87 -87
  77. package/lib/browser/views/preference-widget.d.ts +36 -36
  78. package/lib/browser/views/preference-widget.js +126 -126
  79. package/lib/browser/workspace-file-preference-provider.d.ts +23 -23
  80. package/lib/browser/workspace-file-preference-provider.js +110 -110
  81. package/lib/browser/workspace-preference-provider.d.ts +28 -28
  82. package/lib/browser/workspace-preference-provider.js +142 -142
  83. package/package.json +10 -10
  84. package/src/browser/abstract-resource-preference-provider.spec.ts +95 -95
  85. package/src/browser/abstract-resource-preference-provider.ts +232 -232
  86. package/src/browser/folder-preference-provider.ts +58 -58
  87. package/src/browser/folders-preferences-provider.ts +244 -244
  88. package/src/browser/index.ts +23 -23
  89. package/src/browser/monaco-jsonc-editor.ts +67 -67
  90. package/src/browser/package.spec.ts +28 -28
  91. package/src/browser/preference-bindings.ts +65 -65
  92. package/src/browser/preference-frontend-module.ts +57 -57
  93. package/src/browser/preference-open-handler.ts +53 -53
  94. package/src/browser/preference-transaction-manager.ts +287 -287
  95. package/src/browser/preference-tree-model.ts +250 -250
  96. package/src/browser/preferences-contribution.ts +263 -263
  97. package/src/browser/preferences-json-schema-contribution.ts +86 -86
  98. package/src/browser/preferences-monaco-contribution.ts +27 -27
  99. package/src/browser/section-preference-provider.ts +83 -83
  100. package/src/browser/style/index.css +506 -506
  101. package/src/browser/style/preference-array.css +94 -94
  102. package/src/browser/style/preference-context-menu.css +74 -74
  103. package/src/browser/style/preference-file.css +31 -31
  104. package/src/browser/style/preference-object.css +49 -49
  105. package/src/browser/style/search-input.css +66 -66
  106. package/src/browser/user-configs-preference-provider.ts +127 -127
  107. package/src/browser/user-preference-provider.ts +35 -35
  108. package/src/browser/util/preference-scope-command-manager.ts +75 -75
  109. package/src/browser/util/preference-tree-generator.ts +226 -226
  110. package/src/browser/util/preference-tree-label-provider.spec.ts +108 -108
  111. package/src/browser/util/preference-tree-label-provider.ts +64 -64
  112. package/src/browser/util/preference-types.ts +169 -169
  113. package/src/browser/views/components/preference-array-input.ts +174 -174
  114. package/src/browser/views/components/preference-boolean-input.ts +69 -69
  115. package/src/browser/views/components/preference-file-input.ts +104 -104
  116. package/src/browser/views/components/preference-json-input.ts +78 -78
  117. package/src/browser/views/components/preference-markdown-renderer.ts +68 -68
  118. package/src/browser/views/components/preference-node-renderer-creator.ts +141 -141
  119. package/src/browser/views/components/preference-node-renderer.ts +477 -477
  120. package/src/browser/views/components/preference-number-input.ts +147 -147
  121. package/src/browser/views/components/preference-select-input.ts +131 -131
  122. package/src/browser/views/components/preference-string-input.ts +76 -76
  123. package/src/browser/views/preference-editor-widget.ts +349 -349
  124. package/src/browser/views/preference-scope-tabbar-widget.tsx +344 -344
  125. package/src/browser/views/preference-searchbar-widget.tsx +183 -183
  126. package/src/browser/views/preference-tree-widget.tsx +93 -93
  127. package/src/browser/views/preference-widget-bindings.ts +102 -102
  128. package/src/browser/views/preference-widget.tsx +117 -117
  129. package/src/browser/workspace-file-preference-provider.ts +100 -100
  130. package/src/browser/workspace-preference-provider.ts +134 -134
@@ -1,127 +1,127 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- var PreferencesWidget_1;
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.PreferencesWidget = void 0;
29
- const inversify_1 = require("@theia/core/shared/inversify");
30
- const browser_1 = require("@theia/core/lib/browser");
31
- const preference_editor_widget_1 = require("./preference-editor-widget");
32
- const preference_tree_widget_1 = require("./preference-tree-widget");
33
- const preference_searchbar_widget_1 = require("./preference-searchbar-widget");
34
- const preference_scope_tabbar_widget_1 = require("./preference-scope-tabbar-widget");
35
- const nls_1 = require("@theia/core/lib/common/nls");
36
- let PreferencesWidget = PreferencesWidget_1 = class PreferencesWidget extends browser_1.Panel {
37
- get currentScope() {
38
- return this.tabBarWidget.currentScope;
39
- }
40
- setSearchTerm(query) {
41
- return this.searchbarWidget.updateSearchTerm(query);
42
- }
43
- setScope(scope) {
44
- this.tabBarWidget.setScope(scope);
45
- }
46
- onResize(msg) {
47
- super.onResize(msg);
48
- if (msg.width < 600 && this.treeWidget && !this.treeWidget.isHidden) {
49
- this.treeWidget.hide();
50
- this.editorWidget.addClass('full-pane');
51
- }
52
- else if (msg.width >= 600 && this.treeWidget && this.treeWidget.isHidden) {
53
- this.treeWidget.show();
54
- this.editorWidget.removeClass('full-pane');
55
- }
56
- }
57
- onActivateRequest(msg) {
58
- super.onActivateRequest(msg);
59
- this.searchbarWidget.focus();
60
- }
61
- init() {
62
- this.id = PreferencesWidget_1.ID;
63
- this.title.label = PreferencesWidget_1.LABEL;
64
- this.title.closable = true;
65
- this.addClass('theia-settings-container');
66
- this.title.iconClass = (0, browser_1.codicon)('settings');
67
- this.searchbarWidget.addClass('preferences-searchbar-widget');
68
- this.addWidget(this.searchbarWidget);
69
- this.tabBarWidget.addClass('preferences-tabbar-widget');
70
- this.addWidget(this.tabBarWidget);
71
- this.treeWidget.addClass('preferences-tree-widget');
72
- this.addWidget(this.treeWidget);
73
- this.editorWidget.addClass('preferences-editor-widget');
74
- this.addWidget(this.editorWidget);
75
- this.update();
76
- }
77
- getPreviewNode() {
78
- return this.node;
79
- }
80
- storeState() {
81
- return {
82
- scopeTabBarState: this.tabBarWidget.storeState(),
83
- editorState: this.editorWidget.storeState(),
84
- searchbarWidgetState: this.searchbarWidget.storeState(),
85
- };
86
- }
87
- restoreState(state) {
88
- this.tabBarWidget.restoreState(state.scopeTabBarState);
89
- this.editorWidget.restoreState(state.editorState);
90
- this.searchbarWidget.restoreState(state.searchbarWidgetState);
91
- }
92
- };
93
- /**
94
- * The widget `id`.
95
- */
96
- PreferencesWidget.ID = 'settings_widget';
97
- /**
98
- * The widget `label` which is used for display purposes.
99
- */
100
- PreferencesWidget.LABEL = nls_1.nls.localizeByDefault('Settings');
101
- __decorate([
102
- (0, inversify_1.inject)(preference_editor_widget_1.PreferencesEditorWidget),
103
- __metadata("design:type", preference_editor_widget_1.PreferencesEditorWidget)
104
- ], PreferencesWidget.prototype, "editorWidget", void 0);
105
- __decorate([
106
- (0, inversify_1.inject)(preference_tree_widget_1.PreferencesTreeWidget),
107
- __metadata("design:type", preference_tree_widget_1.PreferencesTreeWidget)
108
- ], PreferencesWidget.prototype, "treeWidget", void 0);
109
- __decorate([
110
- (0, inversify_1.inject)(preference_searchbar_widget_1.PreferencesSearchbarWidget),
111
- __metadata("design:type", preference_searchbar_widget_1.PreferencesSearchbarWidget)
112
- ], PreferencesWidget.prototype, "searchbarWidget", void 0);
113
- __decorate([
114
- (0, inversify_1.inject)(preference_scope_tabbar_widget_1.PreferencesScopeTabBar),
115
- __metadata("design:type", preference_scope_tabbar_widget_1.PreferencesScopeTabBar)
116
- ], PreferencesWidget.prototype, "tabBarWidget", void 0);
117
- __decorate([
118
- (0, inversify_1.postConstruct)(),
119
- __metadata("design:type", Function),
120
- __metadata("design:paramtypes", []),
121
- __metadata("design:returntype", void 0)
122
- ], PreferencesWidget.prototype, "init", null);
123
- PreferencesWidget = PreferencesWidget_1 = __decorate([
124
- (0, inversify_1.injectable)()
125
- ], PreferencesWidget);
126
- exports.PreferencesWidget = PreferencesWidget;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var PreferencesWidget_1;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.PreferencesWidget = void 0;
29
+ const inversify_1 = require("@theia/core/shared/inversify");
30
+ const browser_1 = require("@theia/core/lib/browser");
31
+ const preference_editor_widget_1 = require("./preference-editor-widget");
32
+ const preference_tree_widget_1 = require("./preference-tree-widget");
33
+ const preference_searchbar_widget_1 = require("./preference-searchbar-widget");
34
+ const preference_scope_tabbar_widget_1 = require("./preference-scope-tabbar-widget");
35
+ const nls_1 = require("@theia/core/lib/common/nls");
36
+ let PreferencesWidget = PreferencesWidget_1 = class PreferencesWidget extends browser_1.Panel {
37
+ get currentScope() {
38
+ return this.tabBarWidget.currentScope;
39
+ }
40
+ setSearchTerm(query) {
41
+ return this.searchbarWidget.updateSearchTerm(query);
42
+ }
43
+ setScope(scope) {
44
+ this.tabBarWidget.setScope(scope);
45
+ }
46
+ onResize(msg) {
47
+ super.onResize(msg);
48
+ if (msg.width < 600 && this.treeWidget && !this.treeWidget.isHidden) {
49
+ this.treeWidget.hide();
50
+ this.editorWidget.addClass('full-pane');
51
+ }
52
+ else if (msg.width >= 600 && this.treeWidget && this.treeWidget.isHidden) {
53
+ this.treeWidget.show();
54
+ this.editorWidget.removeClass('full-pane');
55
+ }
56
+ }
57
+ onActivateRequest(msg) {
58
+ super.onActivateRequest(msg);
59
+ this.searchbarWidget.focus();
60
+ }
61
+ init() {
62
+ this.id = PreferencesWidget_1.ID;
63
+ this.title.label = PreferencesWidget_1.LABEL;
64
+ this.title.closable = true;
65
+ this.addClass('theia-settings-container');
66
+ this.title.iconClass = (0, browser_1.codicon)('settings');
67
+ this.searchbarWidget.addClass('preferences-searchbar-widget');
68
+ this.addWidget(this.searchbarWidget);
69
+ this.tabBarWidget.addClass('preferences-tabbar-widget');
70
+ this.addWidget(this.tabBarWidget);
71
+ this.treeWidget.addClass('preferences-tree-widget');
72
+ this.addWidget(this.treeWidget);
73
+ this.editorWidget.addClass('preferences-editor-widget');
74
+ this.addWidget(this.editorWidget);
75
+ this.update();
76
+ }
77
+ getPreviewNode() {
78
+ return this.node;
79
+ }
80
+ storeState() {
81
+ return {
82
+ scopeTabBarState: this.tabBarWidget.storeState(),
83
+ editorState: this.editorWidget.storeState(),
84
+ searchbarWidgetState: this.searchbarWidget.storeState(),
85
+ };
86
+ }
87
+ restoreState(state) {
88
+ this.tabBarWidget.restoreState(state.scopeTabBarState);
89
+ this.editorWidget.restoreState(state.editorState);
90
+ this.searchbarWidget.restoreState(state.searchbarWidgetState);
91
+ }
92
+ };
93
+ /**
94
+ * The widget `id`.
95
+ */
96
+ PreferencesWidget.ID = 'settings_widget';
97
+ /**
98
+ * The widget `label` which is used for display purposes.
99
+ */
100
+ PreferencesWidget.LABEL = nls_1.nls.localizeByDefault('Settings');
101
+ __decorate([
102
+ (0, inversify_1.inject)(preference_editor_widget_1.PreferencesEditorWidget),
103
+ __metadata("design:type", preference_editor_widget_1.PreferencesEditorWidget)
104
+ ], PreferencesWidget.prototype, "editorWidget", void 0);
105
+ __decorate([
106
+ (0, inversify_1.inject)(preference_tree_widget_1.PreferencesTreeWidget),
107
+ __metadata("design:type", preference_tree_widget_1.PreferencesTreeWidget)
108
+ ], PreferencesWidget.prototype, "treeWidget", void 0);
109
+ __decorate([
110
+ (0, inversify_1.inject)(preference_searchbar_widget_1.PreferencesSearchbarWidget),
111
+ __metadata("design:type", preference_searchbar_widget_1.PreferencesSearchbarWidget)
112
+ ], PreferencesWidget.prototype, "searchbarWidget", void 0);
113
+ __decorate([
114
+ (0, inversify_1.inject)(preference_scope_tabbar_widget_1.PreferencesScopeTabBar),
115
+ __metadata("design:type", preference_scope_tabbar_widget_1.PreferencesScopeTabBar)
116
+ ], PreferencesWidget.prototype, "tabBarWidget", void 0);
117
+ __decorate([
118
+ (0, inversify_1.postConstruct)(),
119
+ __metadata("design:type", Function),
120
+ __metadata("design:paramtypes", []),
121
+ __metadata("design:returntype", void 0)
122
+ ], PreferencesWidget.prototype, "init", null);
123
+ PreferencesWidget = PreferencesWidget_1 = __decorate([
124
+ (0, inversify_1.injectable)()
125
+ ], PreferencesWidget);
126
+ exports.PreferencesWidget = PreferencesWidget;
127
127
  //# sourceMappingURL=preference-widget.js.map
@@ -1,24 +1,24 @@
1
- import URI from '@theia/core/lib/common/uri';
2
- import { PreferenceScope } from '@theia/core/lib/browser/preferences';
3
- import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
4
- import { AbstractResourcePreferenceProvider } from './abstract-resource-preference-provider';
5
- export declare class WorkspaceFilePreferenceProviderOptions {
6
- workspaceUri: URI;
7
- }
8
- export declare const WorkspaceFilePreferenceProviderFactory: unique symbol;
9
- export declare type WorkspaceFilePreferenceProviderFactory = (options: WorkspaceFilePreferenceProviderOptions) => WorkspaceFilePreferenceProvider;
10
- export declare class WorkspaceFilePreferenceProvider extends AbstractResourcePreferenceProvider {
11
- protected readonly workspaceService: WorkspaceService;
12
- protected readonly options: WorkspaceFilePreferenceProviderOptions;
13
- protected sectionsInsideSettings: Set<string>;
14
- protected getUri(): URI;
15
- protected parse(content: string): any;
16
- protected getPath(preferenceName: string): string[];
17
- /**
18
- * @returns `true` if `firstSegment` is a section name (e.g. `tasks`, `launch`)
19
- */
20
- protected belongsInSection(firstSegment: string, remainder: string): boolean;
21
- getScope(): PreferenceScope;
22
- getDomain(): string[];
23
- }
1
+ import URI from '@theia/core/lib/common/uri';
2
+ import { PreferenceScope } from '@theia/core/lib/browser/preferences';
3
+ import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
4
+ import { AbstractResourcePreferenceProvider } from './abstract-resource-preference-provider';
5
+ export declare class WorkspaceFilePreferenceProviderOptions {
6
+ workspaceUri: URI;
7
+ }
8
+ export declare const WorkspaceFilePreferenceProviderFactory: unique symbol;
9
+ export declare type WorkspaceFilePreferenceProviderFactory = (options: WorkspaceFilePreferenceProviderOptions) => WorkspaceFilePreferenceProvider;
10
+ export declare class WorkspaceFilePreferenceProvider extends AbstractResourcePreferenceProvider {
11
+ protected readonly workspaceService: WorkspaceService;
12
+ protected readonly options: WorkspaceFilePreferenceProviderOptions;
13
+ protected sectionsInsideSettings: Set<string>;
14
+ protected getUri(): URI;
15
+ protected parse(content: string): any;
16
+ protected getPath(preferenceName: string): string[];
17
+ /**
18
+ * @returns `true` if `firstSegment` is a section name (e.g. `tasks`, `launch`)
19
+ */
20
+ protected belongsInSection(firstSegment: string, remainder: string): boolean;
21
+ getScope(): PreferenceScope;
22
+ getDomain(): string[];
23
+ }
24
24
  //# sourceMappingURL=workspace-file-preference-provider.d.ts.map
@@ -1,111 +1,111 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.WorkspaceFilePreferenceProvider = exports.WorkspaceFilePreferenceProviderFactory = exports.WorkspaceFilePreferenceProviderOptions = void 0;
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const preferences_1 = require("@theia/core/lib/browser/preferences");
30
- const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
31
- const abstract_resource_preference_provider_1 = require("./abstract-resource-preference-provider");
32
- let WorkspaceFilePreferenceProviderOptions = class WorkspaceFilePreferenceProviderOptions {
33
- };
34
- WorkspaceFilePreferenceProviderOptions = __decorate([
35
- (0, inversify_1.injectable)()
36
- ], WorkspaceFilePreferenceProviderOptions);
37
- exports.WorkspaceFilePreferenceProviderOptions = WorkspaceFilePreferenceProviderOptions;
38
- exports.WorkspaceFilePreferenceProviderFactory = Symbol('WorkspaceFilePreferenceProviderFactory');
39
- let WorkspaceFilePreferenceProvider = class WorkspaceFilePreferenceProvider extends abstract_resource_preference_provider_1.AbstractResourcePreferenceProvider {
40
- constructor() {
41
- super(...arguments);
42
- this.sectionsInsideSettings = new Set();
43
- }
44
- getUri() {
45
- return this.options.workspaceUri;
46
- }
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- parse(content) {
49
- const data = super.parse(content);
50
- if (workspace_service_1.WorkspaceData.is(data)) {
51
- const settings = { ...data.settings };
52
- for (const key of this.configurations.getSectionNames().filter(name => name !== 'settings')) {
53
- // If the user has written configuration inside the "settings" object, we will respect that.
54
- if (settings[key]) {
55
- this.sectionsInsideSettings.add(key);
56
- }
57
- // Favor sections outside the "settings" object to agree with VSCode behavior
58
- if (data[key]) {
59
- settings[key] = data[key];
60
- this.sectionsInsideSettings.delete(key);
61
- }
62
- }
63
- return settings;
64
- }
65
- return {};
66
- }
67
- getPath(preferenceName) {
68
- var _a;
69
- const firstSegment = preferenceName.split('.', 1)[0];
70
- const remainder = preferenceName.slice(firstSegment.length + 1);
71
- if (this.belongsInSection(firstSegment, remainder)) {
72
- // Default to writing sections outside the "settings" object.
73
- const path = [firstSegment];
74
- if (remainder) {
75
- path.push(remainder);
76
- }
77
- // If the user has already written this section inside the "settings" object, modify it there.
78
- if (this.sectionsInsideSettings.has(firstSegment)) {
79
- path.unshift('settings');
80
- }
81
- return path;
82
- }
83
- return ['settings'].concat((_a = super.getPath(preferenceName)) !== null && _a !== void 0 ? _a : []);
84
- }
85
- /**
86
- * @returns `true` if `firstSegment` is a section name (e.g. `tasks`, `launch`)
87
- */
88
- belongsInSection(firstSegment, remainder) {
89
- return this.configurations.isSectionName(firstSegment);
90
- }
91
- getScope() {
92
- return preferences_1.PreferenceScope.Workspace;
93
- }
94
- getDomain() {
95
- // workspace file is treated as part of the workspace
96
- return this.workspaceService.tryGetRoots().map(r => r.resource.toString()).concat([this.options.workspaceUri.toString()]);
97
- }
98
- };
99
- __decorate([
100
- (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
101
- __metadata("design:type", workspace_service_1.WorkspaceService)
102
- ], WorkspaceFilePreferenceProvider.prototype, "workspaceService", void 0);
103
- __decorate([
104
- (0, inversify_1.inject)(WorkspaceFilePreferenceProviderOptions),
105
- __metadata("design:type", WorkspaceFilePreferenceProviderOptions)
106
- ], WorkspaceFilePreferenceProvider.prototype, "options", void 0);
107
- WorkspaceFilePreferenceProvider = __decorate([
108
- (0, inversify_1.injectable)()
109
- ], WorkspaceFilePreferenceProvider);
110
- exports.WorkspaceFilePreferenceProvider = WorkspaceFilePreferenceProvider;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.WorkspaceFilePreferenceProvider = exports.WorkspaceFilePreferenceProviderFactory = exports.WorkspaceFilePreferenceProviderOptions = void 0;
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const preferences_1 = require("@theia/core/lib/browser/preferences");
30
+ const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
31
+ const abstract_resource_preference_provider_1 = require("./abstract-resource-preference-provider");
32
+ let WorkspaceFilePreferenceProviderOptions = class WorkspaceFilePreferenceProviderOptions {
33
+ };
34
+ WorkspaceFilePreferenceProviderOptions = __decorate([
35
+ (0, inversify_1.injectable)()
36
+ ], WorkspaceFilePreferenceProviderOptions);
37
+ exports.WorkspaceFilePreferenceProviderOptions = WorkspaceFilePreferenceProviderOptions;
38
+ exports.WorkspaceFilePreferenceProviderFactory = Symbol('WorkspaceFilePreferenceProviderFactory');
39
+ let WorkspaceFilePreferenceProvider = class WorkspaceFilePreferenceProvider extends abstract_resource_preference_provider_1.AbstractResourcePreferenceProvider {
40
+ constructor() {
41
+ super(...arguments);
42
+ this.sectionsInsideSettings = new Set();
43
+ }
44
+ getUri() {
45
+ return this.options.workspaceUri;
46
+ }
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ parse(content) {
49
+ const data = super.parse(content);
50
+ if (workspace_service_1.WorkspaceData.is(data)) {
51
+ const settings = { ...data.settings };
52
+ for (const key of this.configurations.getSectionNames().filter(name => name !== 'settings')) {
53
+ // If the user has written configuration inside the "settings" object, we will respect that.
54
+ if (settings[key]) {
55
+ this.sectionsInsideSettings.add(key);
56
+ }
57
+ // Favor sections outside the "settings" object to agree with VSCode behavior
58
+ if (data[key]) {
59
+ settings[key] = data[key];
60
+ this.sectionsInsideSettings.delete(key);
61
+ }
62
+ }
63
+ return settings;
64
+ }
65
+ return {};
66
+ }
67
+ getPath(preferenceName) {
68
+ var _a;
69
+ const firstSegment = preferenceName.split('.', 1)[0];
70
+ const remainder = preferenceName.slice(firstSegment.length + 1);
71
+ if (this.belongsInSection(firstSegment, remainder)) {
72
+ // Default to writing sections outside the "settings" object.
73
+ const path = [firstSegment];
74
+ if (remainder) {
75
+ path.push(remainder);
76
+ }
77
+ // If the user has already written this section inside the "settings" object, modify it there.
78
+ if (this.sectionsInsideSettings.has(firstSegment)) {
79
+ path.unshift('settings');
80
+ }
81
+ return path;
82
+ }
83
+ return ['settings'].concat((_a = super.getPath(preferenceName)) !== null && _a !== void 0 ? _a : []);
84
+ }
85
+ /**
86
+ * @returns `true` if `firstSegment` is a section name (e.g. `tasks`, `launch`)
87
+ */
88
+ belongsInSection(firstSegment, remainder) {
89
+ return this.configurations.isSectionName(firstSegment);
90
+ }
91
+ getScope() {
92
+ return preferences_1.PreferenceScope.Workspace;
93
+ }
94
+ getDomain() {
95
+ // workspace file is treated as part of the workspace
96
+ return this.workspaceService.tryGetRoots().map(r => r.resource.toString()).concat([this.options.workspaceUri.toString()]);
97
+ }
98
+ };
99
+ __decorate([
100
+ (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
101
+ __metadata("design:type", workspace_service_1.WorkspaceService)
102
+ ], WorkspaceFilePreferenceProvider.prototype, "workspaceService", void 0);
103
+ __decorate([
104
+ (0, inversify_1.inject)(WorkspaceFilePreferenceProviderOptions),
105
+ __metadata("design:type", WorkspaceFilePreferenceProviderOptions)
106
+ ], WorkspaceFilePreferenceProvider.prototype, "options", void 0);
107
+ WorkspaceFilePreferenceProvider = __decorate([
108
+ (0, inversify_1.injectable)()
109
+ ], WorkspaceFilePreferenceProvider);
110
+ exports.WorkspaceFilePreferenceProvider = WorkspaceFilePreferenceProvider;
111
111
  //# sourceMappingURL=workspace-file-preference-provider.js.map
@@ -1,29 +1,29 @@
1
- import URI from '@theia/core/lib/common/uri';
2
- import { DisposableCollection } from '@theia/core/lib/common/disposable';
3
- import { PreferenceProvider } from '@theia/core/lib/browser/preferences';
4
- import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
5
- import { WorkspaceFilePreferenceProviderFactory } from './workspace-file-preference-provider';
6
- export declare class WorkspacePreferenceProvider extends PreferenceProvider {
7
- protected readonly workspaceService: WorkspaceService;
8
- protected readonly workspaceFileProviderFactory: WorkspaceFilePreferenceProviderFactory;
9
- protected readonly folderPreferenceProvider: PreferenceProvider;
10
- protected readonly toDisposeOnEnsureDelegateUpToDate: DisposableCollection;
11
- protected init(): void;
12
- getConfigUri(resourceUri?: string | undefined, sectionName?: string): URI | undefined;
13
- getContainingConfigUri(resourceUri?: string | undefined, sectionName?: string): URI | undefined;
14
- protected _delegate: PreferenceProvider | undefined;
15
- protected get delegate(): PreferenceProvider | undefined;
16
- protected ensureDelegateUpToDate(): void;
17
- protected createDelegate(): PreferenceProvider | undefined;
18
- get<T>(preferenceName: string, resourceUri?: string | undefined): T | undefined;
19
- resolve<T>(preferenceName: string, resourceUri?: string | undefined): {
20
- value?: T;
21
- configUri?: URI;
22
- };
23
- getPreferences(resourceUri?: string | undefined): {
24
- [p: string]: any;
25
- };
26
- setPreference(preferenceName: string, value: any, resourceUri?: string | undefined): Promise<boolean>;
27
- protected ensureResourceUri(): string | undefined;
28
- }
1
+ import URI from '@theia/core/lib/common/uri';
2
+ import { DisposableCollection } from '@theia/core/lib/common/disposable';
3
+ import { PreferenceProvider } from '@theia/core/lib/browser/preferences';
4
+ import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
5
+ import { WorkspaceFilePreferenceProviderFactory } from './workspace-file-preference-provider';
6
+ export declare class WorkspacePreferenceProvider extends PreferenceProvider {
7
+ protected readonly workspaceService: WorkspaceService;
8
+ protected readonly workspaceFileProviderFactory: WorkspaceFilePreferenceProviderFactory;
9
+ protected readonly folderPreferenceProvider: PreferenceProvider;
10
+ protected readonly toDisposeOnEnsureDelegateUpToDate: DisposableCollection;
11
+ protected init(): void;
12
+ getConfigUri(resourceUri?: string | undefined, sectionName?: string): URI | undefined;
13
+ getContainingConfigUri(resourceUri?: string | undefined, sectionName?: string): URI | undefined;
14
+ protected _delegate: PreferenceProvider | undefined;
15
+ protected get delegate(): PreferenceProvider | undefined;
16
+ protected ensureDelegateUpToDate(): void;
17
+ protected createDelegate(): PreferenceProvider | undefined;
18
+ get<T>(preferenceName: string, resourceUri?: string | undefined): T | undefined;
19
+ resolve<T>(preferenceName: string, resourceUri?: string | undefined): {
20
+ value?: T;
21
+ configUri?: URI;
22
+ };
23
+ getPreferences(resourceUri?: string | undefined): {
24
+ [p: string]: any;
25
+ };
26
+ setPreference(preferenceName: string, value: any, resourceUri?: string | undefined): Promise<boolean>;
27
+ protected ensureResourceUri(): string | undefined;
28
+ }
29
29
  //# sourceMappingURL=workspace-preference-provider.d.ts.map