@theia/plugin-ext 1.18.0-next.d3501165 → 1.19.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 (273) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +5 -0
  3. package/lib/common/arrays.d.ts +4 -0
  4. package/lib/common/arrays.d.ts.map +1 -1
  5. package/lib/common/arrays.js +9 -1
  6. package/lib/common/arrays.js.map +1 -1
  7. package/lib/common/connection.d.ts +1 -2
  8. package/lib/common/connection.d.ts.map +1 -1
  9. package/lib/common/connection.js.map +1 -1
  10. package/lib/common/plugin-api-rpc-model.d.ts +4 -0
  11. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  12. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  13. package/lib/common/plugin-api-rpc.d.ts +29 -11
  14. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  15. package/lib/common/plugin-api-rpc.js +21 -1
  16. package/lib/common/plugin-api-rpc.js.map +1 -1
  17. package/lib/common/plugin-protocol.d.ts +1 -0
  18. package/lib/common/plugin-protocol.d.ts.map +1 -1
  19. package/lib/common/plugin-protocol.js.map +1 -1
  20. package/lib/hosted/browser/hosted-plugin.d.ts +5 -6
  21. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  22. package/lib/hosted/browser/hosted-plugin.js +19 -13
  23. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  24. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  25. package/lib/hosted/browser/worker/debug-stub.js +1 -0
  26. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -1
  28. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  29. package/lib/hosted/node/hosted-plugin-deployer-handler.js +14 -38
  30. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  31. package/lib/hosted/node/hosted-plugin-localization-service.d.ts +37 -0
  32. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -0
  33. package/lib/hosted/node/hosted-plugin-localization-service.js +197 -0
  34. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -0
  35. package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
  36. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  37. package/lib/hosted/node/hosted-plugin-process.js +5 -7
  38. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  39. package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
  40. package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
  41. package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
  42. package/lib/hosted/node/plugin-manifest-loader.d.ts +1 -1
  43. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
  44. package/lib/hosted/node/plugin-manifest-loader.js +4 -52
  45. package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
  46. package/lib/hosted/node/plugin-service.d.ts +3 -6
  47. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  48. package/lib/hosted/node/plugin-service.js +7 -40
  49. package/lib/hosted/node/plugin-service.js.map +1 -1
  50. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  51. package/lib/hosted/node/scanners/scanner-theia.js +3 -2
  52. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  53. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
  54. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +6 -2
  55. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
  56. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +2 -2
  57. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  58. package/lib/main/browser/custom-editors/custom-editor-opener.js +6 -2
  59. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  60. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  61. package/lib/main/browser/custom-editors/custom-editors-main.js +1 -2
  62. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  63. package/lib/main/browser/debug/debug-main.js +1 -1
  64. package/lib/main/browser/debug/debug-main.js.map +1 -1
  65. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  66. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  67. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  68. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  69. package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
  70. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  71. package/lib/main/browser/debug/plugin-debug-service.js +15 -0
  72. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  73. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +2 -2
  74. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  75. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  76. package/lib/main/browser/dialogs/modal-notification.d.ts +4 -4
  77. package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
  78. package/lib/main/browser/dialogs/modal-notification.js +21 -10
  79. package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
  80. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  81. package/lib/main/browser/editors-and-documents-main.js +3 -4
  82. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  83. package/lib/main/browser/languages-main.js +1 -1
  84. package/lib/main/browser/languages-main.js.map +1 -1
  85. package/lib/main/browser/message-registry-main.js +1 -1
  86. package/lib/main/browser/message-registry-main.js.map +1 -1
  87. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  88. package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
  89. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  90. package/lib/main/browser/plugin-ext-widget.d.ts.map +1 -1
  91. package/lib/main/browser/plugin-ext-widget.js +3 -2
  92. package/lib/main/browser/plugin-ext-widget.js.map +1 -1
  93. package/lib/main/browser/plugin-shared-style.js +1 -1
  94. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  95. package/lib/main/browser/quick-open-main.d.ts +3 -6
  96. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  97. package/lib/main/browser/quick-open-main.js +48 -100
  98. package/lib/main/browser/quick-open-main.js.map +1 -1
  99. package/lib/main/browser/timeline-main.d.ts.map +1 -1
  100. package/lib/main/browser/timeline-main.js +1 -1
  101. package/lib/main/browser/timeline-main.js.map +1 -1
  102. package/lib/main/browser/view/plugin-view-registry.d.ts +3 -2
  103. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  104. package/lib/main/browser/view/plugin-view-registry.js +64 -24
  105. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  106. package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
  107. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  108. package/lib/main/browser/view/plugin-view-widget.js +3 -1
  109. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  110. package/lib/main/browser/view/tree-view-widget.d.ts +3 -4
  111. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  112. package/lib/main/browser/view/tree-view-widget.js +25 -28
  113. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  114. package/lib/main/browser/webview/webview-frontend-security-warnings.d.ts.map +1 -1
  115. package/lib/main/browser/webview/webview-frontend-security-warnings.js +8 -5
  116. package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
  117. package/lib/main/browser/webview/webview-preferences.d.ts.map +1 -1
  118. package/lib/main/browser/webview/webview-preferences.js +3 -2
  119. package/lib/main/browser/webview/webview-preferences.js.map +1 -1
  120. package/lib/main/browser/webview/webview.d.ts +1 -1
  121. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  122. package/lib/main/browser/webview/webview.js +2 -2
  123. package/lib/main/browser/webview/webview.js.map +1 -1
  124. package/lib/plugin/comments.d.ts.map +1 -1
  125. package/lib/plugin/comments.js +2 -3
  126. package/lib/plugin/comments.js.map +1 -1
  127. package/lib/plugin/custom-editors.d.ts +1 -2
  128. package/lib/plugin/custom-editors.d.ts.map +1 -1
  129. package/lib/plugin/custom-editors.js +2 -3
  130. package/lib/plugin/custom-editors.js.map +1 -1
  131. package/lib/plugin/decorations.d.ts.map +1 -1
  132. package/lib/plugin/decorations.js +2 -3
  133. package/lib/plugin/decorations.js.map +1 -1
  134. package/lib/plugin/document-data.d.ts.map +1 -1
  135. package/lib/plugin/document-data.js +1 -1
  136. package/lib/plugin/document-data.js.map +1 -1
  137. package/lib/plugin/documents.d.ts.map +1 -1
  138. package/lib/plugin/documents.js +1 -2
  139. package/lib/plugin/documents.js.map +1 -1
  140. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  141. package/lib/plugin/file-system-event-service-ext-impl.js +2 -3
  142. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  143. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  144. package/lib/plugin/file-system-ext-impl.js +12 -13
  145. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  146. package/lib/plugin/known-commands.spec.js +1 -2
  147. package/lib/plugin/known-commands.spec.js.map +1 -1
  148. package/lib/plugin/languages/call-hierarchy.d.ts +1 -1
  149. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  150. package/lib/plugin/languages/call-hierarchy.js +8 -3
  151. package/lib/plugin/languages/call-hierarchy.js.map +1 -1
  152. package/lib/plugin/languages/rename.d.ts +1 -2
  153. package/lib/plugin/languages/rename.d.ts.map +1 -1
  154. package/lib/plugin/languages/rename.js.map +1 -1
  155. package/lib/plugin/languages.d.ts +1 -1
  156. package/lib/plugin/languages.d.ts.map +1 -1
  157. package/lib/plugin/languages.js +2 -1
  158. package/lib/plugin/languages.js.map +1 -1
  159. package/lib/plugin/message-registry.d.ts.map +1 -1
  160. package/lib/plugin/message-registry.js +8 -5
  161. package/lib/plugin/message-registry.js.map +1 -1
  162. package/lib/plugin/node/debug/debug.d.ts +4 -3
  163. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  164. package/lib/plugin/node/debug/debug.js +34 -15
  165. package/lib/plugin/node/debug/debug.js.map +1 -1
  166. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
  167. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  168. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  169. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
  170. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  171. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
  172. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  173. package/lib/plugin/plugin-context.d.ts.map +1 -1
  174. package/lib/plugin/plugin-context.js +8 -3
  175. package/lib/plugin/plugin-context.js.map +1 -1
  176. package/lib/plugin/plugin-manager.d.ts +2 -0
  177. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  178. package/lib/plugin/plugin-manager.js +24 -3
  179. package/lib/plugin/plugin-manager.js.map +1 -1
  180. package/lib/plugin/plugin-storage.d.ts +4 -0
  181. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  182. package/lib/plugin/plugin-storage.js +6 -1
  183. package/lib/plugin/plugin-storage.js.map +1 -1
  184. package/lib/plugin/preference-registry.spec.js.map +1 -1
  185. package/lib/plugin/quick-open.d.ts +1 -3
  186. package/lib/plugin/quick-open.d.ts.map +1 -1
  187. package/lib/plugin/quick-open.js +10 -25
  188. package/lib/plugin/quick-open.js.map +1 -1
  189. package/lib/plugin/tasks/tasks.d.ts +1 -1
  190. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  191. package/lib/plugin/tasks/tasks.js +3 -2
  192. package/lib/plugin/tasks/tasks.js.map +1 -1
  193. package/lib/plugin/timeline.d.ts.map +1 -1
  194. package/lib/plugin/timeline.js +1 -2
  195. package/lib/plugin/timeline.js.map +1 -1
  196. package/lib/plugin/type-converters.d.ts.map +1 -1
  197. package/lib/plugin/type-converters.js +18 -11
  198. package/lib/plugin/type-converters.js.map +1 -1
  199. package/lib/plugin/types-impl.d.ts +55 -1
  200. package/lib/plugin/types-impl.d.ts.map +1 -1
  201. package/lib/plugin/types-impl.js +81 -1
  202. package/lib/plugin/types-impl.js.map +1 -1
  203. package/lib/plugin/webviews.d.ts +1 -2
  204. package/lib/plugin/webviews.d.ts.map +1 -1
  205. package/lib/plugin/webviews.js.map +1 -1
  206. package/package.json +31 -27
  207. package/src/common/arrays.ts +8 -0
  208. package/src/common/connection.ts +1 -2
  209. package/src/common/plugin-api-rpc-model.ts +4 -0
  210. package/src/common/plugin-api-rpc.ts +31 -10
  211. package/src/common/plugin-protocol.ts +2 -0
  212. package/src/hosted/browser/hosted-plugin.ts +19 -12
  213. package/src/hosted/browser/worker/debug-stub.ts +1 -0
  214. package/src/hosted/node/hosted-plugin-deployer-handler.ts +13 -40
  215. package/src/hosted/node/hosted-plugin-localization-service.ts +201 -0
  216. package/src/hosted/node/hosted-plugin-process.ts +4 -6
  217. package/src/hosted/node/plugin-ext-hosted-backend-module.ts +2 -0
  218. package/src/hosted/node/plugin-manifest-loader.ts +4 -56
  219. package/src/hosted/node/plugin-service.ts +7 -40
  220. package/src/hosted/node/scanners/scanner-theia.ts +4 -2
  221. package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +6 -2
  222. package/src/main/browser/custom-editors/custom-editor-opener.tsx +8 -4
  223. package/src/main/browser/custom-editors/custom-editors-main.ts +1 -2
  224. package/src/main/browser/debug/debug-main.ts +1 -1
  225. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
  226. package/src/main/browser/debug/plugin-debug-service.ts +23 -0
  227. package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
  228. package/src/main/browser/dialogs/modal-notification.ts +24 -13
  229. package/src/main/browser/dialogs/style/modal-notification.css +17 -2
  230. package/src/main/browser/editors-and-documents-main.ts +1 -2
  231. package/src/main/browser/languages-main.ts +1 -1
  232. package/src/main/browser/message-registry-main.ts +1 -1
  233. package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
  234. package/src/main/browser/plugin-ext-widget.tsx +3 -2
  235. package/src/main/browser/plugin-shared-style.ts +1 -1
  236. package/src/main/browser/quick-open-main.ts +54 -109
  237. package/src/main/browser/style/index.css +1 -5
  238. package/src/main/browser/style/plugin-sidebar.css +1 -1
  239. package/src/main/browser/timeline-main.ts +1 -2
  240. package/src/main/browser/view/plugin-view-registry.ts +68 -26
  241. package/src/main/browser/view/plugin-view-widget.ts +7 -2
  242. package/src/main/browser/view/tree-view-widget.tsx +41 -46
  243. package/src/main/browser/webview/pre/host.js +20 -12
  244. package/src/main/browser/webview/pre/main.js +1 -2
  245. package/src/main/browser/webview/pre/service-worker.js +1 -1
  246. package/src/main/browser/webview/webview-frontend-security-warnings.ts +8 -7
  247. package/src/main/browser/webview/webview-preferences.ts +3 -2
  248. package/src/main/browser/webview/webview.ts +2 -2
  249. package/src/plugin/comments.ts +1 -2
  250. package/src/plugin/custom-editors.ts +2 -4
  251. package/src/plugin/decorations.ts +1 -2
  252. package/src/plugin/document-data.ts +1 -2
  253. package/src/plugin/documents.ts +1 -2
  254. package/src/plugin/file-system-event-service-ext-impl.ts +1 -2
  255. package/src/plugin/file-system-ext-impl.ts +1 -2
  256. package/src/plugin/known-commands.spec.ts +1 -2
  257. package/src/plugin/languages/call-hierarchy.ts +14 -5
  258. package/src/plugin/languages/rename.ts +1 -2
  259. package/src/plugin/languages.ts +5 -2
  260. package/src/plugin/message-registry.ts +9 -6
  261. package/src/plugin/node/debug/debug.ts +40 -19
  262. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
  263. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
  264. package/src/plugin/plugin-context.ts +21 -10
  265. package/src/plugin/plugin-manager.ts +26 -4
  266. package/src/plugin/plugin-storage.ts +7 -2
  267. package/src/plugin/preference-registry.spec.ts +1 -2
  268. package/src/plugin/quick-open.ts +12 -29
  269. package/src/plugin/tasks/tasks.ts +3 -2
  270. package/src/plugin/timeline.ts +1 -2
  271. package/src/plugin/type-converters.ts +20 -13
  272. package/src/plugin/types-impl.ts +77 -1
  273. package/src/plugin/webviews.ts +1 -2
