UNPKG

18.6 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2018 Google 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// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.bindCorePreferences = exports.createCorePreferences = exports.CorePreferences = exports.CorePreferenceContribution = exports.corePreferenceSchema = void 0;
19const environment_1 = require("@theia/application-package/lib/environment");
20const preferences_1 = require("./preferences");
21const supported_encodings_1 = require("./supported-encodings");
22const frontend_application_config_provider_1 = require("./frontend-application-config-provider");
23const os_1 = require("../common/os");
24const nls_1 = require("../common/nls");
25const application_props_1 = require("@theia/application-package/lib/application-props");
26/* eslint-disable max-len */
27const windowTitleDescription = [
28 nls_1.nls.localizeByDefault('Controls the window title based on the current context such as the opened workspace or active editor. Variables are substituted based on the context:'),
29 nls_1.nls.localizeByDefault('`${activeEditorShort}`: the file name (e.g. myFile.txt).'),
30 nls_1.nls.localizeByDefault('`${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt).'),
31 nls_1.nls.localizeByDefault('`${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt).'),
32 nls_1.nls.localizeByDefault('`${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder).'),
33 nls_1.nls.localizeByDefault('`${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder).'),
34 nls_1.nls.localizeByDefault('`${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder).'),
35 nls_1.nls.localizeByDefault('`${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder).'),
36 nls_1.nls.localizeByDefault('`${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).'),
37 nls_1.nls.localizeByDefault('`${rootName}`: name of the workspace with optional remote name and workspace indicator if applicable (e.g. myFolder, myRemoteFolder [SSH] or myWorkspace (Workspace)).'),
38 nls_1.nls.localizeByDefault('`${rootPath}`: file path of the opened workspace or folder (e.g. /Users/Development/myWorkspace).'),
39 nls_1.nls.localizeByDefault('`${appName}`: e.g. VS Code.'),
40 nls_1.nls.localizeByDefault('`${remoteName}`: e.g. SSH'),
41 nls_1.nls.localizeByDefault('`${dirty}`: an indicator for when the active editor has unsaved changes.'),
42 nls_1.nls.localizeByDefault('`${separator}`: a conditional separator (" - ") that only shows when surrounded by variables with values or static text.')
43].join('\n- ');
44exports.corePreferenceSchema = {
45 'type': 'object',
46 properties: {
47 'application.confirmExit': {
48 type: 'string',
49 enum: [
50 'never',
51 'ifRequired',
52 'always',
53 ],
54 default: 'ifRequired',
55 description: nls_1.nls.localizeByDefault('Controls whether to show a confirmation dialog before closing the browser tab or window. Note that even if enabled, browsers may still decide to close a tab or window without confirmation and that this setting is only a hint that may not work in all cases.'),
56 },
57 'breadcrumbs.enabled': {
58 'type': 'boolean',
59 'default': true,
60 'description': nls_1.nls.localizeByDefault('Enable/disable navigation breadcrumbs.'),
61 'scope': 'application'
62 },
63 'files.encoding': {
64 'type': 'string',
65 'enum': Object.keys(supported_encodings_1.SUPPORTED_ENCODINGS),
66 'default': 'utf8',
67 'description': nls_1.nls.localizeByDefault('The default character set encoding to use when reading and writing files. This setting can also be configured per language.'),
68 'scope': 'language-overridable',
69 'enumDescriptions': Object.keys(supported_encodings_1.SUPPORTED_ENCODINGS).map(key => supported_encodings_1.SUPPORTED_ENCODINGS[key].labelLong),
70 'included': Object.keys(supported_encodings_1.SUPPORTED_ENCODINGS).length > 1
71 },
72 'keyboard.dispatch': {
73 type: 'string',
74 enum: [
75 'code',
76 'keyCode',
77 ],
78 default: 'code',
79 markdownDescription: nls_1.nls.localizeByDefault('Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`.')
80 },
81 'window.tabbar.enhancedPreview': {
82 type: 'string',
83 enum: ['classic', 'enhanced', 'visual'],
84 markdownEnumDescriptions: [
85 nls_1.nls.localize('theia/core/enhancedPreview/classic', 'Display a simple preview of the tab with basic information.'),
86 nls_1.nls.localize('theia/core/enhancedPreview/enhanced', 'Display an enhanced preview of the tab with additional information.'),
87 nls_1.nls.localize('theia/core/enhancedPreview/visual', 'Display a visual preview of the tab.'),
88 ],
89 default: 'classic',
90 description: nls_1.nls.localize('theia/core/enhancedPreview', 'Controls what information about the tab should be displayed in horizontal tab bars, when hovering.')
91 },
92 'window.menuBarVisibility': {
93 type: 'string',
94 enum: ['classic', 'visible', 'hidden', 'compact'],
95 markdownEnumDescriptions: [
96 nls_1.nls.localizeByDefault('Menu is displayed at the top of the window and only hidden in full screen mode.'),
97 nls_1.nls.localizeByDefault('Menu is always visible at the top of the window even in full screen mode.'),
98 nls_1.nls.localizeByDefault('Menu is always hidden.'),
99 nls_1.nls.localizeByDefault('Menu is displayed as a compact button in the side bar. This value is ignored when {0} is {1}.', '`#window.titleBarStyle#`', '`native`')
100 ],
101 default: 'classic',
102 scope: 'application',
103 markdownDescription: nls_1.nls.localizeByDefault("Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it. A setting of 'compact' will move the menu into the side bar."),
104 included: !(os_1.isOSX && environment_1.environment.electron.is())
105 },
106 'window.title': {
107 type: 'string',
108 default: os_1.isOSX
109 ? '${activeEditorShort}${separator}${rootName}'
110 : '${dirty} ${activeEditorShort}${separator}${rootName}${separator}${appName}',
111 scope: 'application',
112 markdownDescription: windowTitleDescription
113 },
114 'window.titleSeparator': {
115 type: 'string',
116 default: ' - ',
117 scope: 'application',
118 markdownDescription: nls_1.nls.localizeByDefault('Separator used by {0}.', '`#window.title#`')
119 },
120 'window.secondaryWindowPlacement': {
121 type: 'string',
122 enum: ['originalSize', 'halfWidth', 'fullSize'],
123 enumDescriptions: [
124 nls_1.nls.localize('theia/core/secondaryWindow/originalSize', 'The position and size of the extracted widget will be the same as the original widget.'),
125 nls_1.nls.localize('theia/core/secondaryWindow/halfWidth', 'The position and size of the extracted widget will be half the width of the running Theia application.'),
126 nls_1.nls.localize('theia/core/secondaryWindow/fullSize', 'The position and size of the extracted widget will be the same as the running Theia application.'),
127 ],
128 default: 'originalSize',
129 description: nls_1.nls.localize('theia/core/secondaryWindow/description', 'Sets the initial position and size of the extracted secondary window.'),
130 },
131 'window.secondaryWindowAlwaysOnTop': {
132 type: 'boolean',
133 default: false,
134 description: nls_1.nls.localize('theia/core/secondaryWindow/alwaysOnTop', 'When enabled, the secondary window stays above all other windows, including those of different applications.'),
135 },
136 'http.proxy': {
137 type: 'string',
138 pattern: '^https?://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$',
139 markdownDescription: nls_1.nls.localizeByDefault('The proxy setting to use. If not set, will be inherited from the `http_proxy` and `https_proxy` environment variables.'),
140 scope: 'application'
141 },
142 'http.proxyStrictSSL': {
143 type: 'boolean',
144 default: true,
145 description: nls_1.nls.localizeByDefault('Controls whether the proxy server certificate should be verified against the list of supplied CAs.'),
146 scope: 'application'
147 },
148 'http.proxyAuthorization': {
149 type: 'string',
150 markdownDescription: nls_1.nls.localizeByDefault('The value to send as the `Proxy-Authorization` header for every network request.'),
151 scope: 'application'
152 },
153 'http.proxySupport': {
154 type: 'string',
155 enum: ['off', 'on', 'fallback', 'override'],
156 enumDescriptions: [
157 nls_1.nls.localizeByDefault('Disable proxy support for extensions.'),
158 nls_1.nls.localizeByDefault('Enable proxy support for extensions.'),
159 nls_1.nls.localizeByDefault('Enable proxy support for extensions, fall back to request options, when no proxy found.'),
160 nls_1.nls.localizeByDefault('Enable proxy support for extensions, override request options.'),
161 ],
162 default: 'override',
163 description: nls_1.nls.localizeByDefault('Use the proxy support for extensions.'),
164 scope: 'application'
165 },
166 'http.systemCertificates': {
167 type: 'boolean',
168 default: true,
169 description: nls_1.nls.localizeByDefault('Controls whether CA certificates should be loaded from the OS. (On Windows and macOS, a reload of the window is required after turning this off.)'),
170 scope: 'application'
171 },
172 'workbench.list.openMode': {
173 type: 'string',
174 enum: [
175 'singleClick',
176 'doubleClick'
177 ],
178 default: 'singleClick',
179 description: nls_1.nls.localizeByDefault('Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.')
180 },
181 'workbench.editor.highlightModifiedTabs': {
182 'type': 'boolean',
183 'markdownDescription': nls_1.nls.localize('theia/core/highlightModifiedTabs', 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.'),
184 'default': false
185 },
186 'workbench.editor.closeOnFileDelete': {
187 'type': 'boolean',
188 'description': nls_1.nls.localizeByDefault('Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that editors with unsaved changes will never close to preserve your data.'),
189 'default': false
190 },
191 'workbench.editor.mouseBackForwardToNavigate': {
192 'type': 'boolean',
193 'description': nls_1.nls.localizeByDefault("Enables the use of mouse buttons four and five for commands 'Go Back' and 'Go Forward'."),
194 'default': true
195 },
196 'workbench.editor.revealIfOpen': {
197 'type': 'boolean',
198 'description': nls_1.nls.localizeByDefault('Controls whether an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, such as when forcing an editor to open in a specific group or to the side of the currently active group.'),
199 'default': false
200 },
201 'workbench.editor.decorations.badges': {
202 'type': 'boolean',
203 'description': nls_1.nls.localizeByDefault('Controls whether editor file decorations should use badges.'),
204 'default': true
205 },
206 'workbench.commandPalette.history': {
207 type: 'number',
208 default: 50,
209 minimum: 0,
210 description: nls_1.nls.localizeByDefault('Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history.')
211 },
212 'workbench.colorTheme': {
213 type: 'string',
214 enum: ['dark', 'light', 'hc-theia'],
215 enumItemLabels: ['Dark (Theia)', 'Light (Theia)', 'High Contrast (Theia)'],
216 default: application_props_1.DefaultTheme.defaultForOSTheme(frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().defaultTheme),
217 description: nls_1.nls.localizeByDefault('Specifies the color theme used in the workbench.')
218 },
219 'workbench.iconTheme': {
220 type: ['string'],
221 enum: ['none', 'theia-file-icons'],
222 enumItemLabels: [nls_1.nls.localizeByDefault('None'), 'File Icons (Theia)'],
223 default: frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().defaultIconTheme,
224 description: nls_1.nls.localizeByDefault("Specifies the file icon theme used in the workbench or 'null' to not show any file icons.")
225 },
226 'workbench.silentNotifications': {
227 type: 'boolean',
228 default: false,
229 description: nls_1.nls.localize('theia/core/silentNotifications', 'Controls whether to suppress notification popups.')
230 },
231 'workbench.statusBar.visible': {
232 type: 'boolean',
233 default: true,
234 description: nls_1.nls.localizeByDefault('Controls the visibility of the status bar at the bottom of the workbench.')
235 },
236 'workbench.tree.renderIndentGuides': {
237 type: 'string',
238 enum: ['onHover', 'none', 'always'],
239 default: 'onHover',
240 description: nls_1.nls.localizeByDefault('Controls whether the tree should render indent guides.')
241 },
242 'workbench.hover.delay': {
243 type: 'number',
244 default: os_1.isOSX ? 1500 : 500,
245 description: nls_1.nls.localizeByDefault('Controls the delay in milliseconds after which the hover is shown.')
246 },
247 'workbench.sash.hoverDelay': {
248 type: 'number',
249 default: 300,
250 minimum: 0,
251 maximum: 2000,
252 description: nls_1.nls.localizeByDefault('Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.')
253 },
254 'workbench.sash.size': {
255 type: 'number',
256 default: 4,
257 minimum: 1,
258 maximum: 20,
259 description: nls_1.nls.localizeByDefault('Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if you feel it\'s hard to resize views using the mouse.')
260 },
261 'workbench.tab.maximize': {
262 type: 'boolean',
263 default: false,
264 description: nls_1.nls.localize('theia/core/tabMaximize', 'Controls whether to maximize tabs on double click.')
265 },
266 'workbench.tab.shrinkToFit.enabled': {
267 type: 'boolean',
268 default: false,
269 description: nls_1.nls.localize('theia/core/tabShrinkToFit', 'Shrink tabs to fit available space.')
270 },
271 'workbench.tab.shrinkToFit.minimumSize': {
272 type: 'number',
273 default: 50,
274 minimum: 10,
275 description: nls_1.nls.localize('theia/core/tabMinimumSize', 'Specifies the minimum size for tabs.')
276 },
277 'workbench.tab.shrinkToFit.defaultSize': {
278 type: 'number',
279 default: 200,
280 minimum: 10,
281 description: nls_1.nls.localize('theia/core/tabDefaultSize', 'Specifies the default size for tabs.')
282 }
283 }
284};
285exports.CorePreferenceContribution = Symbol('CorePreferenceContribution');
286exports.CorePreferences = Symbol('CorePreferences');
287function createCorePreferences(preferences, schema = exports.corePreferenceSchema) {
288 return (0, preferences_1.createPreferenceProxy)(preferences, schema);
289}
290exports.createCorePreferences = createCorePreferences;
291function bindCorePreferences(bind) {
292 bind(exports.CorePreferences).toDynamicValue(ctx => {
293 const preferences = ctx.container.get(preferences_1.PreferenceService);
294 const contribution = ctx.container.get(exports.CorePreferenceContribution);
295 return createCorePreferences(preferences, contribution.schema);
296 }).inSingletonScope();
297 bind(exports.CorePreferenceContribution).toConstantValue({ schema: exports.corePreferenceSchema });
298 bind(preferences_1.PreferenceContribution).toService(exports.CorePreferenceContribution);
299}
300exports.bindCorePreferences = bindCorePreferences;
301//# sourceMappingURL=core-preferences.js.map
\No newline at end of file