@theia/editor 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 (112) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/decorations/editor-decoration-style.d.ts +8 -8
  3. package/lib/browser/decorations/editor-decoration-style.js +36 -36
  4. package/lib/browser/decorations/editor-decoration.d.ts +106 -106
  5. package/lib/browser/decorations/editor-decoration.js +37 -37
  6. package/lib/browser/decorations/editor-decorator.d.ts +6 -6
  7. package/lib/browser/decorations/editor-decorator.js +43 -43
  8. package/lib/browser/decorations/index.d.ts +3 -3
  9. package/lib/browser/decorations/index.js +30 -30
  10. package/lib/browser/diff-navigator.d.ts +9 -10
  11. package/lib/browser/diff-navigator.d.ts.map +1 -1
  12. package/lib/browser/diff-navigator.js +19 -19
  13. package/lib/browser/diff-navigator.js.map +1 -1
  14. package/lib/browser/editor-command.d.ts +102 -102
  15. package/lib/browser/editor-command.js +426 -426
  16. package/lib/browser/editor-contribution.d.ts +26 -26
  17. package/lib/browser/editor-contribution.js +198 -198
  18. package/lib/browser/editor-frontend-module.d.ts +5 -5
  19. package/lib/browser/editor-frontend-module.js +74 -74
  20. package/lib/browser/editor-generated-preference-schema.d.ts +282 -249
  21. package/lib/browser/editor-generated-preference-schema.d.ts.map +1 -1
  22. package/lib/browser/editor-generated-preference-schema.js +2451 -2316
  23. package/lib/browser/editor-generated-preference-schema.js.map +1 -1
  24. package/lib/browser/editor-keybinding.d.ts +5 -5
  25. package/lib/browser/editor-keybinding.js +55 -55
  26. package/lib/browser/editor-linenumber-contribution.d.ts +15 -15
  27. package/lib/browser/editor-linenumber-contribution.d.ts.map +1 -1
  28. package/lib/browser/editor-linenumber-contribution.js +95 -96
  29. package/lib/browser/editor-linenumber-contribution.js.map +1 -1
  30. package/lib/browser/editor-manager.d.ts +115 -115
  31. package/lib/browser/editor-manager.js +428 -428
  32. package/lib/browser/editor-menu.d.ts +48 -48
  33. package/lib/browser/editor-menu.js +210 -210
  34. package/lib/browser/editor-navigation-contribution.d.ts +67 -67
  35. package/lib/browser/editor-navigation-contribution.js +343 -343
  36. package/lib/browser/editor-preferences.d.ts +41 -41
  37. package/lib/browser/editor-preferences.js +176 -176
  38. package/lib/browser/editor-variable-contribution.d.ts +8 -8
  39. package/lib/browser/editor-variable-contribution.js +64 -64
  40. package/lib/browser/editor-widget-factory.d.ts +17 -17
  41. package/lib/browser/editor-widget-factory.js +91 -91
  42. package/lib/browser/editor-widget.d.ts +24 -24
  43. package/lib/browser/editor-widget.d.ts.map +1 -1
  44. package/lib/browser/editor-widget.js +122 -114
  45. package/lib/browser/editor-widget.js.map +1 -1
  46. package/lib/browser/editor.d.ts +295 -293
  47. package/lib/browser/editor.d.ts.map +1 -1
  48. package/lib/browser/editor.js +103 -103
  49. package/lib/browser/editor.js.map +1 -1
  50. package/lib/browser/index.d.ts +10 -10
  51. package/lib/browser/index.js +37 -37
  52. package/lib/browser/language-status/editor-language-status-service.d.ts +77 -77
  53. package/lib/browser/language-status/editor-language-status-service.js +251 -251
  54. package/lib/browser/navigation/navigation-location-service.d.ts +103 -103
  55. package/lib/browser/navigation/navigation-location-service.js +281 -281
  56. package/lib/browser/navigation/navigation-location-service.spec.d.ts +1 -1
  57. package/lib/browser/navigation/navigation-location-service.spec.js +184 -184
  58. package/lib/browser/navigation/navigation-location-similarity.d.ts +15 -15
  59. package/lib/browser/navigation/navigation-location-similarity.js +62 -62
  60. package/lib/browser/navigation/navigation-location-similarity.spec.d.ts +1 -1
  61. package/lib/browser/navigation/navigation-location-similarity.spec.js +32 -32
  62. package/lib/browser/navigation/navigation-location-updater.d.ts +35 -35
  63. package/lib/browser/navigation/navigation-location-updater.js +210 -210
  64. package/lib/browser/navigation/navigation-location-updater.spec.d.ts +1 -1
  65. package/lib/browser/navigation/navigation-location-updater.spec.js +177 -177
  66. package/lib/browser/navigation/navigation-location.d.ts +191 -191
  67. package/lib/browser/navigation/navigation-location.js +300 -300
  68. package/lib/browser/navigation/test/mock-navigation-location-updater.d.ts +15 -15
  69. package/lib/browser/navigation/test/mock-navigation-location-updater.js +38 -38
  70. package/lib/browser/quick-editor-service.d.ts +16 -16
  71. package/lib/browser/quick-editor-service.js +109 -109
  72. package/lib/browser/undo-redo-service.d.ts +23 -23
  73. package/lib/browser/undo-redo-service.js +110 -110
  74. package/lib/common/language-selector.d.ts +13 -13
  75. package/lib/common/language-selector.js +90 -90
  76. package/lib/package.spec.js +25 -25
  77. package/package.json +5 -5
  78. package/src/browser/decorations/editor-decoration-style.ts +41 -41
  79. package/src/browser/decorations/editor-decoration.ts +127 -127
  80. package/src/browser/decorations/editor-decorator.ts +36 -36
  81. package/src/browser/decorations/index.ts +19 -19
  82. package/src/browser/diff-navigator.ts +27 -28
  83. package/src/browser/editor-command.ts +414 -414
  84. package/src/browser/editor-contribution.ts +185 -185
  85. package/src/browser/editor-frontend-module.ts +87 -87
  86. package/src/browser/editor-generated-preference-schema.ts +2707 -2539
  87. package/src/browser/editor-keybinding.ts +55 -55
  88. package/src/browser/editor-linenumber-contribution.ts +88 -89
  89. package/src/browser/editor-manager.ts +442 -442
  90. package/src/browser/editor-menu.ts +224 -224
  91. package/src/browser/editor-navigation-contribution.ts +343 -343
  92. package/src/browser/editor-preferences.ts +226 -226
  93. package/src/browser/editor-variable-contribution.ts +54 -54
  94. package/src/browser/editor-widget-factory.ts +82 -82
  95. package/src/browser/editor-widget.ts +137 -130
  96. package/src/browser/editor.ts +360 -358
  97. package/src/browser/index.ts +26 -26
  98. package/src/browser/language-status/editor-language-status-service.ts +271 -271
  99. package/src/browser/language-status/editor-language-status.css +101 -101
  100. package/src/browser/navigation/navigation-location-service.spec.ts +245 -245
  101. package/src/browser/navigation/navigation-location-service.ts +284 -284
  102. package/src/browser/navigation/navigation-location-similarity.spec.ts +46 -46
  103. package/src/browser/navigation/navigation-location-similarity.ts +58 -58
  104. package/src/browser/navigation/navigation-location-updater.spec.ts +197 -197
  105. package/src/browser/navigation/navigation-location-updater.ts +220 -220
  106. package/src/browser/navigation/navigation-location.ts +418 -418
  107. package/src/browser/navigation/test/mock-navigation-location-updater.ts +41 -41
  108. package/src/browser/quick-editor-service.ts +94 -94
  109. package/src/browser/style/index.css +19 -19
  110. package/src/browser/undo-redo-service.ts +120 -120
  111. package/src/common/language-selector.ts +104 -104
  112. package/src/package.spec.ts +28 -28
