UNPKG

17.1 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 'http.proxy': {
121 type: 'string',
122 pattern: '^https?://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$',
123 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.'),
124 scope: 'application'
125 },
126 'http.proxyStrictSSL': {
127 type: 'boolean',
128 default: true,
129 description: nls_1.nls.localizeByDefault('Controls whether the proxy server certificate should be verified against the list of supplied CAs.'),
130 scope: 'application'
131 },
132 'http.proxyAuthorization': {
133 type: 'string',
134 markdownDescription: nls_1.nls.localizeByDefault('The value to send as the `Proxy-Authorization` header for every network request.'),
135 scope: 'application'
136 },
137 'http.proxySupport': {
138 type: 'string',
139 enum: ['off', 'on', 'fallback', 'override'],
140 enumDescriptions: [
141 nls_1.nls.localizeByDefault('Disable proxy support for extensions.'),
142 nls_1.nls.localizeByDefault('Enable proxy support for extensions.'),
143 nls_1.nls.localizeByDefault('Enable proxy support for extensions, fall back to request options, when no proxy found.'),
144 nls_1.nls.localizeByDefault('Enable proxy support for extensions, override request options.'),
145 ],
146 default: 'override',
147 description: nls_1.nls.localizeByDefault('Use the proxy support for extensions.'),
148 scope: 'application'
149 },
150 'http.systemCertificates': {
151 type: 'boolean',
152 default: true,
153 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.)'),
154 scope: 'application'
155 },
156 'workbench.list.openMode': {
157 type: 'string',
158 enum: [
159 'singleClick',
160 'doubleClick'
161 ],
162 default: 'singleClick',
163 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.')
164 },
165 'workbench.editor.highlightModifiedTabs': {
166 'type': 'boolean',
167 'markdownDescription': nls_1.nls.localize('theia/core/highlightModifiedTabs', 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.'),
168 'default': false
169 },
170 'workbench.editor.closeOnFileDelete': {
171 'type': 'boolean',
172 '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.'),
173 'default': false
174 },
175 'workbench.editor.mouseBackForwardToNavigate': {
176 'type': 'boolean',
177 'description': nls_1.nls.localizeByDefault("Enables the use of mouse buttons four and five for commands 'Go Back' and 'Go Forward'."),
178 'default': true
179 },
180 'workbench.editor.revealIfOpen': {
181 'type': 'boolean',
182 '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.'),
183 'default': false
184 },
185 'workbench.commandPalette.history': {
186 type: 'number',
187 default: 50,
188 minimum: 0,
189 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.')
190 },
191 'workbench.colorTheme': {
192 type: 'string',
193 enum: ['dark', 'light', 'hc-theia'],
194 enumItemLabels: ['Dark (Theia)', 'Light (Theia)', 'High Contrast (Theia)'],
195 default: application_props_1.DefaultTheme.defaultForOSTheme(frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().defaultTheme),
196 description: nls_1.nls.localizeByDefault('Specifies the color theme used in the workbench.')
197 },
198 'workbench.iconTheme': {
199 type: ['string'],
200 enum: ['none', 'theia-file-icons'],
201 enumItemLabels: [nls_1.nls.localizeByDefault('None'), 'File Icons (Theia)'],
202 default: frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().defaultIconTheme,
203 description: nls_1.nls.localizeByDefault("Specifies the file icon theme used in the workbench or 'null' to not show any file icons.")
204 },
205 'workbench.silentNotifications': {
206 type: 'boolean',
207 default: false,
208 description: nls_1.nls.localize('theia/core/silentNotifications', 'Controls whether to suppress notification popups.')
209 },
210 'workbench.statusBar.visible': {
211 type: 'boolean',
212 default: true,
213 description: nls_1.nls.localizeByDefault('Controls the visibility of the status bar at the bottom of the workbench.')
214 },
215 'workbench.tree.renderIndentGuides': {
216 type: 'string',
217 enum: ['onHover', 'none', 'always'],
218 default: 'onHover',
219 description: nls_1.nls.localizeByDefault('Controls whether the tree should render indent guides.')
220 },
221 'workbench.hover.delay': {
222 type: 'number',
223 default: os_1.isOSX ? 1500 : 500,
224 description: nls_1.nls.localizeByDefault('Controls the delay in milliseconds after which the hover is shown.')
225 },
226 'workbench.sash.hoverDelay': {
227 type: 'number',
228 default: 300,
229 minimum: 0,
230 maximum: 2000,
231 description: nls_1.nls.localizeByDefault('Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.')
232 },
233 'workbench.sash.size': {
234 type: 'number',
235 default: 4,
236 minimum: 1,
237 maximum: 20,
238 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.')
239 },
240 'workbench.tab.maximize': {
241 type: 'boolean',
242 default: false,
243 description: nls_1.nls.localize('theia/core/tabMaximize', 'Controls whether to maximize tabs on double click.')
244 },
245 'workbench.tab.shrinkToFit.enabled': {
246 type: 'boolean',
247 default: false,
248 description: nls_1.nls.localize('theia/core/tabShrinkToFit', 'Shrink tabs to fit available space.')
249 },
250 'workbench.tab.shrinkToFit.minimumSize': {
251 type: 'number',
252 default: 50,
253 minimum: 10,
254 description: nls_1.nls.localize('theia/core/tabMinimumSize', 'Specifies the minimum size for tabs.')
255 },
256 'workbench.tab.shrinkToFit.defaultSize': {
257 type: 'number',
258 default: 200,
259 minimum: 10,
260 description: nls_1.nls.localize('theia/core/tabDefaultSize', 'Specifies the default size for tabs.')
261 }
262 }
263};
264exports.CorePreferenceContribution = Symbol('CorePreferenceContribution');
265exports.CorePreferences = Symbol('CorePreferences');
266function createCorePreferences(preferences, schema = exports.corePreferenceSchema) {
267 return (0, preferences_1.createPreferenceProxy)(preferences, schema);
268}
269exports.createCorePreferences = createCorePreferences;
270function bindCorePreferences(bind) {
271 bind(exports.CorePreferences).toDynamicValue(ctx => {
272 const preferences = ctx.container.get(preferences_1.PreferenceService);
273 const contribution = ctx.container.get(exports.CorePreferenceContribution);
274 return createCorePreferences(preferences, contribution.schema);
275 }).inSingletonScope();
276 bind(exports.CorePreferenceContribution).toConstantValue({ schema: exports.corePreferenceSchema });
277 bind(preferences_1.PreferenceContribution).toService(exports.CorePreferenceContribution);
278}
279exports.bindCorePreferences = bindCorePreferences;
280//# sourceMappingURL=core-preferences.js.map
\No newline at end of file