@theia/plugin-ext 1.55.0-next.4 → 1.55.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 (272) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +1 -0
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.d.ts +1 -0
  4. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  5. package/lib/main/browser/authentication-main.d.ts +1 -0
  6. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  7. package/lib/main/browser/command-registry-main.d.ts +1 -0
  8. package/lib/main/browser/command-registry-main.d.ts.map +1 -1
  9. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -0
  10. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  11. package/lib/main/browser/debug/plugin-debug-service.d.ts +1 -0
  12. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  13. package/lib/main/browser/editors-and-documents-main.js +6 -3
  14. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  15. package/lib/main/browser/languages-main.d.ts +1 -0
  16. package/lib/main/browser/languages-main.d.ts.map +1 -1
  17. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -1
  18. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +8 -7
  19. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
  20. package/lib/main/browser/notebooks/notebooks-main.d.ts +5 -12
  21. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
  22. package/lib/main/browser/notebooks/notebooks-main.js +6 -4
  23. package/lib/main/browser/notebooks/notebooks-main.js.map +1 -1
  24. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +22 -12
  25. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
  26. package/lib/main/browser/notebooks/renderers/cell-output-webview.js +145 -74
  27. package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
  28. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
  29. package/lib/main/browser/notebooks/renderers/output-webview-internal.js +198 -69
  30. package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
  31. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +56 -6
  32. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -1
  33. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  34. package/lib/main/browser/plugin-ext-frontend-module.js +2 -1
  35. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  36. package/lib/main/browser/quick-open-main.d.ts +1 -0
  37. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  38. package/lib/main/browser/tabs/tabs-main.d.ts +2 -0
  39. package/lib/main/browser/tabs/tabs-main.d.ts.map +1 -1
  40. package/lib/main/browser/tabs/tabs-main.js +17 -2
  41. package/lib/main/browser/tabs/tabs-main.js.map +1 -1
  42. package/lib/main/browser/terminal-main.d.ts +1 -0
  43. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  44. package/lib/main/browser/view/tree-view-decorator-service.d.ts +1 -0
  45. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  46. package/lib/main/browser/view/tree-view-widget.d.ts +1 -0
  47. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  48. package/lib/main/browser/view/tree-views-main.d.ts +1 -0
  49. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  50. package/lib/main/browser/webview/webview.d.ts +1 -0
  51. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  52. package/lib/main/browser/webview-views/webview-views-main.d.ts +1 -0
  53. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
  54. package/lib/main/browser/webviews-main.d.ts +1 -0
  55. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  56. package/lib/main/browser/workspace-main.d.ts +1 -0
  57. package/lib/main/browser/workspace-main.d.ts.map +1 -1
  58. package/lib/plugin/authentication-ext.d.ts +1 -0
  59. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  60. package/lib/plugin/clipboard-ext.d.ts +1 -0
  61. package/lib/plugin/clipboard-ext.d.ts.map +1 -1
  62. package/lib/plugin/command-registry.d.ts +1 -0
  63. package/lib/plugin/command-registry.d.ts.map +1 -1
  64. package/lib/plugin/comments.d.ts +1 -0
  65. package/lib/plugin/comments.d.ts.map +1 -1
  66. package/lib/plugin/custom-editors.d.ts +1 -0
  67. package/lib/plugin/custom-editors.d.ts.map +1 -1
  68. package/lib/plugin/debug/debug-ext.d.ts +1 -0
  69. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  70. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +1 -0
  71. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -1
  72. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +1 -0
  73. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  74. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts +1 -0
  75. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -1
  76. package/lib/plugin/decorations.d.ts +1 -0
  77. package/lib/plugin/decorations.d.ts.map +1 -1
  78. package/lib/plugin/dialogs.d.ts +1 -0
  79. package/lib/plugin/dialogs.d.ts.map +1 -1
  80. package/lib/plugin/document-data.d.ts +1 -0
  81. package/lib/plugin/document-data.d.ts.map +1 -1
  82. package/lib/plugin/documents.d.ts +1 -0
  83. package/lib/plugin/documents.d.ts.map +1 -1
  84. package/lib/plugin/env.d.ts +1 -0
  85. package/lib/plugin/env.d.ts.map +1 -1
  86. package/lib/plugin/file-system-event-service-ext-impl.d.ts +17 -1
  87. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  88. package/lib/plugin/file-system-event-service-ext-impl.js +9 -7
  89. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  90. package/lib/plugin/file-system-ext-impl.d.ts +28 -3
  91. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  92. package/lib/plugin/file-system-ext-impl.js +4 -2
  93. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  94. package/lib/plugin/file-system-watcher.spec.d.ts +2 -0
  95. package/lib/plugin/file-system-watcher.spec.d.ts.map +1 -0
  96. package/lib/plugin/file-system-watcher.spec.js +108 -0
  97. package/lib/plugin/file-system-watcher.spec.js.map +1 -0
  98. package/lib/plugin/label-service.d.ts +1 -0
  99. package/lib/plugin/label-service.d.ts.map +1 -1
  100. package/lib/plugin/languages/call-hierarchy.d.ts +1 -0
  101. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  102. package/lib/plugin/languages/code-action.d.ts +1 -0
  103. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  104. package/lib/plugin/languages/color.d.ts +1 -0
  105. package/lib/plugin/languages/color.d.ts.map +1 -1
  106. package/lib/plugin/languages/completion.d.ts +1 -0
  107. package/lib/plugin/languages/completion.d.ts.map +1 -1
  108. package/lib/plugin/languages/declaration.d.ts +1 -0
  109. package/lib/plugin/languages/declaration.d.ts.map +1 -1
  110. package/lib/plugin/languages/definition.d.ts +1 -0
  111. package/lib/plugin/languages/definition.d.ts.map +1 -1
  112. package/lib/plugin/languages/diagnostics.d.ts +1 -0
  113. package/lib/plugin/languages/diagnostics.d.ts.map +1 -1
  114. package/lib/plugin/languages/document-drop-edit.d.ts +1 -0
  115. package/lib/plugin/languages/document-drop-edit.d.ts.map +1 -1
  116. package/lib/plugin/languages/document-formatting.d.ts +1 -0
  117. package/lib/plugin/languages/document-formatting.d.ts.map +1 -1
  118. package/lib/plugin/languages/document-highlight.d.ts +1 -0
  119. package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
  120. package/lib/plugin/languages/evaluatable-expression.d.ts +1 -0
  121. package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -1
  122. package/lib/plugin/languages/folding.d.ts +1 -0
  123. package/lib/plugin/languages/folding.d.ts.map +1 -1
  124. package/lib/plugin/languages/hover.d.ts +1 -0
  125. package/lib/plugin/languages/hover.d.ts.map +1 -1
  126. package/lib/plugin/languages/implementation.d.ts +1 -0
  127. package/lib/plugin/languages/implementation.d.ts.map +1 -1
  128. package/lib/plugin/languages/inlay-hints.d.ts +1 -0
  129. package/lib/plugin/languages/inlay-hints.d.ts.map +1 -1
  130. package/lib/plugin/languages/inline-completion.d.ts +1 -0
  131. package/lib/plugin/languages/inline-completion.d.ts.map +1 -1
  132. package/lib/plugin/languages/inline-values.d.ts +1 -0
  133. package/lib/plugin/languages/inline-values.d.ts.map +1 -1
  134. package/lib/plugin/languages/lens.d.ts +1 -0
  135. package/lib/plugin/languages/lens.d.ts.map +1 -1
  136. package/lib/plugin/languages/link-provider.d.ts +1 -0
  137. package/lib/plugin/languages/link-provider.d.ts.map +1 -1
  138. package/lib/plugin/languages/linked-editing-range.d.ts +1 -0
  139. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -1
  140. package/lib/plugin/languages/on-type-formatting.d.ts +1 -0
  141. package/lib/plugin/languages/on-type-formatting.d.ts.map +1 -1
  142. package/lib/plugin/languages/outline.d.ts +1 -0
  143. package/lib/plugin/languages/outline.d.ts.map +1 -1
  144. package/lib/plugin/languages/range-formatting.d.ts +1 -0
  145. package/lib/plugin/languages/range-formatting.d.ts.map +1 -1
  146. package/lib/plugin/languages/reference.d.ts +1 -0
  147. package/lib/plugin/languages/reference.d.ts.map +1 -1
  148. package/lib/plugin/languages/rename.d.ts +1 -0
  149. package/lib/plugin/languages/rename.d.ts.map +1 -1
  150. package/lib/plugin/languages/selection-range.d.ts +1 -0
  151. package/lib/plugin/languages/selection-range.d.ts.map +1 -1
  152. package/lib/plugin/languages/semantic-highlighting.d.ts +1 -0
  153. package/lib/plugin/languages/semantic-highlighting.d.ts.map +1 -1
  154. package/lib/plugin/languages/signature.d.ts +1 -0
  155. package/lib/plugin/languages/signature.d.ts.map +1 -1
  156. package/lib/plugin/languages/type-definition.d.ts +1 -0
  157. package/lib/plugin/languages/type-definition.d.ts.map +1 -1
  158. package/lib/plugin/languages/type-hierarchy.d.ts +1 -0
  159. package/lib/plugin/languages/type-hierarchy.d.ts.map +1 -1
  160. package/lib/plugin/languages/util.d.ts +1 -0
  161. package/lib/plugin/languages/util.d.ts.map +1 -1
  162. package/lib/plugin/languages/workspace-symbol.d.ts +1 -0
  163. package/lib/plugin/languages/workspace-symbol.d.ts.map +1 -1
  164. package/lib/plugin/languages-utils.d.ts +1 -0
  165. package/lib/plugin/languages-utils.d.ts.map +1 -1
  166. package/lib/plugin/languages.d.ts +1 -0
  167. package/lib/plugin/languages.d.ts.map +1 -1
  168. package/lib/plugin/markdown-string.d.ts +1 -0
  169. package/lib/plugin/markdown-string.d.ts.map +1 -1
  170. package/lib/plugin/message-registry.d.ts +1 -0
  171. package/lib/plugin/message-registry.d.ts.map +1 -1
  172. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +1 -0
  173. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -1
  174. package/lib/plugin/notebook/notebook-document.d.ts +1 -0
  175. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -1
  176. package/lib/plugin/notebook/notebook-documents.d.ts +1 -0
  177. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -1
  178. package/lib/plugin/notebook/notebook-editor.d.ts +1 -0
  179. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -1
  180. package/lib/plugin/notebook/notebook-editors.d.ts +1 -0
  181. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -1
  182. package/lib/plugin/notebook/notebook-kernels.d.ts +1 -0
  183. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  184. package/lib/plugin/notebook/notebook-renderers.d.ts +1 -0
  185. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -1
  186. package/lib/plugin/notebook/notebooks.d.ts +4 -2
  187. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  188. package/lib/plugin/notebook/notebooks.js +2 -2
  189. package/lib/plugin/notebook/notebooks.js.map +1 -1
  190. package/lib/plugin/notification.d.ts +1 -0
  191. package/lib/plugin/notification.d.ts.map +1 -1
  192. package/lib/plugin/output-channel/log-output-channel.d.ts +1 -0
  193. package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -1
  194. package/lib/plugin/output-channel/output-channel-item.d.ts +1 -0
  195. package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
  196. package/lib/plugin/output-channel-registry.d.ts +1 -0
  197. package/lib/plugin/output-channel-registry.d.ts.map +1 -1
  198. package/lib/plugin/plugin-context.d.ts +2 -0
  199. package/lib/plugin/plugin-context.d.ts.map +1 -1
  200. package/lib/plugin/plugin-context.js +47 -15
  201. package/lib/plugin/plugin-context.js.map +1 -1
  202. package/lib/plugin/plugin-manager.d.ts +1 -0
  203. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  204. package/lib/plugin/plugin-storage.d.ts +1 -0
  205. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  206. package/lib/plugin/preference-registry.d.ts +1 -0
  207. package/lib/plugin/preference-registry.d.ts.map +1 -1
  208. package/lib/plugin/quick-open.d.ts +1 -0
  209. package/lib/plugin/quick-open.d.ts.map +1 -1
  210. package/lib/plugin/scm.d.ts +2 -0
  211. package/lib/plugin/scm.d.ts.map +1 -1
  212. package/lib/plugin/scm.js +3 -3
  213. package/lib/plugin/scm.js.map +1 -1
  214. package/lib/plugin/secrets-ext.d.ts +1 -0
  215. package/lib/plugin/secrets-ext.d.ts.map +1 -1
  216. package/lib/plugin/status-bar/status-bar-item.d.ts +1 -0
  217. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  218. package/lib/plugin/status-bar-message-registry.d.ts +1 -0
  219. package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
  220. package/lib/plugin/tabs.d.ts +1 -0
  221. package/lib/plugin/tabs.d.ts.map +1 -1
  222. package/lib/plugin/tasks/task-provider.d.ts +1 -0
  223. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  224. package/lib/plugin/tasks/tasks.d.ts +1 -0
  225. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  226. package/lib/plugin/terminal-ext.d.ts +1 -0
  227. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  228. package/lib/plugin/test-item.d.ts +1 -0
  229. package/lib/plugin/test-item.d.ts.map +1 -1
  230. package/lib/plugin/tests.d.ts +1 -0
  231. package/lib/plugin/tests.d.ts.map +1 -1
  232. package/lib/plugin/text-editor.d.ts +1 -0
  233. package/lib/plugin/text-editor.d.ts.map +1 -1
  234. package/lib/plugin/text-editors.d.ts +1 -0
  235. package/lib/plugin/text-editors.d.ts.map +1 -1
  236. package/lib/plugin/timeline.d.ts +1 -0
  237. package/lib/plugin/timeline.d.ts.map +1 -1
  238. package/lib/plugin/tree/tree-views.d.ts +1 -0
  239. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  240. package/lib/plugin/type-converters.d.ts +1 -0
  241. package/lib/plugin/type-converters.d.ts.map +1 -1
  242. package/lib/plugin/types-impl.d.ts +1 -0
  243. package/lib/plugin/types-impl.d.ts.map +1 -1
  244. package/lib/plugin/uri-ext.d.ts +1 -0
  245. package/lib/plugin/uri-ext.d.ts.map +1 -1
  246. package/lib/plugin/webview-views.d.ts +1 -0
  247. package/lib/plugin/webview-views.d.ts.map +1 -1
  248. package/lib/plugin/webviews.d.ts +1 -0
  249. package/lib/plugin/webviews.d.ts.map +1 -1
  250. package/lib/plugin/window-state.d.ts +2 -1
  251. package/lib/plugin/window-state.d.ts.map +1 -1
  252. package/lib/plugin/window-state.js +8 -1
  253. package/lib/plugin/window-state.js.map +1 -1
  254. package/lib/plugin/workspace.d.ts +1 -0
  255. package/lib/plugin/workspace.d.ts.map +1 -1
  256. package/package.json +29 -29
  257. package/src/main/browser/editors-and-documents-main.ts +5 -3
  258. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +9 -8
  259. package/src/main/browser/notebooks/notebook-kernels-main.ts +2 -2
  260. package/src/main/browser/notebooks/notebooks-main.ts +13 -18
  261. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +170 -74
  262. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +237 -73
  263. package/src/main/browser/notebooks/renderers/webview-communication.ts +78 -7
  264. package/src/main/browser/plugin-ext-frontend-module.ts +6 -5
  265. package/src/main/browser/tabs/tabs-main.ts +17 -2
  266. package/src/plugin/file-system-event-service-ext-impl.ts +11 -8
  267. package/src/plugin/file-system-ext-impl.ts +7 -3
  268. package/src/plugin/file-system-watcher.spec.ts +125 -0
  269. package/src/plugin/notebook/notebooks.ts +5 -5
  270. package/src/plugin/plugin-context.ts +55 -15
  271. package/src/plugin/scm.ts +5 -4
  272. package/src/plugin/window-state.ts +7 -1