@@ -1,42 +1,42 @@
1
- import { interfaces } from '@theia/core/shared/inversify';
2
- import { PreferenceProxy, PreferenceService, PreferenceSchema, PreferenceChangeEvent } from '@theia/core/lib/browser/preferences';
3
- import { GeneratedEditorPreferences } from './editor-generated-preference-schema';
4
- interface CodeActionsContributionProperties {
5
- 'editor.codeActionsOnSave': string[] | ({
6
- 'source.fixAll': boolean;
7
- } & Record<string, boolean>);
8
- }
9
- interface FileContributionEditorPreferences {
10
- 'editor.formatOnSave': boolean;
11
- 'editor.formatOnSaveMode': 'file' | 'modifications' | 'modificationsIfAvailable';
12
- 'files.eol': '\n' | '\r\n' | 'auto';
13
- 'files.autoSave': 'off' | 'afterDelay' | 'onFocusChange' | 'onWindowChange';
14
- 'files.autoSaveDelay': number;
15
- 'files.refactoring.autoSave': boolean;
16
- }
17
- interface FormatActionsMultipleProperties {
18
- 'editor.defaultFormatter': string | null;
19
- }
20
- interface TheiaEditorProperties {
21
- 'editor.formatOnSaveTimeout': number;
22
- 'editor.history.persistClosedEditors': boolean;
23
- }
24
- export declare const editorPreferenceSchema: PreferenceSchema;
25
- export interface EditorConfiguration extends GeneratedEditorPreferences, CodeActionsContributionProperties, FileContributionEditorPreferences, FormatActionsMultipleProperties, TheiaEditorProperties {
26
- }
27
- export declare type EndOfLinePreference = '\n' | '\r\n' | 'auto';
28
- export declare type EditorPreferenceChange = PreferenceChangeEvent<EditorConfiguration>;
29
- export declare const EditorPreferenceContribution: unique symbol;
30
- export declare const EditorPreferences: unique symbol;
31
- export declare type EditorPreferences = PreferenceProxy<EditorConfiguration>;
32
- /**
33
- * @deprecated @since 1.23.0
34
- *
35
- * By default, editor preferences now use a validated preference proxy created by the PreferenceProxyFactory binding.
36
- * This function will create an unvalidated preference proxy.
37
- * See {@link bindEditorPreferences}
38
- */
39
- export declare function createEditorPreferences(preferences: PreferenceService, schema?: PreferenceSchema): EditorPreferences;
40
- export declare function bindEditorPreferences(bind: interfaces.Bind): void;
41
- export {};
1
+ import { interfaces } from '@theia/core/shared/inversify';
2
+ import { PreferenceProxy, PreferenceService, PreferenceSchema, PreferenceChangeEvent } from '@theia/core/lib/browser/preferences';
3
+ import { GeneratedEditorPreferences } from './editor-generated-preference-schema';
4
+ interface CodeActionsContributionProperties {
5
+ 'editor.codeActionsOnSave': string[] | ({
6
+ 'source.fixAll': boolean;
7
+ } & Record<string, boolean>);
8
+ }
9
+ interface FileContributionEditorPreferences {
10
+ 'editor.formatOnSave': boolean;
11
+ 'editor.formatOnSaveMode': 'file' | 'modifications' | 'modificationsIfAvailable';
12
+ 'files.eol': '\n' | '\r\n' | 'auto';
13
+ 'files.autoSave': 'off' | 'afterDelay' | 'onFocusChange' | 'onWindowChange';
14
+ 'files.autoSaveDelay': number;
15
+ 'files.refactoring.autoSave': boolean;
16
+ }
17
+ interface FormatActionsMultipleProperties {
18
+ 'editor.defaultFormatter': string | null;
19
+ }
20
+ interface TheiaEditorProperties {
21
+ 'editor.formatOnSaveTimeout': number;
22
+ 'editor.history.persistClosedEditors': boolean;
23
+ }
24
+ export declare const editorPreferenceSchema: PreferenceSchema;
25
+ export interface EditorConfiguration extends GeneratedEditorPreferences, CodeActionsContributionProperties, FileContributionEditorPreferences, FormatActionsMultipleProperties, TheiaEditorProperties {
26
+ }
27
+ export declare type EndOfLinePreference = '\n' | '\r\n' | 'auto';
28
+ export declare type EditorPreferenceChange = PreferenceChangeEvent<EditorConfiguration>;
29
+ export declare const EditorPreferenceContribution: unique symbol;
30
+ export declare const EditorPreferences: unique symbol;
31
+ export declare type EditorPreferences = PreferenceProxy<EditorConfiguration>;
32
+ /**
33
+ * @deprecated @since 1.23.0
34
+ *
35
+ * By default, editor preferences now use a validated preference proxy created by the PreferenceProxyFactory binding.
36
+ * This function will create an unvalidated preference proxy.
37
+ * See {@link bindEditorPreferences}
38
+ */
39
+ export declare function createEditorPreferences(preferences: PreferenceService, schema?: PreferenceSchema): EditorPreferences;
40
+ export declare function bindEditorPreferences(bind: interfaces.Bind): void;
41
+ export {};
42
42
  //# sourceMappingURL=editor-preferences.d.ts.map
