@theia/terminal 1.34.2 → 1.34.3

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 (121) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +30 -30
  3. package/lib/browser/base/terminal-service.d.ts +34 -34
  4. package/lib/browser/base/terminal-service.js +7 -7
  5. package/lib/browser/base/terminal-widget.d.ts +184 -184
  6. package/lib/browser/base/terminal-widget.js +34 -34
  7. package/lib/browser/index.d.ts +1 -1
  8. package/lib/browser/index.js +28 -28
  9. package/lib/browser/search/terminal-search-container.d.ts +3 -3
  10. package/lib/browser/search/terminal-search-container.js +28 -28
  11. package/lib/browser/search/terminal-search-widget.d.ts +30 -30
  12. package/lib/browser/search/terminal-search-widget.js +147 -147
  13. package/lib/browser/shell-terminal-profile.d.ts +19 -19
  14. package/lib/browser/shell-terminal-profile.js +39 -39
  15. package/lib/browser/terminal-contribution.d.ts +3 -3
  16. package/lib/browser/terminal-contribution.js +20 -20
  17. package/lib/browser/terminal-copy-on-selection-handler.d.ts +10 -10
  18. package/lib/browser/terminal-copy-on-selection-handler.js +103 -103
  19. package/lib/browser/terminal-file-link-provider.d.ts +24 -24
  20. package/lib/browser/terminal-file-link-provider.js +200 -200
  21. package/lib/browser/terminal-frontend-contribution.d.ts +112 -112
  22. package/lib/browser/terminal-frontend-contribution.js +994 -994
  23. package/lib/browser/terminal-frontend-module.d.ts +5 -5
  24. package/lib/browser/terminal-frontend-module.js +115 -115
  25. package/lib/browser/terminal-keybinding-contexts.d.ts +15 -15
  26. package/lib/browser/terminal-keybinding-contexts.js +71 -71
  27. package/lib/browser/terminal-link-helpers.d.ts +27 -27
  28. package/lib/browser/terminal-link-helpers.js +155 -155
  29. package/lib/browser/terminal-link-provider.d.ts +51 -51
  30. package/lib/browser/terminal-link-provider.js +197 -197
  31. package/lib/browser/terminal-preferences.d.ts +61 -61
  32. package/lib/browser/terminal-preferences.js +329 -329
  33. package/lib/browser/terminal-profile-service.d.ts +55 -55
  34. package/lib/browser/terminal-profile-service.js +149 -149
  35. package/lib/browser/terminal-quick-open-service.d.ts +36 -36
  36. package/lib/browser/terminal-quick-open-service.js +137 -137
  37. package/lib/browser/terminal-theme-service.d.ts +21 -21
  38. package/lib/browser/terminal-theme-service.js +218 -218
  39. package/lib/browser/terminal-url-link-provider.d.ts +11 -11
  40. package/lib/browser/terminal-url-link-provider.js +76 -76
  41. package/lib/browser/terminal-widget-impl.d.ts +173 -173
  42. package/lib/browser/terminal-widget-impl.js +769 -769
  43. package/lib/common/base-terminal-protocol.d.ts +100 -100
  44. package/lib/common/base-terminal-protocol.js +88 -88
  45. package/lib/common/shell-terminal-protocol.d.ts +29 -29
  46. package/lib/common/shell-terminal-protocol.js +22 -22
  47. package/lib/common/terminal-common-module.d.ts +7 -7
  48. package/lib/common/terminal-common-module.js +31 -31
  49. package/lib/common/terminal-protocol.d.ts +12 -12
  50. package/lib/common/terminal-protocol.js +21 -21
  51. package/lib/common/terminal-watcher.d.ts +13 -13
  52. package/lib/common/terminal-watcher.js +70 -70
  53. package/lib/node/base-terminal-server.d.ts +36 -36
  54. package/lib/node/base-terminal-server.js +252 -252
  55. package/lib/node/buffering-stream.d.ts +39 -39
  56. package/lib/node/buffering-stream.js +75 -75
  57. package/lib/node/buffering-stream.spec.d.ts +1 -1
  58. package/lib/node/buffering-stream.spec.js +43 -43
  59. package/lib/node/index.d.ts +1 -1
  60. package/lib/node/index.js +28 -28
  61. package/lib/node/shell-process.d.ts +26 -26
  62. package/lib/node/shell-process.js +106 -106
  63. package/lib/node/shell-terminal-server.d.ts +14 -14
  64. package/lib/node/shell-terminal-server.js +114 -114
  65. package/lib/node/shell-terminal-server.spec.d.ts +1 -1
  66. package/lib/node/shell-terminal-server.spec.js +35 -35
  67. package/lib/node/terminal-backend-contribution.d.ts +9 -9
  68. package/lib/node/terminal-backend-contribution.js +75 -75
  69. package/lib/node/terminal-backend-contribution.slow-spec.d.ts +1 -1
  70. package/lib/node/terminal-backend-contribution.slow-spec.js +54 -54
  71. package/lib/node/terminal-backend-module.d.ts +11 -11
  72. package/lib/node/terminal-backend-module.js +69 -69
  73. package/lib/node/terminal-server.d.ts +9 -9
  74. package/lib/node/terminal-server.js +64 -64
  75. package/lib/node/terminal-server.spec.d.ts +1 -1
  76. package/lib/node/terminal-server.spec.js +41 -41
  77. package/lib/node/test/terminal-test-container.d.ts +2 -2
  78. package/lib/node/test/terminal-test-container.js +40 -40
  79. package/lib/package.spec.js +25 -25
  80. package/package.json +9 -9
  81. package/src/browser/base/terminal-service.ts +60 -60
  82. package/src/browser/base/terminal-widget.ts +244 -244
  83. package/src/browser/index.ts +17 -17
  84. package/src/browser/search/terminal-search-container.ts +28 -28
  85. package/src/browser/search/terminal-search-widget.tsx +161 -161
  86. package/src/browser/shell-terminal-profile.ts +40 -40
  87. package/src/browser/style/terminal-search.css +93 -93
  88. package/src/browser/style/terminal.css +33 -33
  89. package/src/browser/terminal-contribution.ts +19 -19
  90. package/src/browser/terminal-copy-on-selection-handler.ts +92 -92
  91. package/src/browser/terminal-file-link-provider.ts +200 -200
  92. package/src/browser/terminal-frontend-contribution.ts +1048 -1048
  93. package/src/browser/terminal-frontend-module.ts +139 -139
  94. package/src/browser/terminal-keybinding-contexts.ts +52 -52
  95. package/src/browser/terminal-link-helpers.ts +187 -187
  96. package/src/browser/terminal-link-provider.ts +203 -203
  97. package/src/browser/terminal-preferences.ts +427 -427
  98. package/src/browser/terminal-profile-service.ts +170 -170
  99. package/src/browser/terminal-quick-open-service.ts +132 -132
  100. package/src/browser/terminal-theme-service.ts +209 -209
  101. package/src/browser/terminal-url-link-provider.ts +66 -66
  102. package/src/browser/terminal-widget-impl.ts +827 -827
  103. package/src/common/base-terminal-protocol.ts +183 -183
  104. package/src/common/shell-terminal-protocol.ts +50 -50
  105. package/src/common/terminal-common-module.ts +30 -30
  106. package/src/common/terminal-protocol.ts +32 -32
  107. package/src/common/terminal-watcher.ts +69 -69
  108. package/src/node/base-terminal-server.ts +279 -279
  109. package/src/node/buffering-stream.spec.ts +46 -46
  110. package/src/node/buffering-stream.ts +95 -95
  111. package/src/node/index.ts +17 -17
  112. package/src/node/shell-process.ts +101 -101
  113. package/src/node/shell-terminal-server.spec.ts +40 -40
  114. package/src/node/shell-terminal-server.ts +95 -95
  115. package/src/node/terminal-backend-contribution.slow-spec.ts +63 -63
  116. package/src/node/terminal-backend-contribution.ts +60 -60
  117. package/src/node/terminal-backend-module.ts +82 -82
  118. package/src/node/terminal-server.spec.ts +47 -47
  119. package/src/node/terminal-server.ts +52 -52
  120. package/src/node/test/terminal-test-container.ts +39 -39
  121. package/src/package.spec.ts +28 -28
