@theia/plugin-ext 1.43.1 → 1.45.0

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 (197) hide show
  1. package/lib/common/plugin-api-rpc.d.ts +11 -1
  2. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.js.map +1 -1
  4. package/lib/common/plugin-protocol.d.ts +9 -2
  5. package/lib/common/plugin-protocol.d.ts.map +1 -1
  6. package/lib/common/plugin-protocol.js.map +1 -1
  7. package/lib/common/proxy-handler.d.ts.map +1 -1
  8. package/lib/common/proxy-handler.js +3 -1
  9. package/lib/common/proxy-handler.js.map +1 -1
  10. package/lib/common/test-types.d.ts +9 -0
  11. package/lib/common/test-types.d.ts.map +1 -1
  12. package/lib/common/test-types.js +36 -1
  13. package/lib/common/test-types.js.map +1 -1
  14. package/lib/hosted/browser/hosted-plugin.d.ts +2 -0
  15. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  16. package/lib/hosted/browser/hosted-plugin.js +54 -6
  17. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  18. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -0
  19. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  20. package/lib/hosted/node/hosted-plugin-deployer-handler.js +6 -0
  21. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  22. package/lib/hosted/node/plugin-activation-events.d.ts.map +1 -1
  23. package/lib/hosted/node/plugin-activation-events.js +1 -1
  24. package/lib/hosted/node/plugin-activation-events.js.map +1 -1
  25. package/lib/hosted/node/scanners/scanner-theia.d.ts +0 -3
  26. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  27. package/lib/hosted/node/scanners/scanner-theia.js +11 -94
  28. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  29. package/lib/main/browser/debug/plugin-debug-service.d.ts +3 -0
  30. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  31. package/lib/main/browser/debug/plugin-debug-service.js +85 -1
  32. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  33. package/lib/main/browser/languages-main.d.ts.map +1 -1
  34. package/lib/main/browser/languages-main.js +1 -0
  35. package/lib/main/browser/languages-main.js.map +1 -1
  36. package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts +1 -0
  37. package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts.map +1 -1
  38. package/lib/main/browser/menus/plugin-menu-command-adapter.js +30 -0
  39. package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
  40. package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts +2 -2
  41. package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
  42. package/lib/main/browser/menus/vscode-theia-menu-mappings.js +6 -1
  43. package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
  44. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts +4 -2
  45. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -1
  46. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +34 -21
  47. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
  48. package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -1
  49. package/lib/main/browser/notebooks/notebook-documents-main.js +8 -9
  50. package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -1
  51. package/lib/main/browser/notebooks/notebook-dto.d.ts +3 -0
  52. package/lib/main/browser/notebooks/notebook-dto.d.ts.map +1 -1
  53. package/lib/main/browser/notebooks/notebook-dto.js +27 -34
  54. package/lib/main/browser/notebooks/notebook-dto.js.map +1 -1
  55. package/lib/main/browser/notebooks/notebook-kernels-main.js +3 -3
  56. package/lib/main/browser/notebooks/notebook-kernels-main.js.map +1 -1
  57. package/lib/main/browser/notebooks/notebooks-main.d.ts +12 -1
  58. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
  59. package/lib/main/browser/notebooks/notebooks-main.js.map +1 -1
  60. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +1 -2
  61. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
  62. package/lib/main/browser/notebooks/renderers/cell-output-webview.js +1 -1
  63. package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
  64. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
  65. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  66. package/lib/main/browser/plugin-contribution-handler.js +10 -0
  67. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  68. package/lib/main/browser/plugin-icon-theme-service.d.ts +12 -1
  69. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  70. package/lib/main/browser/plugin-icon-theme-service.js +44 -8
  71. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  72. package/lib/main/browser/plugin-shared-style.d.ts +5 -1
  73. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  74. package/lib/main/browser/plugin-shared-style.js +33 -16
  75. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  76. package/lib/main/browser/terminal-main.d.ts +1 -0
  77. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  78. package/lib/main/browser/terminal-main.js +5 -0
  79. package/lib/main/browser/terminal-main.js.map +1 -1
  80. package/lib/main/browser/text-editor-main.d.ts.map +1 -1
  81. package/lib/main/browser/text-editor-main.js +10 -0
  82. package/lib/main/browser/text-editor-main.js.map +1 -1
  83. package/lib/main/browser/webview/webview.d.ts +20 -1
  84. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  85. package/lib/main/browser/webview/webview.js +38 -1
  86. package/lib/main/browser/webview/webview.js.map +1 -1
  87. package/lib/main/node/plugin-deployer-contribution.d.ts +1 -1
  88. package/lib/main/node/plugin-deployer-contribution.d.ts.map +1 -1
  89. package/lib/main/node/plugin-deployer-contribution.js +2 -1
  90. package/lib/main/node/plugin-deployer-contribution.js.map +1 -1
  91. package/lib/main/node/plugin-deployer-impl.d.ts +1 -1
  92. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  93. package/lib/main/node/plugin-deployer-impl.js +3 -2
  94. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  95. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  96. package/lib/main/node/plugin-ext-backend-module.js +3 -0
  97. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  98. package/lib/main/node/plugin-mgmt-cli-contribution.d.ts +13 -0
  99. package/lib/main/node/plugin-mgmt-cli-contribution.d.ts.map +1 -0
  100. package/lib/main/node/plugin-mgmt-cli-contribution.js +71 -0
  101. package/lib/main/node/plugin-mgmt-cli-contribution.js.map +1 -0
  102. package/lib/plugin/command-registry.d.ts.map +1 -1
  103. package/lib/plugin/command-registry.js +9 -3
  104. package/lib/plugin/command-registry.js.map +1 -1
  105. package/lib/plugin/env.d.ts +0 -3
  106. package/lib/plugin/env.d.ts.map +1 -1
  107. package/lib/plugin/env.js +0 -6
  108. package/lib/plugin/env.js.map +1 -1
  109. package/lib/plugin/languages-utils.d.ts +2 -1
  110. package/lib/plugin/languages-utils.d.ts.map +1 -1
  111. package/lib/plugin/languages-utils.js +14 -1
  112. package/lib/plugin/languages-utils.js.map +1 -1
  113. package/lib/plugin/languages.d.ts.map +1 -1
  114. package/lib/plugin/languages.js +2 -1
  115. package/lib/plugin/languages.js.map +1 -1
  116. package/lib/plugin/notebook/notebook-document.js +3 -3
  117. package/lib/plugin/notebook/notebook-document.js.map +1 -1
  118. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  119. package/lib/plugin/notebook/notebooks.js +7 -4
  120. package/lib/plugin/notebook/notebooks.js.map +1 -1
  121. package/lib/plugin/plugin-context.d.ts.map +1 -1
  122. package/lib/plugin/plugin-context.js +5 -1
  123. package/lib/plugin/plugin-context.js.map +1 -1
  124. package/lib/plugin/plugin-manager.d.ts +1 -1
  125. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  126. package/lib/plugin/plugin-manager.js +4 -24
  127. package/lib/plugin/plugin-manager.js.map +1 -1
  128. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  129. package/lib/plugin/terminal-ext.d.ts +5 -0
  130. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  131. package/lib/plugin/terminal-ext.js +11 -0
  132. package/lib/plugin/terminal-ext.js.map +1 -1
  133. package/lib/plugin/tests.d.ts +6 -1
  134. package/lib/plugin/tests.d.ts.map +1 -1
  135. package/lib/plugin/tests.js +22 -0
  136. package/lib/plugin/tests.js.map +1 -1
  137. package/lib/plugin/text-editor.d.ts +6 -2
  138. package/lib/plugin/text-editor.d.ts.map +1 -1
  139. package/lib/plugin/text-editor.js +57 -2
  140. package/lib/plugin/text-editor.js.map +1 -1
  141. package/lib/plugin/type-converters.d.ts +1 -12
  142. package/lib/plugin/type-converters.d.ts.map +1 -1
  143. package/lib/plugin/type-converters.js +3 -121
  144. package/lib/plugin/type-converters.js.map +1 -1
  145. package/lib/plugin/types-impl.d.ts +23 -0
  146. package/lib/plugin/types-impl.d.ts.map +1 -1
  147. package/lib/plugin/types-impl.js +36 -4
  148. package/lib/plugin/types-impl.js.map +1 -1
  149. package/lib/plugin/window-state.d.ts.map +1 -1
  150. package/lib/plugin/window-state.js +3 -4
  151. package/lib/plugin/window-state.js.map +1 -1
  152. package/package.json +29 -29
  153. package/src/common/plugin-api-rpc.ts +12 -1
  154. package/src/common/plugin-protocol.ts +9 -2
  155. package/src/common/proxy-handler.ts +3 -1
  156. package/src/common/test-types.ts +20 -0
  157. package/src/hosted/browser/hosted-plugin.ts +51 -6
  158. package/src/hosted/node/hosted-plugin-deployer-handler.ts +7 -0
  159. package/src/hosted/node/plugin-activation-events.ts +10 -9
  160. package/src/hosted/node/scanners/scanner-theia.ts +10 -101
  161. package/src/main/browser/debug/plugin-debug-service.ts +91 -2
  162. package/src/main/browser/languages-main.ts +1 -0
  163. package/src/main/browser/menus/plugin-menu-command-adapter.ts +30 -0
  164. package/src/main/browser/menus/vscode-theia-menu-mappings.ts +7 -2
  165. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +36 -22
  166. package/src/main/browser/notebooks/notebook-documents-main.ts +11 -12
  167. package/src/main/browser/notebooks/notebook-dto.ts +24 -34
  168. package/src/main/browser/notebooks/notebook-kernels-main.ts +1 -1
  169. package/src/main/browser/notebooks/notebooks-main.ts +13 -2
  170. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +3 -3
  171. package/src/main/browser/plugin-contribution-handler.ts +9 -0
  172. package/src/main/browser/plugin-icon-theme-service.ts +46 -12
  173. package/src/main/browser/plugin-shared-style.ts +37 -17
  174. package/src/main/browser/terminal-main.ts +7 -0
  175. package/src/main/browser/text-editor-main.ts +9 -0
  176. package/src/main/browser/webview/pre/host.js +1 -1
  177. package/src/main/browser/webview/pre/main.js +84 -34
  178. package/src/main/browser/webview/webview.ts +49 -1
  179. package/src/main/node/plugin-deployer-contribution.ts +3 -2
  180. package/src/main/node/plugin-deployer-impl.ts +4 -3
  181. package/src/main/node/plugin-ext-backend-module.ts +4 -0
  182. package/src/main/node/plugin-mgmt-cli-contribution.ts +64 -0
  183. package/src/plugin/command-registry.ts +8 -3
  184. package/src/plugin/env.ts +0 -8
  185. package/src/plugin/languages-utils.ts +13 -1
  186. package/src/plugin/languages.ts +3 -2
  187. package/src/plugin/notebook/notebook-document.ts +8 -8
  188. package/src/plugin/notebook/notebooks.ts +6 -4
  189. package/src/plugin/plugin-context.ts +6 -1
  190. package/src/plugin/plugin-manager.ts +5 -25
  191. package/src/plugin/status-bar/status-bar-item.ts +1 -1
  192. package/src/plugin/terminal-ext.ts +15 -0
  193. package/src/plugin/tests.ts +25 -1
  194. package/src/plugin/text-editor.ts +64 -4
  195. package/src/plugin/type-converters.ts +3 -123
  196. package/src/plugin/types-impl.ts +33 -0
  197. package/src/plugin/window-state.ts +4 -4