@@ -1,177 +1,177 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.bindEditorPreferences = exports.createEditorPreferences = exports.EditorPreferences = exports.EditorPreferenceContribution = exports.editorPreferenceSchema = void 0;
19
- const preferences_1 = require("@theia/core/lib/browser/preferences");
20
- const injectable_preference_proxy_1 = require("@theia/core/lib/browser/preferences/injectable-preference-proxy");
21
- const nls_1 = require("@theia/core/lib/common/nls");
22
- const core_1 = require("@theia/core");
23
- const editor_generated_preference_schema_1 = require("./editor-generated-preference-schema");
24
- /* eslint-disable @theia/localization-check,max-len,no-null/no-null */
25
- // #region src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.ts
26
- const codeActionsContributionSchema = {
27
- 'editor.codeActionsOnSave': {
28
- oneOf: [
29
- {
30
- type: 'object',
31
- properties: {
32
- 'source.fixAll': {
33
- type: 'boolean',
34
- description: nls_1.nls.localizeByDefault('Controls whether auto fix action should be run on file save.')
35
- }
36
- },
37
- additionalProperties: {
38
- type: 'boolean'
39
- },
40
- },
41
- {
42
- type: 'array',
43
- items: { type: 'string' }
44
- }
45
- ],
46
- default: {},
47
- description: nls_1.nls.localizeByDefault('Code action kinds to be run on save.'),
48
- scope: 'language-overridable',
49
- }
50
- };
51
- // #endregion
52
- // #region src/vs/workbench/contrib/files/browser/files.contribution.ts
53
- const fileContributionSchema = {
54
- 'editor.formatOnSave': {
55
- 'type': 'boolean',
56
- 'description': nls_1.nls.localizeByDefault('Format a file on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down.'),
57
- 'scope': preferences_1.PreferenceScope.fromString('language-overridable'),
58
- },
59
- 'editor.formatOnSaveMode': {
60
- 'type': 'string',
61
- 'default': 'file',
62
- 'enum': [
63
- 'file',
64
- 'modifications',
65
- 'modificationsIfAvailable'
66
- ],
67
- 'enumDescriptions': [
68
- nls_1.nls.localizeByDefault('Format the whole file.'),
69
- nls_1.nls.localizeByDefault('Format modifications (requires source control).'),
70
- nls_1.nls.localize('theia/editor/editor.formatOnSaveMode.modificationsIfAvailable', "Will attempt to format modifications only (requires source control). If source control can't be used, then the whole file will be formatted."),
71
- ],
72
- 'markdownDescription': nls_1.nls.localizeByDefault('Controls if format on save formats the whole file or only modifications. Only applies when `#editor.formatOnSave#` is enabled.'),
73
- 'scope': preferences_1.PreferenceScope.fromString('language-overridable'),
74
- },
75
- // Include this, even though it is not strictly an `editor`preference.
76
- 'files.eol': {
77
- 'type': 'string',
78
- 'enum': [
79
- '\n',
80
- '\r\n',
81
- 'auto'
82
- ],
83
- 'enumDescriptions': [
84
- nls_1.nls.localizeByDefault('LF'),
85
- nls_1.nls.localizeByDefault('CRLF'),
86
- nls_1.nls.localizeByDefault('Uses operating system specific end of line character.')
87
- ],
88
- 'default': 'auto',
89
- 'description': nls_1.nls.localizeByDefault('The default end of line character.'),
90
- 'scope': preferences_1.PreferenceScope.fromString('language-overridable')
91
- },
92
- // We used to call these `editor.autoSave` and `editor.autoSaveDelay`.
93
- 'files.autoSave': {
94
- 'type': 'string',
95
- 'enum': ['off', 'afterDelay', 'onFocusChange', 'onWindowChange'],
96
- 'markdownEnumDescriptions': [
97
- nls_1.nls.localize('theia/editor/files.autoSave.off', 'An editor with changes is never automatically saved.'),
98
- nls_1.nls.localize('theia/editor/files.autoSave.afterDelay', 'An editor with changes is automatically saved after the configured `#files.autoSaveDelay#`.'),
99
- nls_1.nls.localize('theia/editor/files.autoSave.onFocusChange', 'An editor with changes is automatically saved when the editor loses focus.'),
100
- nls_1.nls.localize('theia/editor/files.autoSave.onWindowChange', 'An editor with changes is automatically saved when the window loses focus.')
101
- ],
102
- 'default': core_1.environment.electron.is() ? 'off' : 'afterDelay',
103
- 'markdownDescription': nls_1.nls.localize('theia/editor/files.autoSave', 'Controls [auto save](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save) of editors that have unsaved changes.', 'off', 'afterDelay', 'onFocusChange', 'onWindowChange', 'afterDelay')
104
- },
105
- 'files.autoSaveDelay': {
106
- 'type': 'number',
107
- 'default': 1000,
108
- 'minimum': 0,
109
- 'markdownDescription': nls_1.nls.localizeByDefault('Controls the delay in milliseconds after which an editor with unsaved changes is saved automatically. Only applies when `#files.autoSave#` is set to `{0}`.', 'afterDelay')
110
- },
111
- 'files.refactoring.autoSave': {
112
- 'type': 'boolean',
113
- 'default': true,
114
- 'description': nls_1.nls.localizeByDefault('Controls if files that were part of a refactoring are saved automatically')
115
- }
116
- };
117
- // #endregion
118
- // #region src/vs/workbench/contrib/format/browser/formatActionsMultiple.ts
119
- // This schema depends on a lot of private stuff in the file, so this is a stripped down version.
120
- const formatActionsMultipleSchema = {
121
- 'editor.defaultFormatter': {
122
- description: nls_1.nls.localizeByDefault('Defines a default formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter.'),
123
- type: ['string', 'null'],
124
- default: null,
125
- }
126
- };
127
- // #endregion
128
- // #region Custom Theia extensions to editor preferences
129
- const theiaEditorSchema = {
130
- 'editor.formatOnSaveTimeout': {
131
- 'type': 'number',
132
- 'default': 750,
133
- 'description': nls_1.nls.localize('theia/editor/formatOnSaveTimeout', 'Timeout in milliseconds after which the formatting that is run on file save is cancelled.')
134
- },
135
- 'editor.history.persistClosedEditors': {
136
- 'type': 'boolean',
137
- 'default': false,
138
- 'description': nls_1.nls.localize('theia/editor/persistClosedEditors', 'Controls whether to persist closed editor history for the workspace across window reloads.')
139
- },
140
- };
141
- // #endregion
142
- const combinedProperties = {
143
- ...editor_generated_preference_schema_1.editorGeneratedPreferenceProperties,
144
- ...codeActionsContributionSchema,
145
- ...fileContributionSchema,
146
- ...formatActionsMultipleSchema,
147
- ...theiaEditorSchema
148
- };
149
- exports.editorPreferenceSchema = {
150
- 'type': 'object',
151
- 'scope': 'resource',
152
- 'overridable': true,
153
- 'properties': combinedProperties,
154
- };
155
- exports.EditorPreferenceContribution = Symbol('EditorPreferenceContribution');
156
- exports.EditorPreferences = Symbol('EditorPreferences');
157
- /**
158
- * @deprecated @since 1.23.0
159
- *
160
- * By default, editor preferences now use a validated preference proxy created by the PreferenceProxyFactory binding.
161
- * This function will create an unvalidated preference proxy.
162
- * See {@link bindEditorPreferences}
163
- */
164
- function createEditorPreferences(preferences, schema = exports.editorPreferenceSchema) {
165
- return (0, preferences_1.createPreferenceProxy)(preferences, schema);
166
- }
167
- exports.createEditorPreferences = createEditorPreferences;
168
- function bindEditorPreferences(bind) {
169
- bind(exports.EditorPreferences).toDynamicValue(ctx => {
170
- const factory = ctx.container.get(injectable_preference_proxy_1.PreferenceProxyFactory);
171
- return factory(exports.editorPreferenceSchema);
172
- }).inSingletonScope();
173
- bind(exports.EditorPreferenceContribution).toConstantValue({ schema: exports.editorPreferenceSchema });
174
- bind(preferences_1.PreferenceContribution).toService(exports.EditorPreferenceContribution);
175
- }
176
- exports.bindEditorPreferences = bindEditorPreferences;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.bindEditorPreferences = exports.createEditorPreferences = exports.EditorPreferences = exports.EditorPreferenceContribution = exports.editorPreferenceSchema = void 0;
19
+ const preferences_1 = require("@theia/core/lib/browser/preferences");
20
+ const injectable_preference_proxy_1 = require("@theia/core/lib/browser/preferences/injectable-preference-proxy");
21
+ const nls_1 = require("@theia/core/lib/common/nls");
22
+ const core_1 = require("@theia/core");
23
+ const editor_generated_preference_schema_1 = require("./editor-generated-preference-schema");
24
+ /* eslint-disable @theia/localization-check,max-len,no-null/no-null */
25
+ // #region src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.ts
26
+ const codeActionsContributionSchema = {
27
+ 'editor.codeActionsOnSave': {
28
+ oneOf: [
29
+ {
30
+ type: 'object',
31
+ properties: {
32
+ 'source.fixAll': {
33
+ type: 'boolean',
34
+ description: nls_1.nls.localizeByDefault('Controls whether auto fix action should be run on file save.')
35
+ }
36
+ },
37
+ additionalProperties: {
38
+ type: 'boolean'
39
+ },
40
+ },
41
+ {
42
+ type: 'array',
43
+ items: { type: 'string' }
44
+ }
45
+ ],
46
+ default: {},
47
+ description: nls_1.nls.localizeByDefault('Code action kinds to be run on save.'),
48
+ scope: 'language-overridable',
49
+ }
50
+ };
51
+ // #endregion
52
+ // #region src/vs/workbench/contrib/files/browser/files.contribution.ts
53
+ const fileContributionSchema = {
54
+ 'editor.formatOnSave': {
55
+ 'type': 'boolean',
56
+ 'description': nls_1.nls.localizeByDefault('Format a file on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down.'),
57
+ 'scope': preferences_1.PreferenceScope.fromString('language-overridable'),
58
+ },
59
+ 'editor.formatOnSaveMode': {
60
+ 'type': 'string',
61
+ 'default': 'file',
62
+ 'enum': [
63
+ 'file',
64
+ 'modifications',
65
+ 'modificationsIfAvailable'
66
+ ],
67
+ 'enumDescriptions': [
68
+ nls_1.nls.localizeByDefault('Format the whole file.'),
69
+ nls_1.nls.localizeByDefault('Format modifications (requires source control).'),
70
+ nls_1.nls.localize('theia/editor/editor.formatOnSaveMode.modificationsIfAvailable', "Will attempt to format modifications only (requires source control). If source control can't be used, then the whole file will be formatted."),
71
+ ],
72
+ 'markdownDescription': nls_1.nls.localizeByDefault('Controls if format on save formats the whole file or only modifications. Only applies when `#editor.formatOnSave#` is enabled.'),
73
+ 'scope': preferences_1.PreferenceScope.fromString('language-overridable'),
74
+ },
75
+ // Include this, even though it is not strictly an `editor`preference.
76
+ 'files.eol': {
77
+ 'type': 'string',
78
+ 'enum': [
79
+ '\n',
80
+ '\r\n',
81
+ 'auto'
82
+ ],
83
+ 'enumDescriptions': [
84
+ nls_1.nls.localizeByDefault('LF'),
85
+ nls_1.nls.localizeByDefault('CRLF'),
86
+ nls_1.nls.localizeByDefault('Uses operating system specific end of line character.')
87
+ ],
88
+ 'default': 'auto',
89
+ 'description': nls_1.nls.localizeByDefault('The default end of line character.'),
90
+ 'scope': preferences_1.PreferenceScope.fromString('language-overridable')
91
+ },
92
+ // We used to call these `editor.autoSave` and `editor.autoSaveDelay`.
93
+ 'files.autoSave': {
94
+ 'type': 'string',
95
+ 'enum': ['off', 'afterDelay', 'onFocusChange', 'onWindowChange'],
96
+ 'markdownEnumDescriptions': [
97
+ nls_1.nls.localize('theia/editor/files.autoSave.off', 'An editor with changes is never automatically saved.'),
98
+ nls_1.nls.localize('theia/editor/files.autoSave.afterDelay', 'An editor with changes is automatically saved after the configured `#files.autoSaveDelay#`.'),
99
+ nls_1.nls.localize('theia/editor/files.autoSave.onFocusChange', 'An editor with changes is automatically saved when the editor loses focus.'),
100
+ nls_1.nls.localize('theia/editor/files.autoSave.onWindowChange', 'An editor with changes is automatically saved when the window loses focus.')
101
+ ],
102
+ 'default': core_1.environment.electron.is() ? 'off' : 'afterDelay',
103
+ 'markdownDescription': nls_1.nls.localize('theia/editor/files.autoSave', 'Controls [auto save](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save) of editors that have unsaved changes.', 'off', 'afterDelay', 'onFocusChange', 'onWindowChange', 'afterDelay')
104
+ },
105
+ 'files.autoSaveDelay': {
106
+ 'type': 'number',
107
+ 'default': 1000,
108
+ 'minimum': 0,
109
+ 'markdownDescription': nls_1.nls.localizeByDefault('Controls the delay in milliseconds after which an editor with unsaved changes is saved automatically. Only applies when `#files.autoSave#` is set to `{0}`.', 'afterDelay')
110
+ },
111
+ 'files.refactoring.autoSave': {
112
+ 'type': 'boolean',
113
+ 'default': true,
114
+ 'description': nls_1.nls.localizeByDefault('Controls if files that were part of a refactoring are saved automatically')
115
+ }
116
+ };
117
+ // #endregion
118
+ // #region src/vs/workbench/contrib/format/browser/formatActionsMultiple.ts
119
+ // This schema depends on a lot of private stuff in the file, so this is a stripped down version.
120
+ const formatActionsMultipleSchema = {
121
+ 'editor.defaultFormatter': {
122
+ description: nls_1.nls.localizeByDefault('Defines a default formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter.'),
123
+ type: ['string', 'null'],
124
+ default: null,
125
+ }
126
+ };
127
+ // #endregion
128
+ // #region Custom Theia extensions to editor preferences
129
+ const theiaEditorSchema = {
130
+ 'editor.formatOnSaveTimeout': {
131
+ 'type': 'number',
132
+ 'default': 750,
133
+ 'description': nls_1.nls.localize('theia/editor/formatOnSaveTimeout', 'Timeout in milliseconds after which the formatting that is run on file save is cancelled.')
134
+ },
135
+ 'editor.history.persistClosedEditors': {
136
+ 'type': 'boolean',
137
+ 'default': false,
138
+ 'description': nls_1.nls.localize('theia/editor/persistClosedEditors', 'Controls whether to persist closed editor history for the workspace across window reloads.')
139
+ },
140
+ };
141
+ // #endregion
142
+ const combinedProperties = {
143
+ ...editor_generated_preference_schema_1.editorGeneratedPreferenceProperties,
144
+ ...codeActionsContributionSchema,
145
+ ...fileContributionSchema,
146
+ ...formatActionsMultipleSchema,
147
+ ...theiaEditorSchema
148
+ };
149
+ exports.editorPreferenceSchema = {
150
+ 'type': 'object',
151
+ 'scope': 'resource',
152
+ 'overridable': true,
153
+ 'properties': combinedProperties,
154
+ };
155
+ exports.EditorPreferenceContribution = Symbol('EditorPreferenceContribution');
156
+ exports.EditorPreferences = Symbol('EditorPreferences');
157
+ /**
158
+ * @deprecated @since 1.23.0
159
+ *
160
+ * By default, editor preferences now use a validated preference proxy created by the PreferenceProxyFactory binding.
161
+ * This function will create an unvalidated preference proxy.
162
+ * See {@link bindEditorPreferences}
163
+ */
164
+ function createEditorPreferences(preferences, schema = exports.editorPreferenceSchema) {
165
+ return (0, preferences_1.createPreferenceProxy)(preferences, schema);
166
+ }
167
+ exports.createEditorPreferences = createEditorPreferences;
168
+ function bindEditorPreferences(bind) {
169
+ bind(exports.EditorPreferences).toDynamicValue(ctx => {
170
+ const factory = ctx.container.get(injectable_preference_proxy_1.PreferenceProxyFactory);
171
+ return factory(exports.editorPreferenceSchema);
172
+ }).inSingletonScope();
173
+ bind(exports.EditorPreferenceContribution).toConstantValue({ schema: exports.editorPreferenceSchema });
174
+ bind(preferences_1.PreferenceContribution).toService(exports.EditorPreferenceContribution);
175
+ }
176
+ exports.bindEditorPreferences = bindEditorPreferences;
177
177
  //# sourceMappingURL=editor-preferences.js.map