@@ -1,427 +1,427 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Bitsler and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- /* eslint-disable max-len */
18
-
19
- import { interfaces } from '@theia/core/shared/inversify';
20
- import { IJSONSchema } from '@theia/core/lib/common/json-schema';
21
- import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/browser';
22
- import { nls } from '@theia/core/lib/common/nls';
23
- import { editorGeneratedPreferenceProperties } from '@theia/editor/lib/browser/editor-generated-preference-schema';
24
- import { OS } from '@theia/core';
25
- import { terminalAnsiColorMap } from './terminal-theme-service';
26
-
27
- const commonProfileProperties: PreferenceSchemaProperties = {
28
- env: {
29
- type: 'object',
30
- additionalProperties: {
31
- type: 'string'
32
- },
33
- markdownDescription: nls.localizeByDefault('An object with environment variables that will be added to the terminal profile process. Set to `null` to delete environment variables from the base environment.'),
34
- },
35
- overrideName: {
36
- type: 'boolean',
37
- description: nls.localizeByDefault('Controls whether or not the profile name overrides the auto detected one.')
38
- },
39
- icon: {
40
- type: 'string',
41
- markdownDescription: nls.localize('theia/terminal/profileIcon', 'A codicon ID to associate with the terminal icon.\nterminal-tmux:"$(terminal-tmux)"')
42
- },
43
- color: {
44
- type: 'string',
45
- enum: Object.getOwnPropertyNames(terminalAnsiColorMap),
46
- description: nls.localize('theia/terminal/profileColor', 'A terminal theme color ID to associate with the terminal.')
47
- }
48
- };
49
-
50
- const stringOrStringArray: IJSONSchema = {
51
- oneOf: [
52
- { type: 'string' },
53
- {
54
- type: 'array',
55
- items: {
56
- type: 'string'
57
- }
58
- }
59
- ]
60
- };
61
-
62
- const pathProperty: IJSONSchema = {
63
- description: nls.localize('theia/terminal/profilePath', 'The path of the shell that this profile uses.'),
64
- ...stringOrStringArray
65
- };
66
-
67
- function shellArgsDeprecatedMessage(type: OS.Type): string {
68
- return nls.localize('theia/terminal/shell.deprecated', 'This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in \'terminal.integrated.profiles.{0}\' and setting its profile name as the default in \'terminal.integrated.defaultProfile.{0}.\'', type.toString().toLowerCase());
69
- }
70
-
71
- export const TerminalConfigSchema: PreferenceSchema = {
72
- type: 'object',
73
- properties: {
74
- 'terminal.enableCopy': {
75
- type: 'boolean',
76
- description: nls.localize('theia/terminal/enableCopy', 'Enable ctrl-c (cmd-c on macOS) to copy selected text'),
77
- default: true
78
- },
79
- 'terminal.enablePaste': {
80
- type: 'boolean',
81
- description: nls.localize('theia/terminal/enablePaste', 'Enable ctrl-v (cmd-v on macOS) to paste from clipboard'),
82
- default: true
83
- },
84
- 'terminal.integrated.fontFamily': {
85
- type: 'string',
86
- markdownDescription: nls.localizeByDefault("Controls the font family of the terminal, this defaults to `#editor.fontFamily#`'s value."),
87
- default: editorGeneratedPreferenceProperties['editor.fontFamily'].default,
88
- },
89
- 'terminal.integrated.fontSize': {
90
- type: 'number',
91
- description: nls.localizeByDefault('Controls the font size in pixels of the terminal.'),
92
- minimum: 6,
93
- default: editorGeneratedPreferenceProperties['editor.fontSize'].default
94
- },
95
- 'terminal.integrated.fontWeight': {
96
- type: 'string',
97
- enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
98
- description: nls.localizeByDefault('The font weight to use within the terminal for non-bold text. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000.'),
99
- default: 'normal'
100
- },
101
- 'terminal.integrated.fontWeightBold': {
102
- type: 'string',
103
- enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
104
- description: nls.localizeByDefault('The font weight to use within the terminal for bold text. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000.'),
105
- default: 'bold'
106
- },
107
- 'terminal.integrated.drawBoldTextInBrightColors': {
108
- description: nls.localizeByDefault('Controls whether bold text in the terminal will always use the \"bright\" ANSI color variant.'),
109
- type: 'boolean',
110
- default: true,
111
- },
112
- 'terminal.integrated.letterSpacing': {
113
- description: nls.localizeByDefault('Controls the letter spacing of the terminal, this is an integer value which represents the amount of additional pixels to add between characters.'),
114
- type: 'number',
115
- default: 1
116
- },
117
- 'terminal.integrated.lineHeight': {
118
- description: nls.localizeByDefault('Controls the line height of the terminal, this number is multiplied by the terminal font size to get the actual line-height in pixels.'),
119
- type: 'number',
120
- minimum: 1,
121
- default: 1
122
- },
123
- 'terminal.integrated.scrollback': {
124
- description: nls.localizeByDefault('Controls the maximum amount of lines the terminal keeps in its buffer.'),
125
- type: 'number',
126
- default: 1000
127
- },
128
- 'terminal.integrated.fastScrollSensitivity': {
129
- markdownDescription: nls.localizeByDefault('Scrolling speed multiplier when pressing `Alt`.'),
130
- type: 'number',
131
- default: 5,
132
- },
133
- 'terminal.integrated.rendererType': {
134
- description: nls.localize('theia/terminal/rendererType', 'Controls how the terminal is rendered.'),
135
- type: 'string',
136
- enum: ['canvas', 'dom'],
137
- default: 'canvas'
138
- },
139
- 'terminal.integrated.copyOnSelection': {
140
- description: nls.localizeByDefault('Controls whether text selected in the terminal will be copied to the clipboard.'),
141
- type: 'boolean',
142
- default: false,
143
- },
144
- 'terminal.integrated.cursorBlinking': {
145
- description: nls.localizeByDefault('Controls whether the terminal cursor blinks.'),
146
- type: 'boolean',
147
- default: false
148
- },
149
- 'terminal.integrated.cursorStyle': {
150
- description: nls.localizeByDefault('Controls the style of terminal cursor.'),
151
- enum: ['block', 'underline', 'line'],
152
- default: 'block'
153
- },
154
- 'terminal.integrated.cursorWidth': {
155
- markdownDescription: nls.localizeByDefault('Controls the width of the cursor when `#terminal.integrated.cursorStyle#` is set to `line`.'),
156
- type: 'number',
157
- default: 1
158
- },
159
- 'terminal.integrated.shell.windows': {
160
- type: ['string', 'null'],
161
- typeDetails: { isFilepath: true },
162
- markdownDescription: nls.localize('theia/terminal/shellWindows', 'The path of the shell that the terminal uses on Windows. (default: \'{0}\').', 'C:\\Windows\\System32\\cmd.exe'),
163
- default: undefined,
164
- deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Windows),
165
- },
166
- 'terminal.integrated.shell.osx': {
167
- type: ['string', 'null'],
168
- markdownDescription: nls.localize('theia/terminal/shellOsx', 'The path of the shell that the terminal uses on macOS (default: \'{0}\'}).', '/bin/bash'),
169
- default: undefined,
170
- deprecationMessage: shellArgsDeprecatedMessage(OS.Type.OSX),
171
- },
172
- 'terminal.integrated.shell.linux': {
173
- type: ['string', 'null'],
174
- markdownDescription: nls.localize('theia/terminal/shellLinux', 'The path of the shell that the terminal uses on Linux (default: \'{0}\'}).', '/bin/bash'),
175
- default: undefined,
176
- deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Linux),
177
- },
178
- 'terminal.integrated.shellArgs.windows': {
179
- type: 'array',
180
- markdownDescription: nls.localize('theia/terminal/shellArgsWindows', 'The command line arguments to use when on the Windows terminal.'),
181
- default: [],
182
- deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Windows),
183
- },
184
- 'terminal.integrated.shellArgs.osx': {
185
- type: 'array',
186
- markdownDescription: nls.localize('theia/terminal/shellArgsOsx', 'The command line arguments to use when on the macOS terminal.'),
187
- default: [
188
- '-l'
189
- ],
190
- deprecationMessage: shellArgsDeprecatedMessage(OS.Type.OSX),
191
- },
192
- 'terminal.integrated.shellArgs.linux': {
193
- type: 'array',
194
- markdownDescription: nls.localize('theia/terminal/shellArgsLinux', 'The command line arguments to use when on the Linux terminal.'),
195
- default: [],
196
- deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Linux),
197
- },
198
- 'terminal.integrated.confirmOnExit': {
199
- type: 'string',
200
- description: nls.localizeByDefault('Controls whether to confirm when the window closes if there are active terminal sessions.'),
201
- enum: ['never', 'always', 'hasChildProcesses'],
202
- enumDescriptions: [
203
- nls.localizeByDefault('Never confirm.'),
204
- nls.localizeByDefault('Always confirm if there are terminals.'),
205
- nls.localizeByDefault('Confirm if there are any terminals that have child processes.'),
206
- ],
207
- default: 'never'
208
- },
209
- 'terminal.integrated.enablePersistentSessions': {
210
- type: 'boolean',
211
- description: nls.localizeByDefault('Persist terminal sessions for the workspace across window reloads.'),
212
- default: true
213
- },
214
- 'terminal.integrated.defaultProfile.windows': {
215
- type: 'string',
216
- description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.Windows.toString())
217
-
218
- },
219
- 'terminal.integrated.defaultProfile.linux': {
220
- type: 'string',
221
- description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.Linux.toString())
222
-
223
- },
224
- 'terminal.integrated.defaultProfile.osx': {
225
- type: 'string',
226
- description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.OSX.toString())
227
- },
228
- 'terminal.integrated.profiles.windows': {
229
- markdownDescription: nls.localize('theia/terminal/profiles', 'The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `"{0}": null`.', 'cmd'),
230
- anyOf: [
231
- {
232
- type: 'object',
233
- properties: {
234
- },
235
- additionalProperties: {
236
- oneOf: [{
237
- type: 'object',
238
- additionalProperties: false,
239
- properties: {
240
- path: pathProperty,
241
- args: {
242
- ...stringOrStringArray,
243
- description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
244
-
245
- },
246
- ...commonProfileProperties
247
- },
248
- required: ['path']
249
- },
250
- {
251
- type: 'object',
252
- additionalProperties: false,
253
- properties: {
254
- source: {
255
- type: 'string',
256
- description: nls.localize('theia/terminal/profileSource', 'A profile source that will auto detect the paths to the shell. Note that non-standard executable locations are not supported and must be created manually in a new profile.')
257
- },
258
- args: {
259
- ...stringOrStringArray,
260
- description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
261
-
262
- },
263
- ...commonProfileProperties
264
- },
265
- required: ['source'],
266
- default: {
267
- path: 'C:\\Windows\\System32\\cmd.exe'
268
- }
269
-
270
- }, {
271
- type: 'null'
272
- }]
273
- },
274
- default: {
275
- cmd: {
276
- path: 'C:\\Windows\\System32\\cmd.exe'
277
- }
278
- }
279
- },
280
- { type: 'null' }
281
- ]
282
- },
283
- 'terminal.integrated.profiles.linux': {
284
- markdownDescription: nls.localize('theia/terminal/profiles', 'The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `"{0}": null`.', 'bash'),
285
- anyOf: [{
286
- type: 'object',
287
- properties: {
288
- },
289
- additionalProperties: {
290
- oneOf: [
291
- {
292
- type: 'object',
293
- properties: {
294
- path: pathProperty,
295
- args: {
296
- type: 'array',
297
- items: { type: 'string' },
298
- description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
299
- },
300
- ...commonProfileProperties
301
- },
302
- required: ['path'],
303
- additionalProperties: false,
304
- },
305
- { type: 'null' }
306
- ]
307
- },
308
- default: {
309
- path: '${env:SHELL}',
310
- args: ['-l']
311
- }
312
-
313
- },
314
- { type: 'null' }
315
- ]
316
- },
317
- 'terminal.integrated.profiles.osx': {
318
- markdownDescription: nls.localize('theia/terminal/profiles', 'The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `"{0}": null`.', 'zsh'),
319
- anyOf: [{
320
- type: 'object',
321
- properties: {
322
- },
323
- additionalProperties: {
324
- oneOf: [
325
- {
326
- type: 'object',
327
- properties: {
328
- path: pathProperty,
329
- args: {
330
- type: 'array',
331
- items: { type: 'string' },
332
- description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
333
- },
334
- ...commonProfileProperties
335
- },
336
- required: ['path'],
337
- additionalProperties: false,
338
- },
339
- { type: 'null' }
340
- ]
341
- },
342
- default: {
343
- path: '${env:SHELL}',
344
- args: ['-l']
345
- }
346
-
347
- },
348
- { type: 'null' }
349
- ]
350
- },
351
- }
352
- };
353
-
354
- export type Profiles = null | {
355
- [key: string]: {
356
- path?: string | string[],
357
- source?: string,
358
- args?: string | string[],
359
- env?: { [key: string]: string },
360
- overrideName?: boolean;
361
- icon?: string,
362
- color?: string
363
- }
364
- };
365
-
366
- export interface TerminalConfiguration {
367
- 'terminal.enableCopy': boolean
368
- 'terminal.enablePaste': boolean
369
- // xterm compatible, see https://xtermjs.org/docs/api/terminal/interfaces/iterminaloptions/
370
- 'terminal.integrated.fontFamily': string
371
- 'terminal.integrated.fontSize': number
372
- 'terminal.integrated.fontWeight': FontWeight
373
- 'terminal.integrated.fontWeightBold': FontWeight,
374
- 'terminal.integrated.drawBoldTextInBrightColors': boolean,
375
- 'terminal.integrated.letterSpacing': number
376
- 'terminal.integrated.lineHeight': number,
377
- 'terminal.integrated.scrollback': number,
378
- 'terminal.integrated.fastScrollSensitivity': number,
379
- 'terminal.integrated.rendererType': TerminalRendererType,
380
- 'terminal.integrated.copyOnSelection': boolean,
381
- 'terminal.integrated.cursorBlinking': boolean,
382
- 'terminal.integrated.cursorStyle': CursorStyleVSCode,
383
- 'terminal.integrated.cursorWidth': number,
384
- 'terminal.integrated.shell.windows': string | null | undefined,
385
- 'terminal.integrated.shell.osx': string | null | undefined,
386
- 'terminal.integrated.shell.linux': string | null | undefined,
387
- 'terminal.integrated.shellArgs.windows': string[],
388
- 'terminal.integrated.shellArgs.osx': string[],
389
- 'terminal.integrated.shellArgs.linux': string[],
390
- 'terminal.integrated.defaultProfile.windows': string,
391
- 'terminal.integrated.defaultProfile.linux': string,
392
- 'terminal.integrated.defaultProfile.osx': string,
393
- 'terminal.integrated.profiles.windows': Profiles
394
- 'terminal.integrated.profiles.linux': Profiles,
395
- 'terminal.integrated.profiles.osx': Profiles,
396
- 'terminal.integrated.confirmOnExit': ConfirmOnExitType
397
- 'terminal.integrated.enablePersistentSessions': boolean
398
- }
399
-
400
- type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
401
- export type CursorStyle = 'block' | 'underline' | 'bar';
402
- // VS Code uses 'line' to represent 'bar'. The following conversion is necessary to support their preferences.
403
- export type CursorStyleVSCode = CursorStyle | 'line';
404
- export type TerminalRendererType = 'canvas' | 'dom';
405
- export type ConfirmOnExitType = 'never' | 'always' | 'hasChildProcesses';
406
- export const DEFAULT_TERMINAL_RENDERER_TYPE = 'canvas';
407
- export function isTerminalRendererType(arg: unknown): arg is TerminalRendererType {
408
- return typeof arg === 'string' && (arg === 'canvas' || arg === 'dom');
409
- }
410
-
411
- export const TerminalPreferenceContribution = Symbol('TerminalPreferenceContribution');
412
- export const TerminalPreferences = Symbol('TerminalPreferences');
413
- export type TerminalPreferences = PreferenceProxy<TerminalConfiguration>;
414
-
415
- export function createTerminalPreferences(preferences: PreferenceService, schema: PreferenceSchema = TerminalConfigSchema): TerminalPreferences {
416
- return createPreferenceProxy(preferences, schema);
417
- }
418
-
419
- export function bindTerminalPreferences(bind: interfaces.Bind): void {
420
- bind(TerminalPreferences).toDynamicValue(ctx => {
421
- const preferences = ctx.container.get<PreferenceService>(PreferenceService);
422
- const contribution = ctx.container.get<PreferenceContribution>(TerminalPreferenceContribution);
423
- return createTerminalPreferences(preferences, contribution.schema);
424
- }).inSingletonScope();
425
- bind(TerminalPreferenceContribution).toConstantValue({ schema: TerminalConfigSchema });
426
- bind(PreferenceContribution).toService(TerminalPreferenceContribution);
427
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Bitsler and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* eslint-disable max-len */
18
+
19
+ import { interfaces } from '@theia/core/shared/inversify';
20
+ import { IJSONSchema } from '@theia/core/lib/common/json-schema';
21
+ import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/browser';
22
+ import { nls } from '@theia/core/lib/common/nls';
23
+ import { editorGeneratedPreferenceProperties } from '@theia/editor/lib/browser/editor-generated-preference-schema';
24
+ import { OS } from '@theia/core';
25
+ import { terminalAnsiColorMap } from './terminal-theme-service';
26
+
27
+ const commonProfileProperties: PreferenceSchemaProperties = {
28
+ env: {
29
+ type: 'object',
30
+ additionalProperties: {
31
+ type: 'string'
32
+ },
33
+ markdownDescription: nls.localizeByDefault('An object with environment variables that will be added to the terminal profile process. Set to `null` to delete environment variables from the base environment.'),
34
+ },
35
+ overrideName: {
36
+ type: 'boolean',
37
+ description: nls.localizeByDefault('Controls whether or not the profile name overrides the auto detected one.')
38
+ },
39
+ icon: {
40
+ type: 'string',
41
+ markdownDescription: nls.localize('theia/terminal/profileIcon', 'A codicon ID to associate with the terminal icon.\nterminal-tmux:"$(terminal-tmux)"')
42
+ },
43
+ color: {
44
+ type: 'string',
45
+ enum: Object.getOwnPropertyNames(terminalAnsiColorMap),
46
+ description: nls.localize('theia/terminal/profileColor', 'A terminal theme color ID to associate with the terminal.')
47
+ }
48
+ };
49
+
50
+ const stringOrStringArray: IJSONSchema = {
51
+ oneOf: [
52
+ { type: 'string' },
53
+ {
54
+ type: 'array',
55
+ items: {
56
+ type: 'string'
57
+ }
58
+ }
59
+ ]
60
+ };
61
+
62
+ const pathProperty: IJSONSchema = {
63
+ description: nls.localize('theia/terminal/profilePath', 'The path of the shell that this profile uses.'),
64
+ ...stringOrStringArray
65
+ };
66
+
67
+ function shellArgsDeprecatedMessage(type: OS.Type): string {
68
+ return nls.localize('theia/terminal/shell.deprecated', 'This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in \'terminal.integrated.profiles.{0}\' and setting its profile name as the default in \'terminal.integrated.defaultProfile.{0}.\'', type.toString().toLowerCase());
69
+ }
70
+
71
+ export const TerminalConfigSchema: PreferenceSchema = {
72
+ type: 'object',
73
+ properties: {
74
+ 'terminal.enableCopy': {
75
+ type: 'boolean',
76
+ description: nls.localize('theia/terminal/enableCopy', 'Enable ctrl-c (cmd-c on macOS) to copy selected text'),
77
+ default: true
78
+ },
79
+ 'terminal.enablePaste': {
80
+ type: 'boolean',
81
+ description: nls.localize('theia/terminal/enablePaste', 'Enable ctrl-v (cmd-v on macOS) to paste from clipboard'),
82
+ default: true
83
+ },
84
+ 'terminal.integrated.fontFamily': {
85
+ type: 'string',
86
+ markdownDescription: nls.localizeByDefault("Controls the font family of the terminal, this defaults to `#editor.fontFamily#`'s value."),
87
+ default: editorGeneratedPreferenceProperties['editor.fontFamily'].default,
88
+ },
89
+ 'terminal.integrated.fontSize': {
90
+ type: 'number',
91
+ description: nls.localizeByDefault('Controls the font size in pixels of the terminal.'),
92
+ minimum: 6,
93
+ default: editorGeneratedPreferenceProperties['editor.fontSize'].default
94
+ },
95
+ 'terminal.integrated.fontWeight': {
96
+ type: 'string',
97
+ enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
98
+ description: nls.localizeByDefault('The font weight to use within the terminal for non-bold text. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000.'),
99
+ default: 'normal'
100
+ },
101
+ 'terminal.integrated.fontWeightBold': {
102
+ type: 'string',
103
+ enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
104
+ description: nls.localizeByDefault('The font weight to use within the terminal for bold text. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000.'),
105
+ default: 'bold'
106
+ },
107
+ 'terminal.integrated.drawBoldTextInBrightColors': {
108
+ description: nls.localizeByDefault('Controls whether bold text in the terminal will always use the \"bright\" ANSI color variant.'),
109
+ type: 'boolean',
110
+ default: true,
111
+ },
112
+ 'terminal.integrated.letterSpacing': {
113
+ description: nls.localizeByDefault('Controls the letter spacing of the terminal, this is an integer value which represents the amount of additional pixels to add between characters.'),
114
+ type: 'number',
115
+ default: 1
116
+ },
117
+ 'terminal.integrated.lineHeight': {
118
+ description: nls.localizeByDefault('Controls the line height of the terminal, this number is multiplied by the terminal font size to get the actual line-height in pixels.'),
119
+ type: 'number',
120
+ minimum: 1,
121
+ default: 1
122
+ },
123
+ 'terminal.integrated.scrollback': {
124
+ description: nls.localizeByDefault('Controls the maximum amount of lines the terminal keeps in its buffer.'),
125
+ type: 'number',
126
+ default: 1000
127
+ },
128
+ 'terminal.integrated.fastScrollSensitivity': {
129
+ markdownDescription: nls.localizeByDefault('Scrolling speed multiplier when pressing `Alt`.'),
130
+ type: 'number',
131
+ default: 5,
132
+ },
133
+ 'terminal.integrated.rendererType': {
134
+ description: nls.localize('theia/terminal/rendererType', 'Controls how the terminal is rendered.'),
135
+ type: 'string',
136
+ enum: ['canvas', 'dom'],
137
+ default: 'canvas'
138
+ },
139
+ 'terminal.integrated.copyOnSelection': {
140
+ description: nls.localizeByDefault('Controls whether text selected in the terminal will be copied to the clipboard.'),
141
+ type: 'boolean',
142
+ default: false,
143
+ },
144
+ 'terminal.integrated.cursorBlinking': {
145
+ description: nls.localizeByDefault('Controls whether the terminal cursor blinks.'),
146
+ type: 'boolean',
147
+ default: false
148
+ },
149
+ 'terminal.integrated.cursorStyle': {
150
+ description: nls.localizeByDefault('Controls the style of terminal cursor.'),
151
+ enum: ['block', 'underline', 'line'],
152
+ default: 'block'
153
+ },
154
+ 'terminal.integrated.cursorWidth': {
155
+ markdownDescription: nls.localizeByDefault('Controls the width of the cursor when `#terminal.integrated.cursorStyle#` is set to `line`.'),
156
+ type: 'number',
157
+ default: 1
158
+ },
159
+ 'terminal.integrated.shell.windows': {
160
+ type: ['string', 'null'],
161
+ typeDetails: { isFilepath: true },
162
+ markdownDescription: nls.localize('theia/terminal/shellWindows', 'The path of the shell that the terminal uses on Windows. (default: \'{0}\').', 'C:\\Windows\\System32\\cmd.exe'),
163
+ default: undefined,
164
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Windows),
165
+ },
166
+ 'terminal.integrated.shell.osx': {
167
+ type: ['string', 'null'],
168
+ markdownDescription: nls.localize('theia/terminal/shellOsx', 'The path of the shell that the terminal uses on macOS (default: \'{0}\'}).', '/bin/bash'),
169
+ default: undefined,
170
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.OSX),
171
+ },
172
+ 'terminal.integrated.shell.linux': {
173
+ type: ['string', 'null'],
174
+ markdownDescription: nls.localize('theia/terminal/shellLinux', 'The path of the shell that the terminal uses on Linux (default: \'{0}\'}).', '/bin/bash'),
175
+ default: undefined,
176
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Linux),
177
+ },
178
+ 'terminal.integrated.shellArgs.windows': {
179
+ type: 'array',
180
+ markdownDescription: nls.localize('theia/terminal/shellArgsWindows', 'The command line arguments to use when on the Windows terminal.'),
181
+ default: [],
182
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Windows),
183
+ },
184
+ 'terminal.integrated.shellArgs.osx': {
185
+ type: 'array',
186
+ markdownDescription: nls.localize('theia/terminal/shellArgsOsx', 'The command line arguments to use when on the macOS terminal.'),
187
+ default: [
188
+ '-l'
189
+ ],
190
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.OSX),
191
+ },
192
+ 'terminal.integrated.shellArgs.linux': {
193
+ type: 'array',
194
+ markdownDescription: nls.localize('theia/terminal/shellArgsLinux', 'The command line arguments to use when on the Linux terminal.'),
195
+ default: [],
196
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Linux),
197
+ },
198
+ 'terminal.integrated.confirmOnExit': {
199
+ type: 'string',
200
+ description: nls.localizeByDefault('Controls whether to confirm when the window closes if there are active terminal sessions.'),
201
+ enum: ['never', 'always', 'hasChildProcesses'],
202
+ enumDescriptions: [
203
+ nls.localizeByDefault('Never confirm.'),
204
+ nls.localizeByDefault('Always confirm if there are terminals.'),
205
+ nls.localizeByDefault('Confirm if there are any terminals that have child processes.'),
206
+ ],
207
+ default: 'never'
208
+ },
209
+ 'terminal.integrated.enablePersistentSessions': {
210
+ type: 'boolean',
211
+ description: nls.localizeByDefault('Persist terminal sessions for the workspace across window reloads.'),
212
+ default: true
213
+ },
214
+ 'terminal.integrated.defaultProfile.windows': {
215
+ type: 'string',
216
+ description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.Windows.toString())
217
+
218
+ },
219
+ 'terminal.integrated.defaultProfile.linux': {
220
+ type: 'string',
221
+ description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.Linux.toString())
222
+
223
+ },
224
+ 'terminal.integrated.defaultProfile.osx': {
225
+ type: 'string',
226
+ description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.OSX.toString())
227
+ },
228
+ 'terminal.integrated.profiles.windows': {
229
+ markdownDescription: nls.localize('theia/terminal/profiles', 'The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `"{0}": null`.', 'cmd'),
230
+ anyOf: [
231
+ {
232
+ type: 'object',
233
+ properties: {
234
+ },
235
+ additionalProperties: {
236
+ oneOf: [{
237
+ type: 'object',
238
+ additionalProperties: false,
239
+ properties: {
240
+ path: pathProperty,
241
+ args: {
242
+ ...stringOrStringArray,
243
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
244
+
245
+ },
246
+ ...commonProfileProperties
247
+ },
248
+ required: ['path']
249
+ },
250
+ {
251
+ type: 'object',
252
+ additionalProperties: false,
253
+ properties: {
254
+ source: {
255
+ type: 'string',
256
+ description: nls.localize('theia/terminal/profileSource', 'A profile source that will auto detect the paths to the shell. Note that non-standard executable locations are not supported and must be created manually in a new profile.')
257
+ },
258
+ args: {
259
+ ...stringOrStringArray,
260
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
261
+
262
+ },
263
+ ...commonProfileProperties
264
+ },
265
+ required: ['source'],
266
+ default: {
267
+ path: 'C:\\Windows\\System32\\cmd.exe'
268
+ }
269
+
270
+ }, {
271
+ type: 'null'
272
+ }]
273
+ },
274
+ default: {
275
+ cmd: {
276
+ path: 'C:\\Windows\\System32\\cmd.exe'
277
+ }
278
+ }
279
+ },
280
+ { type: 'null' }
281
+ ]
282
+ },
283
+ 'terminal.integrated.profiles.linux': {
284
+ markdownDescription: nls.localize('theia/terminal/profiles', 'The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `"{0}": null`.', 'bash'),
285
+ anyOf: [{
286
+ type: 'object',
287
+ properties: {
288
+ },
289
+ additionalProperties: {
290
+ oneOf: [
291
+ {
292
+ type: 'object',
293
+ properties: {
294
+ path: pathProperty,
295
+ args: {
296
+ type: 'array',
297
+ items: { type: 'string' },
298
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
299
+ },
300
+ ...commonProfileProperties
301
+ },
302
+ required: ['path'],
303
+ additionalProperties: false,
304
+ },
305
+ { type: 'null' }
306
+ ]
307
+ },
308
+ default: {
309
+ path: '${env:SHELL}',
310
+ args: ['-l']
311
+ }
312
+
313
+ },
314
+ { type: 'null' }
315
+ ]
316
+ },
317
+ 'terminal.integrated.profiles.osx': {
318
+ markdownDescription: nls.localize('theia/terminal/profiles', 'The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `"{0}": null`.', 'zsh'),
319
+ anyOf: [{
320
+ type: 'object',
321
+ properties: {
322
+ },
323
+ additionalProperties: {
324
+ oneOf: [
325
+ {
326
+ type: 'object',
327
+ properties: {
328
+ path: pathProperty,
329
+ args: {
330
+ type: 'array',
331
+ items: { type: 'string' },
332
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
333
+ },
334
+ ...commonProfileProperties
335
+ },
336
+ required: ['path'],
337
+ additionalProperties: false,
338
+ },
339
+ { type: 'null' }
340
+ ]
341
+ },
342
+ default: {
343
+ path: '${env:SHELL}',
344
+ args: ['-l']
345
+ }
346
+
347
+ },
348
+ { type: 'null' }
349
+ ]
350
+ },
351
+ }
352
+ };
353
+
354
+ export type Profiles = null | {
355
+ [key: string]: {
356
+ path?: string | string[],
357
+ source?: string,
358
+ args?: string | string[],
359
+ env?: { [key: string]: string },
360
+ overrideName?: boolean;
361
+ icon?: string,
362
+ color?: string
363
+ }
364
+ };
365
+
366
+ export interface TerminalConfiguration {
367
+ 'terminal.enableCopy': boolean
368
+ 'terminal.enablePaste': boolean
369
+ // xterm compatible, see https://xtermjs.org/docs/api/terminal/interfaces/iterminaloptions/
370
+ 'terminal.integrated.fontFamily': string
371
+ 'terminal.integrated.fontSize': number
372
+ 'terminal.integrated.fontWeight': FontWeight
373
+ 'terminal.integrated.fontWeightBold': FontWeight,
374
+ 'terminal.integrated.drawBoldTextInBrightColors': boolean,
375
+ 'terminal.integrated.letterSpacing': number
376
+ 'terminal.integrated.lineHeight': number,
377
+ 'terminal.integrated.scrollback': number,
378
+ 'terminal.integrated.fastScrollSensitivity': number,
379
+ 'terminal.integrated.rendererType': TerminalRendererType,
380
+ 'terminal.integrated.copyOnSelection': boolean,
381
+ 'terminal.integrated.cursorBlinking': boolean,
382
+ 'terminal.integrated.cursorStyle': CursorStyleVSCode,
383
+ 'terminal.integrated.cursorWidth': number,
384
+ 'terminal.integrated.shell.windows': string | null | undefined,
385
+ 'terminal.integrated.shell.osx': string | null | undefined,
386
+ 'terminal.integrated.shell.linux': string | null | undefined,
387
+ 'terminal.integrated.shellArgs.windows': string[],
388
+ 'terminal.integrated.shellArgs.osx': string[],
389
+ 'terminal.integrated.shellArgs.linux': string[],
390
+ 'terminal.integrated.defaultProfile.windows': string,
391
+ 'terminal.integrated.defaultProfile.linux': string,
392
+ 'terminal.integrated.defaultProfile.osx': string,
393
+ 'terminal.integrated.profiles.windows': Profiles
394
+ 'terminal.integrated.profiles.linux': Profiles,
395
+ 'terminal.integrated.profiles.osx': Profiles,
396
+ 'terminal.integrated.confirmOnExit': ConfirmOnExitType
397
+ 'terminal.integrated.enablePersistentSessions': boolean
398
+ }
399
+
400
+ type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
401
+ export type CursorStyle = 'block' | 'underline' | 'bar';
402
+ // VS Code uses 'line' to represent 'bar'. The following conversion is necessary to support their preferences.
403
+ export type CursorStyleVSCode = CursorStyle | 'line';
404
+ export type TerminalRendererType = 'canvas' | 'dom';
405
+ export type ConfirmOnExitType = 'never' | 'always' | 'hasChildProcesses';
406
+ export const DEFAULT_TERMINAL_RENDERER_TYPE = 'canvas';
407
+ export function isTerminalRendererType(arg: unknown): arg is TerminalRendererType {
408
+ return typeof arg === 'string' && (arg === 'canvas' || arg === 'dom');
409
+ }
410
+
411
+ export const TerminalPreferenceContribution = Symbol('TerminalPreferenceContribution');
412
+ export const TerminalPreferences = Symbol('TerminalPreferences');
413
+ export type TerminalPreferences = PreferenceProxy<TerminalConfiguration>;
414
+
415
+ export function createTerminalPreferences(preferences: PreferenceService, schema: PreferenceSchema = TerminalConfigSchema): TerminalPreferences {
416
+ return createPreferenceProxy(preferences, schema);
417
+ }
418
+
419
+ export function bindTerminalPreferences(bind: interfaces.Bind): void {
420
+ bind(TerminalPreferences).toDynamicValue(ctx => {
421
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
422
+ const contribution = ctx.container.get<PreferenceContribution>(TerminalPreferenceContribution);
423
+ return createTerminalPreferences(preferences, contribution.schema);
424
+ }).inSingletonScope();
425
+ bind(TerminalPreferenceContribution).toConstantValue({ schema: TerminalConfigSchema });
426
+ bind(PreferenceContribution).toService(TerminalPreferenceContribution);
427
+ }