@theia/plugin-ext 1.53.0-next.6 → 1.53.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.
- 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 +13 -2
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +4 -2
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/rpc-protocol.d.ts +14 -13
- package/lib/common/rpc-protocol.d.ts.map +1 -1
- package/lib/common/rpc-protocol.js +56 -53
- package/lib/common/rpc-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +1 -0
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +13 -3
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +13 -1
- package/lib/hosted/node/scanners/scanner-theia.js.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/custom-editors/custom-editor-opener.d.ts +5 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +107 -31
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-widget.d.ts +7 -4
- package/lib/main/browser/custom-editors/custom-editor-widget.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-widget.js +21 -7
- package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts +4 -4
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +5 -55
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +3 -3
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +19 -15
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.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/main-context.d.ts.map +1 -1
- package/lib/main/browser/main-context.js +3 -0
- package/lib/main/browser/main-context.js.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/plugin-menu-command-adapter.d.ts.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js +1 -0
- package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts +2 -2
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js +2 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +1 -1
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-main.js +22 -3
- package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-editors-main.d.ts +1 -1
- package/lib/main/browser/notebooks/notebook-editors-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebook-editors-main.js +16 -2
- package/lib/main/browser/notebooks/notebook-editors-main.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/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +18 -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/uri-main.d.ts +16 -0
- package/lib/main/browser/uri-main.d.ts.map +1 -0
- package/lib/main/browser/uri-main.js +64 -0
- package/lib/main/browser/uri-main.js.map +1 -0
- 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/webview/webview.d.ts +2 -3
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +5 -4
- package/lib/main/browser/webview/webview.js.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/webviews-main.js +6 -1
- package/lib/main/browser/webviews-main.js.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 +3 -4
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +5 -7
- package/lib/plugin/custom-editors.js.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 +3 -0
- package/lib/plugin/env.d.ts.map +1 -1
- package/lib/plugin/env.js +4 -1
- package/lib/plugin/env.js.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/known-commands.d.ts.map +1 -1
- package/lib/plugin/known-commands.js +1 -0
- package/lib/plugin/known-commands.js.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/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 +14 -6
- 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-manager.js +2 -1
- package/lib/plugin/plugin-manager.js.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 +1 -0
- package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
- package/lib/plugin/status-bar-message-registry.d.ts +1 -0
- package/lib/plugin/status-bar-message-registry.d.ts.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 +2 -0
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +1 -0
- package/lib/plugin/terminal-ext.js.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 +6 -0
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +9 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/uri-ext.d.ts +38 -0
- package/lib/plugin/uri-ext.d.ts.map +1 -0
- package/lib/plugin/uri-ext.js +50 -0
- package/lib/plugin/uri-ext.js.map +1 -0
- 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/webviews.js +1 -1
- package/lib/plugin/webviews.js.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/common/plugin-api-rpc.ts +17 -4
- package/src/common/rpc-protocol.ts +62 -66
- package/src/hosted/browser/hosted-plugin.ts +16 -5
- package/src/hosted/node/scanners/scanner-theia.ts +12 -1
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +110 -25
- package/src/main/browser/custom-editors/custom-editor-widget.ts +20 -11
- package/src/main/browser/custom-editors/custom-editors-main.ts +11 -70
- package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +15 -13
- package/src/main/browser/main-context.ts +4 -0
- package/src/main/browser/menus/menus-contribution-handler.ts +2 -1
- package/src/main/browser/menus/plugin-menu-command-adapter.ts +1 -0
- package/src/main/browser/menus/vscode-theia-menu-mappings.ts +3 -1
- package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +1 -1
- package/src/main/browser/notebooks/notebook-documents-main.ts +24 -4
- package/src/main/browser/notebooks/notebook-editors-main.ts +15 -2
- package/src/main/browser/plugin-ext-frontend-module.ts +23 -4
- package/src/main/browser/uri-main.ts +72 -0
- package/src/main/browser/webview/pre/service-worker.js +2 -1
- package/src/main/browser/webview/webview.ts +5 -6
- package/src/main/browser/webviews-main.ts +6 -1
- package/src/plugin/custom-editors.ts +8 -10
- package/src/plugin/env.ts +6 -1
- package/src/plugin/known-commands.ts +1 -0
- package/src/plugin/plugin-context.ts +16 -8
- package/src/plugin/plugin-manager.ts +2 -1
- package/src/plugin/terminal-ext.ts +2 -0
- package/src/plugin/types-impl.ts +10 -0
- package/src/plugin/uri-ext.ts +60 -0
- package/src/plugin/webviews.ts +1 -1
- package/lib/common/proxy-handler.d.ts +0 -73
- package/lib/common/proxy-handler.d.ts.map +0 -1
- package/lib/common/proxy-handler.js +0 -106
- package/lib/common/proxy-handler.js.map +0 -1
- package/src/common/proxy-handler.ts +0 -143
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { inject } from '@theia/core/shared/inversify';
|
|
18
17
|
import URI from '@theia/core/lib/common/uri';
|
|
19
|
-
import { ApplicationShell, OpenHandler, Widget, WidgetManager, WidgetOpenerOptions } from '@theia/core/lib/browser';
|
|
18
|
+
import { ApplicationShell, DiffUris, OpenHandler, SplitWidget, Widget, WidgetManager, WidgetOpenerOptions } from '@theia/core/lib/browser';
|
|
20
19
|
import { CustomEditor, CustomEditorPriority, CustomEditorSelector } from '../../../common';
|
|
21
20
|
import { CustomEditorWidget } from './custom-editor-widget';
|
|
21
|
+
import { PluginCustomEditorRegistry } from './plugin-custom-editor-registry';
|
|
22
22
|
import { generateUuid } from '@theia/core/lib/common/uuid';
|
|
23
|
-
import { Emitter } from '@theia/core';
|
|
23
|
+
import { DisposableCollection, Emitter } from '@theia/core';
|
|
24
24
|
import { match } from '@theia/core/lib/common/glob';
|
|
25
25
|
|
|
26
26
|
export class CustomEditorOpener implements OpenHandler {
|
|
@@ -33,8 +33,9 @@ export class CustomEditorOpener implements OpenHandler {
|
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
35
|
private readonly editor: CustomEditor,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
protected readonly shell: ApplicationShell,
|
|
37
|
+
protected readonly widgetManager: WidgetManager,
|
|
38
|
+
protected readonly editorRegistry: PluginCustomEditorRegistry
|
|
38
39
|
) {
|
|
39
40
|
this.id = CustomEditorOpener.toCustomEditorId(this.editor.viewType);
|
|
40
41
|
this.label = this.editor.displayName;
|
|
@@ -45,7 +46,13 @@ export class CustomEditorOpener implements OpenHandler {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
canHandle(uri: URI): number {
|
|
48
|
-
|
|
49
|
+
const { selector } = this.editor;
|
|
50
|
+
if (DiffUris.isDiffUri(uri)) {
|
|
51
|
+
const [left, right] = DiffUris.decode(uri);
|
|
52
|
+
if (this.matches(selector, right) && this.matches(selector, left)) {
|
|
53
|
+
return this.getPriority();
|
|
54
|
+
}
|
|
55
|
+
} else if (this.matches(selector, uri)) {
|
|
49
56
|
return this.getPriority();
|
|
50
57
|
}
|
|
51
58
|
return 0;
|
|
@@ -62,34 +69,112 @@ export class CustomEditorOpener implements OpenHandler {
|
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
protected readonly pendingWidgetPromises = new Map<string, Promise<CustomEditorWidget>>();
|
|
65
|
-
async
|
|
72
|
+
protected async openCustomEditor(uri: URI, options?: WidgetOpenerOptions): Promise<CustomEditorWidget> {
|
|
66
73
|
let widget: CustomEditorWidget | undefined;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const uriString = uri.toString();
|
|
78
|
-
let widgetPromise = this.pendingWidgetPromises.get(uriString);
|
|
79
|
-
if (!widgetPromise) {
|
|
74
|
+
let isNewWidget = false;
|
|
75
|
+
const uriString = uri.toString();
|
|
76
|
+
let widgetPromise = this.pendingWidgetPromises.get(uriString);
|
|
77
|
+
if (widgetPromise) {
|
|
78
|
+
widget = await widgetPromise;
|
|
79
|
+
} else {
|
|
80
|
+
const widgets = this.widgetManager.getWidgets(CustomEditorWidget.FACTORY_ID) as CustomEditorWidget[];
|
|
81
|
+
widget = widgets.find(w => w.viewType === this.editor.viewType && w.resource.toString() === uriString);
|
|
82
|
+
if (!widget) {
|
|
83
|
+
isNewWidget = true;
|
|
80
84
|
const id = generateUuid();
|
|
81
|
-
widgetPromise = this.widgetManager.getOrCreateWidget<CustomEditorWidget>(CustomEditorWidget.FACTORY_ID, { id })
|
|
85
|
+
widgetPromise = this.widgetManager.getOrCreateWidget<CustomEditorWidget>(CustomEditorWidget.FACTORY_ID, { id }).then(async w => {
|
|
86
|
+
try {
|
|
87
|
+
w.viewType = this.editor.viewType;
|
|
88
|
+
w.resource = uri;
|
|
89
|
+
await this.editorRegistry.resolveWidget(w);
|
|
90
|
+
if (options?.widgetOptions) {
|
|
91
|
+
await this.shell.addWidget(w, options.widgetOptions);
|
|
92
|
+
}
|
|
93
|
+
return w;
|
|
94
|
+
} catch (e) {
|
|
95
|
+
w.dispose();
|
|
96
|
+
throw e;
|
|
97
|
+
}
|
|
98
|
+
}).finally(() => this.pendingWidgetPromises.delete(uriString));
|
|
82
99
|
this.pendingWidgetPromises.set(uriString, widgetPromise);
|
|
83
100
|
widget = await widgetPromise;
|
|
84
|
-
this.pendingWidgetPromises.delete(uriString);
|
|
85
|
-
widget.viewType = this.editor.viewType;
|
|
86
|
-
widget.resource = uri;
|
|
87
|
-
this.onDidOpenCustomEditorEmitter.fire([widget, options]);
|
|
88
101
|
}
|
|
89
102
|
}
|
|
103
|
+
if (options?.mode === 'activate') {
|
|
104
|
+
await this.shell.activateWidget(widget.id);
|
|
105
|
+
} else if (options?.mode === 'reveal') {
|
|
106
|
+
await this.shell.revealWidget(widget.id);
|
|
107
|
+
}
|
|
108
|
+
if (isNewWidget) {
|
|
109
|
+
this.onDidOpenCustomEditorEmitter.fire([widget, options]);
|
|
110
|
+
}
|
|
90
111
|
return widget;
|
|
91
112
|
}
|
|
92
113
|
|
|
114
|
+
protected async openSideBySide(uri: URI, options?: WidgetOpenerOptions): Promise<Widget | undefined> {
|
|
115
|
+
const [leftUri, rightUri] = DiffUris.decode(uri);
|
|
116
|
+
const widget = await this.widgetManager.getOrCreateWidget<SplitWidget>(
|
|
117
|
+
CustomEditorWidget.SIDE_BY_SIDE_FACTORY_ID, { uri: uri.toString(), viewType: this.editor.viewType });
|
|
118
|
+
if (!widget.panes.length) { // a new widget
|
|
119
|
+
const trackedDisposables = new DisposableCollection(widget);
|
|
120
|
+
try {
|
|
121
|
+
const createPane = async (paneUri: URI) => {
|
|
122
|
+
let pane = await this.openCustomEditor(paneUri);
|
|
123
|
+
if (pane.isAttached) {
|
|
124
|
+
await this.shell.closeWidget(pane.id);
|
|
125
|
+
if (!pane.isDisposed) { // user canceled
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
pane = await this.openCustomEditor(paneUri);
|
|
129
|
+
}
|
|
130
|
+
return pane;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const rightPane = await createPane(rightUri);
|
|
134
|
+
if (!rightPane) {
|
|
135
|
+
trackedDisposables.dispose();
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
trackedDisposables.push(rightPane);
|
|
139
|
+
|
|
140
|
+
const leftPane = await createPane(leftUri);
|
|
141
|
+
if (!leftPane) {
|
|
142
|
+
trackedDisposables.dispose();
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
trackedDisposables.push(leftPane);
|
|
146
|
+
|
|
147
|
+
widget.addPane(leftPane);
|
|
148
|
+
widget.addPane(rightPane);
|
|
149
|
+
|
|
150
|
+
// dispose the widget if either of its panes gets externally disposed
|
|
151
|
+
leftPane.disposed.connect(() => widget.dispose());
|
|
152
|
+
rightPane.disposed.connect(() => widget.dispose());
|
|
153
|
+
|
|
154
|
+
if (options?.widgetOptions) {
|
|
155
|
+
await this.shell.addWidget(widget, options.widgetOptions);
|
|
156
|
+
}
|
|
157
|
+
} catch (e) {
|
|
158
|
+
trackedDisposables.dispose();
|
|
159
|
+
console.error(e);
|
|
160
|
+
throw e;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (options?.mode === 'activate') {
|
|
164
|
+
await this.shell.activateWidget(widget.id);
|
|
165
|
+
} else if (options?.mode === 'reveal') {
|
|
166
|
+
await this.shell.revealWidget(widget.id);
|
|
167
|
+
}
|
|
168
|
+
return widget;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async open(uri: URI, options?: WidgetOpenerOptions): Promise<Widget | undefined> {
|
|
172
|
+
options = { ...options };
|
|
173
|
+
options.mode ??= 'activate';
|
|
174
|
+
options.widgetOptions ??= { area: 'main' };
|
|
175
|
+
return DiffUris.isDiffUri(uri) ? this.openSideBySide(uri, options) : this.openCustomEditor(uri, options);
|
|
176
|
+
}
|
|
177
|
+
|
|
93
178
|
matches(selectors: CustomEditorSelector[], resource: URI): boolean {
|
|
94
179
|
return selectors.some(selector => this.selectorMatches(selector, resource));
|
|
95
180
|
}
|
|
@@ -17,29 +17,36 @@
|
|
|
17
17
|
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
18
|
import URI from '@theia/core/lib/common/uri';
|
|
19
19
|
import { FileOperation } from '@theia/filesystem/lib/common/files';
|
|
20
|
-
import { ApplicationShell, NavigatableWidget, Saveable, SaveableSource, SaveOptions } from '@theia/core/lib/browser';
|
|
20
|
+
import { ApplicationShell, DelegatingSaveable, NavigatableWidget, Saveable, SaveableSource, SaveOptions } from '@theia/core/lib/browser';
|
|
21
21
|
import { SaveableService } from '@theia/core/lib/browser/saveable-service';
|
|
22
22
|
import { Reference } from '@theia/core/lib/common/reference';
|
|
23
23
|
import { WebviewWidget } from '../webview/webview';
|
|
24
24
|
import { CustomEditorModel } from './custom-editors-main';
|
|
25
|
+
import { CustomEditorWidget as CustomEditorWidgetShape } from '@theia/editor/lib/browser';
|
|
25
26
|
|
|
26
27
|
@injectable()
|
|
27
|
-
export class CustomEditorWidget extends WebviewWidget implements SaveableSource, NavigatableWidget {
|
|
28
|
+
export class CustomEditorWidget extends WebviewWidget implements CustomEditorWidgetShape, SaveableSource, NavigatableWidget {
|
|
28
29
|
static override FACTORY_ID = 'plugin-custom-editor';
|
|
30
|
+
static readonly SIDE_BY_SIDE_FACTORY_ID = CustomEditorWidget.FACTORY_ID + '.side-by-side';
|
|
29
31
|
|
|
30
32
|
override id: string;
|
|
31
33
|
resource: URI;
|
|
32
34
|
|
|
33
|
-
protected _modelRef: Reference<CustomEditorModel
|
|
34
|
-
get modelRef(): Reference<CustomEditorModel> {
|
|
35
|
+
protected _modelRef: Reference<CustomEditorModel | undefined> = { object: undefined, dispose: () => { } };
|
|
36
|
+
get modelRef(): Reference<CustomEditorModel | undefined> {
|
|
35
37
|
return this._modelRef;
|
|
36
38
|
}
|
|
37
39
|
set modelRef(modelRef: Reference<CustomEditorModel>) {
|
|
40
|
+
this._modelRef.dispose();
|
|
38
41
|
this._modelRef = modelRef;
|
|
42
|
+
this.delegatingSaveable.delegate = modelRef.object;
|
|
39
43
|
this.doUpdateContent();
|
|
40
44
|
}
|
|
45
|
+
|
|
46
|
+
// ensures that saveable is available even if modelRef.object is undefined
|
|
47
|
+
protected readonly delegatingSaveable = new DelegatingSaveable();
|
|
41
48
|
get saveable(): Saveable {
|
|
42
|
-
return this.
|
|
49
|
+
return this.delegatingSaveable;
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
@inject(ApplicationShell)
|
|
@@ -60,21 +67,23 @@ export class CustomEditorWidget extends WebviewWidget implements SaveableSource,
|
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
undo(): void {
|
|
63
|
-
this._modelRef.object
|
|
70
|
+
this._modelRef.object?.undo();
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
redo(): void {
|
|
67
|
-
this._modelRef.object
|
|
74
|
+
this._modelRef.object?.redo();
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
async save(options?: SaveOptions): Promise<void> {
|
|
71
|
-
await this._modelRef.object
|
|
78
|
+
await this._modelRef.object?.saveCustomEditor(options);
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
async saveAs(source: URI, target: URI, options?: SaveOptions): Promise<void> {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
if (this._modelRef.object) {
|
|
83
|
+
const result = await this._modelRef.object.saveCustomEditorAs(source, target, options);
|
|
84
|
+
this.doMove(target);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
getResourceUri(): URI | undefined {
|
|
@@ -24,7 +24,6 @@ import { MAIN_RPC_CONTEXT, CustomEditorsMain, CustomEditorsExt, CustomTextEditor
|
|
|
24
24
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
25
25
|
import { HostedPluginSupport } from '../../../hosted/browser/hosted-plugin';
|
|
26
26
|
import { PluginCustomEditorRegistry } from './plugin-custom-editor-registry';
|
|
27
|
-
import { CustomEditorWidget } from './custom-editor-widget';
|
|
28
27
|
import { Emitter } from '@theia/core';
|
|
29
28
|
import { UriComponents } from '../../../common/uri-components';
|
|
30
29
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
@@ -39,11 +38,9 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
|
39
38
|
import { UndoRedoService } from '@theia/editor/lib/browser/undo-redo-service';
|
|
40
39
|
import { WebviewsMainImpl } from '../webviews-main';
|
|
41
40
|
import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
|
|
42
|
-
import { ApplicationShell,
|
|
43
|
-
import {
|
|
44
|
-
import { WebviewWidgetIdentifier } from '../webview/webview';
|
|
41
|
+
import { ApplicationShell, LabelProvider, Saveable, SaveOptions } from '@theia/core/lib/browser';
|
|
42
|
+
import { WebviewPanelOptions } from '@theia/plugin';
|
|
45
43
|
import { EditorPreferences } from '@theia/editor/lib/browser';
|
|
46
|
-
import { ViewColumn, WebviewPanelTargetArea } from '../../../plugin/types-impl';
|
|
47
44
|
|
|
48
45
|
const enum CustomEditorModelType {
|
|
49
46
|
Custom,
|
|
@@ -58,7 +55,7 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable {
|
|
|
58
55
|
protected readonly customEditorService: CustomEditorService;
|
|
59
56
|
protected readonly undoRedoService: UndoRedoService;
|
|
60
57
|
protected readonly customEditorRegistry: PluginCustomEditorRegistry;
|
|
61
|
-
protected readonly labelProvider:
|
|
58
|
+
protected readonly labelProvider: LabelProvider;
|
|
62
59
|
protected readonly widgetManager: WidgetManager;
|
|
63
60
|
protected readonly editorPreferences: EditorPreferences;
|
|
64
61
|
private readonly proxy: CustomEditorsExt;
|
|
@@ -75,7 +72,7 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable {
|
|
|
75
72
|
this.customEditorService = container.get(CustomEditorService);
|
|
76
73
|
this.undoRedoService = container.get(UndoRedoService);
|
|
77
74
|
this.customEditorRegistry = container.get(PluginCustomEditorRegistry);
|
|
78
|
-
this.labelProvider = container.get(
|
|
75
|
+
this.labelProvider = container.get(LabelProvider);
|
|
79
76
|
this.editorPreferences = container.get(EditorPreferences);
|
|
80
77
|
this.widgetManager = container.get(WidgetManager);
|
|
81
78
|
this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.CUSTOM_EDITORS_EXT);
|
|
@@ -111,7 +108,8 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable {
|
|
|
111
108
|
const disposables = new DisposableCollection();
|
|
112
109
|
|
|
113
110
|
disposables.push(
|
|
114
|
-
this.customEditorRegistry.registerResolver(viewType, async
|
|
111
|
+
this.customEditorRegistry.registerResolver(viewType, async widget => {
|
|
112
|
+
|
|
115
113
|
const { resource, identifier } = widget;
|
|
116
114
|
widget.options = options;
|
|
117
115
|
|
|
@@ -144,13 +142,16 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable {
|
|
|
144
142
|
});
|
|
145
143
|
}
|
|
146
144
|
|
|
145
|
+
this.webviewsMain.hookWebview(widget);
|
|
146
|
+
widget.title.label = this.labelProvider.getName(resource);
|
|
147
|
+
|
|
147
148
|
const _cancellationSource = new CancellationTokenSource();
|
|
148
149
|
await this.proxy.$resolveWebviewEditor(
|
|
149
150
|
resource.toComponents(),
|
|
150
151
|
identifier.id,
|
|
151
152
|
viewType,
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
widget.title.label,
|
|
154
|
+
widget.viewState.position,
|
|
154
155
|
options,
|
|
155
156
|
_cancellationSource.token
|
|
156
157
|
);
|
|
@@ -213,66 +214,6 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable {
|
|
|
213
214
|
const model = await this.getCustomEditorModel(resourceComponents, viewType);
|
|
214
215
|
model.changeContent();
|
|
215
216
|
}
|
|
216
|
-
|
|
217
|
-
async $createCustomEditorPanel(
|
|
218
|
-
panelId: string,
|
|
219
|
-
title: string,
|
|
220
|
-
widgetOpenerOptions: WidgetOpenerOptions | undefined,
|
|
221
|
-
options: WebviewPanelOptions & WebviewOptions
|
|
222
|
-
): Promise<void> {
|
|
223
|
-
const view = await this.widgetManager.getOrCreateWidget<CustomEditorWidget>(CustomEditorWidget.FACTORY_ID, <WebviewWidgetIdentifier>{ id: panelId });
|
|
224
|
-
this.webviewsMain.hookWebview(view);
|
|
225
|
-
view.title.label = title;
|
|
226
|
-
const { enableFindWidget, retainContextWhenHidden, enableScripts, enableForms, localResourceRoots, ...contentOptions } = options;
|
|
227
|
-
view.viewColumn = ViewColumn.One; // behaviour might be overridden later using widgetOpenerOptions (if available)
|
|
228
|
-
view.options = { enableFindWidget, retainContextWhenHidden };
|
|
229
|
-
view.setContentOptions({
|
|
230
|
-
allowScripts: enableScripts,
|
|
231
|
-
allowForms: enableForms,
|
|
232
|
-
localResourceRoots: localResourceRoots && localResourceRoots.map(root => root.toString()),
|
|
233
|
-
...contentOptions,
|
|
234
|
-
...view.contentOptions
|
|
235
|
-
});
|
|
236
|
-
if (view.isAttached) {
|
|
237
|
-
if (view.isVisible) {
|
|
238
|
-
this.shell.revealWidget(view.id);
|
|
239
|
-
}
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
const showOptions: WebviewPanelShowOptions = {
|
|
243
|
-
preserveFocus: true
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
if (widgetOpenerOptions) {
|
|
247
|
-
if (widgetOpenerOptions.mode === 'reveal') {
|
|
248
|
-
showOptions.preserveFocus = false;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (widgetOpenerOptions.widgetOptions) {
|
|
252
|
-
let area: WebviewPanelTargetArea;
|
|
253
|
-
switch (widgetOpenerOptions.widgetOptions.area) {
|
|
254
|
-
case 'main':
|
|
255
|
-
area = WebviewPanelTargetArea.Main;
|
|
256
|
-
case 'left':
|
|
257
|
-
area = WebviewPanelTargetArea.Left;
|
|
258
|
-
case 'right':
|
|
259
|
-
area = WebviewPanelTargetArea.Right;
|
|
260
|
-
case 'bottom':
|
|
261
|
-
area = WebviewPanelTargetArea.Bottom;
|
|
262
|
-
default: // includes 'top' and 'secondaryWindow'
|
|
263
|
-
area = WebviewPanelTargetArea.Main;
|
|
264
|
-
}
|
|
265
|
-
showOptions.area = area;
|
|
266
|
-
|
|
267
|
-
if (widgetOpenerOptions.widgetOptions.mode === 'split-right' ||
|
|
268
|
-
widgetOpenerOptions.widgetOptions.mode === 'open-to-right') {
|
|
269
|
-
showOptions.viewColumn = ViewColumn.Beside;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
this.webviewsMain.addOrReattachWidget(view, showOptions);
|
|
275
|
-
}
|
|
276
217
|
}
|
|
277
218
|
|
|
278
219
|
export interface CustomEditorModel extends Saveable, Disposable {
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
18
|
import { CustomEditor, DeployedPlugin } from '../../../common';
|
|
19
19
|
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
20
|
+
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
20
21
|
import { CustomEditorOpener } from './custom-editor-opener';
|
|
21
22
|
import { Emitter } from '@theia/core';
|
|
22
|
-
import { ApplicationShell, DefaultOpenerService, OpenWithService, WidgetManager
|
|
23
|
+
import { ApplicationShell, DefaultOpenerService, OpenWithService, WidgetManager } from '@theia/core/lib/browser';
|
|
23
24
|
import { CustomEditorWidget } from './custom-editor-widget';
|
|
24
25
|
|
|
25
26
|
@injectable()
|
|
26
27
|
export class PluginCustomEditorRegistry {
|
|
27
28
|
private readonly editors = new Map<string, CustomEditor>();
|
|
28
|
-
private readonly pendingEditors = new
|
|
29
|
-
private readonly resolvers = new Map<string, (widget: CustomEditorWidget
|
|
29
|
+
private readonly pendingEditors = new Map<CustomEditorWidget, { deferred: Deferred<void>, disposable: Disposable }>();
|
|
30
|
+
private readonly resolvers = new Map<string, (widget: CustomEditorWidget) => Promise<void>>();
|
|
30
31
|
|
|
31
32
|
private readonly onWillOpenCustomEditorEmitter = new Emitter<string>();
|
|
32
33
|
readonly onWillOpenCustomEditor = this.onWillOpenCustomEditorEmitter.event;
|
|
@@ -74,7 +75,8 @@ export class PluginCustomEditorRegistry {
|
|
|
74
75
|
const editorOpenHandler = new CustomEditorOpener(
|
|
75
76
|
editor,
|
|
76
77
|
this.shell,
|
|
77
|
-
this.widgetManager
|
|
78
|
+
this.widgetManager,
|
|
79
|
+
this
|
|
78
80
|
);
|
|
79
81
|
toDispose.push(this.defaultOpenerService.addHandler(editorOpenHandler));
|
|
80
82
|
toDispose.push(
|
|
@@ -86,30 +88,30 @@ export class PluginCustomEditorRegistry {
|
|
|
86
88
|
open: uri => editorOpenHandler.open(uri)
|
|
87
89
|
})
|
|
88
90
|
);
|
|
89
|
-
toDispose.push(
|
|
90
|
-
editorOpenHandler.onDidOpenCustomEditor(event => this.resolveWidget(event[0], event[1]))
|
|
91
|
-
);
|
|
92
91
|
return toDispose;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
resolveWidget
|
|
94
|
+
async resolveWidget(widget: CustomEditorWidget): Promise<void> {
|
|
96
95
|
const resolver = this.resolvers.get(widget.viewType);
|
|
97
96
|
if (resolver) {
|
|
98
|
-
resolver(widget
|
|
97
|
+
await resolver(widget);
|
|
99
98
|
} else {
|
|
100
|
-
|
|
99
|
+
const deferred = new Deferred<void>();
|
|
100
|
+
const disposable = widget.onDidDispose(() => this.pendingEditors.delete(widget));
|
|
101
|
+
this.pendingEditors.set(widget, { deferred, disposable });
|
|
101
102
|
this.onWillOpenCustomEditorEmitter.fire(widget.viewType);
|
|
103
|
+
return deferred.promise;
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
|
|
105
|
-
registerResolver(viewType: string, resolver: (widget: CustomEditorWidget
|
|
107
|
+
registerResolver(viewType: string, resolver: (widget: CustomEditorWidget) => Promise<void>): Disposable {
|
|
106
108
|
if (this.resolvers.has(viewType)) {
|
|
107
109
|
throw new Error(`Resolver for ${viewType} already registered`);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
for (const editorWidget of this.pendingEditors) {
|
|
112
|
+
for (const [editorWidget, { deferred, disposable }] of this.pendingEditors.entries()) {
|
|
111
113
|
if (editorWidget.viewType === viewType) {
|
|
112
|
-
resolver(editorWidget);
|
|
114
|
+
resolver(editorWidget).then(() => deferred.resolve(), err => deferred.reject(err)).finally(() => disposable.dispose());
|
|
113
115
|
this.pendingEditors.delete(editorWidget);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
@@ -64,6 +64,7 @@ import { NotebookDocumentsMainImpl } from './notebooks/notebook-documents-main';
|
|
|
64
64
|
import { NotebookKernelsMainImpl } from './notebooks/notebook-kernels-main';
|
|
65
65
|
import { NotebooksAndEditorsMain } from './notebooks/notebook-documents-and-editors-main';
|
|
66
66
|
import { TestingMainImpl } from './test-main';
|
|
67
|
+
import { UriMainImpl } from './uri-main';
|
|
67
68
|
|
|
68
69
|
export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container): void {
|
|
69
70
|
const authenticationMain = new AuthenticationMainImpl(rpc, container);
|
|
@@ -203,4 +204,7 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
|
|
|
203
204
|
|
|
204
205
|
const localizationMain = new LocalizationMainImpl(container);
|
|
205
206
|
rpc.set(PLUGIN_RPC_CONTEXT.LOCALIZATION_MAIN, localizationMain);
|
|
207
|
+
|
|
208
|
+
const uriMain = new UriMainImpl(rpc, container);
|
|
209
|
+
rpc.set(PLUGIN_RPC_CONTEXT.URI_MAIN, uriMain);
|
|
206
210
|
}
|
|
@@ -107,10 +107,11 @@ export class MenusContributionPointHandler {
|
|
|
107
107
|
if (command) {
|
|
108
108
|
toDispose.push(this.commandAdapter.addCommand(command));
|
|
109
109
|
targets.forEach(target => {
|
|
110
|
+
|
|
110
111
|
const node = new ActionMenuNode({
|
|
111
112
|
commandId: command,
|
|
112
113
|
when: item.when,
|
|
113
|
-
order
|
|
114
|
+
order
|
|
114
115
|
}, this.commands);
|
|
115
116
|
const parent = this.menuRegistry.getMenuNode(target, group);
|
|
116
117
|
toDispose.push(parent.addNode(node));
|
|
@@ -108,6 +108,7 @@ export class PluginMenuCommandAdapter implements MenuCommandAdapter {
|
|
|
108
108
|
['scm/resourceState/context', toScmArgs],
|
|
109
109
|
['scm/title', () => [this.toScmArg(this.scmService.selectedRepository)]],
|
|
110
110
|
['testing/message/context', toTestMessageArgs],
|
|
111
|
+
['testing/profiles/context', noArgs],
|
|
111
112
|
['scm/change/title', (...args) => this.toScmChangeArgs(...args)],
|
|
112
113
|
['timeline/item/context', (...args) => this.toTimelineArgs(...args)],
|
|
113
114
|
['view/item/context', (...args) => this.toTreeArgs(...args)],
|
|
@@ -32,7 +32,7 @@ import { COMMENT_CONTEXT, COMMENT_THREAD_CONTEXT, COMMENT_TITLE } from '../comme
|
|
|
32
32
|
import { VIEW_ITEM_CONTEXT_MENU } from '../view/tree-view-widget';
|
|
33
33
|
import { WEBVIEW_CONTEXT_MENU, WebviewWidget } from '../webview/webview';
|
|
34
34
|
import { EDITOR_LINENUMBER_CONTEXT_MENU } from '@theia/editor/lib/browser/editor-linenumber-contribution';
|
|
35
|
-
import { TEST_VIEW_CONTEXT_MENU } from '@theia/test/lib/browser/view/test-view-contribution';
|
|
35
|
+
import { PLUGIN_TEST_VIEW_TITLE_MENU, TEST_VIEW_CONTEXT_MENU } from '@theia/test/lib/browser/view/test-view-contribution';
|
|
36
36
|
import { TEST_RUNS_CONTEXT_MENU } from '@theia/test/lib/browser/view/test-run-view-contribution';
|
|
37
37
|
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
|
|
38
38
|
|
|
@@ -62,6 +62,7 @@ export const implementedVSCodeContributionPoints = [
|
|
|
62
62
|
'timeline/item/context',
|
|
63
63
|
'testing/item/context',
|
|
64
64
|
'testing/message/context',
|
|
65
|
+
'testing/profiles/context',
|
|
65
66
|
'view/item/context',
|
|
66
67
|
'view/title',
|
|
67
68
|
'webview/context',
|
|
@@ -93,6 +94,7 @@ export const codeToTheiaMappings = new Map<ContributionPoint, MenuPath[]>([
|
|
|
93
94
|
['scm/title', [PLUGIN_SCM_TITLE_MENU]],
|
|
94
95
|
['testing/item/context', [TEST_VIEW_CONTEXT_MENU]],
|
|
95
96
|
['testing/message/context', [TEST_RUNS_CONTEXT_MENU]],
|
|
97
|
+
['testing/profiles/context', [PLUGIN_TEST_VIEW_TITLE_MENU]],
|
|
96
98
|
['timeline/item/context', [TIMELINE_ITEM_CONTEXT_MENU]],
|
|
97
99
|
['view/item/context', [VIEW_ITEM_CONTEXT_MENU]],
|
|
98
100
|
['view/title', [PLUGIN_VIEW_TITLE_MENU]],
|
|
@@ -21,7 +21,7 @@ import { NotebookModelResolverService } from '@theia/notebook/lib/browser';
|
|
|
21
21
|
import { NotebookModel } from '@theia/notebook/lib/browser/view-model/notebook-model';
|
|
22
22
|
import { NotebookCellsChangeType } from '@theia/notebook/lib/common';
|
|
23
23
|
import { NotebookMonacoTextModelService } from '@theia/notebook/lib/browser/service/notebook-monaco-text-model-service';
|
|
24
|
-
import { MAIN_RPC_CONTEXT, NotebookCellsChangedEventDto, NotebookDataDto, NotebookDocumentsExt, NotebookDocumentsMain } from '../../../common';
|
|
24
|
+
import { MAIN_RPC_CONTEXT, NotebookCellsChangedEventDto, NotebookDataDto, NotebookDocumentsExt, NotebookDocumentsMain, NotebookRawContentEventDto } from '../../../common';
|
|
25
25
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
26
26
|
import { NotebookDto } from './notebook-dto';
|
|
27
27
|
import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
|
|
@@ -156,19 +156,39 @@ export class NotebookDocumentsMainImpl implements NotebookDocumentsMain {
|
|
|
156
156
|
// ref.dispose();
|
|
157
157
|
// });
|
|
158
158
|
|
|
159
|
+
const uriComponents = ref.uri.toComponents();
|
|
159
160
|
// untitled notebooks are dirty by default
|
|
160
|
-
this.proxy.$acceptDirtyStateChanged(
|
|
161
|
+
this.proxy.$acceptDirtyStateChanged(uriComponents, true);
|
|
161
162
|
|
|
162
|
-
// apply content changes...
|
|
163
|
+
// apply content changes...
|
|
163
164
|
if (options.content) {
|
|
164
165
|
const data = NotebookDto.fromNotebookDataDto(options.content);
|
|
165
166
|
ref.setData(data);
|
|
167
|
+
|
|
168
|
+
// Create and send a change events
|
|
169
|
+
const rawEvents: NotebookRawContentEventDto[] = [];
|
|
170
|
+
if (options.content.cells && options.content.cells.length > 0) {
|
|
171
|
+
rawEvents.push({
|
|
172
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
173
|
+
changes: [{ start: 0, deleteCount: 0, newItems: ref.cells.map(NotebookDto.toNotebookCellDto) }]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (options.content.metadata) {
|
|
177
|
+
rawEvents.push({
|
|
178
|
+
kind: NotebookCellsChangeType.ChangeDocumentMetadata,
|
|
179
|
+
metadata: options.content.metadata
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (rawEvents.length > 0) {
|
|
183
|
+
this.proxy.$acceptModelChanged(uriComponents, { versionId: 1, rawEvents }, true);
|
|
184
|
+
}
|
|
166
185
|
}
|
|
167
|
-
return
|
|
186
|
+
return uriComponents;
|
|
168
187
|
}
|
|
169
188
|
|
|
170
189
|
async $tryOpenNotebook(uriComponents: UriComponents): Promise<UriComponents> {
|
|
171
190
|
const uri = URI.fromComponents(uriComponents);
|
|
191
|
+
await this.notebookModelResolverService.resolve(uri);
|
|
172
192
|
return uri.toComponents();
|
|
173
193
|
}
|
|
174
194
|
|
|
@@ -54,12 +54,25 @@ export class NotebookEditorsMainImpl implements NotebookEditorsMain {
|
|
|
54
54
|
throw new Error('Method not implemented.');
|
|
55
55
|
}
|
|
56
56
|
$trySetSelections(id: string, range: CellRange[]): void {
|
|
57
|
-
|
|
57
|
+
if (!this.mainThreadEditors.has(id)) {
|
|
58
|
+
throw new Error('Editor not found');
|
|
59
|
+
}
|
|
60
|
+
const editor = this.mainThreadEditors.get(id);
|
|
61
|
+
editor?.model?.setSelectedCell(editor.model.cells[range[0].start]);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
handleEditorsAdded(editors: readonly NotebookEditorWidget[]): void {
|
|
64
|
+
async handleEditorsAdded(editors: readonly NotebookEditorWidget[]): Promise<void> {
|
|
61
65
|
for (const editor of editors) {
|
|
62
66
|
this.mainThreadEditors.set(editor.id, editor);
|
|
67
|
+
const model = await editor.ready;
|
|
68
|
+
model.onDidChangeSelectedCell(e => {
|
|
69
|
+
const newCellIndex = e.cell ? model.cells.indexOf(e.cell) : -1;
|
|
70
|
+
this.proxy.$acceptEditorPropertiesChanged(editor.id, {
|
|
71
|
+
selections: {
|
|
72
|
+
selections: newCellIndex >= 0 ? [{ start: newCellIndex, end: newCellIndex }] : []
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
63
76
|
}
|
|
64
77
|
}
|
|
65
78
|
|