@@ -79,29 +79,6 @@ class ActivatedPlugin {
79
79
 
80
80
  export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
81
81
 
82
- static SUPPORTED_ACTIVATION_EVENTS = new Set([
83
- '*',
84
- 'onLanguage',
85
- 'onCommand',
86
- 'onDebug',
87
- 'onDebugInitialConfigurations',
88
- 'onDebugResolve',
89
- 'onDebugAdapterProtocolTracker',
90
- 'onDebugDynamicConfigurations',
91
- 'onTaskType',
92
- 'workspaceContains',
93
- 'onView',
94
- 'onUri',
95
- 'onTerminalProfile',
96
- 'onWebviewPanel',
97
- 'onFileSystem',
98
- 'onCustomEditor',
99
- 'onStartupFinished',
100
- 'onAuthenticationRequest',
101
- 'onNotebook',
102
- 'onNotebookSerializer'
103
- ]);
104
-
105
82
  private configStorage: ConfigStorage | undefined;
106
83
  private readonly registry = new Map<string, Plugin>();
107
84
  private readonly activations = new Map<string, (() => Promise<void>)[] | undefined>();
@@ -113,6 +90,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
113
90
  private onDidChangeEmitter = new Emitter<void>();
114
91
  private messageRegistryProxy: MessageRegistryMain;
115
92
  private notificationMain: NotificationMain;
93
+ private supportedActivationEvents: Set<string>;
116
94
  protected fireOnDidChange(): void {
117
95
  this.onDidChangeEmitter.fire(undefined);
118
96
  }
@@ -206,7 +184,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
206
184
 
207
185
  this.envExt.setQueryParameters(params.env.queryParams);
208
186
  this.envExt.setLanguage(params.env.language);
209
- this.envExt.setShell(params.env.shell);
187
+ this.terminalService.$setShell(params.env.shell);
210
188
  this.envExt.setUIKind(params.env.uiKind);
211
189
  this.envExt.setApplicationName(params.env.appName);
212
190
  this.envExt.setAppHost(params.env.appHost);
@@ -219,6 +197,8 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
219
197
 
220
198
  this.webview.init(params.webview);
221
199
  this.jsonValidation = params.jsonValidation;
200
+
201
+ this.supportedActivationEvents = new Set(params.supportedActivationEvents ?? []);
222
202
  }
