@theia/plugin-ext 1.27.0-next.9 → 1.27.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/lib/common/connection.d.ts +3 -3
  2. package/lib/common/connection.d.ts.map +1 -1
  3. package/lib/common/connection.js +0 -1
  4. package/lib/common/connection.js.map +1 -1
  5. package/lib/common/plugin-api-rpc.d.ts +18 -8
  6. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  7. package/lib/common/plugin-api-rpc.js.map +1 -1
  8. package/lib/common/plugin-identifiers.d.ts +41 -0
  9. package/lib/common/plugin-identifiers.d.ts.map +1 -0
  10. package/lib/common/plugin-identifiers.js +81 -0
  11. package/lib/common/plugin-identifiers.js.map +1 -0
  12. package/lib/common/plugin-protocol.d.ts +50 -11
  13. package/lib/common/plugin-protocol.d.ts.map +1 -1
  14. package/lib/common/plugin-protocol.js +3 -1
  15. package/lib/common/plugin-protocol.js.map +1 -1
  16. package/lib/hosted/browser/hosted-plugin.d.ts +2 -2
  17. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  18. package/lib/hosted/browser/hosted-plugin.js +26 -18
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/browser/worker/debug-stub.d.ts +1 -1
  21. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  22. package/lib/hosted/browser/worker/debug-stub.js +2 -2
  23. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  24. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  25. package/lib/hosted/browser/worker/plugin-manifest-loader.js +4 -1
  26. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +17 -9
  28. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  29. package/lib/hosted/node/hosted-plugin-deployer-handler.js +99 -18
  30. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  31. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  32. package/lib/hosted/node/hosted-plugin-localization-service.js +2 -4
  33. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  34. package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
  35. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  36. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  37. package/lib/hosted/node/hosted-plugin.d.ts +2 -2
  38. package/lib/hosted/node/hosted-plugin.d.ts.map +1 -1
  39. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  40. package/lib/hosted/node/metadata-scanner.d.ts +3 -2
  41. package/lib/hosted/node/metadata-scanner.d.ts.map +1 -1
  42. package/lib/hosted/node/metadata-scanner.js +8 -3
  43. package/lib/hosted/node/metadata-scanner.js.map +1 -1
  44. package/lib/hosted/node/plugin-host-rpc.js +2 -2
  45. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  46. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
  47. package/lib/hosted/node/plugin-manifest-loader.js +3 -0
  48. package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
  49. package/lib/hosted/node/plugin-service.d.ts +18 -4
  50. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  51. package/lib/hosted/node/plugin-service.js +73 -18
  52. package/lib/hosted/node/plugin-service.js.map +1 -1
  53. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  54. package/lib/hosted/node/scanners/scanner-theia.js +6 -3
  55. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  56. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  57. package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -2
  58. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  59. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +3 -3
  60. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  61. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  62. package/lib/main/browser/documents-main.d.ts +1 -2
  63. package/lib/main/browser/documents-main.d.ts.map +1 -1
  64. package/lib/main/browser/documents-main.js +26 -6
  65. package/lib/main/browser/documents-main.js.map +1 -1
  66. package/lib/main/browser/editors-and-documents-main.d.ts +2 -0
  67. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  68. package/lib/main/browser/editors-and-documents-main.js +14 -2
  69. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  70. package/lib/main/browser/languages-main.d.ts.map +1 -1
  71. package/lib/main/browser/languages-main.js +2 -1
  72. package/lib/main/browser/languages-main.js.map +1 -1
  73. package/lib/main/browser/main-context.d.ts.map +1 -1
  74. package/lib/main/browser/main-context.js +5 -4
  75. package/lib/main/browser/main-context.js.map +1 -1
  76. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
  77. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  78. package/lib/main/browser/plugin-contribution-handler.js +36 -1
  79. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  80. package/lib/main/browser/plugin-shared-style.d.ts +4 -2
  81. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  82. package/lib/main/browser/plugin-shared-style.js +15 -4
  83. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  84. package/lib/main/browser/text-editors-main.d.ts +6 -3
  85. package/lib/main/browser/text-editors-main.d.ts.map +1 -1
  86. package/lib/main/browser/text-editors-main.js +8 -1
  87. package/lib/main/browser/text-editors-main.js.map +1 -1
  88. package/lib/main/browser/theming-main.d.ts +2 -1
  89. package/lib/main/browser/theming-main.d.ts.map +1 -1
  90. package/lib/main/browser/theming-main.js +3 -6
  91. package/lib/main/browser/theming-main.js.map +1 -1
  92. package/lib/main/browser/view/plugin-tree-view-node-label-provider.d.ts.map +1 -1
  93. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +7 -5
  94. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  95. package/lib/main/browser/view/plugin-view-registry.d.ts +1 -1
  96. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  97. package/lib/main/browser/view/plugin-view-registry.js +11 -6
  98. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  99. package/lib/main/browser/view/tree-view-widget.d.ts +10 -5
  100. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  101. package/lib/main/browser/view/tree-view-widget.js +40 -14
  102. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  103. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +3 -1
  104. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  105. package/lib/main/browser/webview/webview-theme-data-provider.js +5 -1
  106. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  107. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +6 -1
  108. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  109. package/lib/main/node/handlers/plugin-theia-directory-handler.js +61 -20
  110. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  111. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +4 -0
  112. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  113. package/lib/main/node/handlers/plugin-theia-file-handler.js +26 -4
  114. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  115. package/lib/main/node/plugin-cli-contribution.d.ts +3 -0
  116. package/lib/main/node/plugin-cli-contribution.d.ts.map +1 -1
  117. package/lib/main/node/plugin-cli-contribution.js +13 -0
  118. package/lib/main/node/plugin-cli-contribution.js.map +1 -1
  119. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts +1 -0
  120. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts.map +1 -1
  121. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +17 -0
  122. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
  123. package/lib/main/node/plugin-deployer-file-handler-context-impl.d.ts.map +1 -1
  124. package/lib/main/node/plugin-deployer-file-handler-context-impl.js +0 -1
  125. package/lib/main/node/plugin-deployer-file-handler-context-impl.js.map +1 -1
  126. package/lib/main/node/plugin-deployer-impl.d.ts +10 -7
  127. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  128. package/lib/main/node/plugin-deployer-impl.js +84 -38
  129. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  130. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  131. package/lib/main/node/plugin-ext-backend-module.js +2 -0
  132. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  133. package/lib/main/node/plugin-server-handler.d.ts +5 -4
  134. package/lib/main/node/plugin-server-handler.d.ts.map +1 -1
  135. package/lib/main/node/plugin-server-handler.js +12 -5
  136. package/lib/main/node/plugin-server-handler.js.map +1 -1
  137. package/lib/main/node/plugin-uninstallation-manager.d.ts +15 -0
  138. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -0
  139. package/lib/main/node/plugin-uninstallation-manager.js +85 -0
  140. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -0
  141. package/lib/plugin/{node/debug/debug.d.ts → debug/debug-ext.d.ts} +15 -13
  142. package/lib/plugin/debug/debug-ext.d.ts.map +1 -0
  143. package/lib/plugin/{node/debug/debug.js → debug/debug-ext.js} +17 -51
  144. package/lib/plugin/debug/debug-ext.js.map +1 -0
  145. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +11 -0
  146. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -0
  147. package/lib/plugin/debug/plugin-debug-adapter-creator.js +42 -0
  148. package/lib/plugin/debug/plugin-debug-adapter-creator.js.map +1 -0
  149. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.d.ts +4 -4
  150. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -0
  151. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.js +1 -1
  152. package/lib/plugin/debug/plugin-debug-adapter-session.js.map +1 -0
  153. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.d.ts +0 -0
  154. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -0
  155. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.js +0 -0
  156. package/lib/plugin/debug/plugin-debug-adapter-tracker.js.map +1 -0
  157. package/lib/plugin/languages-utils.d.ts.map +1 -1
  158. package/lib/plugin/languages-utils.js +3 -2
  159. package/lib/plugin/languages-utils.js.map +1 -1
  160. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +18 -0
  161. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -0
  162. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js +155 -0
  163. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js.map +1 -0
  164. package/lib/plugin/plugin-context.d.ts +1 -1
  165. package/lib/plugin/plugin-context.d.ts.map +1 -1
  166. package/lib/plugin/plugin-context.js +1 -2
  167. package/lib/plugin/plugin-context.js.map +1 -1
  168. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  169. package/lib/plugin/plugin-manager.js +5 -9
  170. package/lib/plugin/plugin-manager.js.map +1 -1
  171. package/lib/plugin/text-editor.d.ts +2 -0
  172. package/lib/plugin/text-editor.d.ts.map +1 -1
  173. package/lib/plugin/text-editor.js +9 -0
  174. package/lib/plugin/text-editor.js.map +1 -1
  175. package/lib/plugin/theming.d.ts +1 -1
  176. package/lib/plugin/theming.d.ts.map +1 -1
  177. package/lib/plugin/tree/tree-views.d.ts +1 -0
  178. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  179. package/lib/plugin/tree/tree-views.js +10 -9
  180. package/lib/plugin/tree/tree-views.js.map +1 -1
  181. package/lib/plugin/types-impl.d.ts +1 -0
  182. package/lib/plugin/types-impl.d.ts.map +1 -1
  183. package/lib/plugin/types-impl.js +3 -2
  184. package/lib/plugin/types-impl.js.map +1 -1
  185. package/package.json +26 -25
  186. package/src/common/connection.ts +3 -4
  187. package/src/common/plugin-api-rpc.ts +20 -12
  188. package/src/common/plugin-identifiers.ts +84 -0
  189. package/src/common/plugin-protocol.ts +57 -12
  190. package/src/hosted/browser/hosted-plugin.ts +28 -21
  191. package/src/hosted/browser/worker/debug-stub.ts +1 -1
  192. package/src/hosted/browser/worker/plugin-manifest-loader.ts +4 -2
  193. package/src/hosted/node/hosted-plugin-deployer-handler.ts +109 -28
  194. package/src/hosted/node/hosted-plugin-localization-service.ts +4 -6
  195. package/src/hosted/node/hosted-plugin-process.ts +4 -4
  196. package/src/hosted/node/hosted-plugin.ts +2 -2
  197. package/src/hosted/node/metadata-scanner.ts +8 -6
  198. package/src/hosted/node/plugin-host-rpc.ts +2 -2
  199. package/src/hosted/node/plugin-manifest-loader.ts +2 -0
  200. package/src/hosted/node/plugin-service.ts +79 -23
  201. package/src/hosted/node/scanners/scanner-theia.ts +7 -4
  202. package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -2
  203. package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
  204. package/src/main/browser/documents-main.ts +26 -8
  205. package/src/main/browser/editors-and-documents-main.ts +16 -2
  206. package/src/main/browser/languages-main.ts +2 -1
  207. package/src/main/browser/main-context.ts +4 -3
  208. package/src/main/browser/plugin-contribution-handler.ts +41 -3
  209. package/src/main/browser/plugin-icon-theme-service.ts +1 -1
  210. package/src/main/browser/plugin-shared-style.ts +9 -5
  211. package/src/main/browser/text-editors-main.ts +12 -2
  212. package/src/main/browser/theming-main.ts +3 -7
  213. package/src/main/browser/view/plugin-tree-view-node-label-provider.ts +7 -5
  214. package/src/main/browser/view/plugin-view-registry.ts +12 -7
  215. package/src/main/browser/view/tree-view-widget.tsx +45 -17
  216. package/src/main/browser/webview/webview-theme-data-provider.ts +7 -10
  217. package/src/main/node/handlers/plugin-theia-directory-handler.ts +56 -28
  218. package/src/main/node/handlers/plugin-theia-file-handler.ts +26 -4
  219. package/src/main/node/plugin-cli-contribution.ts +12 -0
  220. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +17 -1
  221. package/src/main/node/plugin-deployer-file-handler-context-impl.ts +0 -1
  222. package/src/main/node/plugin-deployer-impl.ts +88 -41
  223. package/src/main/node/plugin-ext-backend-module.ts +3 -0
  224. package/src/main/node/plugin-server-handler.ts +15 -7
  225. package/src/main/node/plugin-uninstallation-manager.ts +74 -0
  226. package/src/plugin/{node/debug/debug.ts → debug/debug-ext.ts} +25 -56
  227. package/src/plugin/debug/plugin-debug-adapter-creator.ts +50 -0
  228. package/src/plugin/{node/debug → debug}/plugin-debug-adapter-session.ts +4 -4
  229. package/src/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.ts +0 -0
  230. package/src/plugin/languages-utils.ts +3 -2
  231. package/src/plugin/node/debug/plugin-node-debug-adapter-creator.ts +167 -0
  232. package/src/plugin/plugin-context.ts +2 -3
  233. package/src/plugin/plugin-manager.ts +5 -9
  234. package/src/plugin/text-editor.ts +16 -5
  235. package/src/plugin/theming.ts +1 -1
  236. package/src/plugin/tree/tree-views.ts +15 -12
  237. package/src/plugin/types-impl.ts +1 -1
  238. package/lib/main/browser/custom-editors/glob.d.ts +0 -51
  239. package/lib/main/browser/custom-editors/glob.d.ts.map +0 -1
  240. package/lib/main/browser/custom-editors/glob.js +0 -593
  241. package/lib/main/browser/custom-editors/glob.js.map +0 -1
  242. package/lib/main/browser/custom-editors/paths.d.ts +0 -25
  243. package/lib/main/browser/custom-editors/paths.d.ts.map +0 -1
  244. package/lib/main/browser/custom-editors/paths.js +0 -227
  245. package/lib/main/browser/custom-editors/paths.js.map +0 -1
  246. package/lib/main/browser/editor/untitled-resource.d.ts +0 -3
  247. package/lib/main/browser/editor/untitled-resource.d.ts.map +0 -1
  248. package/lib/main/browser/editor/untitled-resource.js +0 -24
  249. package/lib/main/browser/editor/untitled-resource.js.map +0 -1
  250. package/lib/plugin/node/debug/debug.d.ts.map +0 -1
  251. package/lib/plugin/node/debug/debug.js.map +0 -1
  252. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts +0 -7
  253. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts.map +0 -1
  254. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js +0 -57
  255. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js.map +0 -1
  256. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +0 -1
  257. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +0 -1
  258. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +0 -15
  259. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +0 -1
  260. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +0 -85
  261. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +0 -1
  262. package/lib/plugin/node/debug/plugin-debug-adapter-tracker.d.ts.map +0 -1
  263. package/lib/plugin/node/debug/plugin-debug-adapter-tracker.js.map +0 -1
  264. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts +0 -19
  265. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts.map +0 -1
  266. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js +0 -45
  267. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js.map +0 -1
  268. package/src/main/browser/custom-editors/glob.ts +0 -743
  269. package/src/main/browser/custom-editors/paths.ts +0 -250
  270. package/src/main/browser/editor/untitled-resource.ts +0 -18
  271. package/src/plugin/node/debug/plugin-debug-adapter-executable-resolver.ts +0 -58
  272. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +0 -86
  273. package/src/plugin/node/debug/plugin-inline-debug-adapter.ts +0 -47
