@theia/plugin-ext 1.27.0-next.4 → 1.27.0-next.41

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 (224) 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 +20 -11
  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 +41 -7
  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 +20 -13
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  21. package/lib/hosted/browser/worker/plugin-manifest-loader.js +4 -1
  22. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  23. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +10 -5
  24. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  25. package/lib/hosted/node/hosted-plugin-deployer-handler.js +54 -12
  26. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
  28. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  29. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  30. package/lib/hosted/node/hosted-plugin.d.ts +2 -2
  31. package/lib/hosted/node/hosted-plugin.d.ts.map +1 -1
  32. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  33. package/lib/hosted/node/metadata-scanner.d.ts +3 -2
  34. package/lib/hosted/node/metadata-scanner.d.ts.map +1 -1
  35. package/lib/hosted/node/metadata-scanner.js +8 -3
  36. package/lib/hosted/node/metadata-scanner.js.map +1 -1
  37. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  38. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
  39. package/lib/hosted/node/plugin-manifest-loader.js +3 -0
  40. package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
  41. package/lib/hosted/node/plugin-service.d.ts +18 -4
  42. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  43. package/lib/hosted/node/plugin-service.js +73 -18
  44. package/lib/hosted/node/plugin-service.js.map +1 -1
  45. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  46. package/lib/hosted/node/scanners/scanner-theia.js +6 -3
  47. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  48. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  49. package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -2
  50. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  51. package/lib/main/browser/debug/plugin-debug-service.d.ts +6 -0
  52. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  53. package/lib/main/browser/debug/plugin-debug-service.js +25 -3
  54. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  55. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +3 -3
  56. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  57. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  58. package/lib/main/browser/documents-main.d.ts +1 -2
  59. package/lib/main/browser/documents-main.d.ts.map +1 -1
  60. package/lib/main/browser/documents-main.js +26 -6
  61. package/lib/main/browser/documents-main.js.map +1 -1
  62. package/lib/main/browser/editors-and-documents-main.d.ts +2 -0
  63. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  64. package/lib/main/browser/editors-and-documents-main.js +14 -2
  65. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  66. package/lib/main/browser/languages-main.d.ts.map +1 -1
  67. package/lib/main/browser/languages-main.js +2 -1
  68. package/lib/main/browser/languages-main.js.map +1 -1
  69. package/lib/main/browser/main-context.d.ts.map +1 -1
  70. package/lib/main/browser/main-context.js +5 -4
  71. package/lib/main/browser/main-context.js.map +1 -1
  72. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
  73. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  74. package/lib/main/browser/plugin-contribution-handler.js +36 -1
  75. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  76. package/lib/main/browser/plugin-shared-style.d.ts +4 -2
  77. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  78. package/lib/main/browser/plugin-shared-style.js +15 -4
  79. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  80. package/lib/main/browser/text-editors-main.d.ts +6 -3
  81. package/lib/main/browser/text-editors-main.d.ts.map +1 -1
  82. package/lib/main/browser/text-editors-main.js +8 -1
  83. package/lib/main/browser/text-editors-main.js.map +1 -1
  84. package/lib/main/browser/theming-main.d.ts +2 -1
  85. package/lib/main/browser/theming-main.d.ts.map +1 -1
  86. package/lib/main/browser/theming-main.js +3 -6
  87. package/lib/main/browser/theming-main.js.map +1 -1
  88. package/lib/main/browser/view/plugin-tree-view-node-label-provider.d.ts.map +1 -1
  89. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +7 -5
  90. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  91. package/lib/main/browser/view/plugin-view-registry.d.ts +1 -1
  92. package/lib/main/browser/view/plugin-view-registry.js +2 -2
  93. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  94. package/lib/main/browser/view/tree-view-widget.d.ts +10 -5
  95. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  96. package/lib/main/browser/view/tree-view-widget.js +39 -13
  97. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  98. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +3 -1
  99. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  100. package/lib/main/browser/webview/webview-theme-data-provider.js +5 -1
  101. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  102. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +6 -1
  103. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  104. package/lib/main/node/handlers/plugin-theia-directory-handler.js +61 -20
  105. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  106. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +4 -0
  107. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  108. package/lib/main/node/handlers/plugin-theia-file-handler.js +25 -4
  109. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  110. package/lib/main/node/plugin-cli-contribution.d.ts +3 -0
  111. package/lib/main/node/plugin-cli-contribution.d.ts.map +1 -1
  112. package/lib/main/node/plugin-cli-contribution.js +13 -0
  113. package/lib/main/node/plugin-cli-contribution.js.map +1 -1
  114. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts +1 -0
  115. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts.map +1 -1
  116. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +17 -0
  117. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
  118. package/lib/main/node/plugin-deployer-file-handler-context-impl.d.ts.map +1 -1
  119. package/lib/main/node/plugin-deployer-file-handler-context-impl.js +0 -1
  120. package/lib/main/node/plugin-deployer-file-handler-context-impl.js.map +1 -1
  121. package/lib/main/node/plugin-deployer-impl.d.ts +5 -2
  122. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  123. package/lib/main/node/plugin-deployer-impl.js +72 -28
  124. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  125. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  126. package/lib/main/node/plugin-ext-backend-module.js +2 -0
  127. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  128. package/lib/main/node/plugin-server-handler.d.ts +3 -2
  129. package/lib/main/node/plugin-server-handler.d.ts.map +1 -1
  130. package/lib/main/node/plugin-server-handler.js +3 -0
  131. package/lib/main/node/plugin-server-handler.js.map +1 -1
  132. package/lib/main/node/plugin-uninstallation-manager.d.ts +12 -0
  133. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -0
  134. package/lib/main/node/plugin-uninstallation-manager.js +66 -0
  135. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -0
  136. package/lib/plugin/custom-editors.d.ts +1 -2
  137. package/lib/plugin/custom-editors.d.ts.map +1 -1
  138. package/lib/plugin/custom-editors.js.map +1 -1
  139. package/lib/plugin/languages-utils.d.ts.map +1 -1
  140. package/lib/plugin/languages-utils.js +3 -2
  141. package/lib/plugin/languages-utils.js.map +1 -1
  142. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +2 -2
  143. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  144. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  145. package/lib/plugin/plugin-context.d.ts.map +1 -1
  146. package/lib/plugin/plugin-context.js +0 -1
  147. package/lib/plugin/plugin-context.js.map +1 -1
  148. package/lib/plugin/text-editor.d.ts +2 -0
  149. package/lib/plugin/text-editor.d.ts.map +1 -1
  150. package/lib/plugin/text-editor.js +9 -0
  151. package/lib/plugin/text-editor.js.map +1 -1
  152. package/lib/plugin/theming.d.ts +1 -1
  153. package/lib/plugin/theming.d.ts.map +1 -1
  154. package/lib/plugin/tree/tree-views.d.ts +1 -0
  155. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  156. package/lib/plugin/tree/tree-views.js +10 -9
  157. package/lib/plugin/tree/tree-views.js.map +1 -1
  158. package/lib/plugin/types-impl.d.ts +1 -0
  159. package/lib/plugin/types-impl.d.ts.map +1 -1
  160. package/lib/plugin/types-impl.js +3 -2
  161. package/lib/plugin/types-impl.js.map +1 -1
  162. package/package.json +25 -24
  163. package/src/common/connection.ts +3 -4
  164. package/src/common/plugin-api-rpc.ts +23 -17
  165. package/src/common/plugin-identifiers.ts +84 -0
  166. package/src/common/plugin-protocol.ts +47 -8
  167. package/src/hosted/browser/hosted-plugin.ts +22 -16
  168. package/src/hosted/browser/worker/plugin-manifest-loader.ts +4 -2
  169. package/src/hosted/node/hosted-plugin-deployer-handler.ts +64 -20
  170. package/src/hosted/node/hosted-plugin-process.ts +4 -4
  171. package/src/hosted/node/hosted-plugin.ts +2 -2
  172. package/src/hosted/node/metadata-scanner.ts +8 -6
  173. package/src/hosted/node/plugin-host-rpc.ts +1 -1
  174. package/src/hosted/node/plugin-manifest-loader.ts +2 -0
  175. package/src/hosted/node/plugin-service.ts +79 -23
  176. package/src/hosted/node/scanners/scanner-theia.ts +7 -4
  177. package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -2
  178. package/src/main/browser/debug/plugin-debug-service.ts +32 -3
  179. package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
  180. package/src/main/browser/documents-main.ts +26 -8
  181. package/src/main/browser/editors-and-documents-main.ts +16 -2
  182. package/src/main/browser/languages-main.ts +2 -1
  183. package/src/main/browser/main-context.ts +4 -3
  184. package/src/main/browser/plugin-contribution-handler.ts +41 -3
  185. package/src/main/browser/plugin-icon-theme-service.ts +1 -1
  186. package/src/main/browser/plugin-shared-style.ts +9 -5
  187. package/src/main/browser/text-editors-main.ts +12 -2
  188. package/src/main/browser/theming-main.ts +3 -7
  189. package/src/main/browser/view/plugin-tree-view-node-label-provider.ts +7 -5
  190. package/src/main/browser/view/plugin-view-registry.ts +3 -3
  191. package/src/main/browser/view/tree-view-widget.tsx +44 -16
  192. package/src/main/browser/webview/webview-theme-data-provider.ts +7 -10
  193. package/src/main/node/handlers/plugin-theia-directory-handler.ts +56 -28
  194. package/src/main/node/handlers/plugin-theia-file-handler.ts +25 -4
  195. package/src/main/node/plugin-cli-contribution.ts +12 -0
  196. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +17 -1
  197. package/src/main/node/plugin-deployer-file-handler-context-impl.ts +0 -1
  198. package/src/main/node/plugin-deployer-impl.ts +75 -30
  199. package/src/main/node/plugin-ext-backend-module.ts +3 -0
  200. package/src/main/node/plugin-server-handler.ts +6 -2
  201. package/src/main/node/plugin-uninstallation-manager.ts +60 -0
  202. package/src/plugin/custom-editors.ts +2 -3
  203. package/src/plugin/languages-utils.ts +3 -2
  204. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +2 -2
  205. package/src/plugin/plugin-context.ts +0 -1
  206. package/src/plugin/text-editor.ts +16 -5
  207. package/src/plugin/theming.ts +1 -1
  208. package/src/plugin/tree/tree-views.ts +15 -12
  209. package/src/plugin/types-impl.ts +1 -1
  210. package/lib/main/browser/custom-editors/glob.d.ts +0 -51
  211. package/lib/main/browser/custom-editors/glob.d.ts.map +0 -1
  212. package/lib/main/browser/custom-editors/glob.js +0 -593
  213. package/lib/main/browser/custom-editors/glob.js.map +0 -1
  214. package/lib/main/browser/custom-editors/paths.d.ts +0 -25
  215. package/lib/main/browser/custom-editors/paths.d.ts.map +0 -1
  216. package/lib/main/browser/custom-editors/paths.js +0 -227
  217. package/lib/main/browser/custom-editors/paths.js.map +0 -1
  218. package/lib/main/browser/editor/untitled-resource.d.ts +0 -3
  219. package/lib/main/browser/editor/untitled-resource.d.ts.map +0 -1
  220. package/lib/main/browser/editor/untitled-resource.js +0 -24
  221. package/lib/main/browser/editor/untitled-resource.js.map +0 -1
  222. package/src/main/browser/custom-editors/glob.ts +0 -743
  223. package/src/main/browser/custom-editors/paths.ts +0 -250
  224. package/src/main/browser/editor/untitled-resource.ts +0 -18
@@ -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';