223
203
 
224
204
  async $start(params: PluginManagerStartParams): Promise<void> {
@@ -263,7 +243,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
263
243
  const activation = () => this.$activatePlugin(plugin.model.id);
264
244
  // an internal activation event is a subject to change
265
245
  this.setActivation(`onPlugin:${plugin.model.id}`, activation);
266
- const unsupportedActivationEvents = plugin.rawModel.activationEvents.filter(e => !PluginManagerExtImpl.SUPPORTED_ACTIVATION_EVENTS.has(e.split(':')[0]));
246
+ const unsupportedActivationEvents = plugin.rawModel.activationEvents.filter(e => !this.supportedActivationEvents.has(e.split(':')[0]));
267
247
  if (unsupportedActivationEvents.length) {
268
248
  console.warn(`Unsupported activation events: ${unsupportedActivationEvents.join(', ')}, please open an issue: https://github.com/eclipse-theia/theia/issues/new`);
269
249
  }
@@ -40,7 +40,7 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
40
40
  private _accessibilityInformation: theia.AccessibilityInformation;
41
41
 
42
42
  private _isVisible: boolean;
43
- private _timeoutHandle: NodeJS.Timer | undefined;
43
+ private _timeoutHandle: NodeJS.Timeout | undefined;
44
44
 
45
45
  _proxy: StatusBarMessageRegistryMain;
46
46
 
@@ -71,6 +71,10 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
71
71
 
72
72
  protected environmentVariableCollections: MultiKeyMap<string, EnvironmentVariableCollectionImpl> = new MultiKeyMap(2);
73
73
 
74
+ private shell: string;
75
+ private readonly onDidChangeShellEmitter = new Emitter<string>();
76
+ readonly onDidChangeShell: theia.Event<string> = this.onDidChangeShellEmitter.event;
77
+
74
78
  constructor(rpc: RPCProtocol) {
75
79
  this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.TERMINAL_MAIN);
76
80
  }