@@ -48,7 +48,7 @@ type Event<T> = vscode.Event<T>;
48
48
  type IExtensionDescription = Plugin;
49
49
  type IWaitUntil = WaitUntilEvent;
50
50
 
51
- class FileSystemWatcher implements vscode.FileSystemWatcher {
51
+ export class FileSystemWatcher implements vscode.FileSystemWatcher {
52
52
 
53
53
  private readonly _onDidCreate = new Emitter<vscode.Uri>();
54
54
  private readonly _onDidChange = new Emitter<vscode.Uri>();
@@ -68,7 +68,8 @@ class FileSystemWatcher implements vscode.FileSystemWatcher {
68
68
  return Boolean(this._config & 0b100);
69
69
  }
70
70
 
71
- constructor(dispatcher: Event<FileSystemEvents>, globPattern: string | IRelativePattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean) {
71
+ constructor(dispatcher: Event<FileSystemEvents>, globPattern: string | IRelativePattern,
72
+ ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean, excludes?: string[]) {
72
73
 
73
74
  this._config = 0;
74
75
  if (ignoreCreateEvents) {
@@ -82,12 +83,13 @@ class FileSystemWatcher implements vscode.FileSystemWatcher {
82
83
  }
83
84
 
84
85
  const parsedPattern = parse(globPattern);
86
+ const excludePatterns = excludes?.map(exclude => parse(exclude)) || [];
85
87
 
86
88
  const subscription = dispatcher(events => {
87
89
  if (!ignoreCreateEvents) {
88
90
  for (const created of events.created) {
89
91
  const uri = URI.revive(created);
90
- if (parsedPattern(uri.fsPath)) {
92
+ if (parsedPattern(uri.fsPath) && !excludePatterns.some(p => p(uri.fsPath))) {
91
93
  this._onDidCreate.fire(uri);
92
94
  }
93
95
  }
@@ -95,7 +97,7 @@ class FileSystemWatcher implements vscode.FileSystemWatcher {
95
97
  if (!ignoreChangeEvents) {
96
98
  for (const changed of events.changed) {
97
99
  const uri = URI.revive(changed);
98
- if (parsedPattern(uri.fsPath)) {
100
+ if (parsedPattern(uri.fsPath) && !excludePatterns.some(p => p(uri.fsPath))) {
99
101
  this._onDidChange.fire(uri);
100
102
  }
101
103
  }
@@ -103,7 +105,7 @@ class FileSystemWatcher implements vscode.FileSystemWatcher {
103
105
  if (!ignoreDeleteEvents) {
104
106
  for (const deleted of events.deleted) {
105
107
  const uri = URI.revive(deleted);
106
- if (parsedPattern(uri.fsPath)) {
108
+ if (parsedPattern(uri.fsPath) && !excludePatterns.some(p => p(uri.fsPath))) {
107
109
  this._onDidDelete.fire(uri);
108
110
  }
109
111
  }
@@ -113,7 +115,7 @@ class FileSystemWatcher implements vscode.FileSystemWatcher {
113
115
  this._disposable = Disposable.from(this._onDidCreate, this._onDidChange, this._onDidDelete, subscription);
114
116
  }
115
117
 
116
- dispose() {
118
+ dispose(): void {
117
119
  this._disposable.dispose();
118
120
  }
119
121
 
@@ -160,8 +162,9 @@ export class ExtHostFileSystemEventService implements ExtHostFileSystemEventServ
160
162
 
161
163
  // --- file events
162
164
 
163
- createFileSystemWatcher(globPattern: string | IRelativePattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): vscode.FileSystemWatcher {
164
- return new FileSystemWatcher(this._onFileSystemEvent.event, globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
165
+ createFileSystemWatcher(globPattern: string | IRelativePattern, ignoreCreateEvents?: boolean,
166
+ ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean, excludes?: string[]): vscode.FileSystemWatcher {
167
+ return new FileSystemWatcher(this._onFileSystemEvent.event, globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents, excludes);
165
168
  }
166
169
 
167
170
  $onFileEvent(events: FileSystemEvents) {
@@ -40,8 +40,9 @@ import { State, StateMachine, LinkComputer, Edge } from '../common/link-computer
40
40
  import { commonPrefixLength } from '@theia/core/lib/common/strings';
41
41
  import { CharCode } from '@theia/core/lib/common/char-code';
42
42
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
43
- import { Emitter } from '@theia/core/shared/vscode-languageserver-protocol';
44
43
  import { MarkdownString } from '../common/plugin-api-rpc-model';
44
+ import { Emitter } from '@theia/core/lib/common';
45
+ import { createAPIObject } from './plugin-context';
45
46
 
46
47
  type IDisposable = vscode.Disposable;
47
48
 
@@ -137,8 +138,11 @@ export class FsLinkProvider {
137
138
  }
138
139
 
139
140
  class ConsumerFileSystem implements vscode.FileSystem {
141
+ apiObject: vscode.FileSystem;
140
142
 
141
- constructor(private _proxy: FileSystemMain, private _capabilities: Map<string, number>) { }
143
+ constructor(private _proxy: FileSystemMain, private _capabilities: Map<string, number>) {
144
+ this.apiObject = createAPIObject(this);
145
+ }
142
146
 
143
147
  stat(uri: vscode.Uri): Promise<vscode.FileStat> {
144
148
  return this._proxy.$stat(uri).catch(ConsumerFileSystem._handleError);
@@ -210,7 +214,7 @@ export class FileSystemExtImpl implements FileSystemExt {
210
214
 
211
215
  private _handlePool: number = 0;
212
216
 
213
- readonly fileSystem: vscode.FileSystem;
217
+ readonly fileSystem: ConsumerFileSystem;
214
218
 
215
219
  constructor(rpc: RPCProtocol) {
216
220
  this._proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.FILE_SYSTEM_MAIN);
@@ -0,0 +1,125 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as assert from 'assert';
18
+ import { FileSystemWatcher } from './file-system-event-service-ext-impl';
19
+ import { DisposableCollection, Emitter } from '@theia/core';
20
+ import { FileSystemEvents } from '../common';
21
+ import { URI } from './types-impl';
22
+
23
+ const eventSource = new Emitter<FileSystemEvents>();
24
+ let disposables = new DisposableCollection();
25
+
26
+ function checkIgnore(ignoreCreate: number, ignoreChange: number, ignoreDelete: number): void {
27
+ const watcher = new FileSystemWatcher(eventSource.event, '**/*.js', !ignoreCreate, !ignoreChange, !ignoreDelete);
28
+ disposables.push(watcher);
29
+ const matching = URI.file('/foo/bar/zoz.js');
30
+
31
+ const changed: URI[] = [];
32
+ const created: URI[] = [];
33
+ const deleted: URI[] = [];
34
+ watcher.onDidChange(e => {
35
+ changed.push(e);
36
+ });
37
+
38
+ watcher.onDidCreate(e => {
39
+ created.push(e);
40
+ });
41
+
42
+ watcher.onDidDelete(e => {
43
+ deleted.push(e);
44
+ });
45
+
46
+ eventSource.fire({ changed: [matching], created: [matching], deleted: [matching] });
47
+
48
+ assert.equal(created.length, ignoreCreate);
49
+ assert.equal(deleted.length, ignoreDelete);
50
+ assert.equal(changed.length, ignoreChange);
51
+
52
+ }
53
+
54
+ describe('File Watcher Test', () => {
55
+ afterEach(() => {
56
+ disposables.dispose();
57
+ disposables = new DisposableCollection();
58
+ });
59
+
60
+ it('Should match files', () => {
61
+ const watcher = new FileSystemWatcher(eventSource.event, '**/*.js');
62
+ disposables.push(watcher);
63
+ const matching = URI.file('/foo/bar/zoz.js');
64
+ const notMatching = URI.file('/foo/bar/zoz.ts');
65
+ const changed: URI[] = [];
66
+ const created: URI[] = [];
67
+ const deleted: URI[] = [];
68
+ watcher.onDidChange(e => {
69
+ changed.push(e);
70
+ });
71
+
72
+ watcher.onDidCreate(e => {
73
+ created.push(e);
74
+ });
75
+
76
+ watcher.onDidDelete(e => {
77
+ deleted.push(e);
78
+ });
79
+
80
+ const URIs = [matching, notMatching];
81
+ eventSource.fire({ changed: URIs, created: URIs, deleted: URIs });
82
+ assert.equal(matching.toString(), changed[0]?.toString());
83
+ assert.equal(matching.toString(), created[0]?.toString());
84
+ assert.equal(matching.toString(), deleted[0]?.toString());
85
+ });
86
+
87
+ it('Should ignore created', () => {
88
+ checkIgnore(0, 1, 1);
89
+ });
90
+
91
+ it('Should ignore changed', () => {
92
+ checkIgnore(1, 0, 1);
93
+ });
94
+
95
+ it('Should ignore deleted', () => {
96
+ checkIgnore(1, 1, 0);
97
+ });
98
+
99
+ it('Should exclude files', () => {
100
+ const watcher = new FileSystemWatcher(eventSource.event, '**/*.js', false, false, false, ['**/bar/**']);
101
+ disposables.push(watcher);
102
+ const notMatching = URI.file('/foo/bar/zoz.js');
103
+ const matching = URI.file('/foo/gux/zoz.js');
104
+ const changed: URI[] = [];
105
+ const created: URI[] = [];
106
+ const deleted: URI[] = [];
107
+ watcher.onDidChange(e => {
108
+ changed.push(e);
109
+ });
110
+
111
+ watcher.onDidCreate(e => {
112
+ created.push(e);
113
+ });
114
+
115
+ watcher.onDidDelete(e => {
116
+ deleted.push(e);
117
+ });
118
+
119
+ const URIs = [matching, notMatching];
120
+ eventSource.fire({ changed: URIs, created: URIs, deleted: URIs });
121
+ assert.equal(matching.toString(), changed[0]?.toString());
122
+ assert.equal(matching.toString(), created[0]?.toString());
123
+ assert.equal(matching.toString(), deleted[0]?.toString());
124
+ });
125
+ });
@@ -22,14 +22,14 @@ import { CancellationToken, Disposable, DisposableCollection, Emitter, Event, UR
22
22
  import { URI as TheiaURI } from '../types-impl';
23
23
  import * as theia from '@theia/plugin';
24
24
  import {
25
- CommandRegistryExt, NotebookCellStatusBarListDto, NotebookDataDto,
25
+ NotebookCellStatusBarListDto, NotebookDataDto,
26
26
  NotebookDocumentsAndEditorsDelta, NotebookDocumentShowOptions, NotebookDocumentsMain, NotebookEditorAddData, NotebookEditorsMain, NotebooksExt, NotebooksMain, Plugin,
27
27
  PLUGIN_RPC_CONTEXT
28
28
  } from '../../common';
29
29
  import { Cache } from '../../common/cache';
30
30
  import { RPCProtocol } from '../../common/rpc-protocol';
31
31
  import { UriComponents } from '../../common/uri-components';
32
- import { CommandsConverter } from '../command-registry';
32
+ import { CommandRegistryImpl, CommandsConverter } from '../command-registry';
33
33
  import * as typeConverters from '../type-converters';
34
34
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
35
35
  import { Cell, NotebookDocument } from './notebook-document';
@@ -74,10 +74,11 @@ export class NotebooksExtImpl implements NotebooksExt {
74
74
 
75
75
  constructor(
76
76
  rpc: RPCProtocol,
77
- commands: CommandRegistryExt,
77
+ commands: CommandRegistryImpl,
78
78
  private textDocumentsAndEditors: EditorsAndDocumentsExtImpl,
79
79
  private textDocuments: DocumentsExtImpl,
80
80
  ) {
81
+ this.commandsConverter = commands.converter;
81
82
  this.notebookProxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOKS_MAIN);
82
83
  this.notebookDocumentsProxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_MAIN);
83
84
  this.notebookEditors = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN);
@@ -329,6 +330,7 @@ export class NotebooksExtImpl implements NotebooksExt {
329
330
  if (delta.newActiveEditor === null) {
330
331
  // clear active notebook as current active editor is non-notebook editor
331
332
  this.activeNotebookEditor = undefined;
333
+ this.onDidChangeActiveNotebookEditorEmitter.fire(undefined);
332
334
  } else if (delta.newActiveEditor) {
333
335
  const activeEditor = this.editors.get(delta.newActiveEditor);
334
336
  if (!activeEditor) {
@@ -340,8 +342,6 @@ export class NotebooksExtImpl implements NotebooksExt {
340
342
  newActiveEditor: null
341
343
  });
342
344
  }
343
- }
344
- if (delta.newActiveEditor !== undefined) {
345
345
  this.onDidChangeActiveNotebookEditorEmitter.fire(this.activeNotebookEditor?.apiEditor);
346
346
  }
347
347
  }
@@ -278,6 +278,22 @@ import { NotebookDocumentsExtImpl } from './notebook/notebook-documents';
278
278
  import { NotebookEditorsExtImpl } from './notebook/notebook-editors';
279
279
  import { TestingExtImpl } from './tests';
280
280
  import { UriExtImpl } from './uri-ext';
281
+ import { isObject } from '@theia/core';
282
+
283
+ export function createAPIObject<T extends Object>(rawObject: T): T {
284
+ return new Proxy(rawObject, {
285
+ get(target, p, receiver) {
286
+ const isOwnProperty = !!Object.getOwnPropertyDescriptor(target, p);
287
+ const val = Reflect.get(target, p);
288
+ if (!isOwnProperty && typeof val === 'function') {
289
+ // bind functions that are inherited from the prototype to the object itself.
290
+ // This should handle the case of events.
291
+ return val.bind(target);
292
+ }
293
+ return val;
294
+ },
295
+ }) as T;
296
+ }
281
297
 
282
298
  export function createAPIFactory(
283
299
  rpc: RPCProtocol,
@@ -496,7 +512,8 @@ export function createAPIFactory(
496
512
  return quickOpenExt.showQuickPick(plugin, items, options, token);
497
513
  },
498
514
  createQuickPick<T extends theia.QuickPickItem>(): theia.QuickPick<T> {
499
- return quickOpenExt.createQuickPick(plugin);
515
+
516
+ return createAPIObject(quickOpenExt.createQuickPick(plugin));
500
517
  },
501
518
  showWorkspaceFolderPick(options?: theia.WorkspaceFolderPickOptions): PromiseLike<theia.WorkspaceFolder | undefined> {
502
519
  return workspaceExt.pickWorkspaceFolder(options);
@@ -535,9 +552,12 @@ export function createAPIFactory(
535
552
  priority = priorityOrAlignment;
536
553
  }
537
554
 
555
+ // TODO: here
538
556
  return statusBarMessageRegistryExt.createStatusBarItem(alignment, priority, id);
539
557
  },
540
558
  createOutputChannel(name: string, options?: { log: true }): any {
559
+
560
+ // TODO: here
541
561
  return !options
542
562
  ? outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin))
543
563
  : outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin), options);
@@ -546,7 +566,7 @@ export function createAPIFactory(
546
566
  title: string,
547
567
  showOptions: theia.ViewColumn | theia.WebviewPanelShowOptions,
548
568
  options: theia.WebviewPanelOptions & theia.WebviewOptions = {}): theia.WebviewPanel {
549
- return webviewExt.createWebview(viewType, title, showOptions, options, plugin);
569
+ return createAPIObject(webviewExt.createWebview(viewType, title, showOptions, options, plugin));
550
570
  },
551
571
  registerWebviewPanelSerializer(viewType: string, serializer: theia.WebviewPanelSerializer): theia.Disposable {
552
572
  return webviewExt.registerWebviewPanelSerializer(viewType, serializer, plugin);
@@ -574,19 +594,19 @@ export function createAPIFactory(
574
594
  createTerminal(nameOrOptions: theia.TerminalOptions | theia.ExtensionTerminalOptions | theia.ExtensionTerminalOptions | (string | undefined),
575
595
  shellPath?: string,
576
596
  shellArgs?: string[] | string): theia.Terminal {
577
- return terminalExt.createTerminal(plugin, nameOrOptions, shellPath, shellArgs);
597
+ return createAPIObject(terminalExt.createTerminal(plugin, nameOrOptions, shellPath, shellArgs));
578
598
  },
579
599
  onDidChangeTerminalState,
580
600
  onDidCloseTerminal,
581
601
  onDidOpenTerminal,
582
602
  createTextEditorDecorationType(options: theia.DecorationRenderOptions): theia.TextEditorDecorationType {
583
- return editors.createTextEditorDecorationType(options);
603
+ return createAPIObject(editors.createTextEditorDecorationType(options));
584
604
  },
585
605
  registerTreeDataProvider<T>(viewId: string, treeDataProvider: theia.TreeDataProvider<T>): Disposable {
586
606
  return treeViewsExt.registerTreeDataProvider(plugin, viewId, treeDataProvider);
587
607
  },
588
608
  createTreeView<T>(viewId: string, options: theia.TreeViewOptions<T>): theia.TreeView<T> {
589
- return treeViewsExt.createTreeView(plugin, viewId, options);
609
+ return createAPIObject(treeViewsExt.createTreeView(plugin, viewId, options));
590
610
  },
591
611
  withScmProgress<R>(task: (progress: theia.Progress<number>) => Thenable<R>) {
592
612
  const options: ProgressOptions = { location: ProgressLocation.SourceControl };
@@ -605,7 +625,7 @@ export function createAPIFactory(
605
625
  return uriExt.registerUriHandler(handler, pluginToPluginInfo(plugin));
606
626
  },
607
627
  createInputBox(): theia.InputBox {
608
- return quickOpenExt.createInputBox(plugin);
628
+ return createAPIObject(quickOpenExt.createInputBox(plugin));
609
629
  },
610
630
  registerTerminalLinkProvider(provider: theia.TerminalLinkProvider): theia.Disposable {
611
631
  return terminalExt.registerTerminalLinkProvider(provider);
@@ -650,10 +670,26 @@ export function createAPIFactory(
650
670
  onDidStartTerminalShellExecution: Event.None
651
671
  };
652
672
 
673
+ function createFileSystemWatcher(pattern: RelativePattern, options?: theia.FileSystemWatcherOptions): theia.FileSystemWatcher;
674
+ function createFileSystemWatcher(pattern: theia.GlobPattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?:
675
+ boolean, ignoreDeleteEvents?: boolean): theia.FileSystemWatcher;
676
+ function createFileSystemWatcher(pattern: RelativePattern | theia.GlobPattern,
677
+ ignoreCreateOrOptions?: theia.FileSystemWatcherOptions | boolean, ignoreChangeEventsBoolean?: boolean, ignoreDeleteEventsBoolean?: boolean): theia.FileSystemWatcher {
678
+ if (isObject<theia.FileSystemWatcherOptions>(ignoreCreateOrOptions)) {
679
+ const { ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents, excludes } = (ignoreCreateOrOptions as theia.FileSystemWatcherOptions);
680
+ return createAPIObject(
681
+ extHostFileSystemEvent.createFileSystemWatcher(fromGlobPattern(pattern),
682
+ ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents, excludes));
683
+ } else {
684
+ return createAPIObject(
685
+ extHostFileSystemEvent.createFileSystemWatcher(fromGlobPattern(pattern),
686
+ ignoreCreateOrOptions as boolean, ignoreChangeEventsBoolean, ignoreDeleteEventsBoolean));
687
+ }
688
+ }
653
689
  const workspace: typeof theia.workspace = {
654
690
 
655
691
  get fs(): theia.FileSystem {
656
- return fileSystemExt.fileSystem;
692
+ return fileSystemExt.fileSystem.apiObject;
657
693
  },
658
694
 
659
695
  get rootPath(): string | undefined {
@@ -755,8 +791,7 @@ export function createAPIFactory(
755
791
  // Notebook extension will create a document in openNotebookDocument() or create openNotebookDocument()
756
792
  return notebooksExt.getNotebookDocument(uri).apiNotebook;
757
793
  },
758
- createFileSystemWatcher: (pattern, ignoreCreate, ignoreChange, ignoreDelete): theia.FileSystemWatcher =>
759
- extHostFileSystemEvent.createFileSystemWatcher(fromGlobPattern(pattern), ignoreCreate, ignoreChange, ignoreDelete),
794
+ createFileSystemWatcher,
760
795
  findFiles(include: theia.GlobPattern, exclude?: theia.GlobPattern | null, maxResults?: number, token?: CancellationToken): PromiseLike<URI[]> {
761
796
  return workspaceExt.findFiles(include, exclude, maxResults, token);
762
797
  },
@@ -849,7 +884,7 @@ export function createAPIFactory(
849
884
  return telemetryExt.onDidChangeTelemetryEnabled;
850
885
  },
851
886
  createTelemetryLogger(sender: theia.TelemetrySender, options?: theia.TelemetryLoggerOptions): theia.TelemetryLogger {
852
- return telemetryExt.createTelemetryLogger(sender, options);
887
+ return createAPIObject(telemetryExt.createTelemetryLogger(sender, options));
853
888
  },
854
889
  get remoteName(): string | undefined { return envExt.remoteName; },
855
890
  get machineId(): string { return envExt.machineId; },
@@ -924,7 +959,7 @@ export function createAPIFactory(
924
959
  return <any>languagesExt.getDiagnostics(resource);
925
960
  },
926
961
  createDiagnosticCollection(name?: string): theia.DiagnosticCollection {
927
- return languagesExt.createDiagnosticCollection(name);
962
+ return createAPIObject(languagesExt.createDiagnosticCollection(name));
928
963
  },
929
964
  setLanguageConfiguration(language: string, configuration: theia.LanguageConfiguration): theia.Disposable {
930
965
  return languagesExt.setLanguageConfiguration(language, configuration);
@@ -1061,7 +1096,7 @@ export function createAPIFactory(
1061
1096
 
1062
1097
  const tests: typeof theia.tests = {
1063
1098
  createTestController(id, label: string) {
1064
- return testingExt.createTestController(id, label);
1099
+ return createAPIObject(testingExt.createTestController(id, label));
1065
1100
  }
1066
1101
  };
1067
1102
  /* End of Tests API */
@@ -1173,6 +1208,7 @@ export function createAPIFactory(
1173
1208
  },
1174
1209
 
1175
1210
  get taskExecutions(): ReadonlyArray<theia.TaskExecution> {
1211
+ // TODO: here
1176
1212
  return tasksExt.taskExecutions;
1177
1213
  },
1178
1214
  onDidStartTask(listener, thisArg?, disposables?) {
@@ -1193,19 +1229,19 @@ export function createAPIFactory(
1193
1229
  get inputBox(): theia.SourceControlInputBox {
1194
1230
  const inputBox = scmExt.getLastInputBox(plugin);
1195
1231
  if (inputBox) {
1196
- return inputBox;
1232
+ return inputBox.apiObject;
1197
1233
  } else {
1198
1234
  throw new Error('Input box not found!');
1199
1235
  }
1200
1236
  },
1201
1237
  createSourceControl(id: string, label: string, rootUri?: URI): theia.SourceControl {
1202
- return scmExt.createSourceControl(plugin, id, label, rootUri);
1238
+ return createAPIObject(scmExt.createSourceControl(plugin, id, label, rootUri));
1203
1239
  }
1204
1240
  };
1205
1241
 
1206
1242
  const comments: typeof theia.comments = {
1207
1243
  createCommentController(id: string, label: string): theia.CommentController {
1208
- return commentsExt.createCommentController(plugin, id, label);
1244
+ return createAPIObject(commentsExt.createCommentController(plugin, id, label));
1209
1245
  }
1210
1246
  };
1211
1247
 
@@ -1268,6 +1304,10 @@ export function createAPIFactory(
1268
1304
  registerMappedEditsProvider(documentSelector: theia.DocumentSelector, provider: theia.MappedEditsProvider): Disposable {
1269
1305
  return Disposable.NULL;
1270
1306
  },
1307
+ /** @stubbed MappedEditsProvider */
1308
+ registerMappedEditsProvider2(provider: theia.MappedEditsProvider2) {
1309
+ return Disposable.NULL;
1310
+ },
1271
1311
  /** @stubbed ChatRequestHandler */
1272
1312
  createChatParticipant(id: string, handler: theia.ChatRequestHandler): theia.ChatParticipant {
1273
1313
  return {
package/src/plugin/scm.ts CHANGED
@@ -39,6 +39,7 @@ import { URI, ThemeIcon } from './types-impl';
39
39
  import { ScmCommandArg } from '../common/plugin-api-rpc';
40
40
  import { sep } from '@theia/core/lib/common/paths';
41
41
  import { PluginIconPath } from './plugin-icon-path';
42
+ import { createAPIObject } from './plugin-context';
42
43
  type ProviderHandle = number;
43
44
  type GroupHandle = number;
44
45
  type ResourceStateHandle = number;
@@ -290,6 +291,7 @@ interface ValidateInput {
290
291
  export class ScmInputBoxImpl implements theia.SourceControlInputBox {
291
292
 
292
293
  private _value: string = '';
294
+ apiObject: theia.SourceControlInputBox;
293
295
 
294
296
  get value(): string {
295
297
  return this._value;
@@ -354,7 +356,7 @@ export class ScmInputBoxImpl implements theia.SourceControlInputBox {
354
356
  }
355
357
 
356
358
  constructor(private plugin: Plugin, private proxy: ScmMain, private sourceControlHandle: number) {
357
- // noop
359
+ this.apiObject = createAPIObject(this);
358
360
  }
359
361
 
360
362
  onInputBoxValueChange(value: string): void {
@@ -543,8 +545,7 @@ class SourceControlImpl implements theia.SourceControl {
543
545
  return this._rootUri;
544
546
  }
545
547
 
546
- private _inputBox: ScmInputBoxImpl;
547
- get inputBox(): ScmInputBoxImpl { return this._inputBox; }
548
+ readonly inputBox: ScmInputBoxImpl;
548
549
 
549
550
  private _count: number | undefined = undefined;
550
551
 
@@ -642,7 +643,7 @@ class SourceControlImpl implements theia.SourceControl {
642
643
  private _label: string,
643
644
  private _rootUri?: theia.Uri
644
645
  ) {
645
- this._inputBox = new ScmInputBoxImpl(plugin, this.proxy, this.handle);
646
+ this.inputBox = new ScmInputBoxImpl(plugin, this.proxy, this.handle);
646
647
  this.proxy.$registerSourceControl(this.handle, _id, _label, _rootUri);
647
648
  }
648
649
 
@@ -55,7 +55,13 @@ export class WindowStateExtImpl implements WindowStateExt {
55
55
  this.windowStateChangedEmitter.fire(this.windowStateCached);
56
56
  }
57
57
 
58
- openUri(uri: URI): Promise<boolean> {
58
+ async openUri(uriOrString: URI | string): Promise<boolean> {
59
+ let uri: URI;
60
+ if (typeof uriOrString === 'string') {
61
+ uri = URI.parse(uriOrString);
62
+ } else {
63
+ uri = uriOrString;
64
+ }
59
65
  if (!uri.scheme.trim().length) {
60
66
  throw new Error('Invalid scheme - cannot be empty');
61
67
  }