@theia/plugin-ext 1.26.0-next.9 → 1.26.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 (163) hide show
  1. package/lib/common/paths-util.js +1 -1
  2. package/lib/common/paths-util.js.map +1 -1
  3. package/lib/common/plugin-api-rpc-model.d.ts +12 -12
  4. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  5. package/lib/common/plugin-api-rpc-model.js +3 -1
  6. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  7. package/lib/common/plugin-api-rpc.d.ts +24 -5
  8. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  9. package/lib/common/plugin-api-rpc.js +2 -1
  10. package/lib/common/plugin-api-rpc.js.map +1 -1
  11. package/lib/common/plugin-protocol.d.ts +1 -0
  12. package/lib/common/plugin-protocol.d.ts.map +1 -1
  13. package/lib/common/plugin-protocol.js.map +1 -1
  14. package/lib/hosted/browser/worker/worker-main.js +4 -2
  15. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  16. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  17. package/lib/hosted/node/hosted-plugin-deployer-handler.js +2 -0
  18. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  19. package/lib/hosted/node/plugin-host-proxy.d.ts +18 -0
  20. package/lib/hosted/node/plugin-host-proxy.d.ts.map +1 -0
  21. package/lib/hosted/node/plugin-host-proxy.js +70 -0
  22. package/lib/hosted/node/plugin-host-proxy.js.map +1 -0
  23. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  24. package/lib/hosted/node/plugin-host-rpc.js +6 -2
  25. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  26. package/lib/main/browser/debug/debug-main.d.ts +1 -0
  27. package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
  28. package/lib/main/browser/debug/debug-main.js +3 -1
  29. package/lib/main/browser/debug/debug-main.js.map +1 -1
  30. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  31. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  32. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  33. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  34. package/lib/main/browser/debug/plugin-debug-service.d.ts +3 -1
  35. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  36. package/lib/main/browser/debug/plugin-debug-service.js +14 -3
  37. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  38. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +5 -2
  39. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  40. package/lib/main/browser/debug/plugin-debug-session-factory.js +6 -4
  41. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  42. package/lib/main/browser/documents-main.d.ts.map +1 -1
  43. package/lib/main/browser/documents-main.js +2 -0
  44. package/lib/main/browser/documents-main.js.map +1 -1
  45. package/lib/main/browser/languages-main.d.ts +8 -2
  46. package/lib/main/browser/languages-main.d.ts.map +1 -1
  47. package/lib/main/browser/languages-main.js +36 -0
  48. package/lib/main/browser/languages-main.js.map +1 -1
  49. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  50. package/lib/main/browser/plugin-ext-frontend-module.js +0 -3
  51. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  52. package/lib/main/browser/status-bar-message-registry-main.d.ts +2 -1
  53. package/lib/main/browser/status-bar-message-registry-main.d.ts.map +1 -1
  54. package/lib/main/browser/status-bar-message-registry-main.js.map +1 -1
  55. package/lib/main/browser/terminal-main.js +1 -1
  56. package/lib/main/browser/terminal-main.js.map +1 -1
  57. package/lib/main/browser/view/tree-view-widget.js +2 -2
  58. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  59. package/lib/plugin/comments.js +1 -1
  60. package/lib/plugin/comments.js.map +1 -1
  61. package/lib/plugin/documents.d.ts.map +1 -1
  62. package/lib/plugin/documents.js +3 -1
  63. package/lib/plugin/documents.js.map +1 -1
  64. package/lib/plugin/file-system-event-service-ext-impl.d.ts +1 -1
  65. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  66. package/lib/plugin/file-system-event-service-ext-impl.js +1 -1
  67. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  68. package/lib/plugin/languages/linked-editing-range.d.ts +12 -0
  69. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -0
  70. package/lib/plugin/languages/linked-editing-range.js +41 -0
  71. package/lib/plugin/languages/linked-editing-range.js.map +1 -0
  72. package/lib/plugin/languages-utils.d.ts +6 -0
  73. package/lib/plugin/languages-utils.d.ts.map +1 -0
  74. package/lib/plugin/languages-utils.js +52 -0
  75. package/lib/plugin/languages-utils.js.map +1 -0
  76. package/lib/plugin/languages.d.ts +7 -2
  77. package/lib/plugin/languages.d.ts.map +1 -1
  78. package/lib/plugin/languages.js +132 -33
  79. package/lib/plugin/languages.js.map +1 -1
  80. package/lib/plugin/markdown-string.d.ts +23 -9
  81. package/lib/plugin/markdown-string.d.ts.map +1 -1
  82. package/lib/plugin/markdown-string.js +97 -26
  83. package/lib/plugin/markdown-string.js.map +1 -1
  84. package/lib/plugin/node/debug/debug.d.ts +1 -1
  85. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  86. package/lib/plugin/node/debug/debug.js +2 -1
  87. package/lib/plugin/node/debug/debug.js.map +1 -1
  88. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +1 -0
  89. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  90. package/lib/plugin/node/debug/plugin-debug-adapter-session.js +1 -0
  91. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  92. package/lib/plugin/plugin-context.d.ts.map +1 -1
  93. package/lib/plugin/plugin-context.js +11 -2
  94. package/lib/plugin/plugin-context.js.map +1 -1
  95. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  96. package/lib/plugin/plugin-manager.js +3 -1
  97. package/lib/plugin/plugin-manager.js.map +1 -1
  98. package/lib/plugin/prefix-sum-computer.d.ts +1 -1
  99. package/lib/plugin/prefix-sum-computer.d.ts.map +1 -1
  100. package/lib/plugin/prefix-sum-computer.js +8 -8
  101. package/lib/plugin/prefix-sum-computer.js.map +1 -1
  102. package/lib/plugin/scm.js +1 -1
  103. package/lib/plugin/scm.js.map +1 -1
  104. package/lib/plugin/status-bar/status-bar-item.d.ts +2 -2
  105. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  106. package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
  107. package/lib/plugin/terminal-ext.d.ts +2 -1
  108. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  109. package/lib/plugin/terminal-ext.js +2 -1
  110. package/lib/plugin/terminal-ext.js.map +1 -1
  111. package/lib/plugin/theming.d.ts +1 -1
  112. package/lib/plugin/theming.js +3 -3
  113. package/lib/plugin/type-converters.d.ts +6 -5
  114. package/lib/plugin/type-converters.d.ts.map +1 -1
  115. package/lib/plugin/type-converters.js +12 -6
  116. package/lib/plugin/type-converters.js.map +1 -1
  117. package/lib/plugin/type-converters.spec.js +16 -15
  118. package/lib/plugin/type-converters.spec.js.map +1 -1
  119. package/lib/plugin/types-impl.d.ts +21 -8
  120. package/lib/plugin/types-impl.d.ts.map +1 -1
  121. package/lib/plugin/types-impl.js +25 -7
  122. package/lib/plugin/types-impl.js.map +1 -1
  123. package/lib/plugin/workspace.js +1 -1
  124. package/lib/plugin/workspace.js.map +1 -1
  125. package/package.json +26 -24
  126. package/src/common/paths-util.ts +1 -1
  127. package/src/common/plugin-api-rpc-model.ts +13 -12
  128. package/src/common/plugin-api-rpc.ts +30 -6
  129. package/src/common/plugin-protocol.ts +1 -0
  130. package/src/hosted/browser/worker/worker-main.ts +4 -2
  131. package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -0
  132. package/src/hosted/node/plugin-host-proxy.ts +80 -0
  133. package/src/hosted/node/plugin-host-rpc.ts +6 -2
  134. package/src/main/browser/debug/debug-main.ts +5 -1
  135. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +2 -2
  136. package/src/main/browser/debug/plugin-debug-service.ts +16 -3
  137. package/src/main/browser/debug/plugin-debug-session-factory.ts +9 -4
  138. package/src/main/browser/documents-main.ts +2 -0
  139. package/src/main/browser/languages-main.ts +43 -2
  140. package/src/main/browser/plugin-ext-frontend-module.ts +0 -4
  141. package/src/main/browser/status-bar-message-registry-main.ts +2 -1
  142. package/src/main/browser/terminal-main.ts +1 -1
  143. package/src/main/browser/view/tree-view-widget.tsx +2 -2
  144. package/src/plugin/comments.ts +1 -1
  145. package/src/plugin/documents.ts +9 -8
  146. package/src/plugin/file-system-event-service-ext-impl.ts +1 -1
  147. package/src/plugin/languages/linked-editing-range.ts +48 -0
  148. package/src/plugin/languages-utils.ts +55 -0
  149. package/src/plugin/languages.ts +139 -40
  150. package/src/plugin/markdown-string.ts +83 -26
  151. package/src/plugin/node/debug/debug.ts +2 -1
  152. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +2 -0
  153. package/src/plugin/plugin-context.ts +15 -3
  154. package/src/plugin/plugin-manager.ts +3 -1
  155. package/src/plugin/prefix-sum-computer.ts +8 -8
  156. package/src/plugin/scm.ts +1 -1
  157. package/src/plugin/status-bar/status-bar-item.ts +3 -3
  158. package/src/plugin/terminal-ext.ts +5 -2
  159. package/src/plugin/theming.ts +4 -4
  160. package/src/plugin/type-converters.spec.ts +20 -17
  161. package/src/plugin/type-converters.ts +17 -12
  162. package/src/plugin/types-impl.ts +31 -11
  163. package/src/plugin/workspace.ts +1 -1