@@ -1,9 +1,9 @@
1
- import { VariableRegistry, VariableContribution } from '@theia/variable-resolver/lib/browser';
2
- import { TextEditor } from './editor';
3
- import { EditorManager } from './editor-manager';
4
- export declare class EditorVariableContribution implements VariableContribution {
5
- protected readonly editorManager: EditorManager;
6
- registerVariables(variables: VariableRegistry): void;
7
- protected getCurrentEditor(): TextEditor | undefined;
8
- }
1
+ import { VariableRegistry, VariableContribution } from '@theia/variable-resolver/lib/browser';
2
+ import { TextEditor } from './editor';
3
+ import { EditorManager } from './editor-manager';
4
+ export declare class EditorVariableContribution implements VariableContribution {
5
+ protected readonly editorManager: EditorManager;
6
+ registerVariables(variables: VariableRegistry): void;
7
+ protected getCurrentEditor(): TextEditor | undefined;
8
+ }
9
9
  //# sourceMappingURL=editor-variable-contribution.d.ts.map
@@ -1,65 +1,65 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 Red Hat, Inc. 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.EditorVariableContribution = void 0;
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const editor_manager_1 = require("./editor-manager");
30
- let EditorVariableContribution = class EditorVariableContribution {
31
- registerVariables(variables) {
32
- variables.registerVariable({
33
- name: 'lineNumber',
34
- description: 'The current line number in the currently opened file',
35
- resolve: () => {
36
- const editor = this.getCurrentEditor();
37
- return editor ? `${editor.cursor.line + 1}` : undefined;
38
- }
39
- });
40
- variables.registerVariable({
41
- name: 'selectedText',
42
- description: 'The current selected text in the active file',
43
- resolve: () => {
44
- const editor = this.getCurrentEditor();
45
- return editor ? editor.document.getText(editor.selection) : undefined;
46
- }
47
- });
48
- }
49
- getCurrentEditor() {
50
- const currentEditor = this.editorManager.currentEditor;
51
- if (!currentEditor) {
52
- return undefined;
53
- }
54
- return currentEditor.editor;
55
- }
56
- };
57
- __decorate([
58
- (0, inversify_1.inject)(editor_manager_1.EditorManager),
59
- __metadata("design:type", editor_manager_1.EditorManager)
60
- ], EditorVariableContribution.prototype, "editorManager", void 0);
61
- EditorVariableContribution = __decorate([
62
- (0, inversify_1.injectable)()
63
- ], EditorVariableContribution);
64
- exports.EditorVariableContribution = EditorVariableContribution;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Red Hat, Inc. 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.EditorVariableContribution = void 0;
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const editor_manager_1 = require("./editor-manager");
30
+ let EditorVariableContribution = class EditorVariableContribution {
31
+ registerVariables(variables) {
32
+ variables.registerVariable({
33
+ name: 'lineNumber',
34
+ description: 'The current line number in the currently opened file',
35
+ resolve: () => {
36
+ const editor = this.getCurrentEditor();
37
+ return editor ? `${editor.cursor.line + 1}` : undefined;
38
+ }
39
+ });
40
+ variables.registerVariable({
41
+ name: 'selectedText',
42
+ description: 'The current selected text in the active file',
43
+ resolve: () => {
44
+ const editor = this.getCurrentEditor();
45
+ return editor ? editor.document.getText(editor.selection) : undefined;
46
+ }
47
+ });
48
+ }
49
+ getCurrentEditor() {
50
+ const currentEditor = this.editorManager.currentEditor;
51
+ if (!currentEditor) {
52
+ return undefined;
53
+ }
54
+ return currentEditor.editor;
55
+ }
56
+ };
57
+ __decorate([
58
+ (0, inversify_1.inject)(editor_manager_1.EditorManager),
59
+ __metadata("design:type", editor_manager_1.EditorManager)
60
+ ], EditorVariableContribution.prototype, "editorManager", void 0);
61
+ EditorVariableContribution = __decorate([
62
+ (0, inversify_1.injectable)()
63
+ ], EditorVariableContribution);
64
+ exports.EditorVariableContribution = EditorVariableContribution;
65
65
  //# sourceMappingURL=editor-variable-contribution.js.map
