UNPKG

14.8 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 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");
26const windowTitleDescription = [
27 'Controls the window title based on the active editor. Variables are substituted based on the context:',
28 '`${activeEditorShort}`: the file name (e.g. myFile.txt).',
29 '`${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt).',
30 '`${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt).',
31 '`${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder).',
32 '`${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder).',
33 '`${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder).',
34 '`${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder).',
35 '`${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).',
36 '`${rootName}`: name of the opened workspace or folder (e.g. myFolder or myWorkspace).',
37 '`${rootPath}`: file path of the opened workspace or folder (e.g. /Users/Development/myWorkspace).',
38 '`${appName}`: e.g. VS Code.',
39 '`${remoteName}`: e.g. SSH',
40 '`${dirty}`: an indicator for when the active editor has unsaved changes.',
41 '`${separator}`: a conditional separator (" - ") that only shows when surrounded by variables with values or static text.'
42].map(e => nls_1.nls.localizeByDefault(e)).join('\n- ');
43exports.corePreferenceSchema = {
44 'type': 'object',
45 properties: {
46 'application.confirmExit': {
47 type: 'string',
48 enum: [
49 'never',
50 'ifRequired',
51 'always',
52 ],
53 default: 'ifRequired',
54 // eslint-disable-next-line max-len
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.menuBarVisibility': {
82 type: 'string',
83 enum: ['classic', 'visible', 'hidden', 'compact'],
84 markdownEnumDescriptions: [
85 nls_1.nls.localizeByDefault('Menu is displayed at the top of the window and only hidden in full screen mode.'),
86 nls_1.nls.localizeByDefault('Menu is always visible at the top of the window even in full screen mode.'),
87 nls_1.nls.localizeByDefault('Menu is always hidden.'),
88 nls_1.nls.localizeByDefault('Menu is displayed as a compact button in the side bar. This value is ignored when `#window.titleBarStyle#` is `native`.')
89 ],
90 default: 'classic',
91 scope: 'application',
92 // eslint-disable-next-line max-len
93 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."),
94 included: !(os_1.isOSX && environment_1.environment.electron.is())
95 },
96 'window.title': {
97 type: 'string',
98 default: os_1.isOSX
99 ? '${activeEditorShort}${separator}${rootName}'
100 : '${dirty} ${activeEditorShort}${separator}${rootName}${separator}${appName}',
101 scope: 'application',
102 markdownDescription: windowTitleDescription
103 },
104 'window.titleSeparator': {
105 type: 'string',
106 default: ' - ',
107 scope: 'application',
108 markdownDescription: nls_1.nls.localizeByDefault('Separator used by `window.title`.')
109 },
110 'http.proxy': {
111 type: 'string',
112 pattern: '^https?://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$',
113 // eslint-disable-next-line max-len
114 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.'),
115 scope: 'application'
116 },
117 'http.proxyStrictSSL': {
118 type: 'boolean',
119 default: true,
120 description: nls_1.nls.localizeByDefault('Controls whether the proxy server certificate should be verified against the list of supplied CAs.'),
121 scope: 'application'
122 },
123 'http.proxyAuthorization': {
124 type: 'string',
125 markdownDescription: nls_1.nls.localizeByDefault('The value to send as the `Proxy-Authorization` header for every network request.'),
126 scope: 'application'
127 },
128 'http.proxySupport': {
129 type: 'string',
130 enum: ['off', 'on', 'fallback', 'override'],
131 enumDescriptions: [
132 nls_1.nls.localizeByDefault('Disable proxy support for extensions.'),
133 nls_1.nls.localizeByDefault('Enable proxy support for extensions.'),
134 nls_1.nls.localizeByDefault('Enable proxy support for extensions, fall back to request options, when no proxy found.'),
135 nls_1.nls.localizeByDefault('Enable proxy support for extensions, override request options.'),
136 ],
137 default: 'override',
138 description: nls_1.nls.localizeByDefault('Use the proxy support for extensions.'),
139 scope: 'application'
140 },
141 'http.systemCertificates': {
142 type: 'boolean',
143 default: true,
144 // eslint-disable-next-line max-len
145 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.)'),
146 scope: 'application'
147 },
148 'workbench.list.openMode': {
149 type: 'string',
150 enum: [
151 'singleClick',
152 'doubleClick'
153 ],
154 default: 'singleClick',
155 // eslint-disable-next-line max-len
156 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.')
157 },
158 'workbench.editor.highlightModifiedTabs': {
159 'type': 'boolean',
160 // eslint-disable-next-line max-len
161 'markdownDescription': nls_1.nls.localize('theia/core/highlightModifiedTabs', 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.'),
162 'default': false
163 },
164 'workbench.editor.closeOnFileDelete': {
165 'type': 'boolean',
166 // eslint-disable-next-line max-len
167 '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.'),
168 'default': false
169 },
170 'workbench.editor.mouseBackForwardToNavigate': {
171 'type': 'boolean',
172 'description': nls_1.nls.localizeByDefault("Enables the use of mouse buttons four and five for commands 'Go Back' and 'Go Forward'."),
173 'default': true
174 },
175 'workbench.commandPalette.history': {
176 type: 'number',
177 default: 50,
178 minimum: 0,
179 // eslint-disable-next-line max-len
180 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.')
181 },
182 'workbench.colorTheme': {
183 type: 'string',
184 enum: ['dark', 'light', 'hc-theia'],
185 enumItemLabels: ['Dark (Theia)', 'Light (Theia)', 'High Contrast (Theia)'],
186 default: application_props_1.DefaultTheme.defaultForOSTheme(frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().defaultTheme),
187 description: nls_1.nls.localizeByDefault('Specifies the color theme used in the workbench.')
188 },
189 'workbench.iconTheme': {
190 type: ['string'],
191 enum: ['none', 'theia-file-icons'],
192 enumItemLabels: [nls_1.nls.localizeByDefault('None'), 'File Icons (Theia)'],
193 default: frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().defaultIconTheme,
194 description: nls_1.nls.localizeByDefault("Specifies the file icon theme used in the workbench or 'null' to not show any file icons.")
195 },
196 'workbench.silentNotifications': {
197 type: 'boolean',
198 default: false,
199 description: nls_1.nls.localize('theia/core/silentNotifications', 'Controls whether to suppress notification popups.')
200 },
201 'workbench.statusBar.visible': {
202 type: 'boolean',
203 default: true,
204 description: nls_1.nls.localizeByDefault('Controls the visibility of the status bar at the bottom of the workbench.')
205 },
206 'workbench.tree.renderIndentGuides': {
207 type: 'string',
208 enum: ['onHover', 'none', 'always'],
209 default: 'onHover',
210 description: nls_1.nls.localizeByDefault('Controls whether the tree should render indent guides.')
211 },
212 'workbench.hover.delay': {
213 type: 'number',
214 default: os_1.isOSX ? 1500 : 500,
215 description: nls_1.nls.localizeByDefault('Controls the delay in milliseconds after which the hover is shown.')
216 },
217 'workbench.sash.hoverDelay': {
218 type: 'number',
219 default: 300,
220 minimum: 0,
221 maximum: 2000,
222 description: nls_1.nls.localizeByDefault('Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.')
223 },
224 'workbench.sash.size': {
225 type: 'number',
226 default: 4,
227 minimum: 1,
228 maximum: 20,
229 // eslint-disable-next-line max-len
230 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.')
231 },
232 'workbench.tab.maximize': {
233 type: 'boolean',
234 default: false,
235 description: nls_1.nls.localize('theia/core/tabMaximize', 'Controls whether to maximize tabs on double click.')
236 }
237 }
238};
239exports.CorePreferenceContribution = Symbol('CorePreferenceContribution');
240exports.CorePreferences = Symbol('CorePreferences');
241function createCorePreferences(preferences, schema = exports.corePreferenceSchema) {
242 return (0, preferences_1.createPreferenceProxy)(preferences, schema);
243}
244exports.createCorePreferences = createCorePreferences;
245function bindCorePreferences(bind) {
246 bind(exports.CorePreferences).toDynamicValue(ctx => {
247 const preferences = ctx.container.get(preferences_1.PreferenceService);
248 const contribution = ctx.container.get(exports.CorePreferenceContribution);
249 return createCorePreferences(preferences, contribution.schema);
250 }).inSingletonScope();
251 bind(exports.CorePreferenceContribution).toConstantValue({ schema: exports.corePreferenceSchema });
252 bind(preferences_1.PreferenceContribution).toService(exports.CorePreferenceContribution);
253}
254exports.bindCorePreferences = bindCorePreferences;
255//# sourceMappingURL=core-preferences.js.map
\No newline at end of file