@theia/plugin-ext 1.65.0-next.28 → 1.65.0-next.47
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.
- package/lib/common/plugin-api-rpc-model.d.ts +1 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +1 -0
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/main/browser/authentication-main.d.ts +1 -0
- package/lib/main/browser/authentication-main.d.ts.map +1 -1
- package/lib/main/browser/command-registry-main.d.ts +1 -0
- package/lib/main/browser/command-registry-main.d.ts.map +1 -1
- package/lib/main/browser/comments/comment-thread-widget.d.ts +1 -0
- package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
- package/lib/main/browser/comments/comments-main.d.ts +1 -0
- package/lib/main/browser/comments/comments-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -0
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +1 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/languages-main.d.ts +1 -0
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js +1 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
- package/lib/main/browser/notebooks/notebooks-main.d.ts +1 -0
- package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js +7 -0
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
- package/lib/main/browser/plugin-ext-argument-processor.d.ts +12 -0
- package/lib/main/browser/plugin-ext-argument-processor.d.ts.map +1 -0
- package/lib/main/browser/plugin-ext-argument-processor.js +41 -0
- package/lib/main/browser/plugin-ext-argument-processor.js.map +1 -0
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +3 -0
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/quick-open-main.d.ts +1 -0
- package/lib/main/browser/quick-open-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.d.ts +1 -0
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +3 -0
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/tree-view-decorator-service.d.ts +1 -0
- package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +1 -0
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-views-main.d.ts +1 -0
- package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
- package/lib/main/browser/view/tree-views-main.js +1 -1
- package/lib/main/browser/view/tree-views-main.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -0
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview-views/webview-views-main.d.ts +1 -0
- package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
- package/lib/main/browser/webviews-main.d.ts +1 -0
- package/lib/main/browser/webviews-main.d.ts.map +1 -1
- package/lib/main/browser/workspace-main.d.ts +1 -0
- package/lib/main/browser/workspace-main.d.ts.map +1 -1
- package/lib/plugin/authentication-ext.d.ts +1 -0
- package/lib/plugin/authentication-ext.d.ts.map +1 -1
- package/lib/plugin/clipboard-ext.d.ts +1 -0
- package/lib/plugin/clipboard-ext.d.ts.map +1 -1
- package/lib/plugin/command-registry.d.ts +1 -0
- package/lib/plugin/command-registry.d.ts.map +1 -1
- package/lib/plugin/comments.d.ts +1 -0
- package/lib/plugin/comments.d.ts.map +1 -1
- package/lib/plugin/custom-editors.d.ts +1 -0
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/debug/debug-ext.d.ts +1 -0
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -1
- package/lib/plugin/decorations.d.ts +1 -0
- package/lib/plugin/decorations.d.ts.map +1 -1
- package/lib/plugin/dialogs.d.ts +1 -0
- package/lib/plugin/dialogs.d.ts.map +1 -1
- package/lib/plugin/document-data.d.ts +1 -0
- package/lib/plugin/document-data.d.ts.map +1 -1
- package/lib/plugin/documents.d.ts +1 -0
- package/lib/plugin/documents.d.ts.map +1 -1
- package/lib/plugin/env.d.ts +1 -0
- package/lib/plugin/env.d.ts.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts +1 -0
- package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-ext-impl.d.ts +1 -0
- package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
- package/lib/plugin/label-service.d.ts +1 -0
- package/lib/plugin/label-service.d.ts.map +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts +1 -0
- package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/code-action.d.ts +1 -0
- package/lib/plugin/languages/code-action.d.ts.map +1 -1
- package/lib/plugin/languages/color.d.ts +1 -0
- package/lib/plugin/languages/color.d.ts.map +1 -1
- package/lib/plugin/languages/completion.d.ts +1 -0
- package/lib/plugin/languages/completion.d.ts.map +1 -1
- package/lib/plugin/languages/declaration.d.ts +1 -0
- package/lib/plugin/languages/declaration.d.ts.map +1 -1
- package/lib/plugin/languages/definition.d.ts +1 -0
- package/lib/plugin/languages/definition.d.ts.map +1 -1
- package/lib/plugin/languages/diagnostics.d.ts +1 -0
- package/lib/plugin/languages/diagnostics.d.ts.map +1 -1
- package/lib/plugin/languages/document-drop-edit.d.ts +1 -0
- package/lib/plugin/languages/document-drop-edit.d.ts.map +1 -1
- package/lib/plugin/languages/document-formatting.d.ts +1 -0
- package/lib/plugin/languages/document-formatting.d.ts.map +1 -1
- package/lib/plugin/languages/document-highlight.d.ts +1 -0
- package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
- package/lib/plugin/languages/evaluatable-expression.d.ts +1 -0
- package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -1
- package/lib/plugin/languages/folding.d.ts +1 -0
- package/lib/plugin/languages/folding.d.ts.map +1 -1
- package/lib/plugin/languages/hover.d.ts +1 -0
- package/lib/plugin/languages/hover.d.ts.map +1 -1
- package/lib/plugin/languages/implementation.d.ts +1 -0
- package/lib/plugin/languages/implementation.d.ts.map +1 -1
- package/lib/plugin/languages/inlay-hints.d.ts +1 -0
- package/lib/plugin/languages/inlay-hints.d.ts.map +1 -1
- package/lib/plugin/languages/inline-completion.d.ts +1 -0
- package/lib/plugin/languages/inline-completion.d.ts.map +1 -1
- package/lib/plugin/languages/inline-values.d.ts +1 -0
- package/lib/plugin/languages/inline-values.d.ts.map +1 -1
- package/lib/plugin/languages/lens.d.ts +1 -0
- package/lib/plugin/languages/lens.d.ts.map +1 -1
- package/lib/plugin/languages/link-provider.d.ts +1 -0
- package/lib/plugin/languages/link-provider.d.ts.map +1 -1
- package/lib/plugin/languages/linked-editing-range.d.ts +1 -0
- package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -1
- package/lib/plugin/languages/on-type-formatting.d.ts +1 -0
- package/lib/plugin/languages/on-type-formatting.d.ts.map +1 -1
- package/lib/plugin/languages/outline.d.ts +1 -0
- package/lib/plugin/languages/outline.d.ts.map +1 -1
- package/lib/plugin/languages/range-formatting.d.ts +1 -0
- package/lib/plugin/languages/range-formatting.d.ts.map +1 -1
- package/lib/plugin/languages/reference.d.ts +1 -0
- package/lib/plugin/languages/reference.d.ts.map +1 -1
- package/lib/plugin/languages/rename.d.ts +1 -0
- package/lib/plugin/languages/rename.d.ts.map +1 -1
- package/lib/plugin/languages/selection-range.d.ts +1 -0
- package/lib/plugin/languages/selection-range.d.ts.map +1 -1
- package/lib/plugin/languages/semantic-highlighting.d.ts +1 -0
- package/lib/plugin/languages/semantic-highlighting.d.ts.map +1 -1
- package/lib/plugin/languages/signature.d.ts +1 -0
- package/lib/plugin/languages/signature.d.ts.map +1 -1
- package/lib/plugin/languages/type-definition.d.ts +1 -0
- package/lib/plugin/languages/type-definition.d.ts.map +1 -1
- package/lib/plugin/languages/type-hierarchy.d.ts +1 -0
- package/lib/plugin/languages/type-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/util.d.ts +1 -0
- package/lib/plugin/languages/util.d.ts.map +1 -1
- package/lib/plugin/languages/workspace-symbol.d.ts +1 -0
- package/lib/plugin/languages/workspace-symbol.d.ts.map +1 -1
- package/lib/plugin/languages-utils.d.ts +1 -0
- package/lib/plugin/languages-utils.d.ts.map +1 -1
- package/lib/plugin/languages.d.ts +1 -0
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/lm-ext.d.ts +1 -0
- package/lib/plugin/lm-ext.d.ts.map +1 -1
- package/lib/plugin/markdown-string.d.ts +1 -0
- package/lib/plugin/markdown-string.d.ts.map +1 -1
- package/lib/plugin/message-registry.d.ts +1 -0
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +1 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-document.d.ts +1 -0
- package/lib/plugin/notebook/notebook-document.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-documents.d.ts +1 -0
- package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-editor.d.ts +1 -0
- package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-editors.d.ts +1 -0
- package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-kernels.d.ts +1 -0
- package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-renderers.d.ts +1 -0
- package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -1
- package/lib/plugin/notebook/notebooks.d.ts +1 -0
- package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
- package/lib/plugin/notification.d.ts +1 -0
- package/lib/plugin/notification.d.ts.map +1 -1
- package/lib/plugin/output-channel/log-output-channel.d.ts +1 -0
- package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -1
- package/lib/plugin/output-channel/output-channel-item.d.ts +1 -0
- package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
- package/lib/plugin/output-channel-registry.d.ts +1 -0
- package/lib/plugin/output-channel-registry.d.ts.map +1 -1
- package/lib/plugin/plugin-context.d.ts +1 -0
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +3 -2
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +1 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +1 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/preference-registry.d.ts +1 -0
- package/lib/plugin/preference-registry.d.ts.map +1 -1
- package/lib/plugin/quick-open.d.ts +1 -0
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/scm.d.ts +1 -0
- package/lib/plugin/scm.d.ts.map +1 -1
- package/lib/plugin/secrets-ext.d.ts +1 -0
- package/lib/plugin/secrets-ext.d.ts.map +1 -1
- package/lib/plugin/status-bar/status-bar-item.d.ts +4 -1
- package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
- package/lib/plugin/status-bar/status-bar-item.js +46 -1
- package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
- package/lib/plugin/status-bar-message-registry.d.ts +4 -1
- package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
- package/lib/plugin/status-bar-message-registry.js +3 -2
- package/lib/plugin/status-bar-message-registry.js.map +1 -1
- package/lib/plugin/tabs.d.ts +1 -0
- package/lib/plugin/tabs.d.ts.map +1 -1
- package/lib/plugin/tasks/task-provider.d.ts +1 -0
- package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +1 -0
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +1 -0
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/test-item.d.ts +1 -0
- package/lib/plugin/test-item.d.ts.map +1 -1
- package/lib/plugin/tests.d.ts +1 -0
- package/lib/plugin/tests.d.ts.map +1 -1
- package/lib/plugin/text-editor.d.ts +1 -0
- package/lib/plugin/text-editor.d.ts.map +1 -1
- package/lib/plugin/text-editors.d.ts +1 -0
- package/lib/plugin/text-editors.d.ts.map +1 -1
- package/lib/plugin/timeline.d.ts +1 -0
- package/lib/plugin/timeline.d.ts.map +1 -1
- package/lib/plugin/tree/tree-views.d.ts +1 -0
- package/lib/plugin/tree/tree-views.d.ts.map +1 -1
- package/lib/plugin/type-converters.d.ts +1 -0
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/types-impl.d.ts +1 -0
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/uri-ext.d.ts +1 -0
- package/lib/plugin/uri-ext.d.ts.map +1 -1
- package/lib/plugin/webview-views.d.ts +1 -0
- package/lib/plugin/webview-views.d.ts.map +1 -1
- package/lib/plugin/webviews.d.ts +1 -0
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/window-state.d.ts +1 -0
- package/lib/plugin/window-state.d.ts.map +1 -1
- package/lib/plugin/workspace.d.ts +1 -0
- package/lib/plugin/workspace.d.ts.map +1 -1
- package/package.json +29 -29
- package/src/main/browser/menus/menus-contribution-handler.ts +2 -2
- package/src/main/browser/menus/vscode-theia-menu-mappings.ts +2 -1
- package/src/main/browser/notebooks/renderers/output-webview-internal.ts +8 -0
- package/src/main/browser/plugin-ext-argument-processor.ts +39 -0
- package/src/main/browser/plugin-ext-frontend-module.ts +4 -0
- package/src/main/browser/view/plugin-view-registry.ts +3 -0
- package/src/main/browser/view/tree-views-main.ts +1 -1
- package/src/main/browser/webview/pre/main.js +13 -10
- package/src/plugin/plugin-context.ts +5 -3
- package/src/plugin/status-bar/status-bar-item.ts +54 -0
- package/src/plugin/status-bar-message-registry.ts +3 -2
|
@@ -250,9 +250,11 @@ delete window.frameElement;
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
let baseElement = event.view.document.getElementsByTagName('base')[0];
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
253
|
+
|
|
254
|
+
// Use composedPath to get the event path through shadow DOM
|
|
255
|
+
const path = event.composedPath ? event.composedPath() : [event.target];
|
|
256
|
+
|
|
257
|
+
for (const node of path) {
|
|
256
258
|
if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
|
|
257
259
|
if (node.getAttribute('href') === '#') {
|
|
258
260
|
event.view.scrollTo(0, 0);
|
|
@@ -267,7 +269,6 @@ delete window.frameElement;
|
|
|
267
269
|
event.preventDefault();
|
|
268
270
|
break;
|
|
269
271
|
}
|
|
270
|
-
node = node.parentNode;
|
|
271
272
|
}
|
|
272
273
|
};
|
|
273
274
|
|
|
@@ -282,13 +283,14 @@ delete window.frameElement;
|
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
if (event.button === 1) {
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
// Use composedPath to get the event path through shadow DOM
|
|
287
|
+
const path = event.composedPath ? event.composedPath() : [event.target];
|
|
288
|
+
|
|
289
|
+
for (const node of path) {
|
|
287
290
|
if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
|
|
288
291
|
event.preventDefault();
|
|
289
292
|
break;
|
|
290
293
|
}
|
|
291
|
-
node = node.parentNode;
|
|
292
294
|
}
|
|
293
295
|
}
|
|
294
296
|
};
|
|
@@ -354,16 +356,17 @@ delete window.frameElement;
|
|
|
354
356
|
host.postMessage('did-context-menu', {
|
|
355
357
|
clientX: e.clientX,
|
|
356
358
|
clientY: e.clientY,
|
|
357
|
-
context: findVscodeContext(e.
|
|
359
|
+
context: findVscodeContext(e.composedPath(), 0)
|
|
358
360
|
});
|
|
359
361
|
};
|
|
360
362
|
|
|
361
|
-
function findVscodeContext(
|
|
363
|
+
function findVscodeContext(nodes, index) {
|
|
364
|
+
const node = nodes[index];
|
|
362
365
|
if (node) {
|
|
363
366
|
if (node.dataset?.vscodeContext) {
|
|
364
367
|
return JSON.parse(node.dataset.vscodeContext);
|
|
365
368
|
}
|
|
366
|
-
return findVscodeContext(
|
|
369
|
+
return findVscodeContext(nodes, ++index);
|
|
367
370
|
}
|
|
368
371
|
return {};
|
|
369
372
|
}
|
|
@@ -240,7 +240,8 @@ import {
|
|
|
240
240
|
TerminalCompletionItemKind,
|
|
241
241
|
TerminalCompletionList,
|
|
242
242
|
McpHttpServerDefinition,
|
|
243
|
-
McpStdioServerDefinition
|
|
243
|
+
McpStdioServerDefinition,
|
|
244
|
+
InteractiveWindowInput
|
|
244
245
|
} from './types-impl';
|
|
245
246
|
import { AuthenticationExtImpl } from './authentication-ext';
|
|
246
247
|
import { SymbolKind } from '../common/plugin-api-rpc-model';
|
|
@@ -333,7 +334,7 @@ export function createAPIFactory(
|
|
|
333
334
|
const notebookRenderers = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_RENDERERS_EXT, new NotebookRenderersExtImpl(rpc, notebooksExt));
|
|
334
335
|
const notebookKernels = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_KERNELS_EXT, new NotebookKernelsExtImpl(rpc, notebooksExt, commandRegistry, webviewExt, workspaceExt));
|
|
335
336
|
const notebookDocuments = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_EXT, new NotebookDocumentsExtImpl(notebooksExt));
|
|
336
|
-
const statusBarMessageRegistryExt = new StatusBarMessageRegistryExt(rpc);
|
|
337
|
+
const statusBarMessageRegistryExt = new StatusBarMessageRegistryExt(rpc, commandRegistry);
|
|
337
338
|
const terminalExt = rpc.set(MAIN_RPC_CONTEXT.TERMINAL_EXT, new TerminalServiceExtImpl(rpc));
|
|
338
339
|
const outputChannelRegistryExt = rpc.set(MAIN_RPC_CONTEXT.OUTPUT_CHANNEL_REGISTRY_EXT, new OutputChannelRegistryExtImpl(rpc));
|
|
339
340
|
const treeViewsExt = rpc.set(MAIN_RPC_CONTEXT.TREE_VIEWS_EXT, new TreeViewsExtImpl(rpc, commandRegistry));
|
|
@@ -1614,7 +1615,8 @@ export function createAPIFactory(
|
|
|
1614
1615
|
TerminalCompletionItemKind,
|
|
1615
1616
|
TerminalCompletionList,
|
|
1616
1617
|
McpHttpServerDefinition,
|
|
1617
|
-
McpStdioServerDefinition
|
|
1618
|
+
McpStdioServerDefinition,
|
|
1619
|
+
TabInputInteractiveWindow: InteractiveWindowInput,
|
|
1618
1620
|
};
|
|
1619
1621
|
};
|
|
1620
1622
|
}
|
|
@@ -17,6 +17,9 @@ import * as theia from '@theia/plugin';
|
|
|
17
17
|
import { ThemeColor, StatusBarAlignment } from '../types-impl';
|
|
18
18
|
import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc';
|
|
19
19
|
import { UUID } from '@theia/core/shared/@lumino/coreutils';
|
|
20
|
+
import { CommandRegistryImpl } from '../command-registry';
|
|
21
|
+
import { MarkdownString } from '../markdown-string';
|
|
22
|
+
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
20
23
|
|
|
21
24
|
export class StatusBarItemImpl implements theia.StatusBarItem {
|
|
22
25
|
|
|
@@ -45,6 +48,7 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
|
|
|
45
48
|
_proxy: StatusBarMessageRegistryMain;
|
|
46
49
|
|
|
47
50
|
constructor(_proxy: StatusBarMessageRegistryMain,
|
|
51
|
+
private readonly commandRegistry: CommandRegistryImpl,
|
|
48
52
|
alignment: StatusBarAlignment = StatusBarAlignment.Left,
|
|
49
53
|
priority: number = 0,
|
|
50
54
|
id = StatusBarItemImpl.nextId()) {
|
|
@@ -105,6 +109,56 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
|
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
public set tooltip(tooltip: string | theia.MarkdownString | undefined) {
|
|
112
|
+
if (tooltip && MarkdownString.isMarkdownString(tooltip)) {
|
|
113
|
+
const markdownTooltip = tooltip;
|
|
114
|
+
const content = markdownTooltip.value;
|
|
115
|
+
// Find all command links in the markdown content
|
|
116
|
+
const regex = /\[([^\]]+)\]\(command:([^?\s\)]+)(?:\?([^\s\)]+))?([^\)]*)\)/g;
|
|
117
|
+
let match;
|
|
118
|
+
let updatedContent = content;
|
|
119
|
+
|
|
120
|
+
while ((match = regex.exec(content)) !== null) {
|
|
121
|
+
const linkText = match[1];
|
|
122
|
+
const commandId = match[2];
|
|
123
|
+
const argsEncoded = match[3]; // This captures the encoded arguments
|
|
124
|
+
const tooltipPart = match[4] || ''; // This captures any tooltip or additional content after the command and args
|
|
125
|
+
|
|
126
|
+
let args: unknown[] = [];
|
|
127
|
+
if (argsEncoded) {
|
|
128
|
+
try {
|
|
129
|
+
const decoded = decodeURIComponent(argsEncoded);
|
|
130
|
+
args = JSON.parse(decoded);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.error('Failed to parse command arguments:', e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const safeCommand = this.commandRegistry.converter.toSafeCommand(
|
|
137
|
+
{
|
|
138
|
+
command: commandId,
|
|
139
|
+
title: linkText,
|
|
140
|
+
arguments: Array.isArray(args) ? args : [args]
|
|
141
|
+
},
|
|
142
|
+
new DisposableCollection()
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
if (safeCommand?.id) {
|
|
146
|
+
let newArgsPart = '';
|
|
147
|
+
if (safeCommand.arguments && safeCommand.arguments.length > 0) {
|
|
148
|
+
newArgsPart = `?${encodeURIComponent(JSON.stringify(safeCommand.arguments))}`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const argsPart = argsEncoded ? `?${argsEncoded}` : '';
|
|
152
|
+
const originalLink = `[${linkText}](command:${commandId}${argsPart}${tooltipPart})`;
|
|
153
|
+
const safeLink = `[${linkText}](command:${safeCommand.id}${newArgsPart}${tooltipPart})`;
|
|
154
|
+
updatedContent = updatedContent.replace(originalLink, safeLink);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (updatedContent !== content) {
|
|
159
|
+
markdownTooltip.value = updatedContent;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
108
162
|
this._tooltip = tooltip;
|
|
109
163
|
this.update();
|
|
110
164
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from '../common/plugin-api-rpc';
|
|
21
21
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
22
22
|
import { StatusBarItemImpl } from './status-bar/status-bar-item';
|
|
23
|
+
import { CommandRegistryImpl } from './command-registry';
|
|
23
24
|
|
|
24
25
|
/*---------------------------------------------------------------------------------------------
|
|
25
26
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -32,7 +33,7 @@ export class StatusBarMessageRegistryExt {
|
|
|
32
33
|
|
|
33
34
|
protected readonly statusMessage: StatusBarMessage;
|
|
34
35
|
|
|
35
|
-
constructor(rpc: RPCProtocol) {
|
|
36
|
+
constructor(rpc: RPCProtocol, readonly commandRegistry: CommandRegistryImpl) {
|
|
36
37
|
this.proxy = rpc.getProxy(Ext.STATUS_BAR_MESSAGE_REGISTRY_MAIN);
|
|
37
38
|
this.statusMessage = new StatusBarMessage(this);
|
|
38
39
|
}
|
|
@@ -58,7 +59,7 @@ export class StatusBarMessageRegistryExt {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
createStatusBarItem(alignment?: StatusBarAlignment, priority?: number, id?: string): StatusBarItem {
|
|
61
|
-
return new StatusBarItemImpl(this.proxy, alignment, priority, id);
|
|
62
|
+
return new StatusBarItemImpl(this.proxy, this.commandRegistry, alignment, priority, id);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
}
|