@@ -795,6 +795,7 @@ export interface PluginMetadata {
795
795
  host: string;
796
796
  model: PluginModel;
797
797
  lifecycle: PluginLifecycle;
798
+ isUnderDevelopment?: boolean;
798
799
  }
799
800
 
800
801
  export const MetadataProcessor = Symbol('MetadataProcessor');
@@ -129,7 +129,8 @@ const pluginManager = new PluginManagerExtImpl({
129
129
  pluginUri: pluginModel.packageUri,
130
130
  model: pluginModel,
131
131
  lifecycle: pluginLifecycle,
132
- rawModel
132
+ rawModel,
133
+ isUnderDevelopment: !!plg.isUnderDevelopment
133
134
  };
134
135
  const apiImpl = apiFactory(plugin);
135
136
  pluginsApiImpl.set(plugin.model.id, apiImpl);
@@ -146,7 +147,8 @@ const pluginManager = new PluginManagerExtImpl({
146
147
  lifecycle: pluginLifecycle,
147
148
  get rawModel(): never {
148
149
  throw new Error('not supported');
149
- }
150
+ },
151
+ isUnderDevelopment: !!plg.isUnderDevelopment
150
152
  }
151
153
  };
152
154
  }
@@ -131,6 +131,7 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
131
131
  }