@@ -1,250 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 SAP SE or an SAP affiliate company 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
- // copied from https://github.com/Microsoft/vscode/blob/bf7ac9201e7a7d01741d4e6e64b5dc9f3197d97b/src/vs/base/common/paths.ts
18
- /*---------------------------------------------------------------------------------------------
19
- * Copyright (c) Microsoft Corporation. All rights reserved.
20
- * Licensed under the MIT License. See License.txt in the project root for license information.
21
- *--------------------------------------------------------------------------------------------*/
22
- /* eslint-disable no-void */
23
- /* eslint-disable no-null/no-null */
24
- 'use strict';
25
- import { isWindows } from '@theia/core/lib/common/os';
26
- import { startsWithIgnoreCase } from '@theia/core/lib/common/strings';
27
- import { CharCode } from '@theia/core/lib/common/char-code';
28
-
29
- /**
30
- * The forward slash path separator.
31
- */
32
- export const sep = '/';
33
-
34
- /**
35
- * The native path separator depending on the OS.
36
- */
37
- export const nativeSep = isWindows ? '\\' : '/';
38
-
39
- const _posixBadPath = /(\/\.\.?\/)|(\/\.\.?)$|^(\.\.?\/)|(\/\/+)|(\\)/;
40
- const _winBadPath = /(\\\.\.?\\)|(\\\.\.?)$|^(\.\.?\\)|(\\\\+)|(\/)/;
41
-
42
- function _isNormal(path: string, win: boolean): boolean {
43
- return win
44
- ? !_winBadPath.test(path)
45
- : !_posixBadPath.test(path);
46
- }
47
-
48
- /**
49
- * @returns the base name of a path.
50
- */
51
- export function basename(path: string): string {
52
- const idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\');
53
- if (idx === 0) {
54
- return path;
55
- } else if (~idx === path.length - 1) {
56
- return basename(path.substring(0, path.length - 1));
57
- } else {
58
- return path.substr(~idx + 1);
59
- }
60
- }
61
-
62
- /**
63
- * @returns `.far` from `boo.far` or the empty string.
64
- */
65
- export function extname(path: string): string {
66
- path = basename(path);
67
- const idx = ~path.lastIndexOf('.');
68
- return idx ? path.substring(~idx) : '';
69
- }
70
-
71
- export function normalize(path: string, toOSPath?: boolean): string {
72
- if (path === null || path === void 0) {
73
- return path;
74
- }
75
-
76
- const len = path.length;
77
- if (len === 0) {
78
- return '.';
79
- }
80
-
81
- const wantsBackslash = isWindows && toOSPath;
82
- if (_isNormal(path, wantsBackslash!)) {
83
- return path;
84
- }
85
-
86
- // eslint-disable-next-line @typescript-eslint/no-shadow
87
- const sep = wantsBackslash ? '\\' : '/';
88
- const root = getRoot(path, sep);
89
-
90
- // skip the root-portion of the path
91
- let start = root.length;
92
- let skip = false;
93
- let res = '';
94
-
95
- for (let end = root.length; end <= len; end++) {
96
-
97
- // either at the end or at a path-separator character
98
- if (end === len || path.charCodeAt(end) === CharCode.Slash || path.charCodeAt(end) === CharCode.Backslash) {
99
-
100
- if (streql(path, start, end, '..')) {
101
- // skip current and remove parent (if there is already something)
102
- const prev_start = res.lastIndexOf(sep);
103
- const prev_part = res.slice(prev_start + 1);
104
- if ((root || prev_part.length > 0) && prev_part !== '..') {
105
- res = prev_start === -1 ? '' : res.slice(0, prev_start);
106
- skip = true;
107
- }
108
- } else if (streql(path, start, end, '.') && (root || res || end < len - 1)) {
109
- // skip current (if there is already something or if there is more to come)
110
- skip = true;
111
- }
112
-
113
- if (!skip) {
114
- const part = path.slice(start, end);
115
- if (res !== '' && res[res.length - 1] !== sep) {
116
- res += sep;
117
- }
118
- res += part;
119
- }
120
- start = end + 1;
121
- skip = false;
122
- }
123
- }
124
-
125
- return root + res;
126
- }
127
- function streql(value: string, start: number, end: number, other: string): boolean {
128
- return start + other.length === end && value.indexOf(other, start) === start;
129
- }
130
-
131
- /**
132
- * Computes the _root_ this path, like `getRoot('c:\files') === c:\`,
133
- * `getRoot('files:///files/path') === files:///`,
134
- * or `getRoot('\\server\shares\path') === \\server\shares\`
135
- */
136
- // eslint-disable-next-line @typescript-eslint/no-shadow
137
- export function getRoot(path: string, sep: string = '/'): string {
138
-
139
- if (!path) {
140
- return '';
141
- }
142
-
143
- const len = path.length;
144
- let code = path.charCodeAt(0);
145
- if (code === CharCode.Slash || code === CharCode.Backslash) {
146
-
147
- code = path.charCodeAt(1);
148
- if (code === CharCode.Slash || code === CharCode.Backslash) {
149
- // UNC candidate \\localhost\shares\ddd
150
- // ^^^^^^^^^^^^^^^^^^^
151
- code = path.charCodeAt(2);
152
- if (code !== CharCode.Slash && code !== CharCode.Backslash) {
153
- // eslint-disable-next-line @typescript-eslint/no-shadow
154
- let pos = 3;
155
- const start = pos;
156
- for (; pos < len; pos++) {
157
- code = path.charCodeAt(pos);
158
- if (code === CharCode.Slash || code === CharCode.Backslash) {
159
- break;
160
- }
161
- }
162
- code = path.charCodeAt(pos + 1);
163
- if (start !== pos && code !== CharCode.Slash && code !== CharCode.Backslash) {
164
- pos += 1;
165
- for (; pos < len; pos++) {
166
- code = path.charCodeAt(pos);
167
- if (code === CharCode.Slash || code === CharCode.Backslash) {
168
- return path.slice(0, pos + 1) // consume this separator
169
- .replace(/[\\/]/g, sep);
170
- }
171
- }
172
- }
173
- }
174
- }
175
-
176
- // /user/far
177
- // ^
178
- return sep;
179
-
180
- } else if ((code >= CharCode.A && code <= CharCode.Z) || (code >= CharCode.a && code <= CharCode.z)) {
181
- // check for windows drive letter c:\ or c:
182
-
183
- if (path.charCodeAt(1) === CharCode.Colon) {
184
- code = path.charCodeAt(2);
185
- if (code === CharCode.Slash || code === CharCode.Backslash) {
186
- // C:\fff
187
- // ^^^
188
- return path.slice(0, 2) + sep;
189
- } else {
190
- // C:
191
- // ^^
192
- return path.slice(0, 2);
193
- }
194
- }
195
- }
196
-
197
- // check for URI
198
- // scheme://authority/path
199
- // ^^^^^^^^^^^^^^^^^^^
200
- let pos = path.indexOf('://');
201
- if (pos !== -1) {
202
- pos += 3; // 3 -> "://".length
203
- for (; pos < len; pos++) {
204
- code = path.charCodeAt(pos);
205
- if (code === CharCode.Slash || code === CharCode.Backslash) {
206
- return path.slice(0, pos + 1); // consume this separator
207
- }
208
- }
209
- }
210
-
211
- return '';
212
- }
213
-
214
- export function isEqualOrParent(path: string, candidate: string, ignoreCase?: boolean): boolean {
215
- if (path === candidate) {
216
- return true;
217
- }
218
-
219
- if (!path || !candidate) {
220
- return false;
221
- }
222
-
223
- if (candidate.length > path.length) {
224
- return false;
225
- }
226
-
227
- if (ignoreCase) {
228
- const beginsWith = startsWithIgnoreCase(path, candidate);
229
- if (!beginsWith) {
230
- return false;
231
- }
232
-
233
- if (candidate.length === path.length) {
234
- return true; // same path, different casing
235
- }
236
-
237
- let sepOffset = candidate.length;
238
- if (candidate.charAt(candidate.length - 1) === nativeSep) {
239
- sepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character
240
- }
241
-
242
- return path.charAt(sepOffset) === nativeSep;
243
- }
244
-
245
- if (candidate.charAt(candidate.length - 1) !== nativeSep) {
246
- candidate += nativeSep;
247
- }
248
-
249
- return path.indexOf(candidate) === 0;
250
- }
@@ -1,18 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Red Hat, Inc. 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
- /** @deprecated @since 1.24. Import from `core/lib/common/resource` instead. */
18
- export { UntitledResourceResolver, UntitledResource, createUntitledURI } from '@theia/core/lib/common/resource';
@@ -1,58 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Red Hat, Inc. 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 path from 'path';
18
- import * as theia from '@theia/plugin';
19
- import { PlatformSpecificAdapterContribution, PluginPackageDebuggersContribution } from '../../../common';
20
- import { isWindows, isOSX } from '@theia/core/lib/common/os';
21
-
22
- /**
23
- * Resolves [DebugAdapterExecutable](#DebugAdapterExecutable) based on contribution.
24
- */
25
- export async function resolveDebugAdapterExecutable(
26
- pluginPath: string, debuggerContribution: PluginPackageDebuggersContribution): Promise<theia.DebugAdapterExecutable | undefined> {
27
- const info = toPlatformInfo(debuggerContribution);
28
- let program = (info && info.program || debuggerContribution.program);
29
- if (!program) {
30
- return undefined;
31
- }
32
- program = path.join(pluginPath, program);
33
- const programArgs = info && info.args || debuggerContribution.args || [];
34
- let runtime = info && info.runtime || debuggerContribution.runtime;
35
- if (runtime && runtime.indexOf('./') === 0) {
36
- runtime = path.join(pluginPath, runtime);
37
- }
38
- const runtimeArgs = info && info.runtimeArgs || debuggerContribution.runtimeArgs || [];
39
- const command = runtime ? runtime : program;
40
- const args = runtime ? [...runtimeArgs, program, ...programArgs] : programArgs;
41
- return {
42
- command,
43
- args
44
- };
45
- }
46
-
47
- function toPlatformInfo(executable: PluginPackageDebuggersContribution): PlatformSpecificAdapterContribution | undefined {
48
- if (isWindows && !process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) {
49
- return executable.winx86 || executable.win || executable.windows;
50
- }
51
- if (isWindows) {
52
- return executable.win || executable.windows;
53
- }
54
- if (isOSX) {
55
- return executable.osx;
56
- }
57
- return executable.linux;
58
- }
@@ -1,86 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Red Hat, Inc. 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 net from 'net';
18
- import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
19
- import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
20
- import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
21
- import { InlineDebugAdapter } from './plugin-inline-debug-adapter';
22
- import { ProcessDebugAdapter, SocketDebugAdapter } from '@theia/debug/lib/node/stream-debug-adapter';
23
- const isElectron = require('is-electron');
24
-
25
- /**
26
- * Starts debug adapter process.
27
- */
28
- export function startDebugAdapter(executable: DebugAdapterExecutable): DebugAdapter {
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- const options: any = { stdio: ['pipe', 'pipe', 2] };
31
-
32
- if (executable.options) {
33
- options.cwd = executable.options.cwd;
34
-
35
- // The additional environment of the executed program or shell. If omitted
36
- // the parent process' environment is used. If provided it is merged with
37
- // the parent process' environment.
38
- options.env = Object.assign({}, process.env);
39
- Object.assign(options.env, executable.options.env);
40
- }
41
-
42
- let childProcess: ChildProcess;
43
- const { command, args } = executable;
44
- if (command === 'node') {
45
- if (Array.isArray(args) && args.length > 0) {
46
- const forkOptions: ForkOptions = {
47
- env: options.env,
48
- // When running in Electron, fork will automatically add ELECTRON_RUN_AS_NODE=1 to the env,
49
- // but this will cause issues when debugging Electron apps, so we'll remove it.
50
- execArgv: isElectron()
51
- ? ['-e', 'delete process.env.ELECTRON_RUN_AS_NODE;require(process.argv[1])']
52
- : [],
53
- silent: true
54
- };
55
- if (options.cwd) {
56
- forkOptions.cwd = options.cwd;
57
- }
58
- options.stdio.push('ipc');
59
- forkOptions.stdio = options.stdio;
60
- childProcess = fork(args[0], args.slice(1), forkOptions);
61
- } else {
62
- throw new Error(`It is not possible to launch debug adapter with the command: ${JSON.stringify(executable)}`);
63
- }
64
- } else {
65
- childProcess = spawn(command, args, options);
66
- }
67
-
68
- return new ProcessDebugAdapter(childProcess);
69
- }
70
-
71
- /**
72
- * Connects to a remote debug server.
73
- */
74
- export function connectSocketDebugAdapter(server: DebugAdapterServer): SocketDebugAdapter {
75
- const socket = net.createConnection(server.port, server.host);
76
- return new SocketDebugAdapter(socket);
77
- }
78
-
79
- export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): SocketDebugAdapter {
80
- const socket = net.createConnection(adapter.path);
81
- return new SocketDebugAdapter(socket);
82
- }
83
-
84
- export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): InlineDebugAdapter {
85
- return new InlineDebugAdapter(adapter.implementation);
86
- }
@@ -1,47 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Red Hat, Inc. 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 { Emitter, Event } from '@theia/core/lib/common/event';
18
- import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
19
- import * as theia from '@theia/plugin';
20
-
21
- /**
22
- * A debug adapter for using the inline implementation from a plugin.
23
- */
24
- export class InlineDebugAdapter implements DebugAdapter {
25
- private messageReceivedEmitter = new Emitter<string>();
26
- onMessageReceived: Event<string> = this.messageReceivedEmitter.event;
27
- onError: Event<Error> = Event.None;
28
- private closeEmitter = new Emitter<void>();
29
- onClose: Event<void> = this.closeEmitter.event;
30
-
31
- constructor(private debugAdapter: theia.DebugAdapter) {
32
- this.debugAdapter.onDidSendMessage(msg => {
33
- this.messageReceivedEmitter.fire(JSON.stringify(msg));
34
- });
35
- }
36
-
37
- async start(): Promise<void> {
38
- }
39
-
40
- send(message: string): void {
41
- this.debugAdapter.handleMessage(JSON.parse(message));
42
- }
43
-
44
- async stop(): Promise<void> {
45
- this.debugAdapter.dispose();
46
- }
47
- }