@@ -79,6 +83,17 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
79
83
  return [...this._terminals.values()];
80
84
  }
81
85
 
86
+ get defaultShell(): string {
87
+ return this.shell || '';
88
+ }
89
+
90
+ async $setShell(shell: string): Promise<void> {
91
+ if (this.shell !== shell) {
92
+ this.shell = shell;
93
+ this.onDidChangeShellEmitter.fire(shell);
94
+ }
95
+ }
96
+
82
97
  createTerminal(
83
98
  nameOrOptions: TerminalOptions | PseudoTerminalOptions | ExtensionTerminalOptions | (string | undefined),
84
99
  shellPath?: string, shellArgs?: string[] | string
@@ -40,10 +40,11 @@ import { TestItemImpl, TestItemCollection } from './test-item';
40
40
  import { AccumulatingTreeDeltaEmitter, TreeDelta } from '@theia/test/lib/common/tree-delta';
41
41
  import {
42
42
  TestItemDTO, TestOutputDTO, TestExecutionState, TestRunProfileDTO,
43
- TestRunProfileKind, TestRunRequestDTO, TestStateChangeDTO, TestItemReference
43
+ TestRunProfileKind, TestRunRequestDTO, TestStateChangeDTO, TestItemReference, TestMessageArg, TestMessageDTO
44
44
  } from '../common/test-types';
45
45
  import { ChangeBatcher, observableProperty } from '@theia/test/lib/common/collections';
46
46
  import { TestRunRequest } from './types-impl';
47
+ import { MarkdownString } from '../common/plugin-api-rpc-model';
47
48
 
48
49
  type RefreshHandler = (token: theia.CancellationToken) => void | theia.Thenable<void>;
49
50
  type ResolveHandler = (item: theia.TestItem | undefined) => theia.Thenable<void> | void;
@@ -335,6 +336,8 @@ export class TestingExtImpl implements TestingExt {
335
336
  return this.toTestItem(arg);
336
337
  } else if (Array.isArray(arg)) {
337
338
  return arg.map(param => TestItemReference.is(param) ? this.toTestItem(param) : param);
339
+ } else if (TestMessageArg.is(arg)) {
340
+ return this.fromTestMessageArg(arg);
338
341
  } else {
339
342
  return arg;
340
343
  }
@@ -343,6 +346,27 @@ export class TestingExtImpl implements TestingExt {
343
346
 
344
347
  }
345
348
 
349
+ fromTestMessageArg(arg: TestMessageArg): { test?: theia.TestItem, message: theia.TestMessage } {
350
+ const testItem = arg.testItemReference ? this.toTestItem(arg.testItemReference) : undefined;
351
+ const message = this.toTestMessage(arg.testMessage);
352
+ return {
353
+ test: testItem,
354
+ message: message
355
+ };
356
+ }
357
+
358
+ toTestMessage(testMessage: TestMessageDTO): theia.TestMessage {
359
+ const message = MarkdownString.is(testMessage.message) ? Convert.toMarkdown(testMessage.message) : testMessage.message;
360
+
361
+ return {
362
+ message: message,
363
+ actualOutput: testMessage.actual,
364
+ expectedOutput: testMessage.expected,
365
+ contextValue: testMessage.contextValue,
366
+ location: testMessage.location ? Convert.toLocation(testMessage.location) : undefined
367
+ };
368
+ }
369
+
346
370
  toTestItem(ref: TestItemReference): theia.TestItem {
347
371
  const result = this.withController(ref.controllerId).items.find(ref.testPath);
348
372
  if (!result) {
@@ -277,7 +277,8 @@ export class TextEditorExt implements theia.TextEditor {
277
277
  }
278
278
 
279
279
  export class TextEditorOptionsExt implements theia.TextEditorOptions {
280
- private _tabSize?: number;
280
+ private _tabSize: number;
281
+ private _indentSize: number | 'tabSize';
281
282
  private _insertSpace: boolean;
282
283
  private _cursorStyle: TextEditorCursorStyle;
283
284
  private _lineNumbers: TextEditorLineNumbersStyle;
@@ -289,12 +290,13 @@ export class TextEditorOptionsExt implements theia.TextEditorOptions {
289
290
 
290
291
  accept(source: TextEditorConfiguration): void {
291
292
  this._tabSize = source.tabSize;
293
+ this._indentSize = source.indentSize;
292
294
  this._insertSpace = source.insertSpaces;
293
295
  this._cursorStyle = source.cursorStyle;
294
296
  this._lineNumbers = source.lineNumbers;
295
297
  }
296
298
 
297
- get tabSize(): number | string | undefined {
299
+ get tabSize(): number {
298
300
  return this._tabSize;
299
301
  }
300
302
 
@@ -305,10 +307,10 @@ export class TextEditorOptionsExt implements theia.TextEditorOptions {
305
307
  }
306
308
 
307
309
  if (typeof tabSize === 'number') {
308
- if (this.tabSize === tabSize) {
310
+ if (this._tabSize === tabSize) {
309
311
  return;
310
312
  }
311
- this.tabSize = tabSize;
313
+ this._tabSize = tabSize;
312
314
  }
313
315
  warnOnError(this.proxy.$trySetOptions(this.id, {
314
316
  tabSize
@@ -334,6 +336,51 @@ export class TextEditorOptionsExt implements theia.TextEditorOptions {
334
336
  return undefined;
335
337
  }
336
338
 
339
+ get indentSize(): number {
340
+ if (this._indentSize === 'tabSize') {
341
+ return this.tabSize;
342
+ }
343
+ return this._indentSize;
344
+ }
345
+
346
+ set indentSize(val: number | string | undefined) {
347
+ const indentSize = this.validateIndentSize(val);
348
+ if (!indentSize) {
349
+ return; // ignore invalid values
350
+ }
351
+
352
+ if (typeof indentSize === 'number') {
353
+ if (this._indentSize === indentSize) {
354
+ return;
355
+ }
356
+ this._indentSize = indentSize;
357
+ } else if (val === 'tabSize') {
358
+ this._indentSize = val;
359
+ }
360
+ warnOnError(this.proxy.$trySetOptions(this.id, {
361
+ indentSize
362
+ }));
363
+ }
364
+
365
+ private validateIndentSize(val: number | string | undefined): number | 'tabSize' | undefined {
366
+ if (val === 'tabSize') {
367
+ return 'tabSize';
368
+ }
369
+
370
+ if (typeof val === 'number') {
371
+ const r = Math.floor(val);
372
+ return r > 0 ? r : undefined;
373
+ }
374
+ if (typeof val === 'string') {
375
+ const r = parseInt(val, undefined);
376
+ if (isNaN(r)) {
377
+ return undefined;
378
+ }
379
+ return r > 0 ? r : undefined;
380
+ }
381
+ return undefined;
382
+ }
383
+
337
384
  get insertSpaces(): boolean | string {
338
385
  return this._insertSpace;
339
386
  }
@@ -395,6 +442,19 @@ export class TextEditorOptionsExt implements theia.TextEditorOptions {
395
442
  }
396
443
  }
397
444
 
445
+ if (typeof newOptions.indentSize !== 'undefined') {
446
+ const indentSize = this.validateIndentSize(newOptions.indentSize);
447
+ if (indentSize === 'tabSize') {
448
+ hasUpdate = true;
449
+ configurationUpdate.indentSize = indentSize;
450
+ } else if (typeof indentSize === 'number' && this._indentSize !== indentSize) {
451
+ // reflect the new indentSize value immediately
452
+ this._indentSize = indentSize;
453
+ hasUpdate = true;
454
+ configurationUpdate.indentSize = indentSize;
455
+ }
456
+ }
457
+
398
458
  if (typeof newOptions.insertSpaces !== 'undefined') {
399
459
  const insertSpaces = this.validateInsertSpaces(newOptions.insertSpaces);
400
460
  if (insertSpaces === 'auto') {
@@ -31,8 +31,7 @@ import { DisposableCollection, Mutable, isEmptyObject, isObject } from '@theia/c
31
31
  import * as notebooks from '@theia/notebook/lib/common';
32
32
  import { CommandsConverter } from './command-registry';
33
33
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
34
- import { CellData, CellExecutionUpdateType, CellOutput, CellOutputItem, CellRange, isTextStreamMime } from '@theia/notebook/lib/common';
35
- import { CellExecuteUpdate, CellExecutionComplete } from '@theia/notebook/lib/browser';
34
+ import { CellRange, isTextStreamMime } from '@theia/notebook/lib/common';
36
35
  import { MarkdownString as MarkdownStringDTO } from '@theia/core/lib/common/markdown-rendering';
37
36
 
38
37
  import { TestItemDTO, TestMessageDTO } from '../common/test-types';
@@ -1636,126 +1635,6 @@ export namespace NotebookKernelSourceAction {
1636
1635
  }
1637
1636
  }
1638
1637
 
1639
- export namespace NotebookDto {
1640
-
1641
- export function toNotebookOutputItemDto(item: CellOutputItem): rpc.NotebookOutputItemDto {
1642
- return {
1643
- mime: item.mime,
1644
- valueBytes: item.data
1645
- };
1646
- }
1647
-
1648
- export function toNotebookOutputDto(output: CellOutput): rpc.NotebookOutputDto {
1649
- return {
1650
- outputId: output.outputId,
1651
- metadata: output.metadata,
1652
- items: output.outputs.map(toNotebookOutputItemDto)
1653
- };
1654
- }
1655
-
1656
- export function toNotebookCellDataDto(cell: CellData): rpc.NotebookCellDataDto {
1657
- return {
1658
- cellKind: cell.cellKind,
1659
- language: cell.language,
1660
- source: cell.source,
1661
- internalMetadata: cell.internalMetadata,
1662
- metadata: cell.metadata,
1663
- outputs: cell.outputs.map(toNotebookOutputDto)
1664
- };
1665
- }
1666
-
1667
- // export function toNotebookDataDto(data: NotebookData): rpc.NotebookDataDto {
1668
- // return {
1669
- // metadata: data.metadata,
1670
- // cells: data.cells.map(toNotebookCellDataDto)
1671
- // };
1672
- // }
1673
-
1674
- export function fromNotebookOutputItemDto(item: rpc.NotebookOutputItemDto): CellOutputItem {
1675
- return {
1676
- mime: item.mime,
1677
- data: item.valueBytes
1678
- };
1679
- }
1680
-
1681
- export function fromNotebookOutputDto(output: rpc.NotebookOutputDto): CellOutput {
1682
- return {
1683
- outputId: output.outputId,
1684
- metadata: output.metadata,
1685
- outputs: output.items.map(fromNotebookOutputItemDto)
1686
- };
1687
- }
1688
-
1689
- export function fromNotebookCellDataDto(cell: rpc.NotebookCellDataDto): CellData {
1690
- return {
1691
- cellKind: cell.cellKind,
1692
- language: cell.language,
1693
- source: cell.source,
1694
- outputs: cell.outputs.map(fromNotebookOutputDto),
1695
- metadata: cell.metadata,
1696
- internalMetadata: cell.internalMetadata
1697
- };
1698
- }
1699
-
1700
- // export function fromNotebookDataDto(data: rpc.NotebookDataDto): NotebookData {
1701
- // return {
1702
- // metadata: data.metadata,
1703
- // cells: data.cells.map(fromNotebookCellDataDto)
1704
- // };
1705
- // }
1706
-
1707
- // export function toNotebookCellDto(cell: Cell): rpc.NotebookCellDto {
1708
- // return {
1709
- // handle: cell.handle,
1710
- // uri: cell.uri,
1711
- // source: cell.textBuffer.getLinesContent(),
1712
- // eol: cell.textBuffer.getEOL(),
1713
- // language: cell.language,
1714
- // cellKind: cell.cellKind,
1715
- // outputs: cell.outputs.map(toNotebookOutputDto),
1716
- // metadata: cell.metadata,
1717
- // internalMetadata: cell.internalMetadata,
1718
- // };
1719
- // }
1720
-
1721
- export function fromCellExecuteUpdateDto(data: rpc.CellExecuteUpdateDto): CellExecuteUpdate {
1722
- if (data.editType === CellExecutionUpdateType.Output) {
1723
- return {
1724
- editType: data.editType,
1725
- cellHandle: data.cellHandle,
1726
- append: data.append,
1727
- outputs: data.outputs.map(fromNotebookOutputDto)
1728
- };
1729
- } else if (data.editType === CellExecutionUpdateType.OutputItems) {
1730
- return {
1731
- editType: data.editType,
1732
- append: data.append,
1733
- outputId: data.outputId,
1734
- items: data.items.map(fromNotebookOutputItemDto)
1735
- };
1736
- } else {
1737
- return data;
1738
- }
1739
- }
1740
-
1741
- export function fromCellExecuteCompleteDto(data: rpc.CellExecutionCompleteDto): CellExecutionComplete {
1742
- return data;
1743
- }
1744
-
1745
- // export function fromCellEditOperationDto(edit: rpc.CellEditOperationDto): CellEditOperation {
1746
- // if (edit.editType === CellEditType.Replace) {
1747
- // return {
1748
- // editType: edit.editType,
1749
- // index: edit.index,
1750
- // count: edit.count,
1751
- // cells: edit.cells.map(fromNotebookCellDataDto)
1752
- // };
1753
- // } else {
1754
- // return edit;
1755
- // }
1756
- // }
1757
- }
1758
-
1759
1638
  export namespace TestMessage {
1760
1639
  export function from(message: theia.TestMessage | readonly theia.TestMessage[]): TestMessageDTO[] {
1761
1640
  if (isReadonlyArray(message)) {
@@ -1765,7 +1644,8 @@ export namespace TestMessage {
1765
1644
  location: fromLocation(message.location),
1766
1645
  message: fromMarkdown(message.message)!,
1767
1646
  expected: message.expectedOutput,
1768
- actual: message.actualOutput
1647
+ actual: message.actualOutput,
1648
+ contextValue: message.contextValue
1769
1649
  }];
1770
1650
  }
1771
1651
  }
@@ -845,6 +845,37 @@ export enum IndentAction {
845
845
  Outdent = 3
846
846
  }
847
847
 
848
+ export namespace SyntaxTokenType {
849
+ export function toString(v: SyntaxTokenType | unknown): 'other' | 'comment' | 'string' | 'regex' {
850
+ switch (v) {
851
+ case SyntaxTokenType.Other: return 'other';
852
+ case SyntaxTokenType.Comment: return 'comment';
853
+ case SyntaxTokenType.String: return 'string';
854
+ case SyntaxTokenType.RegEx: return 'regex';
855
+ }
856
+ return 'other';
857
+ }
858
+ }
859
+
860
+ export enum SyntaxTokenType {
861
+ /**
862
+ * Everything except tokens that are part of comments, string literals and regular expressions.
863
+ */
864
+ Other = 0,
865
+ /**
866
+ * A comment.
867
+ */
868
+ Comment = 1,
869
+ /**
870
+ * A string literal.
871
+ */
872
+ String = 2,
873
+ /**
874
+ * A regular expression.
875
+ */
876
+ RegEx = 3
877
+ }
878
+
848
879
  @es5ClassCompat
849
880
  export class TextEdit {
850
881
 
@@ -1657,6 +1688,7 @@ export class CodeActionKind {
1657
1688
  public static readonly Source = CodeActionKind.Empty.append('source');
1658
1689
  public static readonly SourceOrganizeImports = CodeActionKind.Source.append('organizeImports');
1659
1690
  public static readonly SourceFixAll = CodeActionKind.Source.append('fixAll');
1691
+ public static readonly Notebook = CodeActionKind.Empty.append('notebook');
1660
1692
 
1661
1693
  constructor(
1662
1694
  public readonly value: string
@@ -3261,6 +3293,7 @@ export class TestMessage implements theia.TestMessage {
3261
3293
  public expectedOutput?: string;
3262
3294
  public actualOutput?: string;
3263
3295
  public location?: theia.Location;
3296
+ public contextValue?: string;
3264
3297
 
3265
3298
  public static diff(message: string | theia.MarkdownString, expected: string, actual: string): theia.TestMessage {
3266
3299
  const msg = new TestMessage(message);
@@ -19,7 +19,6 @@ import { WindowState } from '@theia/plugin';
19
19
  import { WindowStateExt, WindowMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
20
20
  import { Event, Emitter } from '@theia/core/lib/common/event';
21
21
  import { RPCProtocol } from '../common/rpc-protocol';
22
- import { Schemes } from '../common/uri-components';
23
22
 
24
23
  export class WindowStateExtImpl implements WindowStateExt {
25
24
 
@@ -50,6 +49,10 @@ export class WindowStateExtImpl implements WindowStateExt {
50
49
  }
51
50
 
52
51
  openUri(uri: URI): Promise<boolean> {
52
+ if (!uri.scheme.trim().length) {
53
+ throw new Error('Invalid scheme - cannot be empty');
54
+ }
55
+
53
56
  return this.proxy.$openUri(uri);
54
57
  }
55
58
 
@@ -57,9 +60,6 @@ export class WindowStateExtImpl implements WindowStateExt {
57
60
  if (!target.scheme.trim().length) {
58
61
  throw new Error('Invalid scheme - cannot be empty');
59
62
  }
60
- if (Schemes.http !== target.scheme && Schemes.https !== target.scheme) {
61
- throw new Error(`Invalid scheme '${target.scheme}'`);
62
- }
63
63
 
64
64
  const uri = await this.proxy.$asExternalUri(target);
65
65
  return URI.revive(uri);