132
132
 
133
133
  const metadata = this.reader.readMetadata(manifest);
134
+ metadata.isUnderDevelopment = entry.getValue('isUnderDevelopment') ?? false;
134
135
 
135
136
  const deployedLocations = this.deployedLocations.get(metadata.model.id) || new Set<string>();
136
137
  deployedLocations.add(entry.rootPath);
@@ -0,0 +1,80 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2022 TypeFox 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
+ import * as http from 'http';
18
+ import * as https from 'https';
19
+ import * as tls from 'tls';
20
+
21
+ import { createHttpPatch, createProxyResolver, createTlsPatch, ProxySupportSetting } from 'vscode-proxy-agent';
22
+ import { PreferenceRegistryExtImpl } from '../../plugin/preference-registry';
23
+
24
+ export function connectProxyResolver(configProvider: PreferenceRegistryExtImpl): void {
25
+ const resolveProxy = createProxyResolver({
26
+ resolveProxy: async url => url,
27
+ getHttpProxySetting: () => configProvider.getConfiguration('http').get('proxy'),
28
+ log: () => { },
29
+ getLogLevel: () => 0,
30
+ proxyResolveTelemetry: () => { },
31
+ useHostProxy: true,
32
+ env: process.env,
33
+ });
34
+ const lookup = createPatchedModules(configProvider, resolveProxy);
35
+ configureModuleLoading(lookup);
36
+ }
37
+
38
+ interface PatchedModules {
39
+ http: typeof http;
40
+ https: typeof https;
41
+ tls: typeof tls;
42
+ }
43
+
44
+ function createPatchedModules(configProvider: PreferenceRegistryExtImpl, resolveProxy: ReturnType<typeof createProxyResolver>): PatchedModules {
45
+ const proxySetting = {
46
+ config: 'off' as ProxySupportSetting
47
+ };
48
+ const certSetting = {
49
+ config: false
50
+ };
51
+ configProvider.onDidChangeConfiguration(() => {
52
+ const httpConfig = configProvider.getConfiguration('http');
53
+ proxySetting.config = httpConfig?.get<ProxySupportSetting>('proxySupport') || 'off';
54
+ certSetting.config = !!httpConfig?.get<boolean>('systemCertificates');
55
+ });
56
+
57
+ return {
58
+ http: Object.assign(http, createHttpPatch(http, resolveProxy, proxySetting, certSetting, true)),
59
+ https: Object.assign(https, createHttpPatch(https, resolveProxy, proxySetting, certSetting, true)),
60
+ tls: Object.assign(tls, createTlsPatch(tls))
61
+ };
62
+ }
63
+
64
+ function configureModuleLoading(lookup: PatchedModules): void {
65
+ const node_module = require('module');
66
+ const original = node_module._load;
67
+ node_module._load = function (request: string): typeof tls | typeof http | typeof https {
68
+ if (request === 'tls') {
69
+ return lookup.tls;
70
+ }
71
+
72
+ if (request !== 'http' && request !== 'https') {
73
+ return original.apply(this, arguments);
74
+ }
75
+
76
+ // Create a shallow copy of the http(s) module to work around extensions that apply changes to the modules
77
+ // See for more info: https://github.com/microsoft/vscode/issues/93167
78
+ return { ...lookup[request] };
79
+ };
80
+ }
@@ -34,6 +34,7 @@ import { WebviewsExtImpl } from '../../plugin/webviews';
34
34
  import { TerminalServiceExtImpl } from '../../plugin/terminal-ext';
35
35
  import { SecretsExtImpl } from '../../plugin/secrets-ext';