@@ -1,18 +1,18 @@
1
- import URI from '@theia/core/lib/common/uri';
2
- import { SelectionService } from '@theia/core/lib/common';
3
- import { NavigatableWidgetOptions, WidgetFactory, LabelProvider } from '@theia/core/lib/browser';
4
- import { EditorWidget } from './editor-widget';
5
- import { TextEditorProvider } from './editor';
6
- export declare class EditorWidgetFactory implements WidgetFactory {
7
- static createID(uri: URI, counter?: number): string;
8
- static ID: string;
9
- readonly id: string;
10
- protected readonly labelProvider: LabelProvider;
11
- protected readonly editorProvider: TextEditorProvider;
12
- protected readonly selectionService: SelectionService;
13
- createWidget(options: NavigatableWidgetOptions): Promise<EditorWidget>;
14
- protected createEditor(uri: URI, options?: NavigatableWidgetOptions): Promise<EditorWidget>;
15
- protected constructEditor(uri: URI): Promise<EditorWidget>;
16
- private setLabels;
17
- }
1
+ import URI from '@theia/core/lib/common/uri';
2
+ import { SelectionService } from '@theia/core/lib/common';
3
+ import { NavigatableWidgetOptions, WidgetFactory, LabelProvider } from '@theia/core/lib/browser';
4
+ import { EditorWidget } from './editor-widget';
5
+ import { TextEditorProvider } from './editor';
6
+ export declare class EditorWidgetFactory implements WidgetFactory {
7
+ static createID(uri: URI, counter?: number): string;
8
+ static ID: string;
9
+ readonly id: string;
10
+ protected readonly labelProvider: LabelProvider;
11
+ protected readonly editorProvider: TextEditorProvider;
12
+ protected readonly selectionService: SelectionService;
13
+ createWidget(options: NavigatableWidgetOptions): Promise<EditorWidget>;
14
+ protected createEditor(uri: URI, options?: NavigatableWidgetOptions): Promise<EditorWidget>;
15
+ protected constructEditor(uri: URI): Promise<EditorWidget>;
16
+ private setLabels;
17
+ }
18
18
  //# sourceMappingURL=editor-widget-factory.d.ts.map