@theia/terminal 1.45.1 → 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 (126) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/base/terminal-service.d.ts +34 -34
  3. package/lib/browser/base/terminal-service.js +7 -7
  4. package/lib/browser/base/terminal-widget.d.ts +192 -192
  5. package/lib/browser/base/terminal-widget.js +34 -34
  6. package/lib/browser/index.d.ts +1 -1
  7. package/lib/browser/index.js +28 -28
  8. package/lib/browser/search/terminal-search-container.d.ts +3 -3
  9. package/lib/browser/search/terminal-search-container.js +28 -28
  10. package/lib/browser/search/terminal-search-widget.d.ts +30 -30
  11. package/lib/browser/search/terminal-search-widget.js +147 -147
  12. package/lib/browser/shell-terminal-profile.d.ts +20 -20
  13. package/lib/browser/shell-terminal-profile.js +42 -42
  14. package/lib/browser/terminal-contribution.d.ts +3 -3
  15. package/lib/browser/terminal-contribution.js +20 -20
  16. package/lib/browser/terminal-copy-on-selection-handler.d.ts +10 -10
  17. package/lib/browser/terminal-copy-on-selection-handler.js +103 -103
  18. package/lib/browser/terminal-file-link-provider.d.ts +24 -24
  19. package/lib/browser/terminal-file-link-provider.js +200 -200
  20. package/lib/browser/terminal-frontend-contribution.d.ts +115 -115
  21. package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
  22. package/lib/browser/terminal-frontend-contribution.js +1078 -1056
  23. package/lib/browser/terminal-frontend-contribution.js.map +1 -1
  24. package/lib/browser/terminal-frontend-module.d.ts +5 -5
  25. package/lib/browser/terminal-frontend-module.js +117 -117
  26. package/lib/browser/terminal-link-helpers.d.ts +27 -27
  27. package/lib/browser/terminal-link-helpers.js +155 -155
  28. package/lib/browser/terminal-link-provider.d.ts +51 -51
  29. package/lib/browser/terminal-link-provider.js +197 -197
  30. package/lib/browser/terminal-preferences.d.ts +61 -61
  31. package/lib/browser/terminal-preferences.d.ts.map +1 -1
  32. package/lib/browser/terminal-preferences.js +357 -356
  33. package/lib/browser/terminal-preferences.js.map +1 -1
  34. package/lib/browser/terminal-profile-service.d.ts +58 -58
  35. package/lib/browser/terminal-profile-service.js +158 -158
  36. package/lib/browser/terminal-quick-open-service.d.ts +36 -36
  37. package/lib/browser/terminal-quick-open-service.js +137 -137
  38. package/lib/browser/terminal-theme-service.d.ts +21 -21
  39. package/lib/browser/terminal-theme-service.d.ts.map +1 -1
  40. package/lib/browser/terminal-theme-service.js +222 -218
  41. package/lib/browser/terminal-theme-service.js.map +1 -1
  42. package/lib/browser/terminal-url-link-provider.d.ts +11 -11
  43. package/lib/browser/terminal-url-link-provider.js +76 -76
  44. package/lib/browser/terminal-widget-impl.d.ts +180 -187
  45. package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
  46. package/lib/browser/terminal-widget-impl.js +857 -867
  47. package/lib/browser/terminal-widget-impl.js.map +1 -1
  48. package/lib/common/base-terminal-protocol.d.ts +55 -55
  49. package/lib/common/base-terminal-protocol.js +84 -84
  50. package/lib/common/shell-terminal-protocol.d.ts +66 -66
  51. package/lib/common/shell-terminal-protocol.js +35 -35
  52. package/lib/common/terminal-common-module.d.ts +7 -7
  53. package/lib/common/terminal-common-module.js +31 -31
  54. package/lib/common/terminal-protocol.d.ts +12 -12
  55. package/lib/common/terminal-protocol.js +21 -21
  56. package/lib/common/terminal-watcher.d.ts +13 -13
  57. package/lib/common/terminal-watcher.js +70 -70
  58. package/lib/node/base-terminal-server.d.ts +24 -24
  59. package/lib/node/base-terminal-server.js +168 -168
  60. package/lib/node/buffering-stream.d.ts +39 -39
  61. package/lib/node/buffering-stream.js +75 -75
  62. package/lib/node/buffering-stream.spec.d.ts +1 -1
  63. package/lib/node/buffering-stream.spec.js +43 -43
  64. package/lib/node/index.d.ts +1 -1
  65. package/lib/node/index.js +28 -28
  66. package/lib/node/shell-process.d.ts +27 -27
  67. package/lib/node/shell-process.js +107 -107
  68. package/lib/node/shell-process.js.map +1 -1
  69. package/lib/node/shell-terminal-server.d.ts +30 -30
  70. package/lib/node/shell-terminal-server.js +212 -212
  71. package/lib/node/shell-terminal-server.spec.d.ts +1 -1
  72. package/lib/node/shell-terminal-server.spec.js +35 -35
  73. package/lib/node/terminal-backend-contribution.d.ts +9 -9
  74. package/lib/node/terminal-backend-contribution.js +75 -75
  75. package/lib/node/terminal-backend-contribution.slow-spec.d.ts +1 -1
  76. package/lib/node/terminal-backend-contribution.slow-spec.js +54 -54
  77. package/lib/node/terminal-backend-module.d.ts +11 -11
  78. package/lib/node/terminal-backend-module.js +69 -69
  79. package/lib/node/terminal-server.d.ts +9 -9
  80. package/lib/node/terminal-server.js +64 -64
  81. package/lib/node/terminal-server.spec.d.ts +1 -1
  82. package/lib/node/terminal-server.spec.js +41 -41
  83. package/lib/node/test/terminal-test-container.d.ts +2 -2
  84. package/lib/node/test/terminal-test-container.js +40 -40
  85. package/lib/package.spec.js +25 -25
  86. package/package.json +12 -12
  87. package/src/browser/base/terminal-service.ts +60 -60
  88. package/src/browser/base/terminal-widget.ts +254 -254
  89. package/src/browser/index.ts +17 -17
  90. package/src/browser/search/terminal-search-container.ts +28 -28
  91. package/src/browser/search/terminal-search-widget.tsx +161 -161
  92. package/src/browser/shell-terminal-profile.ts +45 -45
  93. package/src/browser/style/terminal-search.css +99 -99
  94. package/src/browser/style/terminal.css +32 -32
  95. package/src/browser/terminal-contribution.ts +19 -19
  96. package/src/browser/terminal-copy-on-selection-handler.ts +92 -92
  97. package/src/browser/terminal-file-link-provider.ts +200 -200
  98. package/src/browser/terminal-frontend-contribution.ts +1120 -1098
  99. package/src/browser/terminal-frontend-module.ts +136 -136
  100. package/src/browser/terminal-link-helpers.ts +187 -187
  101. package/src/browser/terminal-link-provider.ts +203 -203
  102. package/src/browser/terminal-preferences.ts +428 -427
  103. package/src/browser/terminal-profile-service.ts +180 -180
  104. package/src/browser/terminal-quick-open-service.ts +132 -132
  105. package/src/browser/terminal-theme-service.ts +213 -209
  106. package/src/browser/terminal-url-link-provider.ts +66 -66
  107. package/src/browser/terminal-widget-impl.ts +939 -936
  108. package/src/common/base-terminal-protocol.ts +125 -125
  109. package/src/common/shell-terminal-protocol.ts +103 -103
  110. package/src/common/terminal-common-module.ts +30 -30
  111. package/src/common/terminal-protocol.ts +32 -32
  112. package/src/common/terminal-watcher.ts +69 -69
  113. package/src/node/base-terminal-server.ts +173 -173
  114. package/src/node/buffering-stream.spec.ts +46 -46
  115. package/src/node/buffering-stream.ts +95 -95
  116. package/src/node/index.ts +17 -17
  117. package/src/node/shell-process.ts +101 -101
  118. package/src/node/shell-terminal-server.spec.ts +40 -40
  119. package/src/node/shell-terminal-server.ts +221 -221
  120. package/src/node/terminal-backend-contribution.slow-spec.ts +63 -63
  121. package/src/node/terminal-backend-contribution.ts +60 -60
  122. package/src/node/terminal-backend-module.ts +82 -82
  123. package/src/node/terminal-server.spec.ts +47 -47
  124. package/src/node/terminal-server.ts +52 -52
  125. package/src/node/test/terminal-test-container.ts +39 -39
  126. package/src/package.spec.ts +28 -28