36
36
  import { BackendInitializationFn } from '../../common';
37
+ import { connectProxyResolver } from './plugin-host-proxy';
37
38
 
38
39
  /**
39
40
  * Handle the RPC calls.
@@ -81,6 +82,7 @@ export class PluginHostRPC {
81
82
  clipboardExt,
82
83
  webviewExt
83
84
  );
85
+ connectProxyResolver(preferenceRegistryExt);
84
86
  }
85
87
 
86
88
  async terminate(): Promise<void> {
@@ -167,7 +169,8 @@ export class PluginHostRPC {
167
169
  pluginUri: pluginModel.packageUri,
168
170
  model: pluginModel,
169
171
  lifecycle: pluginLifecycle,
170
- rawModel
172
+ rawModel,
173
+ isUnderDevelopment: !!plg.isUnderDevelopment
171
174
  });
172
175
  } else {
173
176
  let backendInitPath = pluginLifecycle.backendInitPath;
@@ -182,7 +185,8 @@ export class PluginHostRPC {
182
185
  pluginUri: pluginModel.packageUri,
183
186
  model: pluginModel,
184
187
  lifecycle: pluginLifecycle,
185
- rawModel
188
+ rawModel,
189
+ isUnderDevelopment: !!plg.isUnderDevelopment
186
190
  };
187
191
 
188
192
  self.initContext(backendInitPath, plugin);
@@ -54,6 +54,7 @@ import { DebugConsoleSession } from '@theia/debug/lib/browser/console/debug-cons
54
54
  import { ContributionProvider } from '@theia/core/lib/common';
55
55
  import { DebugContribution } from '@theia/debug/lib/browser/debug-contribution';
56
56
  import { ConnectionImpl } from '../../../common/connection';
57
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
57
58
 
58
59
  export class DebugMainImpl implements DebugMain, Disposable {
59
60
  private readonly debugExt: DebugExt;
@@ -73,6 +74,7 @@ export class DebugMainImpl implements DebugMain, Disposable {
73
74
  private readonly fileService: FileService;
74
75
  private readonly pluginService: HostedPluginSupport;
75
76
  private readonly debugContributionProvider: ContributionProvider<DebugContribution>;
77
+ private readonly workspaceService: WorkspaceService;
76
78
 
77
79
  private readonly debuggerContributions = new Map<string, DisposableCollection>();
78
80
  private readonly configurationProviders = new Map<number, DisposableCollection>();
@@ -95,6 +97,7 @@ export class DebugMainImpl implements DebugMain, Disposable {
95
97
  this.debugContributionProvider = container.getNamed(ContributionProvider, DebugContribution);
96
98
  this.fileService = container.get(FileService);
97
99
  this.pluginService = container.get(HostedPluginSupport);
100
+ this.workspaceService = container.get(WorkspaceService);
98
101
 
99
102
  const fireDidChangeBreakpoints = ({ added, removed, changed }: BreakpointsChangeEvent<SourceBreakpoint | FunctionBreakpoint>) => {
100
103
  this.debugExt.$breakpointsDidChange(
@@ -155,7 +158,8 @@ export class DebugMainImpl implements DebugMain, Disposable {
155
158
  },
156
159
  this.fileService,
157
160
  terminalOptionsExt,
158
- this.debugContributionProvider
161
+ this.debugContributionProvider,
162
+ this.workspaceService,
159
163
  );
160
164
 
161
165
  const toDispose = new DisposableCollection(
@@ -37,9 +37,9 @@ export class PluginDebugAdapterContribution {
37
37
  return this.description.label;
38
38
  }
39
39
 
40
- async createDebugSession(config: DebugConfiguration): Promise<string> {
40
+ async createDebugSession(config: DebugConfiguration, workspaceFolder: string | undefined): Promise<string> {
41
41
  await this.pluginService.activateByDebug('onDebugAdapterProtocolTracker', config.type);
42
- return this.debugExt.$createDebugSession(config);
42
+ return this.debugExt.$createDebugSession(config, workspaceFolder);
43
43
  }
44
44
 
45
45
  async terminateDebugSession(sessionId: string): Promise<void> {
@@ -23,6 +23,7 @@ import { PluginDebugConfigurationProvider } from './plugin-debug-configuration-p
23
23
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
24
24
  import { WebSocketConnectionProvider } from '@theia/core/lib/browser/messaging/ws-connection-provider';
25
25
  import { WorkspaceService } from '@theia/workspace/lib/browser';
26
+ import { CommandIdVariables } from '@theia/variable-resolver/lib/browser';
26
27
  import { DebugConfigurationProviderTriggerKind } from '../../../common/plugin-api-rpc';
27
28
  import { DebuggerContribution } from '../../../common/plugin-protocol';
28
29
  import { DebugRequestTypes } from '@theia/debug/lib/browser/debug-session-connection';
@@ -227,6 +228,18 @@ export class PluginDebugService implements DebugService {
227
228
  });
228
229
  }
229
230
 
231
+ async provideDebuggerVariables(debugType: string): Promise<CommandIdVariables> {
232
+ for (const contribution of this.debuggers) {
233
+ if (contribution.type === debugType) {
234
+ const variables = contribution.variables;
235
+ if (variables && Object.keys(variables).length > 0) {
236
+ return variables;
237
+ }
238
+ }
239
+ }
240
+ return {};
241
+ }
242
+
230
243
  async getDebuggersForLanguage(language: string): Promise<DebuggerDescription[]> {
231
244
  const debuggers = await this.delegated.getDebuggersForLanguage(language);
232
245
 
@@ -264,14 +277,14 @@ export class PluginDebugService implements DebugService {
264
277
  return snippets;
265
278
  }
266
279
 
267
- async createDebugSession(config: DebugConfiguration): Promise<string> {
280
+ async createDebugSession(config: DebugConfiguration, workspaceFolder: string | undefined): Promise<string> {
268
281
  const contributor = this.contributors.get(config.type);
269
282
  if (contributor) {
270
- const sessionId = await contributor.createDebugSession(config);
283
+ const sessionId = await contributor.createDebugSession(config, workspaceFolder);
271
284
  this.sessionId2contrib.set(sessionId, contributor);
272
285
  return sessionId;
273
286
  } else {
274
- return this.delegated.createDebugSession(config);
287
+ return this.delegated.createDebugSession(config, workspaceFolder);
275
288
  }
276
289
  }
277
290
 
@@ -31,6 +31,7 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service';
31
31
  import { DebugContribution } from '@theia/debug/lib/browser/debug-contribution';
32
32
  import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
33
33
  import { Channel } from '@theia/debug/lib/common/debug-service';
34
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
34
35
 
35
36
  export class PluginDebugSession extends DebugSession {
36
37
  constructor(
@@ -45,8 +46,10 @@ export class PluginDebugSession extends DebugSession {
45
46
  protected override readonly messages: MessageClient,
46
47
  protected override readonly fileService: FileService,
47
48
  protected readonly terminalOptionsExt: TerminalOptionsExt | undefined,
48
- protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>) {
49
- super(id, options, parentSession, connection, terminalServer, editorManager, breakpoints, labelProvider, messages, fileService, debugContributionProvider);
49
+ protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>,
50
+ protected override readonly workspaceService: WorkspaceService) {
51
+ super(id, options, parentSession, connection, terminalServer, editorManager, breakpoints, labelProvider, messages, fileService, debugContributionProvider,
52
+ workspaceService);
50
53
  }
51
54
 
52
55
  protected override async doCreateTerminal(terminalWidgetOptions: TerminalWidgetOptions): Promise<TerminalWidget> {
@@ -71,7 +74,8 @@ export class PluginDebugSessionFactory extends DefaultDebugSessionFactory {
71
74
  protected readonly connectionFactory: (sessionId: string) => Promise<Channel>,
72
75
  protected override readonly fileService: FileService,
73
76
  protected readonly terminalOptionsExt: TerminalOptionsExt | undefined,
74
- protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>
77
+ protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>,
78
+ protected override readonly workspaceService: WorkspaceService,
75
79
  ) {
76
80
  super();
77
81
  }
@@ -94,7 +98,8 @@ export class PluginDebugSessionFactory extends DefaultDebugSessionFactory {
94
98
  this.messages,
95
99
  this.fileService,
96
100
  this.terminalOptionsExt,
97
- this.debugContributionProvider
101
+ this.debugContributionProvider,
102
+ this.workspaceService,
98
103
  );
99
104
  }
100
105
  }
@@ -32,6 +32,7 @@ import { Reference } from '@theia/core/lib/common/reference';
32
32
  import { dispose } from '../../common/disposable-util';
33
33
  import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages';
34
34
  import * as monaco from '@theia/monaco-editor-core';
35
+ import { TextDocumentChangeReason } from '../../plugin/types-impl';
35
36
 
36
37
  /*---------------------------------------------------------------------------------------------
37
38
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -157,6 +158,7 @@ export class DocumentsMainImpl implements DocumentsMain, Disposable {
157
158
  this.proxy.$acceptModelChanged(modelUri, {
158
159
  eol: e.eol,
159
160
  versionId: e.versionId,
161
+ reason: e.isRedoing ? TextDocumentChangeReason.Redo : e.isUndoing ? TextDocumentChangeReason.Undo : undefined,
160
162
  changes: e.changes.map(c =>
161
163
  ({
162
164
  text: c.text,
@@ -32,7 +32,8 @@ import {
32
32
  LanguagesExt,
33
33
  WorkspaceEditDto,
34
34
  WorkspaceTextEditDto,
35
- PluginInfo
35
+ PluginInfo,
36
+ LanguageStatus as LanguageStatusDTO
36
37
  } from '../../common/plugin-api-rpc';
37
38
  import { injectable, inject } from '@theia/core/shared/inversify';
38
39
  import {
@@ -49,7 +50,6 @@ import * as vst from '@theia/core/shared/vscode-languageserver-protocol';
49
50
  import * as theia from '@theia/plugin';
50
51
  import { UriComponents } from '../../common/uri-components';
51
52
  import { CancellationToken } from '@theia/core/lib/common';
52
- import { LanguageSelector, RelativePattern } from '@theia/callhierarchy/lib/common/language-selector';
53
53
  import { CallHierarchyService, CallHierarchyServiceProvider, CallHierarchyItem } from '@theia/callhierarchy/lib/browser';
54
54
  import { toDefinition, toUriComponents, fromDefinition, fromPosition, toCaller, toCallee } from './callhierarchy/callhierarchy-type-converters';
55
55
  import { Position, DocumentUri, DiagnosticTag } from '@theia/core/shared/vscode-languageserver-protocol';
@@ -64,6 +64,8 @@ import { IMarkerService } from '@theia/monaco-editor-core/esm/vs/platform/marker
64
64
  import * as MonacoLanguageSelector from '@theia/monaco-editor-core/esm/vs/editor/common/languageSelector';
65
65
  import * as MonacoPath from '@theia/monaco-editor-core/esm/vs/base/common/path';
66
66
  import { IRelativePattern } from '@theia/monaco-editor-core/esm/vs/base/common/glob';
67
+ import { EditorLanguageStatusService, LanguageStatus as EditorLanguageStatus } from '@theia/editor/lib/browser/language-status/editor-language-status-service';
68
+ import { LanguageSelector, RelativePattern } from '@theia/editor/lib/common/language-selector';
67
69
 
68
70
  interface RegistrationFunction<T> {
69
71
  (languageId: MonacoLanguageSelector.LanguageSelector, service: T): Disposable;
@@ -81,6 +83,9 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
81
83
  @inject(CallHierarchyServiceProvider)
82
84
  private readonly callHierarchyServiceContributionRegistry: CallHierarchyServiceProvider;
83
85
 
86
+ @inject(EditorLanguageStatusService)
87
+ protected readonly languageStatusService: EditorLanguageStatusService;
88
+
84
89
  private readonly proxy: LanguagesExt;
85
90
  private readonly services = new Map<number, Disposable>();
86
91
  private readonly toDispose = new DisposableCollection();
@@ -948,6 +953,42 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
948
953
  });
949
954
  }
950
955
 
956
+ // --- linked editing range
957
+
958
+ $registerLinkedEditingRangeProvider(handle: number, selector: SerializedDocumentFilter[]): void {
959
+ const languageSelector = this.toLanguageSelector(selector);
960
+ const linkedEditingRangeProvider = this.createLinkedEditingRangeProvider(handle);
961
+ this.register(handle,
962
+ (monaco.languages.registerLinkedEditingRangeProvider as RegistrationFunction<monaco.languages.LinkedEditingRangeProvider>)(languageSelector, linkedEditingRangeProvider)
963
+ );
964
+ }
965
+
966
+ protected createLinkedEditingRangeProvider(handle: number): monaco.languages.LinkedEditingRangeProvider {
967
+ return {
968
+ provideLinkedEditingRanges: async (model: monaco.editor.ITextModel, position: monaco.Position, token: CancellationToken):
969
+ Promise<monaco.languages.LinkedEditingRanges | undefined> => {
970
+ const res = await this.proxy.$provideLinkedEditingRanges(handle, model.uri, position, token);
971
+ if (res) {
972
+ return {
973
+ ranges: res.ranges,
974
+ wordPattern: reviveRegExp(res.wordPattern)
975
+ };
976
+ }
977
+ return undefined;
978
+ }
979
+ };
980
+ };
981
+
982
+ // -- Language status
983
+
984
+ $setLanguageStatus(handle: number, status: LanguageStatusDTO): void {
985
+ const internal: EditorLanguageStatus = { ...status, selector: this.toLanguageSelector(status.selector) };
986
+ this.languageStatusService.setLanguageStatusItem(handle, internal);
987
+ };
988
+
989
+ $removeLanguageStatus(handle: number): void {
990
+ this.languageStatusService.removeLanguageStatusItem(handle);
991
+ };
951
992
  }
952
993
 
953
994
  function reviveMarker(marker: MarkerData): vst.Diagnostic {
@@ -35,7 +35,6 @@ import { PluginWidget } from './plugin-ext-widget';
35
35
  import { PluginFrontendViewContribution } from './plugin-frontend-view-contribution';
36
36
  import { PluginExtDeployCommandService } from './plugin-ext-deploy-command';
37
37
  import { EditorModelService } from './text-editor-model-service';
38
- import { UntitledResourceResolver } from './editor/untitled-resource';
39
38
  import { CodeEditorWidgetUtil, MenusContributionPointHandler } from './menus/menus-contribution-handler';
40
39
  import { PluginContributionHandler } from './plugin-contribution-handler';
41
40
  import { PluginViewRegistry, PLUGIN_VIEW_CONTAINER_FACTORY_ID, PLUGIN_VIEW_FACTORY_ID, PLUGIN_VIEW_DATA_FACTORY_ID } from './view/plugin-view-registry';
@@ -108,9 +107,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
108
107
 
109
108
  bind(EditorModelService).toSelf().inSingletonScope();
110
109
 
111
- bind(UntitledResourceResolver).toSelf().inSingletonScope();
112
- bind(ResourceResolver).toService(UntitledResourceResolver);
113
-
114
110
  bind(FrontendApplicationContribution).toDynamicValue(ctx => ({
115
111
  onStart(): MaybePromise<void> {
116
112
  ctx.container.get(HostedPluginSupport).onStart(ctx.container);
@@ -19,6 +19,7 @@ import * as types from '../../plugin/types-impl';
19
19
  import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc';
20
20
  import { StatusBar, StatusBarAlignment, StatusBarEntry } from '@theia/core/lib/browser/status-bar/status-bar';
21
21
  import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
22
+ import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
22
23
 
23
24
  export class StatusBarMessageRegistryMainImpl implements StatusBarMessageRegistryMain, Disposable {
24
25
  private readonly delegate: StatusBar;
@@ -45,7 +46,7 @@ export class StatusBarMessageRegistryMainImpl implements StatusBarMessageRegistr
45
46
  alignment: number,
46
47
  color: string | undefined,
47
48
  backgroundColor: string | undefined,
48
- tooltip: string | undefined,
49
+ tooltip: string | MarkdownString | undefined,
49
50
  command: string | undefined,
50
51
  accessibilityInformation: types.AccessibilityInformation,
51
52
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -90,7 +90,7 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, Disposable
90
90
  );
91
91
  updateProcessId();
92
92
  this.toDispose.push(terminal.onDidOpen(() => updateProcessId()));
93
- this.toDispose.push(terminal.onTerminalDidClose(() => this.extProxy.$terminalClosed(terminal.id)));
93
+ this.toDispose.push(terminal.onTerminalDidClose(term => this.extProxy.$terminalClosed(term.id, term.exitStatus)));
94
94
  this.toDispose.push(terminal.onSizeChanged(({ cols, rows }) => {
95
95
  this.extProxy.$terminalSizeChanged(terminal.id, cols, rows);
96
96
  }));
@@ -43,7 +43,7 @@ import { View } from '../../../common/plugin-protocol';
43
43
  import CoreURI from '@theia/core/lib/common/uri';
44
44
  import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
45
45
  import * as markdownit from '@theia/core/shared/markdown-it';
46
- import { isMarkdownString } from '../../../plugin/markdown-string';
46
+ import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
47
47
  import { LabelParser } from '@theia/core/lib/browser/label-parser';
48
48
  import { AccessibilityInformation } from '@theia/plugin';
49
49
 
@@ -312,7 +312,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
312
312
  };
313
313
  }
314
314
 
315
- if (node.tooltip && isMarkdownString(node.tooltip)) {
315
+ if (node.tooltip && MarkdownString.is(node.tooltip)) {
316
316
  // Render markdown in custom tooltip
317
317
  const tooltip = this.markdownIt.render(node.tooltip.value);
318
318
 
@@ -352,7 +352,7 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
352
352
  }
353
353
  if (modified('comments')) {
354
354
  formattedModifications.comments =
355
- this._comments.map(cmt => convertToModeComment(this, this.commentController, cmt, this.commentsMap));
355
+ this._comments.map(comment => convertToModeComment(this, this.commentController, comment, this.commentsMap));
356
356
  }
357
357
  if (modified('collapsibleState')) {
358
358
  formattedModifications.collapseState = convertToCollapsibleState(this.collapseState);
@@ -163,7 +163,8 @@ export class DocumentsExtImpl implements DocumentsExt {
163
163
  data.acceptIsDirty(isDirty);
164
164
  this._onDidChangeDocument.fire({
165
165
  document: data.document,
166
- contentChanges: []
166
+ contentChanges: [],
167
+ reason: undefined,
167
168
  });
168
169
  }
169
170
  $acceptModelChanged(strUrl: UriComponents, e: ModelChangedEvent, isDirty: boolean): void {
@@ -177,13 +178,13 @@ export class DocumentsExtImpl implements DocumentsExt {
177
178
  data.onEvents(e);
178
179
  this._onDidChangeDocument.fire({
179
180
  document: data.document,
180
- contentChanges: e.changes.map(change =>
181
- ({
182
- range: Converter.toRange(change.range),
183
- rangeOffset: change.rangeOffset,
184
- rangeLength: change.rangeLength,
185
- text: change.text
186
- }))
181
+ reason: e.reason,
182
+ contentChanges: e.changes.map(change => ({
183
+ range: Converter.toRange(change.range),
184
+ rangeOffset: change.rangeOffset,
185
+ rangeLength: change.rangeLength,
186
+ text: change.text
187
+ }))
187
188
  });
188
189
  }
189
190
  getAllDocumentData(): DocumentDataExt[] {
@@ -29,7 +29,7 @@
29
29
  /* eslint-disable @typescript-eslint/tslint/config */