@@ -193,7 +193,6 @@
193
193
  initialScrollProgress: undefined
194
194
  };
195
195
 
196
-
197
196
  /**
198
197
  * @param {HTMLDocument?} document
199
198
  * @param {HTMLElement?} body
@@ -477,7 +476,7 @@
477
476
  const newFrame = document.createElement('iframe');
478
477
  newFrame.setAttribute('id', 'pending-frame');
479
478
  newFrame.setAttribute('frameborder', '0');
480
- newFrame.setAttribute('sandbox', options.allowScripts ? 'allow-scripts allow-forms allow-same-origin' : 'allow-same-origin');
479
+ newFrame.setAttribute('sandbox', options.allowScripts ? 'allow-scripts allow-forms allow-same-origin allow-downloads' : 'allow-same-origin');
481
480
  if (host.fakeLoad) {
482
481
  // We should just be able to use srcdoc, but I wasn't
483
482
  // seeing the service worker applying properly.
@@ -248,7 +248,7 @@ async function processLocalhostRequest(event, requestUrl) {
248
248
  const origin = requestUrl.origin;
249
249
 
250
250
  const resolveRedirect = redirectOrigin => {
251
- if (!redirectOrigin) {
251
+ if (!redirectOrigin || requestUrl.origin === redirectOrigin) {
252
252
  return fetch(event.request);
253
253
  }
254
254
  const location = event.request.url.replace(new RegExp(`^${requestUrl.origin}(/|$)`), `${redirectOrigin}$1`);
@@ -15,8 +15,9 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import { MessageService } from '@theia/core';
18
- import { FrontendApplicationContribution } from '@theia/core/lib/browser';
18
+ import { Dialog, FrontendApplicationContribution } from '@theia/core/lib/browser';
19
19
  import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
20
+ import { nls } from '@theia/core/lib/common/nls';
20
21
  import { WindowService } from '@theia/core/lib/browser/window/window-service';
21
22
  import { inject, injectable } from '@theia/core/shared/inversify';
22
23
  import { WebviewExternalEndpoint } from '../../common/webview-protocol';
@@ -44,12 +45,12 @@ export class WebviewFrontendSecurityWarnings implements FrontendApplicationContr
44
45
  }
45
46
  const hostPattern = await this.webviewEnvironment.hostPatternPromise;
46
47
  if (hostPattern !== WebviewExternalEndpoint.defaultPattern) {
47
- this.messageService.warn(`\
48
- The webview endpoint's host pattern has been changed to \`${hostPattern}\`; changing the pattern can lead to security vulnerabilities. \
49
- See \`@theia/plugin-ext/README.md\` for more information.`,
50
- /* actions: */ 'Ok', 'Go To README',
51
- ).then(action => {
52
- if (action === 'Go To README') {
48
+ const goToReadme = nls.localize('theia/webview/goToReadme', 'Go To README');
49
+ const message = nls.localize('theia/webview/messageWarning', '\
50
+ The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \
51
+ See `{2}` for more information.', 'webview', hostPattern, '@theia/plugin-ext/README.md');
52
+ this.messageService.warn(message, Dialog.OK, goToReadme).then(action => {
53
+ if (action === goToReadme) {
53
54
  this.windowService.openNewWindow('https://www.npmjs.com/package/@theia/plugin-ext', { external: true });
54
55
  }
55
56
  });
@@ -23,6 +23,7 @@ import {
23
23
  PreferenceContribution,
24
24
  PreferenceSchema
25
25
  } from '@theia/core/lib/browser/preferences';
26
+ import { nls } from '@theia/core/lib/common/nls';
26
27
 
27
28
  const frontendConfig = FrontendApplicationConfigProvider.get();
28
29
 
@@ -32,7 +33,7 @@ export const WebviewConfigSchema: PreferenceSchema = {
32
33
  'webview.trace': {
33
34
  type: 'string',
34
35
  enum: ['off', 'on', 'verbose'],
35
- description: 'Controls communication tracing with webviews.',
36
+ description: nls.localize('theia/plugin-ext/webviewTrace', 'Controls communication tracing with webviews.'),
36
37
  default: 'off'
37
38
  }
38
39
  }
@@ -42,7 +43,7 @@ if (frontendConfig.securityWarnings) {
42
43
  WebviewConfigSchema.properties['webview.warnIfUnsecure'] = {
43
44
  scope: 'application',
44
45
  type: 'boolean',
45
- description: 'Warns users that webviews are currently deployed unsecurely.',
46
+ description: nls.localize('theia/plugin-ext/webviewWarnIfUnsecure', 'Warns users that webviews are currently deployed unsecurely.'),
46
47
  default: true,
47
48
  };
48
49
  }
@@ -40,7 +40,7 @@ import { Schemes } from '../../../common/uri-components';
40
40
  import { PluginSharedStyle } from '../plugin-shared-style';
41
41
  import { WebviewThemeDataProvider } from './webview-theme-data-provider';
42
42
  import { ExternalUriService } from '@theia/core/lib/browser/external-uri-service';
43
- import { OutputChannelManager } from '@theia/output/lib/common/output-channel';
43
+ import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
44
44
  import { WebviewPreferences } from './webview-preferences';
45
45
  import { WebviewResourceCache } from './webview-resource-cache';
46
46
  import { Endpoint } from '@theia/core/lib/browser/endpoint';
@@ -249,7 +249,7 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget {
249
249
 
250
250
  const element = document.createElement('iframe');
251
251
  element.className = 'webview';
252
- element.sandbox.add('allow-scripts', 'allow-forms', 'allow-same-origin');
252
+ element.sandbox.add('allow-scripts', 'allow-forms', 'allow-same-origin', 'allow-downloads');
253
253
  element.setAttribute('src', `${this.externalEndpoint}/index.html?id=${this.identifier.id}`);
254
254
  element.style.border = 'none';
255
255
  element.style.width = '100%';
@@ -18,7 +18,7 @@ import * as theia from '@theia/plugin';
18
18
  import { RPCProtocol } from '../common/rpc-protocol';
19
19
  import { CommandRegistryImpl } from './command-registry';
20
20
  import { UriComponents } from '../common/uri-components';
21
- import { URI } from './types-impl';
21
+ import { CommentThreadCollapsibleState, URI } from './types-impl';
22
22
  import {
23
23
  Range,
24
24
  Comment,
@@ -29,7 +29,6 @@ import { DocumentsExtImpl } from './documents';
29
29
  import { Emitter } from '@theia/core/lib/common/event';
30
30
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
31
31
  import { fromMarkdown, fromRange, toRange } from './type-converters';
32
- import { CommentThreadCollapsibleState } from './types-impl';
33
32
  import {
34
33
  CommentsCommandArg, CommentsContextCommandArg, CommentsEditCommandArg,
35
34
  CommentsExt,
@@ -19,17 +19,15 @@
19
19
  *--------------------------------------------------------------------------------------------*/
20
20
  // copied and modified from https://github.com/microsoft/vscode/blob/53eac52308c4611000a171cc7bf1214293473c78/src/vs/workbench/api/common/extHostCustomEditors.ts
21
21
 
22
- import { CustomEditorsExt, CustomEditorsMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
22
+ import { CustomEditorsExt, CustomEditorsMain, Plugin, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
23
23
  import * as theia from '@theia/plugin';
24
24
  import { RPCProtocol } from '../common/rpc-protocol';
25
- import { Plugin } from '../common/plugin-api-rpc';
26
- import { URI } from './types-impl';
25
+ import { Disposable, URI } from './types-impl';
27
26
  import { UriComponents } from '../common/uri-components';
28
27
  import { DocumentsExtImpl } from './documents';
29
28
  import { WebviewImpl, WebviewsExtImpl } from './webviews';
30
29
  import { CancellationToken, CancellationTokenSource } from '@theia/core/lib/common/cancellation';
31
30
  import { DisposableCollection } from '@theia/core/lib/common/disposable';
32
- import { Disposable } from './types-impl';
33
31
  import { WorkspaceExtImpl } from './workspace';
34
32
  import * as Converters from './type-converters';
35
33
 
@@ -24,8 +24,7 @@ import {
24
24
  PLUGIN_RPC_CONTEXT, PluginInfo
25
25
  } from '../common/plugin-api-rpc';
26
26
  import { RPCProtocol } from '../common/rpc-protocol';
27
- import { URI } from './types-impl';
28
- import { Disposable, FileDecoration } from './types-impl';
27
+ import { Disposable, FileDecoration, URI } from './types-impl';
29
28
  import { CancellationToken } from '@theia/core/lib/common';
30
29
  import { dirname } from 'path';
31
30
 
@@ -17,9 +17,8 @@
17
17
  import * as theia from '@theia/plugin';
18
18
  import { ModelChangedEvent, DocumentsMain } from '../common/plugin-api-rpc';
19
19
  import { Range as ARange } from '../common/plugin-api-rpc-model';
20
- import { URI } from './types-impl';
20
+ import { EndOfLine, Position, Range, URI } from './types-impl';
21
21
  import { ok } from '../common/assert';
22
- import { Range, Position, EndOfLine } from './types-impl';
23
22
  import { PrefixSumComputer } from './prefix-sum-computer';
24
23
  import { getWordAtText, ensureValidWordDefinition } from './word-helper';
25
24
 
@@ -21,7 +21,7 @@
21
21
  * based on https://github.com/Microsoft/vscode/blob/bf9a27ec01f2ef82fc45f69e0c946c7d74a57d3e/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts
22
22
  */
23
23
  import { DocumentsExt, ModelChangedEvent, PLUGIN_RPC_CONTEXT, DocumentsMain, SingleEditOperation } from '../common/plugin-api-rpc';
24
- import { URI } from './types-impl';
24
+ import { TextEdit, URI } from './types-impl';
25
25
  import { UriComponents } from '../common/uri-components';
26
26
  import { RPCProtocol } from '../common/rpc-protocol';
27
27
  import { Emitter, Event } from '@theia/core/lib/common/event';
@@ -31,7 +31,6 @@ import { EditorsAndDocumentsExtImpl } from './editors-and-documents';
31
31
  import * as Converter from './type-converters';
32
32
  import { DisposableCollection } from '@theia/core/lib/common/disposable';
33
33
  import { Range, TextDocumentShowOptions } from '../common/plugin-api-rpc-model';
34
- import { TextEdit } from './types-impl';
35
34
 
36
35
  export class DocumentsExtImpl implements DocumentsExt {
37
36
  private toDispose = new DisposableCollection();
@@ -31,11 +31,10 @@
31
31
  import { Emitter, WaitUntilEvent, AsyncEmitter } from '@theia/core/lib/common/event';
32
32
  import { IRelativePattern, parse } from '@theia/callhierarchy/lib/common/glob';
33
33
  import { UriComponents } from '@theia/core/shared/vscode-uri';
34
- import { URI } from './types-impl';
34
+ import { Disposable, URI, WorkspaceEdit } from './types-impl';
35
35
  import { EditorsAndDocumentsExtImpl as ExtHostDocumentsAndEditors } from './editors-and-documents';
36
36
  import type * as vscode from '@theia/plugin';
37
37
  import * as typeConverter from './type-converters';
38
- import { Disposable, WorkspaceEdit } from './types-impl';
39
38
  import { FileOperation } from '@theia/filesystem/lib/common/files';
40
39
  import { flatten } from '../common/arrays';
41
40
  import { CancellationToken } from '@theia/core/lib/common/cancellation';
@@ -29,12 +29,11 @@
29
29
  /* eslint-disable @typescript-eslint/no-explicit-any */
30
30
 
31
31
  import { UriComponents } from '@theia/core/shared/vscode-uri';
32
- import { URI } from './types-impl';
32
+ import { FileChangeType, FileSystemError, URI } from './types-impl';
33
33
  import { RPCProtocol } from '../common/rpc-protocol';
34
34
  import { PLUGIN_RPC_CONTEXT, FileSystemExt, FileSystemMain, IFileChangeDto } from '../common/plugin-api-rpc';
35
35
  import * as vscode from '@theia/plugin';
36
36
  import * as files from '@theia/filesystem/lib/common/files';
37
- import { FileChangeType, FileSystemError } from './types-impl';
38
37
  import * as typeConverter from './type-converters';
39
38
  import { LanguagesExtImpl } from './languages';
40
39
  import { Schemes as Schemas } from '../common/uri-components';
@@ -16,8 +16,7 @@
16
16
 
17
17
  import * as assert from 'assert';
18
18
  import { KnownCommands } from './known-commands';
19
- import { URI } from './types-impl';
20
- import { Position } from './types-impl';
19
+ import { Position, URI } from './types-impl';
21
20
  import { fromPosition } from './type-converters';
22
21
 
23
22
  describe('Known Command Conversions', () => {
@@ -29,7 +29,9 @@ export class CallHierarchyAdapter {
29
29
  private readonly documents: DocumentsExtImpl
30
30
  ) { }
31
31
 
32
- async provideRootDefinition(resource: URI, position: rpc.Position, token: theia.CancellationToken): Promise<model.CallHierarchyDefinition | undefined> {
32
+ async provideRootDefinition(
33
+ resource: URI, position: rpc.Position, token: theia.CancellationToken
34
+ ): Promise<model.CallHierarchyDefinition | model.CallHierarchyDefinition[] | undefined> {
33
35
  const documentData = this.documents.getDocumentData(resource);
34
36
  if (!documentData) {
35
37
  return Promise.reject(new Error(`There is no document for ${resource}`));
@@ -40,12 +42,14 @@ export class CallHierarchyAdapter {
40
42
  position.lineNumber,
41
43
  position.column
42
44
  ),
43
- token);
45
+ token
46
+ );
47
+
44
48
  if (!definition) {
45
49
  return undefined;
46
50
  }
47
51
 
48
- return this.fromCallHierarchyItem(definition);
52
+ return Array.isArray(definition) ? definition.map(item => this.fromCallHierarchyItem(item)) : this.fromCallHierarchyItem(definition);
49
53
  }
50
54
 
51
55
  async provideCallers(definition: model.CallHierarchyDefinition, token: theia.CancellationToken): Promise<model.CallHierarchyReference[] | undefined> {
@@ -72,7 +76,9 @@ export class CallHierarchyAdapter {
72
76
  range: this.fromRange(item.range),
73
77
  selectionRange: this.fromRange(item.selectionRange),
74
78
  name: item.name,
75
- kind: item.kind
79
+ kind: item.kind,
80
+ tags: item.tags,
81
+ data: item.data,
76
82
  };
77
83
  }
78
84
 
@@ -95,7 +101,7 @@ export class CallHierarchyAdapter {
95
101
  }
96
102
 
97
103
  private toCallHierarchyItem(definition: model.CallHierarchyDefinition): theia.CallHierarchyItem {
98
- return new types.CallHierarchyItem(
104
+ const item = new types.CallHierarchyItem(
99
105
  Converter.SymbolKind.toSymbolKind(definition.kind),
100
106
  definition.name,
101
107
  definition.detail ? definition.detail : '',
@@ -103,6 +109,9 @@ export class CallHierarchyAdapter {
103
109
  this.toRange(definition.range),
104
110
  this.toRange(definition.selectionRange),
105
111
  );
112
+ item.tags = definition.tags;
113
+ item.data = definition.data;
114
+ return item;
106
115
  }
107
116
 
108
117
  private fromCallHierarchyIncomingCall(caller: theia.CallHierarchyIncomingCall): model.CallHierarchyReference {
@@ -19,8 +19,7 @@ import * as theia from '@theia/plugin';
19
19
  import * as Converter from '../type-converters';
20
20
  import * as model from '../../common/plugin-api-rpc-model';
21
21
  import { DocumentsExtImpl } from '../documents';
22
- import { WorkspaceEditDto } from '../../common/plugin-api-rpc';
23
- import { Position } from '../../common/plugin-api-rpc';
22
+ import { Position, WorkspaceEditDto } from '../../common/plugin-api-rpc';
24
23
  import { Range } from '../types-impl';
25
24
  import { isObject } from '../../common/types';
26
25
 
@@ -90,6 +90,7 @@ import { DeclarationAdapter } from './languages/declaration';
90
90
  import { CallHierarchyAdapter } from './languages/call-hierarchy';
91
91
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
92
92
  import { DocumentSemanticTokensAdapter, DocumentRangeSemanticTokensAdapter } from './languages/semantic-highlighting';
93
+ import { isReadonlyArray } from '../common/arrays';
93
94
 
94
95
  type Adapter = CompletionAdapter |
95
96
  SignatureHelpAdapter |
@@ -204,7 +205,7 @@ export class LanguagesExtImpl implements LanguagesExt {
204
205
  }
205
206
 
206
207
  private transformDocumentSelector(selector: theia.DocumentSelector): SerializedDocumentFilter[] {
207
- if (Array.isArray(selector)) {
208
+ if (isReadonlyArray(selector)) {
208
209
  return selector.map(sel => this.doTransformDocumentSelector(sel)!);
209
210
  }
210
211
 
@@ -582,7 +583,9 @@ export class LanguagesExtImpl implements LanguagesExt {
582
583
  return this.createDisposable(callId);
583
584
  }
584
585
 
585
- $provideRootDefinition(handle: number, resource: UriComponents, location: Position, token: theia.CancellationToken): Promise<CallHierarchyDefinition | undefined> {
586
+ $provideRootDefinition(
587
+ handle: number, resource: UriComponents, location: Position, token: theia.CancellationToken
588
+ ): Promise<CallHierarchyDefinition | CallHierarchyDefinition[] | undefined> {
586
589
  return this.withAdapter(handle, CallHierarchyAdapter, adapter => adapter.provideRootDefinition(URI.revive(resource), location, token), undefined);
587
590
  }
588
591
 
@@ -50,14 +50,17 @@ export class MessageRegistryExt {
50
50
  } else {
51
51
  if ('modal' in optionsOrFirstItem) {
52
52
  options.modal = optionsOrFirstItem.modal;
53
+ if ('detail' in optionsOrFirstItem) {
54
+ options.detail = optionsOrFirstItem.detail;
55
+ }
53
56
  }
54
57
  }
58
+ for (const item of rest) {
59
+ pushItem(item);
60
+ }
61
+ const actionHandle = await this.proxy.$showMessage(type, message, options, actions);
62
+ return actionHandle !== undefined ? items[actionHandle] : undefined;
55
63
  }
56
- for (const item of rest) {
57
- pushItem(item);
58
- }
59
- const actionHandle = await this.proxy.$showMessage(type, message, options, actions);
60
- return actionHandle !== undefined ? items[actionHandle] : undefined;
61
- }
62
64
 
65
+ }
63
66
  }
@@ -15,22 +15,25 @@
15
15
  ********************************************************************************/
16
16
  import { Emitter } from '@theia/core/lib/common/event';
17
17
  import { Path } from '@theia/core/lib/common/path';
18
- import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
19
18
  import * as theia from '@theia/plugin';
20
19
  import { URI } from '@theia/core/shared/vscode-uri';
21
20
  import { Breakpoint } from '../../../common/plugin-api-rpc-model';
22
- import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
21
+ import { DebugConfigurationProviderTriggerKind, DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
23
22
  import { PluginPackageDebuggersContribution } from '../../../common/plugin-protocol';
24
23
  import { RPCProtocol } from '../../../common/rpc-protocol';
25
24
  import { PluginWebSocketChannel } from '../../../common/connection';
26
25
  import { CommandRegistryImpl } from '../../command-registry';
27
26
  import { ConnectionExtImpl } from '../../connection-ext';
28
- import { Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range } from '../../types-impl';
27
+ import {
28
+ Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range,
29
+ DebugAdapterServer, DebugAdapterExecutable, DebugAdapterNamedPipeServer, DebugAdapterInlineImplementation
30
+ } from '../../types-impl';
29
31
  import { resolveDebugAdapterExecutable } from './plugin-debug-adapter-executable-resolver';
30
32
  import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
31
- import { connectDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
33
+ import { connectInlineDebugAdapter, connectPipeDebugAdapter, connectSocketDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
32
34
  import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
33
35
  import uuid = require('uuid');
36
+ import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
34
37
 
35
38
  /* eslint-disable @typescript-eslint/no-explicit-any */
36
39
 
@@ -43,8 +46,11 @@ export class DebugExtImpl implements DebugExt {
43
46
  // debug sessions by sessionId
44
47
  private sessions = new Map<string, PluginDebugAdapterSession>();
45
48
 
46
- // providers by type
49
+ // providers by type (initial)
47
50
  private configurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
51
+ // providers by type (dynamic)
52
+ private dynamicConfigurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
53
+
48
54
  /**
49
55
  * Only use internally, don't send it to the frontend. It's expensive!
50
56
  * It's already there as a part of the plugin metadata.
@@ -182,19 +188,22 @@ export class DebugExtImpl implements DebugExt {
182
188
  });
183
189
  }
184
190
 
185
- registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider): Disposable {
186
- console.log(`Debug configuration provider has been registered: ${debugType}`);
187
- const providers = this.configurationProviders.get(debugType) || new Set<theia.DebugConfigurationProvider>();
188
- this.configurationProviders.set(debugType, providers);
191
+ registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider, trigger: theia.DebugConfigurationProviderTriggerKind): Disposable {
192
+ console.log(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
193
+ const providersByTriggerKind = trigger === DebugConfigurationProviderTriggerKind.Initial ? this.configurationProviders : this.dynamicConfigurationProviders;
194
+ let providers = providersByTriggerKind.get(debugType);
195
+ if (!providers) {
196
+ providersByTriggerKind.set(debugType, providers = new Set());
197
+ }
189
198
  providers.add(provider);
190
199
 
191
200
  return Disposable.create(() => {
192
201
  // eslint-disable-next-line @typescript-eslint/no-shadow
193
- const providers = this.configurationProviders.get(debugType);
202
+ const providers = providersByTriggerKind.get(debugType);
194
203
  if (providers) {
195
204
  providers.delete(provider);
196
205
  if (providers.size === 0) {
197
- this.configurationProviders.delete(debugType);
206
+ providersByTriggerKind.delete(debugType);
198
207
  }
199
208
  }
200
209
  });
@@ -319,10 +328,10 @@ export class DebugExtImpl implements DebugExt {
319
328
  return undefined;
320
329
  }
321
330
 
322
- async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration[]> {
331
+ async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined, dynamic: boolean = false): Promise<theia.DebugConfiguration[]> {
323
332
  let result: theia.DebugConfiguration[] = [];
324
333
 
325
- const providers = this.configurationProviders.get(debugType);
334
+ const providers = dynamic ? this.dynamicConfigurationProviders.get(debugType) : this.configurationProviders.get(debugType);
326
335
  if (providers) {
327
336
  for (const provider of providers) {
328
337
  if (provider.provideDebugConfigurations) {
@@ -337,7 +346,11 @@ export class DebugExtImpl implements DebugExt {
337
346
  async $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration | undefined> {
338
347
  let current = debugConfiguration;
339
348
 
340
- for (const providers of [this.configurationProviders.get(debugConfiguration.type), this.configurationProviders.get('*')]) {
349
+ for (const providers of [
350
+ this.configurationProviders.get(debugConfiguration.type),
351
+ this.dynamicConfigurationProviders.get(debugConfiguration.type),
352
+ this.configurationProviders.get('*')
353
+ ]) {
341
354
  if (providers) {
342
355
  for (const provider of providers) {
343
356
  if (provider.resolveDebugConfiguration) {
@@ -363,7 +376,11 @@ export class DebugExtImpl implements DebugExt {
363
376
  Promise<theia.DebugConfiguration | undefined> {
364
377
  let current = debugConfiguration;
365
378
 
366
- for (const providers of [this.configurationProviders.get(debugConfiguration.type), this.configurationProviders.get('*')]) {
379
+ for (const providers of [
380
+ this.configurationProviders.get(debugConfiguration.type),
381
+ this.dynamicConfigurationProviders.get(debugConfiguration.type),
382
+ this.configurationProviders.get('*')
383
+ ]) {
367
384
  if (providers) {
368
385
  for (const provider of providers) {
369
386
  if (provider.resolveDebugConfigurationWithSubstitutedVariables) {
@@ -409,16 +426,20 @@ export class DebugExtImpl implements DebugExt {
409
426
  // @param executable The debug adapter's executable information as specified in the package.json (or undefined if no such information exists).
410
427
  const descriptor = await descriptorFactory.createDebugAdapterDescriptor(session, executable);
411
428
  if (descriptor) {
412
- if ('port' in descriptor) {
413
- return connectDebugAdapter(descriptor);
414
- } else {
429
+ if (DebugAdapterServer.is(descriptor)) {
430
+ return connectSocketDebugAdapter(descriptor);
431
+ } else if (DebugAdapterExecutable.is(descriptor)) {
415
432
  return startDebugAdapter(descriptor);
433
+ } else if (DebugAdapterNamedPipeServer.is(descriptor)) {
434
+ return connectPipeDebugAdapter(descriptor);
435
+ } else if (DebugAdapterInlineImplementation.is(descriptor)) {
436
+ return connectInlineDebugAdapter(descriptor);
416
437
  }
417
438
  }
418
439
  }
419
440
 
420
441
  if ('debugServer' in debugConfiguration) {
421
- return connectDebugAdapter({ port: debugConfiguration.debugServer });
442
+ return connectSocketDebugAdapter({ port: debugConfiguration.debugServer });
422
443
  } else {
423
444
  if (!executable) {
424
445
  throw new Error('It is not possible to provide debug adapter executable.');
@@ -14,23 +14,23 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
18
17
  import { DebugAdapterSessionImpl } from '@theia/debug/lib/node/debug-adapter-session';
19
18
  import * as theia from '@theia/plugin';
20
19
  import { IWebSocket } from '@theia/core/shared/vscode-ws-jsonrpc';
20
+ import { CommunicationProvider, DebugAdapterSession } from '@theia/debug/lib/node/debug-model';
21
21
 
22
22
  /* eslint-disable @typescript-eslint/no-explicit-any */
23
23
 
24
24
  /**
25
25
  * Server debug adapter session.
26
26
  */
27
- export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession {
27
+ export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession, DebugAdapterSession {
28
28
  readonly type: string;
29
29
  readonly name: string;
30
30
  readonly configuration: theia.DebugConfiguration;
31
31
 
32
32
  constructor(
33
- protected readonly communicationProvider: CommunicationProvider,
33
+ readonly communicationProvider: CommunicationProvider,
34
34
  protected readonly tracker: theia.DebugAdapterTracker,
35
35
  protected readonly theiaSession: theia.DebugSession) {
36
36
 
@@ -15,15 +15,18 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import * as net from 'net';
18
- import * as theia from '@theia/plugin';
19
- import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
20
18
  import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
19
+ import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
20
+ import { StreamCommunicationProvider } from '@theia/debug/lib/node/stream-communication-provider';
21
+ import { Disposable } from '@theia/core/lib/common/disposable';
22
+ import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
23
+ import { InlineCommunicationProvider } from '@theia/debug/lib/node/inline-communication-provider';
21
24
  const isElectron = require('is-electron');
22
25
 
23
26
  /**
24
27
  * Starts debug adapter process.
25
28
  */
26
- export function startDebugAdapter(executable: theia.DebugAdapterExecutable): CommunicationProvider {
29
+ export function startDebugAdapter(executable: DebugAdapterExecutable): CommunicationProvider {
27
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
31
  const options: any = { stdio: ['pipe', 'pipe', 2] };
29
32
 
@@ -63,21 +66,28 @@ export function startDebugAdapter(executable: theia.DebugAdapterExecutable): Com
63
66
  childProcess = spawn(command, args, options);
64
67
  }
65
68
 
66
- return {
67
- input: childProcess.stdin!,
68
- output: childProcess.stdout!,
69
- dispose: () => childProcess.kill()
70
- };
69
+ const provider = new StreamCommunicationProvider(childProcess.stdout!, childProcess.stdin!);
70
+ provider.push(Disposable.create(() => childProcess.kill()));
71
+ return provider;
71
72
  }
72
73
 
73
74
  /**
74
75
  * Connects to a remote debug server.
75
76
  */
76
- export function connectDebugAdapter(server: theia.DebugAdapterServer): CommunicationProvider {
77
+ export function connectSocketDebugAdapter(server: DebugAdapterServer): CommunicationProvider {
77
78
  const socket = net.createConnection(server.port, server.host);
78
- return {
79
- input: socket,
80
- output: socket,
81
- dispose: () => socket.end()
82
- };
79
+ const provider = new StreamCommunicationProvider(socket, socket);
80
+ provider.push(Disposable.create(() => socket.end()));
81
+ return provider;
82
+ }
83
+
84
+ export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): CommunicationProvider {
85
+ const socket = net.createConnection(adapter.path);
86
+ const provider = new StreamCommunicationProvider(socket, socket);
87
+ provider.push(Disposable.create(() => socket.end()));
88
+ return provider;
89
+ }
90
+
91
+ export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): CommunicationProvider {
92
+ return new InlineCommunicationProvider(adapter.implementation);
83
93
  }