@@ -1,427 +1,428 @@
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-only 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. Defaults to {0}\'s value.', '`#editor.fontFamily#`'),
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 number 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 number of lines the terminal keeps in its buffer. We pre-allocate memory based on this value in order to ensure a smooth experience. As such, as the value increases, so will the amount of memory.'),
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 when the terminal is focused.'),
151
- enum: ['block', 'underline', 'line'],
152
- default: 'block'
153
- },
154
- 'terminal.integrated.cursorWidth': {
155
- markdownDescription: nls.localizeByDefault('Controls the width of the cursor when {0} is set to {1}.', '`#terminal.integrated.cursorStyle#`', '`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/history 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.localizeByDefault('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-only 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. Defaults to {0}\'s value.', '`#editor.fontFamily#`'),
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 number 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 number of lines the terminal keeps in its buffer. We pre-allocate memory based on this value in order to ensure a smooth experience. As such, as the value increases, so will the amount of memory.'),
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
+ deprecationMessage: nls.localize('theia/terminal/rendererTypeDeprecationMessage', 'The renderer type is no longer supported as an option.')
139
+ },
140
+ 'terminal.integrated.copyOnSelection': {
141
+ description: nls.localizeByDefault('Controls whether text selected in the terminal will be copied to the clipboard.'),
142
+ type: 'boolean',
143
+ default: false,
144
+ },
145
+ 'terminal.integrated.cursorBlinking': {
146
+ description: nls.localizeByDefault('Controls whether the terminal cursor blinks.'),
147
+ type: 'boolean',
148
+ default: false
149
+ },
150
+ 'terminal.integrated.cursorStyle': {
151
+ description: nls.localizeByDefault('Controls the style of terminal cursor when the terminal is focused.'),
152
+ enum: ['block', 'underline', 'line'],
153
+ default: 'block'
154
+ },
155
+ 'terminal.integrated.cursorWidth': {
156
+ markdownDescription: nls.localizeByDefault('Controls the width of the cursor when {0} is set to {1}.', '`#terminal.integrated.cursorStyle#`', '`line`'),
157
+ type: 'number',
158
+ default: 1
159
+ },
160
+ 'terminal.integrated.shell.windows': {
161
+ type: ['string', 'null'],
162
+ typeDetails: { isFilepath: true },
163
+ markdownDescription: nls.localize('theia/terminal/shellWindows', 'The path of the shell that the terminal uses on Windows. (default: \'{0}\').', 'C:\\Windows\\System32\\cmd.exe'),
164
+ default: undefined,
165
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Windows),
166
+ },
167
+ 'terminal.integrated.shell.osx': {
168
+ type: ['string', 'null'],
169
+ markdownDescription: nls.localize('theia/terminal/shellOsx', 'The path of the shell that the terminal uses on macOS (default: \'{0}\'}).', '/bin/bash'),
170
+ default: undefined,
171
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.OSX),
172
+ },
173
+ 'terminal.integrated.shell.linux': {
174
+ type: ['string', 'null'],
175
+ markdownDescription: nls.localize('theia/terminal/shellLinux', 'The path of the shell that the terminal uses on Linux (default: \'{0}\'}).', '/bin/bash'),
176
+ default: undefined,
177
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Linux),
178
+ },
179
+ 'terminal.integrated.shellArgs.windows': {
180
+ type: 'array',
181
+ markdownDescription: nls.localize('theia/terminal/shellArgsWindows', 'The command line arguments to use when on the Windows terminal.'),
182
+ default: [],
183
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Windows),
184
+ },
185
+ 'terminal.integrated.shellArgs.osx': {
186
+ type: 'array',
187
+ markdownDescription: nls.localize('theia/terminal/shellArgsOsx', 'The command line arguments to use when on the macOS terminal.'),
188
+ default: [
189
+ '-l'
190
+ ],
191
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.OSX),
192
+ },
193
+ 'terminal.integrated.shellArgs.linux': {
194
+ type: 'array',
195
+ markdownDescription: nls.localize('theia/terminal/shellArgsLinux', 'The command line arguments to use when on the Linux terminal.'),
196
+ default: [],
197
+ deprecationMessage: shellArgsDeprecatedMessage(OS.Type.Linux),
198
+ },
199
+ 'terminal.integrated.confirmOnExit': {
200
+ type: 'string',
201
+ description: nls.localizeByDefault('Controls whether to confirm when the window closes if there are active terminal sessions.'),
202
+ enum: ['never', 'always', 'hasChildProcesses'],
203
+ enumDescriptions: [
204
+ nls.localizeByDefault('Never confirm.'),
205
+ nls.localizeByDefault('Always confirm if there are terminals.'),
206
+ nls.localizeByDefault('Confirm if there are any terminals that have child processes.'),
207
+ ],
208
+ default: 'never'
209
+ },
210
+ 'terminal.integrated.enablePersistentSessions': {
211
+ type: 'boolean',
212
+ description: nls.localizeByDefault('Persist terminal sessions/history for the workspace across window reloads.'),
213
+ default: true
214
+ },
215
+ 'terminal.integrated.defaultProfile.windows': {
216
+ type: 'string',
217
+ description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.Windows.toString())
218
+
219
+ },
220
+ 'terminal.integrated.defaultProfile.linux': {
221
+ type: 'string',
222
+ description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.Linux.toString())
223
+
224
+ },
225
+ 'terminal.integrated.defaultProfile.osx': {
226
+ type: 'string',
227
+ description: nls.localize('theia/terminal/defaultProfile', 'The default profile used on {0}', OS.Type.OSX.toString())
228
+ },
229
+ 'terminal.integrated.profiles.windows': {
230
+ 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'),
231
+ anyOf: [
232
+ {
233
+ type: 'object',
234
+ properties: {
235
+ },
236
+ additionalProperties: {
237
+ oneOf: [{
238
+ type: 'object',
239
+ additionalProperties: false,
240
+ properties: {
241
+ path: pathProperty,
242
+ args: {
243
+ ...stringOrStringArray,
244
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
245
+
246
+ },
247
+ ...commonProfileProperties
248
+ },
249
+ required: ['path']
250
+ },
251
+ {
252
+ type: 'object',
253
+ additionalProperties: false,
254
+ properties: {
255
+ source: {
256
+ type: 'string',
257
+ description: nls.localizeByDefault('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.')
258
+ },
259
+ args: {
260
+ ...stringOrStringArray,
261
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
262
+
263
+ },
264
+ ...commonProfileProperties
265
+ },
266
+ required: ['source'],
267
+ default: {
268
+ path: 'C:\\Windows\\System32\\cmd.exe'
269
+ }
270
+
271
+ }, {
272
+ type: 'null'
273
+ }]
274
+ },
275
+ default: {
276
+ cmd: {
277
+ path: 'C:\\Windows\\System32\\cmd.exe'
278
+ }
279
+ }
280
+ },
281
+ { type: 'null' }
282
+ ]
283
+ },
284
+ 'terminal.integrated.profiles.linux': {
285
+ 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'),
286
+ anyOf: [{
287
+ type: 'object',
288
+ properties: {
289
+ },
290
+ additionalProperties: {
291
+ oneOf: [
292
+ {
293
+ type: 'object',
294
+ properties: {
295
+ path: pathProperty,
296
+ args: {
297
+ type: 'array',
298
+ items: { type: 'string' },
299
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
300
+ },
301
+ ...commonProfileProperties
302
+ },
303
+ required: ['path'],
304
+ additionalProperties: false,
305
+ },
306
+ { type: 'null' }
307
+ ]
308
+ },
309
+ default: {
310
+ path: '${env:SHELL}',
311
+ args: ['-l']
312
+ }
313
+
314
+ },
315
+ { type: 'null' }
316
+ ]
317
+ },
318
+ 'terminal.integrated.profiles.osx': {
319
+ 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'),
320
+ anyOf: [{
321
+ type: 'object',
322
+ properties: {
323
+ },
324
+ additionalProperties: {
325
+ oneOf: [
326
+ {
327
+ type: 'object',
328
+ properties: {
329
+ path: pathProperty,
330
+ args: {
331
+ type: 'array',
332
+ items: { type: 'string' },
333
+ description: nls.localize('theia/terminal/profileArgs', 'The shell arguments that this profile uses.'),
334
+ },
335
+ ...commonProfileProperties
336
+ },
337
+ required: ['path'],
338
+ additionalProperties: false,
339
+ },
340
+ { type: 'null' }
341
+ ]
342
+ },
343
+ default: {
344
+ path: '${env:SHELL}',
345
+ args: ['-l']
346
+ }
347
+
348
+ },
349
+ { type: 'null' }
350
+ ]
351
+ },
352
+ }
353
+ };
354
+
355
+ export type Profiles = null | {
356
+ [key: string]: {
357
+ path?: string | string[],
358
+ source?: string,
359
+ args?: string | string[],
360
+ env?: { [key: string]: string },
361
+ overrideName?: boolean;
362
+ icon?: string,
363
+ color?: string
364
+ }
365
+ };
366
+
367
+ export interface TerminalConfiguration {
368
+ 'terminal.enableCopy': boolean
369
+ 'terminal.enablePaste': boolean
370
+ // xterm compatible, see https://xtermjs.org/docs/api/terminal/interfaces/iterminaloptions/
371
+ 'terminal.integrated.fontFamily': string
372
+ 'terminal.integrated.fontSize': number
373
+ 'terminal.integrated.fontWeight': FontWeight
374
+ 'terminal.integrated.fontWeightBold': FontWeight,
375
+ 'terminal.integrated.drawBoldTextInBrightColors': boolean,
376
+ 'terminal.integrated.letterSpacing': number
377
+ 'terminal.integrated.lineHeight': number,
378
+ 'terminal.integrated.scrollback': number,
379
+ 'terminal.integrated.fastScrollSensitivity': number,
380
+ 'terminal.integrated.rendererType': TerminalRendererType,
381
+ 'terminal.integrated.copyOnSelection': boolean,
382
+ 'terminal.integrated.cursorBlinking': boolean,
383
+ 'terminal.integrated.cursorStyle': CursorStyleVSCode,
384
+ 'terminal.integrated.cursorWidth': number,
385
+ 'terminal.integrated.shell.windows': string | null | undefined,
386
+ 'terminal.integrated.shell.osx': string | null | undefined,
387
+ 'terminal.integrated.shell.linux': string | null | undefined,
388
+ 'terminal.integrated.shellArgs.windows': string[],
389
+ 'terminal.integrated.shellArgs.osx': string[],
390
+ 'terminal.integrated.shellArgs.linux': string[],
391
+ 'terminal.integrated.defaultProfile.windows': string,
392
+ 'terminal.integrated.defaultProfile.linux': string,
393
+ 'terminal.integrated.defaultProfile.osx': string,
394
+ 'terminal.integrated.profiles.windows': Profiles
395
+ 'terminal.integrated.profiles.linux': Profiles,
396
+ 'terminal.integrated.profiles.osx': Profiles,
397
+ 'terminal.integrated.confirmOnExit': ConfirmOnExitType
398
+ 'terminal.integrated.enablePersistentSessions': boolean
399
+ }
400
+
401
+ type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
402
+ export type CursorStyle = 'block' | 'underline' | 'bar';
403
+ // VS Code uses 'line' to represent 'bar'. The following conversion is necessary to support their preferences.
404
+ export type CursorStyleVSCode = CursorStyle | 'line';
405
+ export type TerminalRendererType = 'canvas' | 'dom';
406
+ export type ConfirmOnExitType = 'never' | 'always' | 'hasChildProcesses';
407
+ export const DEFAULT_TERMINAL_RENDERER_TYPE = 'canvas';
408
+ export function isTerminalRendererType(arg: unknown): arg is TerminalRendererType {
409
+ return typeof arg === 'string' && (arg === 'canvas' || arg === 'dom');
410
+ }
411
+
412
+ export const TerminalPreferenceContribution = Symbol('TerminalPreferenceContribution');
413
+ export const TerminalPreferences = Symbol('TerminalPreferences');
414
+ export type TerminalPreferences = PreferenceProxy<TerminalConfiguration>;
415
+
416
+ export function createTerminalPreferences(preferences: PreferenceService, schema: PreferenceSchema = TerminalConfigSchema): TerminalPreferences {
417
+ return createPreferenceProxy(preferences, schema);
418
+ }
419
+
420
+ export function bindTerminalPreferences(bind: interfaces.Bind): void {
421
+ bind(TerminalPreferences).toDynamicValue(ctx => {
422
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
423
+ const contribution = ctx.container.get<PreferenceContribution>(TerminalPreferenceContribution);
424
+ return createTerminalPreferences(preferences, contribution.schema);
425
+ }).inSingletonScope();
426
+ bind(TerminalPreferenceContribution).toConstantValue({ schema: TerminalConfigSchema });
427
+ bind(PreferenceContribution).toService(TerminalPreferenceContribution);
428
+ }