30
30
 
31
31
  import { Emitter, WaitUntilEvent, AsyncEmitter } from '@theia/core/lib/common/event';
32
- import { IRelativePattern, parse } from '@theia/callhierarchy/lib/common/glob';
32
+ import { IRelativePattern, parse } from '@theia/core/lib/common/glob';
33
33
  import { UriComponents } from '@theia/core/shared/vscode-uri';
34
34
  import { Disposable, URI, WorkspaceEdit } from './types-impl';
35
35
  import { EditorsAndDocumentsExtImpl as ExtHostDocumentsAndEditors } from './editors-and-documents';
@@ -0,0 +1,48 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson 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
+ import * as theia from '@theia/plugin';
18
+ import * as rpc from '../../common/plugin-api-rpc';
19
+ import { DocumentsExtImpl } from '../documents';
20
+ import { LinkedEditingRanges } from '../../common/plugin-api-rpc-model';
21
+ import { URI } from '@theia/core/shared/vscode-uri';
22
+ import { coalesce } from '../../common/arrays';
23
+ import { fromRange, toPosition } from '../type-converters';
24
+ import { serializeRegExp } from '../languages-utils';
25
+
26
+ export class LinkedEditingRangeAdapter {
27
+
28
+ constructor(
29
+ private readonly documents: DocumentsExtImpl,
30
+ private readonly provider: theia.LinkedEditingRangeProvider
31
+ ) { }
32
+
33
+ async provideRanges(resource: URI, position: rpc.Position, token: theia.CancellationToken): Promise<LinkedEditingRanges | undefined> {
34
+
35
+ const doc = this.documents.getDocument(resource);
36
+ const pos = toPosition(position);
37
+
38
+ const value = await this.provider.provideLinkedEditingRanges(doc, pos, token);
39
+ if (value && Array.isArray(value.ranges)) {
40
+ return {
41
+ ranges: coalesce(value.ranges.map(r => fromRange(r))),
42
+ wordPattern: serializeRegExp(value.wordPattern)
43
+ };
44
+ }
45
+ return undefined;
46
+ }
47
+
48
+ }
@@ -0,0 +1,55 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson 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
+ import * as theia from '@theia/plugin';
18
+ import { SerializedIndentationRule, SerializedOnEnterRule, SerializedRegExp } from '../common';
19
+
20
+ export function serializeEnterRules(rules?: theia.OnEnterRule[]): SerializedOnEnterRule[] | undefined {
21
+ if (typeof rules === 'undefined' || rules === null) {
22
+ return undefined;
23
+ }
24
+
25
+ return rules.map(r =>
26
+ ({
27
+ action: r.action,
28
+ beforeText: serializeRegExp(r.beforeText),
29
+ afterText: serializeRegExp(r.afterText)
30
+ } as SerializedOnEnterRule));
31
+ }
32
+
33
+ export function serializeRegExp(regexp?: RegExp): SerializedRegExp | undefined {
34
+ if (typeof regexp === 'undefined' || regexp === null) {
35
+ return undefined;
36
+ }
37
+
38
+ return {
39
+ pattern: regexp.source,
40
+ flags: (regexp.global ? 'g' : '') + (regexp.ignoreCase ? 'i' : '') + (regexp.multiline ? 'm' : '')
41
+ };
42
+ }
43
+
44
+ export function serializeIndentation(indentationRules?: theia.IndentationRule): SerializedIndentationRule | undefined {
45
+ if (typeof indentationRules === 'undefined' || indentationRules === null) {
46
+ return undefined;
47
+ }
48
+
49
+ return {
50
+ increaseIndentPattern: serializeRegExp(indentationRules.increaseIndentPattern),
51
+ decreaseIndentPattern: serializeRegExp(indentationRules.decreaseIndentPattern),
52
+ indentNextLinePattern: serializeRegExp(indentationRules.indentNextLinePattern),
53
+ unIndentedLinePattern: serializeRegExp(indentationRules.unIndentedLinePattern)
54
+ };
55
+ }