From 58b998d9e1f721928f576579f16ded46b7505e84 Mon Sep 17 00:00:00 2001 From: EAGzzyCSL Date: Thu, 10 Mar 2022 09:58:54 +0800 Subject: [PATCH] style: enable eslint-plugin-import-rule import/order (#595) --- .eslintrc.js | 23 ++-- jest.config.js | 4 +- .../browser/file-search.contribution.test.ts | 23 ++-- .../browser/status-bar.contribution.test.ts | 1 - packages/addons/__test__/node/inde.test.ts | 1 - .../file-content-update-time.contribution.ts | 6 +- .../src/browser/file-drop.contribution.ts | 3 +- .../addons/src/browser/file-drop.service.ts | 9 +- .../src/browser/file-search.contribution.ts | 53 ++++---- packages/addons/src/browser/index.ts | 11 +- .../browser/langauge-change.contribution.ts | 2 +- .../src/browser/status-bar-contribution.ts | 2 +- .../toolbar-customize.contribution.ts | 6 +- .../toolbar-customize/toolbar-customize.tsx | 4 +- packages/addons/src/node/file-drop.service.ts | 3 +- packages/addons/src/node/index.ts | 4 +- .../__test__/browser/comment-thread.test.ts | 15 ++- .../__test__/browser/comment.service.test.ts | 21 +-- .../browser/comments-feature.registry.test.ts | 15 ++- .../src/browser/comment-reactions.view.tsx | 16 ++- .../comments/src/browser/comments-body.tsx | 5 +- .../src/browser/comments-feature.registry.ts | 1 + .../src/browser/comments-item.view.tsx | 21 +-- .../src/browser/comments-panel.view.tsx | 11 +- .../src/browser/comments-textarea.view.tsx | 12 +- .../comments/src/browser/comments-thread.ts | 12 +- .../src/browser/comments-zone.service.ts | 2 +- .../src/browser/comments-zone.view.tsx | 23 ++-- .../src/browser/comments.contribution.ts | 9 +- .../comments/src/browser/comments.service.ts | 28 ++-- packages/comments/src/browser/index.ts | 7 +- packages/comments/src/common/index.ts | 4 +- .../recycle-tree/prompt/index.test.ts | 6 +- .../recycle-tree/tree/TreeNode.test.ts | 2 +- packages/components/src/badge/index.tsx | 2 +- packages/components/src/button/index.tsx | 6 +- packages/components/src/checkbox/index.tsx | 3 +- packages/components/src/dialog/index.tsx | 7 +- packages/components/src/dropdown/dropdown.tsx | 7 +- packages/components/src/icon/icon.tsx | 2 +- packages/components/src/icon/iconfont-cn.tsx | 3 +- .../components/src/input/HistoryInputBox.tsx | 4 +- packages/components/src/input/Input.tsx | 4 +- .../components/src/input/ProxiedInput.tsx | 1 + .../components/src/input/ValidateInput.tsx | 3 +- .../src/locale-context-provider.tsx | 3 +- packages/components/src/menu/MenuItem.tsx | 7 +- packages/components/src/menu/SubMenu.tsx | 2 +- packages/components/src/menu/index.tsx | 14 +- packages/components/src/message/index.ts | 1 + packages/components/src/message/message.tsx | 10 +- packages/components/src/modal/Modal.tsx | 13 +- .../components/src/notification/index.tsx | 6 +- .../src/notification/notification.tsx | 6 +- packages/components/src/overlay/index.tsx | 3 +- packages/components/src/popover/index.tsx | 2 +- .../src/recycle-list/RecycleList.tsx | 5 +- .../src/recycle-tree/RecycleTree.tsx | 13 +- .../src/recycle-tree/TreeNodeRendererWrap.ts | 3 +- .../src/recycle-tree/basic/index.tsx | 19 +-- .../src/recycle-tree/basic/menubar-item.tsx | 3 +- .../recycle-tree/basic/tree-node.define.ts | 1 + .../src/recycle-tree/basic/tree-node.tsx | 8 +- .../src/recycle-tree/basic/tree-service.ts | 5 +- .../src/recycle-tree/basic/types.ts | 6 +- .../decorators/Adaptive/index.tsx | 3 +- .../recycle-tree/decorators/Filter/index.tsx | 2 +- .../recycle-tree/prompt/NewPromptHandle.ts | 3 +- .../recycle-tree/prompt/RenamePromptHandle.ts | 3 +- .../components/src/recycle-tree/tree/Tree.ts | 3 +- .../src/recycle-tree/tree/TreeNode.ts | 2 +- .../tree/decoration/CompositeDecoration.ts | 3 +- .../tree/decoration/Decoration.ts | 2 +- .../tree/decoration/DecorationManager.ts | 5 +- .../src/recycle-tree/tree/model/TreeModel.ts | 6 +- .../tree/model/treeState/TreeStateManager.ts | 5 +- .../tree/model/treeState/TreeStateWatcher.ts | 1 + .../components/src/recycle-tree/types/tree.ts | 1 + .../src/recycle-tree/types/watcher.ts | 3 +- packages/components/src/scrollbars/index.tsx | 4 +- packages/components/src/select/index.tsx | 2 +- packages/components/src/tabs/index.tsx | 2 +- packages/components/src/tooltip/index.tsx | 2 +- packages/components/src/utils/deprecated.tsx | 1 + packages/components/src/utils/path.ts | 2 +- packages/components/webpack.config.js | 5 +- .../connection/__test__/browser/index.test.ts | 3 +- .../connection/__test__/node/index.test.ts | 16 ++- .../src/browser/ws-channel-handler.ts | 6 +- packages/connection/src/common/message.ts | 4 +- .../src/node/common-channel-handler.ts | 4 +- packages/connection/src/node/connect.ts | 3 +- packages/core-browser/__mocks__/preference.ts | 3 +- packages/core-browser/__mocks__/storage.ts | 2 +- .../application/application.service.test.ts | 1 + .../__tests__/bootstrap/connection.test.ts | 5 +- .../__tests__/external-preference.test.ts | 2 +- .../__tests__/keybinding/keybinding.test.ts | 27 ++-- .../keyboard/keyboard-layout-provider.test.ts | 5 +- .../keyboard/keyboard-layout-service.test.ts | 7 +- .../menu/next/ctxmenu-service.test.ts | 6 +- .../__tests__/menu/next/menu-service.test.tsx | 9 +- .../menu/next/menubar-service.test.ts | 6 +- .../__tests__/opener/opener.service.test.ts | 4 +- .../preferences/preference-proxy.test.ts | 7 +- .../__tests__/progress-service.test.ts | 7 +- .../__tests__/raw-context-key.test.ts | 1 - .../services/clipboard.service.test.ts | 3 +- .../services/credentials-service.test.ts | 6 +- .../__tests__/services/cryptr-service.test.ts | 4 +- .../services/external-uri.service.test.ts | 2 +- .../services/storage.service.test.ts | 4 +- .../__tests__/window/window.service.test.ts | 7 +- .../src/application/application.service.ts | 1 + .../authentication.contribution.ts | 3 +- .../authentication/authentication.service.ts | 3 +- packages/core-browser/src/bootstrap/app.ts | 45 ++++--- .../core-browser/src/bootstrap/app.view.tsx | 9 +- .../core-browser/src/bootstrap/connection.ts | 2 +- .../src/bootstrap/inner-providers.ts | 59 +++++---- packages/core-browser/src/browser-module.ts | 3 +- .../src/common/common.contribution.ts | 14 +- .../core-browser/src/common/common.define.ts | 1 + .../core-browser/src/common/common.module.ts | 10 +- .../src/components/actions/index.tsx | 7 +- .../src/components/layout/box-panel.tsx | 5 +- .../src/components/layout/default-layout.tsx | 4 +- .../src/components/layout/split-panel.tsx | 13 +- .../src/components/portal/index.tsx | 1 + .../recycle-tree/recycle-tree.view.tsx | 8 +- .../src/components/resize/resize.tsx | 3 +- .../src/components/tree/tree-node.view.tsx | 17 ++- .../src/components/tree/tree.view.tsx | 13 +- packages/core-browser/src/context-key.ts | 4 +- .../core-browser/src/encoding-registry.ts | 1 + packages/core-browser/src/fs/index.ts | 1 + .../core-browser/src/keybinding/keybinding.ts | 7 +- .../src/keyboard/keyboard-layout-provider.ts | 2 + .../src/keyboard/keyboard-layout-service.ts | 1 + packages/core-browser/src/keyboard/keys.ts | 2 +- .../keyboard/layouts/layout.contribution.ts | 2 +- .../src/layout/accordion/tab-bar-toolbar.tsx | 1 + .../accordion/view-context-key.registry.ts | 3 +- packages/core-browser/src/layout/index.ts | 7 +- .../core-browser/src/layout/layout-state.ts | 4 +- packages/core-browser/src/menu/next/base.ts | 8 +- .../src/menu/next/ctxmenu-service.ts | 3 +- .../src/menu/next/menu-service.ts | 5 +- .../src/menu/next/menu.contrib.interface.ts | 3 +- .../src/menu/next/menu.interface.ts | 5 +- .../src/menu/next/menubar-service.ts | 4 +- .../src/menu/next/renderer/ctxmenu/base.ts | 2 +- .../src/menu/next/renderer/ctxmenu/browser.ts | 6 +- .../menu/next/renderer/ctxmenu/electron.ts | 7 +- .../src/menu/next/toolbar-action.service.ts | 1 + packages/core-browser/src/monaco/index.ts | 3 +- .../core-browser/src/opener/command-opener.ts | 1 + .../core-browser/src/opener/default-opener.ts | 4 +- .../core-browser/src/opener/http-opener.ts | 4 +- .../src/opener/opener.contribution.ts | 13 +- .../core-browser/src/opener/opener.service.ts | 4 +- .../src/preferences/early-preferences.ts | 4 +- .../preferences/preference-configurations.ts | 1 + .../preferences/preference-contribution.ts | 9 +- .../src/preferences/preference-provider.ts | 1 + .../src/preferences/preference-proxy.ts | 3 +- .../src/preferences/preference-service.ts | 6 +- .../core-browser/src/preferences/settings.ts | 3 +- .../src/progress/progress-bar.tsx | 7 +- .../src/progress/progress-indicator.ts | 4 +- .../src/progress/progress.service.tsx | 17 ++- packages/core-browser/src/quick-open/index.ts | 4 +- .../src/quick-open/recent-files.ts | 5 +- .../core-browser/src/react-hooks/event.tsx | 2 + .../core-browser/src/react-hooks/hot-key.tsx | 2 +- .../src/react-hooks/injectable-hooks.tsx | 4 +- .../src/react-providers/config-provider.tsx | 2 + .../core-browser/src/react-providers/slot.tsx | 9 +- .../src/services/clipboard.service.ts | 1 + .../src/services/credentials-service.ts | 2 +- .../src/services/cryptr-service.ts | 2 +- .../src/services/external-uri.service.ts | 3 +- .../src/services/label-service.ts | 13 +- .../src/services/status-bar-service.ts | 1 + packages/core-browser/src/style/icon/icon.ts | 2 +- .../src/toolbar/components/button.tsx | 16 ++- .../src/toolbar/components/select.tsx | 6 +- .../src/toolbar/toolbar.popover.registry.ts | 1 + .../src/toolbar/toolbar.registry.ts | 10 +- packages/core-browser/src/toolbar/toolbar.tsx | 20 +-- packages/core-browser/src/toolbar/types.ts | 2 +- .../core-browser/src/utils/react-hooks.ts | 7 +- .../core-browser/src/window/window.service.ts | 8 +- .../__tests__/character-classifier.test.ts | 3 +- .../core-common/__tests__/di-helper.test.ts | 1 + .../core-common/__tests__/encodings.test.ts | 3 +- .../core-common/__tests__/event-bus.test.ts | 1 + packages/core-common/__tests__/event.test.ts | 8 +- packages/core-common/__tests__/map.test.ts | 5 +- .../__tests__/reporter.service.test.ts | 2 +- .../core-common/__tests__/utils/glob.test.ts | 2 +- .../__tests__/utils/marshalling.test.ts | 1 + .../core-common/__tests__/utils/paths.test.ts | 2 +- .../core-common/src/browser-fs/ensure-dir.ts | 1 + packages/core-common/src/cancellation.ts | 2 +- packages/core-common/src/command.ts | 1 + .../src/di-helper/domain-helper.ts | 1 + packages/core-common/src/electron.ts | 3 +- .../src/event-bus/event-bus-types.ts | 2 +- .../core-common/src/event-bus/event-bus.ts | 7 +- .../src/event-bus/event-decorator.ts | 9 +- packages/core-common/src/event.ts | 4 +- .../src/hash-calculate/hash-calculate.ts | 4 +- .../src/keyboard/keyboard-layout-provider.ts | 3 +- packages/core-common/src/lifecycle.ts | 2 +- packages/core-common/src/localize.ts | 2 +- packages/core-common/src/map.ts | 3 +- packages/core-common/src/problem-matcher.ts | 5 +- packages/core-common/src/problem-pattern.ts | 8 +- packages/core-common/src/reference.ts | 2 +- packages/core-common/src/reporter.ts | 7 +- packages/core-common/src/storage.ts | 7 +- packages/core-common/src/task-definition.ts | 5 +- .../core-common/src/types/authentication.ts | 2 +- .../src/types/markers/markers-manager.ts | 6 +- packages/core-common/src/uri.ts | 1 + packages/core-common/src/utils/arrays.ts | 2 +- packages/core-common/src/utils/buffer.ts | 3 +- packages/core-common/src/utils/comparers.ts | 4 +- packages/core-common/src/utils/file-uri.ts | 1 + packages/core-common/src/utils/glob.ts | 5 +- packages/core-common/src/utils/ipc.ts | 7 +- packages/core-common/src/utils/marshalling.ts | 1 + packages/core-common/src/utils/paths.ts | 6 +- packages/core-common/src/utils/strings.ts | 1 + .../__tests__/menu.service.test.ts | 8 +- .../browser-preload/index.js | 1 + .../core-electron-main/src/bootstrap/api.ts | 2 + .../core-electron-main/src/bootstrap/app.ts | 35 ++--- .../src/bootstrap/services/events.ts | 1 + .../src/bootstrap/services/index.ts | 3 +- .../src/bootstrap/services/menu/index.ts | 4 +- .../src/bootstrap/services/protocol.ts | 6 +- .../src/bootstrap/services/ui.ts | 20 ++- .../src/bootstrap/services/url.ts | 4 +- .../core-electron-main/src/bootstrap/types.ts | 2 + .../src/bootstrap/window.ts | 12 +- .../core-node/__tests__/bootstrap/app.test.ts | 11 +- .../common-module/credential.server.test.ts | 6 +- .../common-module/cryptr.server.test.ts | 4 +- .../__tests__/common-module/index.test.ts | 7 +- .../__tests__/logger/node-logger.test.ts | 5 +- packages/core-node/src/bootstrap/app.ts | 16 ++- .../src/bootstrap/inner-providers.ts | 3 +- .../core-node/src/bootstrap/shell-path.ts | 3 +- .../src/common-module/credential.server.ts | 3 +- .../src/common-module/cryptr.server.ts | 3 +- packages/core-node/src/common-module/index.ts | 6 +- packages/core-node/src/connection.ts | 12 +- .../hash-calculate.contribution.ts | 1 + .../breakpoint/breakpoint-manager.test.ts | 2 +- .../browser/debug-ansi-handle.test.ts | 15 ++- .../debug-configuration-manager.test.ts | 3 +- .../browser/debug-link-detector.test.ts | 5 +- .../browser/debug-progress.service.test.ts | 23 ++-- .../__tests__/browser/debug-service.test.ts | 3 +- .../browser/debug-session-connection.test.ts | 8 +- .../browser/debug-session-manager.test.ts | 13 +- .../__tests__/browser/debugModel.test.ts | 15 ++- .../editor/debug-breakpoint-widget.test.ts | 10 +- .../editor/debug-expression-provider.test.ts | 6 +- .../browser/editor/debug-hover-model.test.ts | 4 +- .../debug-hover-tree.model.service.test.ts | 9 +- .../editor/debug-model-manager.test.ts | 2 +- .../browser/editor/debug-model.test.ts | 12 +- .../editor/editor-hover-contribution.test.ts | 11 +- .../browser/launch-preferences.test.ts | 32 +++-- .../browser/model/debug-breakpoint.test.ts | 7 +- .../browser/model/debug-source.test.ts | 2 +- .../browser/model/debug-watch.test.ts | 8 +- .../debug-breakpoints.service.test.ts | 14 +- .../debug-configuration.service.test.ts | 14 +- .../debug-toolbar.service.test.ts | 4 +- .../debug-console-tree.model.service.test.ts | 38 +++--- .../view/console/debug-console.view.test.tsx | 53 ++++---- .../frames/debug-call-stack.service.test.ts | 14 +- ...debug-variables-tree.model.service.test.ts | 14 +- .../debug-watch-tree.model.service.test.ts | 11 +- .../breakpoint/breakpoint-decoration.ts | 2 + .../browser/breakpoint/breakpoint-manager.ts | 12 +- .../browser/breakpoint/breakpoint-marker.ts | 4 +- .../browser/components/debug-action/index.tsx | 6 +- .../floating-click-widget/index.tsx | 7 +- .../contextkeys/debug-contextkey.service.ts | 4 +- .../debug/src/browser/debug-ansi-handle.ts | 5 +- .../browser/debug-configuration-manager.ts | 27 ++-- .../src/browser/debug-configuration-model.ts | 1 + .../debug/src/browser/debug-contribution.ts | 75 +++++------ .../debug/src/browser/debug-link-detector.ts | 5 +- .../debug/src/browser/debug-preferences.ts | 2 +- .../src/browser/debug-progress.service.ts | 15 ++- .../debug/src/browser/debug-schema-updater.ts | 4 +- packages/debug/src/browser/debug-service.ts | 3 +- .../src/browser/debug-session-connection.ts | 12 +- .../src/browser/debug-session-contribution.ts | 23 ++-- .../src/browser/debug-session-manager.ts | 26 ++-- packages/debug/src/browser/debug-session.ts | 31 +++-- packages/debug/src/browser/debugUtils.ts | 1 + .../browser/editor/debug-breakpoint-widget.ts | 8 +- .../editor/debug-breakpoint-zone-widget.tsx | 19 +-- .../editor/debug-editor-contribution.ts | 49 +++---- .../editor/debug-expression-provider.ts | 8 +- .../src/browser/editor/debug-hover-model.ts | 3 +- .../src/browser/editor/debug-hover-source.ts | 8 +- .../editor/debug-hover-tree.model.service.ts | 9 +- .../src/browser/editor/debug-hover-widget.tsx | 12 +- .../src/browser/editor/debug-hover.view.tsx | 18 ++- .../src/browser/editor/debug-model-manager.ts | 7 +- .../debug/src/browser/editor/debug-model.ts | 42 +++--- .../editor/debug-run-to-cursor.service.ts | 14 +- .../browser/editor/evaluatable-expression.ts | 2 +- .../debug/src/browser/editor/inline-values.ts | 3 +- packages/debug/src/browser/index.ts | 9 +- .../src/browser/markers/marker-manager.ts | 1 + .../debug/src/browser/model/debug-source.ts | 9 +- .../src/browser/model/debug-stack-frame.ts | 13 +- .../debug/src/browser/model/debug-thread.ts | 7 +- .../debug/src/browser/model/debug-watch.ts | 8 +- .../launch-preferences-contribution.ts | 1 + .../browser/preferences/launch-preferences.ts | 1 + .../tree/debug-console-tree-node.define.tsx | 13 +- .../browser/tree/debug-tree-node.define.ts | 11 +- .../breakpoints/debug-breakpoints.service.ts | 25 ++-- .../breakpoints/debug-breakpoints.view.tsx | 19 +-- .../debug-configuration.service.ts | 12 +- .../debug-configuration.view.tsx | 16 ++- .../configuration/debug-toolbar.service.ts | 8 +- .../view/configuration/debug-toolbar.view.tsx | 17 ++- .../console/debug-console-filter.model.ts | 2 +- .../console/debug-console-filter.service.ts | 5 +- .../console/debug-console-filter.view.tsx | 13 +- .../view/console/debug-console-model.ts | 3 +- .../view/console/debug-console-session.ts | 16 ++- .../console/debug-console-toolbar.view.tsx | 6 +- .../debug-console-tree.model.service.ts | 20 +-- .../console/debug-console.contribution.ts | 20 +-- .../view/console/debug-console.service.ts | 35 ++--- .../view/console/debug-console.view.tsx | 21 +-- .../src/browser/view/debug-view-model.ts | 10 +- .../frames/debug-call-stack-frame.view.tsx | 14 +- .../frames/debug-call-stack-session.view.tsx | 11 +- .../frames/debug-call-stack-thread.view.tsx | 11 +- .../frames/debug-call-stack.contribution.ts | 20 +-- .../frames/debug-call-stack.operation.tsx | 7 +- .../view/frames/debug-call-stack.service.ts | 10 +- .../view/frames/debug-call-stack.view.tsx | 9 +- .../view/variables/debug-variables-model.ts | 3 +- .../debug-variables-tree.model.service.ts | 11 +- .../variables/debug-variables.contribution.ts | 30 +++-- .../view/variables/debug-variables.view.tsx | 14 +- .../browser/view/watch/debug-watch-model.ts | 3 +- .../watch/debug-watch-tree.model.service.ts | 18 ++- .../view/watch/debug-watch.contribution.ts | 20 +-- .../browser/view/watch/debug-watch.view.tsx | 14 +- packages/debug/src/common/constants.ts | 3 +- packages/debug/src/common/debug-model.ts | 12 +- packages/debug/src/common/debug-service.ts | 1 + packages/debug/src/common/debug-session.ts | 5 +- .../src/common/evaluatable-expression.ts | 4 +- packages/debug/src/common/inline-values.ts | 4 +- .../__tests__/browser/index.test.ts | 3 +- .../src/browser/decorationsService.ts | 4 +- packages/decoration/src/browser/index.ts | 1 + .../__tests__/browser/breadcrumb.test.ts | 15 ++- .../__tests__/browser/decoration.test.ts | 7 +- .../browser/doc-cache/empty-doc-cache.test.ts | 10 +- .../doc-cache/local-storage-cache.test.ts | 10 +- .../editor-document-model-service.test.ts | 18 +-- .../doc-model/editor-document-model.test.ts | 19 +-- .../__tests__/browser/editor-service.test.ts | 59 +++++---- .../browser/editor.collection.test.ts | 15 ++- .../browser/editor.contribution.test.ts | 5 +- .../__tests__/browser/editor.feature.test.ts | 13 +- .../browser/editor.status-bar.test.ts | 5 +- .../workspace-symbol-quickopen.test.ts | 8 +- .../editor/__tests__/browser/resource.test.ts | 15 ++- .../__tests__/browser/test-providers.ts | 2 +- .../editor/src/browser/breadcrumb/default.ts | 2 + .../src/browser/breadcrumb/document-symbol.ts | 8 +- .../editor/src/browser/breadcrumb/index.ts | 7 +- packages/editor/src/browser/component.ts | 12 +- .../src/browser/component/scroll/scroll.tsx | 5 +- .../editor/src/browser/decoration-applier.ts | 14 +- packages/editor/src/browser/diff/compare.ts | 3 +- packages/editor/src/browser/diff/index.ts | 5 +- .../src/browser/doc-cache/empty-doc-cache.ts | 1 + .../browser/doc-cache/local-storage-cache.ts | 3 +- .../editor-document-model-service.ts | 10 +- .../doc-model/editor-document-model.ts | 15 ++- .../editor/src/browser/doc-model/override.ts | 9 +- .../editor/src/browser/doc-model/save-task.ts | 1 + .../src/browser/doc-model/saveParticipants.ts | 23 ++-- .../editor/src/browser/doc-model/types.ts | 7 +- .../src/browser/editor-collection.service.ts | 24 ++-- packages/editor/src/browser/editor-opener.ts | 1 + .../editor/src/browser/editor.contribution.ts | 32 ++--- .../src/browser/editor.decoration.service.ts | 10 +- .../editor/src/browser/editor.override.ts | 16 ++- .../src/browser/editor.status-bar.service.ts | 6 +- packages/editor/src/browser/editor.view.tsx | 15 ++- packages/editor/src/browser/feature.ts | 4 +- .../src/browser/format/formatterSelect.ts | 5 +- .../src/browser/fs-resource/fs-editor-doc.ts | 7 +- .../src/browser/fs-resource/fs-resource.ts | 14 +- .../editor/src/browser/fs-resource/index.ts | 9 +- .../editor/src/browser/grid/grid.service.ts | 3 +- packages/editor/src/browser/history/index.ts | 3 +- packages/editor/src/browser/index.ts | 74 ++++++----- .../browser/language/diagnostic-collection.ts | 7 +- .../language/language-status.contribution.ts | 1 + .../language/language-status.service.ts | 6 +- .../src/browser/language/language.service.ts | 6 +- .../editor/src/browser/menu/editor.context.ts | 8 +- .../editor/src/browser/menu/editor.menu.ts | 5 +- .../src/browser/menu/title-context.menu.ts | 5 +- .../callHierarchy.contribution.ts | 2 +- .../monaco-contrib/command/command.service.ts | 4 +- .../tokenizer/textmate-registry.ts | 3 +- .../tokenizer/textmate-tokenizer.ts | 3 +- .../tokenizer/textmate.service.ts | 42 +++--- .../editor/src/browser/navigation.view.tsx | 15 ++- .../src/browser/preference/contribution.ts | 1 + .../src/browser/preference/converter.ts | 6 +- .../editor/src/browser/preference/util.ts | 1 + .../src/browser/quick-open/go-to-line.ts | 9 +- .../quick-open/workspace-symbol-quickopen.ts | 12 +- .../editor/src/browser/resource.service.ts | 10 +- packages/editor/src/browser/tab.view.tsx | 20 +-- packages/editor/src/browser/types.ts | 27 ++-- .../editor/src/browser/untitled-resource.ts | 1 + .../editor/src/browser/view/editor.react.tsx | 2 + .../editor/src/browser/view/react-hook.tsx | 3 +- .../editor/src/browser/view/suggest-widget.ts | 6 +- .../editor/src/browser/view/topPadding.ts | 3 +- .../src/browser/workbench-editor.service.ts | 87 +++++++------ packages/editor/src/common/doc-cache.ts | 2 +- packages/editor/src/common/editor.ts | 14 +- packages/editor/src/common/language-status.ts | 1 + packages/editor/src/common/language.ts | 9 +- .../common/mocks/workbench-editor.service.ts | 7 +- .../electron-basic/__tests__/index.test.ts | 16 ++- .../src/browser/dialog/index.ts | 2 +- .../src/browser/header/header.tsx | 11 +- packages/electron-basic/src/browser/index.ts | 11 +- .../src/browser/welcome/contribution.ts | 7 +- .../src/browser/welcome/welcome.tsx | 6 +- .../browser/explorer.contribution.test.ts | 5 +- .../src/browser/explorer-contribution.ts | 2 +- packages/explorer/src/browser/index.ts | 1 + .../__tests__/browser/index.test.ts | 3 +- .../__tests__/node/index.test.ts | 14 +- .../src/browser/file-server.contribution.ts | 3 +- .../express-file-server/src/browser/index.ts | 3 +- .../node/express-file-server.contribution.ts | 12 +- .../express-file-server/src/node/index.ts | 1 + .../src/browser/extension-overview/index.tsx | 10 +- .../src/browser/extension/index.tsx | 3 +- .../extension-manager/src/browser/index.ts | 1 + .../src/browser/vsx-extension.contribution.ts | 7 +- .../src/browser/vsx-extension.service.ts | 5 +- .../src/browser/vsx-extension.view.tsx | 15 ++- packages/extension-manager/src/node/index.ts | 1 + .../src/node/vsx-extension.service.ts | 6 +- .../__tests__/browser/storage.service.test.ts | 12 +- .../__tests__/browser/storage.test.ts | 17 ++- .../extension-storage/src/browser/index.ts | 8 +- .../src/browser/storage-path.ts | 13 +- .../src/browser/storage.service.ts | 6 +- .../extension-storage/src/browser/storage.ts | 3 +- .../src/common/storage-path.ts | 2 +- .../extension-storage/src/common/storage.ts | 5 +- .../__mocks__/api/mainthread.extension.log.ts | 2 +- .../api/mainthread.extension.service.ts | 1 - .../__mocks__/extension.service.client.ts | 4 +- packages/extension/__mocks__/extensions.ts | 2 + .../extension/__mocks__/initRPCProtocol.ts | 4 +- .../__mocks__/mockExtNodClientService.ts | 1 + packages/extension/__mocks__/worker.ts | 4 +- .../browser/activation.service.test.ts | 2 +- .../extension-service-mock-helper.ts | 102 ++++++++------- .../extension.contribution.test.ts | 7 +- .../extension.service.test.ts | 29 +++-- .../extension.worker.service.test.ts | 1 + .../__tests__/browser/extension.test.ts | 13 +- .../extension/__tests__/browser/index.test.ts | 1 + .../__tests__/browser/main.language.test.ts | 56 ++++---- .../browser/main.thread.command.test.ts | 14 +- .../browser/main.thread.custom-editor.test.ts | 15 ++- .../browser/main.thread.debug.test.ts | 19 +-- .../browser/main.thread.decoration.test.ts | 16 +-- .../browser/main.thread.editor.test.ts | 86 ++++++------ .../__tests__/browser/main.thread.env.test.ts | 15 ++- .../browser/main.thread.extensions.test.ts | 57 ++++---- .../browser/main.thread.output.test.ts | 8 +- .../browser/main.thread.secret.test.ts | 7 +- .../browser/main.thread.statusbar.test.ts | 11 +- .../browser/main.thread.task.test.ts | 51 ++++---- .../browser/main.thread.treeview.test.ts | 13 +- .../browser/main.thread.webview.test.ts | 39 +++--- .../browser/main.thread.window.test.ts | 8 +- .../browser/main.thread.workspace.test.ts | 123 +++++++++--------- .../browser/sumi-browser/index.test.ts | 3 +- .../browser/vscode.contributes.test.ts | 29 +++-- .../__tests__/common/activator.test.ts | 2 +- .../common/require-interceptor.test.ts | 1 + .../hosted/api/sumi/ext.host.command.test.ts | 5 +- .../hosted/api/sumi/ext.host.layout.test.ts | 7 +- .../hosted/api/sumi/ext.host.toolbar.test.ts | 13 +- .../hosted/api/sumi/ext.host.window.test.ts | 10 +- .../api/vscode/__mock__/taskProvider.ts | 2 + .../api/vscode/editor/editor.host.test.ts | 3 +- .../vscode/ext.host.authentication.test.ts | 36 ++--- .../api/vscode/ext.host.command.test.ts | 21 +-- .../api/vscode/ext.host.comments.test.ts | 34 ++--- .../api/vscode/ext.host.custom-editor.test.ts | 10 +- .../hosted/api/vscode/ext.host.debug.test.ts | 15 ++- .../api/vscode/ext.host.decoration.test.ts | 3 +- .../hosted/api/vscode/ext.host.env.test.ts | 12 +- .../api/vscode/ext.host.extensions.test.ts | 6 +- .../api/vscode/ext.host.file-system.test.ts | 2 +- .../api/vscode/ext.host.quickopen.test.ts | 14 +- .../hosted/api/vscode/ext.host.secret.test.ts | 3 +- .../api/vscode/ext.host.statusbar.test.ts | 17 +-- .../api/vscode/ext.host.storage.test.ts | 6 +- .../hosted/api/vscode/ext.host.task.test.ts | 65 ++++----- .../api/vscode/ext.host.terminal.test.ts | 30 +++-- .../hosted/api/vscode/ext.host.test.ts | 15 ++- .../api/vscode/ext.host.theming.test.ts | 10 +- .../api/vscode/ext.host.treeview.test.ts | 8 +- .../hosted/api/vscode/ext.host.urls.test.ts | 5 +- .../api/vscode/ext.host.webview.test.ts | 5 +- .../vscode/language/rang-formatting.test.ts | 3 +- .../__tests__/hosted/ext.host.proxy.test.ts | 11 +- .../__tests__/hosted/vscode.extension.test.ts | 1 + .../__tests__/hosted/worker.host.test.ts | 13 +- .../extension.host.manager.common-tester.ts | 11 +- .../node/extension.host.manager.test.ts | 3 +- .../node/extension.host.proxy.manager.test.ts | 6 +- .../node/extension.service.client.test.ts | 14 +- .../__tests__/node/extension.service.test.ts | 13 +- .../src/browser/activation.service.ts | 5 +- .../components/extension-loading-view.tsx | 4 +- .../components/extension-portal-root.tsx | 6 +- .../components/extension-tree-view-node.tsx | 11 +- .../components/extension-tree-view.tsx | 18 +-- .../components/extension-webview-view.tsx | 4 +- .../browser/extension-instance-management.ts | 1 + .../browser/extension-management.service.ts | 1 + .../src/browser/extension-node.service.ts | 1 + .../src/browser/extension-view.service.ts | 39 +++--- .../src/browser/extension-worker.service.ts | 1 + .../src/browser/extension.contribution.ts | 12 +- .../src/browser/extension.service.ts | 36 ++--- packages/extension/src/browser/extension.ts | 4 +- packages/extension/src/browser/index.ts | 3 +- .../extension/src/browser/metadata.service.ts | 8 +- .../require-interceptor.contribution.ts | 3 + packages/extension/src/browser/shadowRoot.tsx | 9 +- .../src/browser/sumi-browser/commands.ts | 5 +- .../src/browser/sumi-browser/components.ts | 4 +- .../sumi-browser/contribution/editor.ts | 9 +- .../sumi-browser/contribution/editorSide.ts | 5 +- .../sumi-browser/contribution/index.ts | 10 +- .../sumi-browser/contribution/tabbar.ts | 7 +- .../sumi-browser/contribution/toolbar.ts | 5 +- .../src/browser/sumi-browser/index.ts | 13 +- .../src/browser/sumi-browser/types.ts | 5 +- .../browser/sumi/contributes/browser-views.ts | 7 +- .../src/browser/sumi/contributes/index.ts | 3 +- .../src/browser/sumi/contributes/toolbar.ts | 4 +- .../src/browser/sumi/main.thread.api.impl.ts | 10 +- .../src/browser/sumi/main.thread.common.ts | 3 +- .../src/browser/sumi/main.thread.layout.ts | 7 +- .../src/browser/sumi/main.thread.lifecycle.ts | 4 +- .../src/browser/sumi/main.thread.theme.ts | 8 +- .../src/browser/sumi/main.thread.toolbar.ts | 6 +- .../src/browser/sumi/main.thread.window.ts | 6 +- packages/extension/src/browser/types.ts | 2 + .../extension-debug-adapter-contribution.ts | 3 +- .../api/debug/extension-debug-service.ts | 12 +- ...ion-debug-session-contribution-registry.ts | 4 +- .../debug/extension-debug-session-factory.ts | 14 +- .../vscode/api/main.thread.api.impl.ts | 60 ++++----- .../vscode/api/main.thread.api.progress.ts | 9 +- .../vscode/api/main.thread.api.webview.ts | 64 ++++----- .../vscode/api/main.thread.authentication.ts | 5 +- .../vscode/api/main.thread.commands.ts | 5 +- .../vscode/api/main.thread.comments.ts | 43 +++--- .../vscode/api/main.thread.connection.ts | 4 +- .../vscode/api/main.thread.custom-editor.ts | 12 +- .../browser/vscode/api/main.thread.debug.ts | 41 +++--- .../vscode/api/main.thread.decoration.ts | 4 +- .../src/browser/vscode/api/main.thread.doc.ts | 13 +- .../vscode/api/main.thread.editor-tabs.ts | 11 +- .../browser/vscode/api/main.thread.editor.ts | 44 ++++--- .../src/browser/vscode/api/main.thread.env.ts | 11 +- .../api/main.thread.file-system-event.ts | 15 ++- .../vscode/api/main.thread.file-system.ts | 9 +- .../vscode/api/main.thread.language.ts | 42 +++--- .../src/browser/vscode/api/main.thread.log.ts | 6 +- .../browser/vscode/api/main.thread.message.ts | 6 +- .../browser/vscode/api/main.thread.output.ts | 7 +- .../vscode/api/main.thread.preference.ts | 20 +-- .../vscode/api/main.thread.quickopen.ts | 7 +- .../src/browser/vscode/api/main.thread.scm.ts | 6 +- .../browser/vscode/api/main.thread.secret.ts | 3 +- .../vscode/api/main.thread.statusbar.ts | 9 +- .../browser/vscode/api/main.thread.storage.ts | 5 +- .../browser/vscode/api/main.thread.tasks.ts | 45 +++---- .../vscode/api/main.thread.terminal.ts | 4 +- .../browser/vscode/api/main.thread.tests.ts | 18 +-- .../browser/vscode/api/main.thread.theming.ts | 10 +- .../vscode/api/main.thread.treeview.ts | 26 ++-- .../browser/vscode/api/main.thread.urls.ts | 3 +- .../vscode/api/main.thread.window-state.ts | 3 +- .../browser/vscode/api/main.thread.window.ts | 7 +- .../vscode/api/main.thread.workspace.ts | 17 +-- .../semantic-token-provider.ts | 4 +- .../api/tree-view/tree-view.model.service.ts | 12 +- .../vscode/api/tree-view/tree-view.model.ts | 1 + .../api/tree-view/tree-view.node.defined.ts | 5 +- .../src/browser/vscode/builtin-commands.ts | 2 +- .../src/browser/vscode/contributes/actions.ts | 5 +- .../browser/vscode/contributes/breakpoints.ts | 3 +- .../src/browser/vscode/contributes/color.ts | 5 +- .../browser/vscode/contributes/commands.ts | 3 +- .../src/browser/vscode/contributes/common.ts | 3 +- .../vscode/contributes/configuration.ts | 3 +- .../contributes/configurationDefaults.ts | 3 +- .../vscode/contributes/customEditors.tsx | 14 +- .../browser/vscode/contributes/debuggers.ts | 3 +- .../src/browser/vscode/contributes/grammar.ts | 4 +- .../src/browser/vscode/contributes/icon.ts | 3 +- .../src/browser/vscode/contributes/index.ts | 35 ++--- .../browser/vscode/contributes/keybindings.ts | 5 +- .../browser/vscode/contributes/language.ts | 4 +- .../vscode/contributes/localization.ts | 2 +- .../src/browser/vscode/contributes/menu.ts | 6 +- .../vscode/contributes/problemMatchers.ts | 2 + .../vscode/contributes/problemPatterns.ts | 1 + .../contributes/semanticTokenModifiers.ts | 1 + .../vscode/contributes/semanticTokenScopes.ts | 1 + .../vscode/contributes/semanticTokenTypes.ts | 1 + .../browser/vscode/contributes/snippets.ts | 3 +- .../vscode/contributes/taskDefinition.ts | 3 +- .../browser/vscode/contributes/terminal.ts | 3 +- .../src/browser/vscode/contributes/theme.ts | 3 +- .../vscode/contributes/view-containers.ts | 5 +- .../vscode/contributes/views-welcome.ts | 7 +- .../src/browser/vscode/contributes/views.ts | 5 +- packages/extension/src/common/activator.ts | 2 + .../extension/src/common/ext.host.proxy.ts | 1 + .../extension/src/common/extension.service.ts | 3 +- packages/extension/src/common/index.ts | 14 +- .../src/common/require-interceptor.ts | 1 + .../extension/src/common/sumi/extension.ts | 4 +- packages/extension/src/common/sumi/index.ts | 5 +- packages/extension/src/common/sumi/toolbar.ts | 1 + .../extension/src/common/vscode/command.ts | 3 +- .../extension/src/common/vscode/comments.ts | 3 +- .../extension/src/common/vscode/connection.ts | 8 +- .../extension/src/common/vscode/converter.ts | 35 ++--- .../src/common/vscode/custom-editor.ts | 7 +- packages/extension/src/common/vscode/debug.ts | 8 +- .../extension/src/common/vscode/decoration.ts | 3 +- packages/extension/src/common/vscode/doc.ts | 5 +- .../src/common/vscode/editor-tabs.ts | 3 +- .../extension/src/common/vscode/editor.ts | 5 +- packages/extension/src/common/vscode/env.ts | 4 +- .../extension/src/common/vscode/ext-types.ts | 6 +- .../common/vscode/extension-message-writer.ts | 3 +- .../src/common/vscode/file-system.ts | 2 +- packages/extension/src/common/vscode/index.ts | 78 +++++------ .../extension/src/common/vscode/languages.ts | 38 +++--- .../extension/src/common/vscode/model.api.ts | 17 ++- .../src/common/vscode/models/html-content.ts | 3 +- packages/extension/src/common/vscode/scm.ts | 2 +- packages/extension/src/common/vscode/tasks.ts | 7 +- .../extension/src/common/vscode/terminal.ts | 4 +- .../src/common/vscode/testing/testApi.ts | 3 +- .../common/vscode/testing/testCollection.ts | 4 +- packages/extension/src/common/vscode/tests.ts | 2 +- .../extension/src/common/vscode/treeview.ts | 8 +- packages/extension/src/common/vscode/urls.ts | 2 + packages/extension/src/common/vscode/utils.ts | 3 +- .../extension/src/common/vscode/webview.ts | 4 +- .../extension/src/common/vscode/window.ts | 8 +- .../extension/src/common/vscode/workspace.ts | 8 +- .../src/hosted/api/sumi/ext.host.api.impl.ts | 18 +-- .../src/hosted/api/sumi/ext.host.command.ts | 2 +- .../src/hosted/api/sumi/ext.host.common.ts | 7 +- .../src/hosted/api/sumi/ext.host.layout.ts | 8 +- .../src/hosted/api/sumi/ext.host.lifecycle.ts | 2 +- .../src/hosted/api/sumi/ext.host.toolbar.ts | 17 ++- .../src/hosted/api/sumi/ext.host.webview.ts | 5 +- .../src/hosted/api/sumi/ext.host.window.ts | 1 + .../hosted/api/telemetry/ext.host.api.impl.ts | 8 +- .../debug/abstract-debug-adapter-session.ts | 7 +- .../src/hosted/api/vscode/debug/common.ts | 1 + .../hosted/api/vscode/debug/ext.host.debug.ts | 33 ++--- ...ension-debug-adapter-excutable-resolver.ts | 3 + .../debug/extension-debug-adapter-session.ts | 4 +- .../debug/extension-debug-adapter-starter.ts | 6 +- .../hosted/api/vscode/doc/doc-manager.host.ts | 8 +- .../hosted/api/vscode/doc/ext-data.host.ts | 6 +- .../src/hosted/api/vscode/doc/mirror.ts | 4 +- .../hosted/api/vscode/editor/edit.builder.ts | 3 +- .../hosted/api/vscode/editor/editor.host.ts | 17 ++- .../hosted/api/vscode/ext.host.api.command.ts | 14 +- .../hosted/api/vscode/ext.host.api.impl.ts | 64 ++++----- .../hosted/api/vscode/ext.host.api.webview.ts | 18 +-- .../api/vscode/ext.host.authentication.ts | 4 +- .../src/hosted/api/vscode/ext.host.command.ts | 35 ++--- .../hosted/api/vscode/ext.host.comments.ts | 12 +- .../hosted/api/vscode/ext.host.connection.ts | 5 +- .../api/vscode/ext.host.custom-editor.ts | 18 ++- .../hosted/api/vscode/ext.host.decoration.ts | 7 +- .../hosted/api/vscode/ext.host.editor-tabs.ts | 3 +- .../src/hosted/api/vscode/ext.host.env.ts | 11 +- .../hosted/api/vscode/ext.host.extensions.ts | 9 +- .../api/vscode/ext.host.file-system-event.ts | 10 +- .../api/vscode/ext.host.file-system-info.ts | 1 + .../hosted/api/vscode/ext.host.file-system.ts | 10 +- .../hosted/api/vscode/ext.host.language.ts | 97 +++++++------- .../src/hosted/api/vscode/ext.host.message.ts | 4 +- .../src/hosted/api/vscode/ext.host.output.ts | 5 +- .../hosted/api/vscode/ext.host.preference.ts | 12 +- .../hosted/api/vscode/ext.host.progress.ts | 17 ++- .../hosted/api/vscode/ext.host.quickopen.ts | 14 +- .../src/hosted/api/vscode/ext.host.scm.ts | 5 +- .../src/hosted/api/vscode/ext.host.secrets.ts | 3 +- .../hosted/api/vscode/ext.host.statusbar.ts | 9 +- .../src/hosted/api/vscode/ext.host.storage.ts | 5 +- .../hosted/api/vscode/ext.host.terminal.ts | 18 ++- .../src/hosted/api/vscode/ext.host.tests.ts | 19 +-- .../src/hosted/api/vscode/ext.host.theming.ts | 3 +- .../hosted/api/vscode/ext.host.treeview.ts | 12 +- .../src/hosted/api/vscode/ext.host.urls.ts | 2 + .../api/vscode/ext.host.window-state.ts | 7 +- .../api/vscode/ext.host.window.api.impl.ts | 19 +-- .../hosted/api/vscode/ext.host.workspace.ts | 20 +-- .../api/vscode/language/callhierarchy.ts | 8 +- .../hosted/api/vscode/language/code-action.ts | 16 ++- .../src/hosted/api/vscode/language/color.ts | 8 +- .../hosted/api/vscode/language/completion.ts | 9 +- .../hosted/api/vscode/language/declaration.ts | 7 +- .../hosted/api/vscode/language/definition.ts | 8 +- .../hosted/api/vscode/language/diagnostics.ts | 4 +- .../api/vscode/language/document-highlight.ts | 8 +- .../vscode/language/evaluatableExpression.ts | 7 +- .../src/hosted/api/vscode/language/folding.ts | 6 +- .../src/hosted/api/vscode/language/hover.ts | 6 +- .../api/vscode/language/implementation.ts | 7 +- .../hosted/api/vscode/language/inlay-hints.ts | 4 +- .../api/vscode/language/inline-values.ts | 8 +- .../src/hosted/api/vscode/language/lens.ts | 6 +- .../api/vscode/language/link-provider.ts | 4 +- .../vscode/language/linked-editing-range.ts | 4 +- .../api/vscode/language/on-type-formatting.ts | 5 +- .../src/hosted/api/vscode/language/outline.ts | 8 +- .../api/vscode/language/range-formatting.ts | 3 + .../hosted/api/vscode/language/reference.ts | 6 +- .../src/hosted/api/vscode/language/rename.ts | 8 +- .../hosted/api/vscode/language/selection.ts | 8 +- .../api/vscode/language/semantic-tokens.ts | 3 +- .../hosted/api/vscode/language/signature.ts | 6 +- .../api/vscode/language/type-definition.ts | 4 +- .../src/hosted/api/vscode/language/util.ts | 6 +- .../api/vscode/language/workspace-symbol.ts | 3 +- .../api/vscode/preferences/configuration.ts | 6 +- .../hosted/api/vscode/tasks/ext.host.tasks.ts | 11 +- .../src/hosted/api/vscode/tasks/taskTypes.ts | 3 +- .../hosted/api/worker/worker.host.api.impl.ts | 46 +++---- .../src/hosted/ext.host.proxy-base.ts | 8 +- packages/extension/src/hosted/ext.host.ts | 17 ++- .../extension/src/hosted/ext.process-base.ts | 19 +-- .../extension/src/hosted/extension-log.ts | 3 +- .../extension/src/hosted/extension-log2.ts | 2 +- .../extension/src/hosted/vscode.extension.ts | 1 + .../src/hosted/worker.host-preload.ts | 6 +- packages/extension/src/hosted/worker.host.ts | 15 ++- .../src/node/extension.host.manager.ts | 9 +- .../src/node/extension.host.proxy.manager.ts | 10 +- .../src/node/extension.profiler.service.ts | 7 +- .../extension/src/node/extension.scanner.ts | 8 +- .../src/node/extension.service.client.ts | 13 +- .../extension/src/node/extension.service.ts | 35 ++--- packages/extension/src/node/index.ts | 6 +- packages/extension/src/node/languagePack.js | 2 +- .../extension/src/node/merge-contributes.ts | 3 +- packages/extension/webpack.config.worker.js | 3 +- .../__tests__/browser/resource.test.ts | 26 ++-- .../__tests__/node/file-doc-node.test.ts | 15 ++- .../file-scheme/src/browser/external.view.tsx | 6 +- packages/file-scheme/src/browser/file-doc.ts | 9 +- .../src/browser/file-scheme-doc.client.ts | 3 +- .../src/browser/file-scheme.contribution.ts | 17 +-- packages/file-scheme/src/browser/index.ts | 5 +- .../file-scheme/src/browser/prevent.view.tsx | 1 + .../file-scheme/src/browser/preview.view.tsx | 6 +- .../src/node/file-scheme-doc.service.ts | 7 +- packages/file-scheme/src/node/index.ts | 1 + .../node/file-search.service.test.ts | 6 +- .../src/node/file-search.service.ts | 9 +- packages/file-search/src/node/index.ts | 4 +- .../browser/file-service-client.test.ts | 15 ++- .../__tests__/browser/watcher.test.ts | 5 +- .../__tests__/node/encoding/encoding.test.ts | 5 +- .../node/file-change-collection.test.ts | 3 +- .../node/file-service-watcher.test.ts | 10 +- .../file-service/__tests__/node/index.test.ts | 19 ++- .../src/browser/file-service-client.ts | 42 +++--- .../src/browser/file-service-contribution.ts | 2 + .../browser/file-service-provider-client.ts | 1 + packages/file-service/src/browser/index.ts | 4 +- .../browser/shadow-file-system.provider.ts | 5 +- packages/file-service/src/browser/watcher.ts | 1 + .../src/common/file-service-client.ts | 5 +- packages/file-service/src/common/files.ts | 3 +- .../src/common/mocks/file-service-client.ts | 8 +- .../src/common/mocks/file-system-provider.ts | 5 +- packages/file-service/src/common/watcher.ts | 3 +- .../src/node/disk-file-system.provider.ts | 23 ++-- packages/file-service/src/node/encoding.ts | 5 +- .../src/node/file-service-watcher.ts | 12 +- .../file-service/src/node/file-service.ts | 20 +-- .../src/node/file-system-manage.ts | 1 + packages/file-service/src/node/index.ts | 4 +- .../dialog/file-dialog-model.service.test.ts | 11 +- .../dialog/file-dialog.service.test.ts | 14 +- .../browser/file-tree-contribution.test.ts | 27 ++-- .../browser/file-tree-model.service.test.ts | 25 ++-- .../browser/file-tree.service.test.ts | 24 ++-- .../__tests__/browser/file-tree.test.ts | 50 +++---- .../dialog/file-dialog-model.service.ts | 10 +- .../src/browser/dialog/file-dialog-node.tsx | 11 +- .../src/browser/dialog/file-dialog.service.ts | 10 +- .../src/browser/dialog/file-dialog.view.tsx | 14 +- .../browser/dialog/window-dialog.service.tsx | 10 +- .../file-tree-next/src/browser/empty.view.tsx | 6 +- .../src/browser/file-tree-contribution.ts | 39 +++--- .../src/browser/file-tree-model.ts | 6 +- .../src/browser/file-tree-node.tsx | 14 +- .../src/browser/file-tree.service.ts | 32 +++-- .../file-tree-next/src/browser/file-tree.tsx | 16 ++- packages/file-tree-next/src/browser/index.ts | 15 ++- .../browser/services/file-tree-api.service.ts | 15 ++- .../services/file-tree-decoration.service.ts | 2 +- .../browser/services/file-tree-dnd.service.ts | 18 +-- .../services/file-tree-model.service.ts | 23 ++-- .../src/browser/symlink-file-decoration.ts | 3 +- .../src/common/file-tree-node.define.ts | 3 +- packages/file-tree-next/src/common/index.ts | 3 +- packages/i18n/src/common/index.ts | 3 +- .../__tests__/browser/keymaps.service.test.ts | 27 ++-- packages/keymaps/src/browser/index.ts | 4 +- .../keymaps/src/browser/keymaps-parser.ts | 4 +- .../src/browser/keymaps.contribution.ts | 11 +- .../keymaps/src/browser/keymaps.service.ts | 16 ++- packages/keymaps/src/browser/keymaps.view.tsx | 18 ++- .../__tests__/browser/log-manage.test.ts | 1 + .../__tests__/browser/log.service.test.ts | 3 +- .../__tests__/node/log-manager.test.ts | 9 +- .../__tests__/node/log.service.test.ts | 9 +- packages/logs-core/src/browser/index.ts | 2 + packages/logs-core/src/browser/log-manage.ts | 4 +- packages/logs-core/src/node/index.ts | 4 +- packages/logs-core/src/node/log-manager.ts | 9 +- packages/logs-core/src/node/log.service.ts | 9 +- packages/logs-core/src/node/logger.ts | 3 +- packages/logs-core/src/node/utils.ts | 4 +- .../__tests__/browser/layout.service.test.tsx | 19 +-- .../browser/accordion/accordion.service.ts | 11 +- .../src/browser/accordion/accordion.view.tsx | 7 +- .../src/browser/accordion/section.view.tsx | 9 +- packages/main-layout/src/browser/index.ts | 8 +- .../main-layout/src/browser/input/index.tsx | 2 + .../main-layout/src/browser/layout.service.ts | 26 ++-- .../src/browser/main-layout.contribution.ts | 14 +- .../main-layout/src/browser/tabbar-handler.ts | 7 +- .../src/browser/tabbar/bar.view.tsx | 17 ++- .../src/browser/tabbar/panel.view.tsx | 19 +-- .../src/browser/tabbar/renderer.view.tsx | 12 +- .../src/browser/tabbar/tabbar.service.ts | 17 ++- .../main-layout/src/browser/views-registry.ts | 1 + .../main-layout/src/browser/welcome.view.tsx | 14 +- .../src/common/main-layout.defination.ts | 11 +- .../browser/markdown-service.test.ts | 7 +- packages/markdown/src/browser/contribution.ts | 9 +- .../markdown/src/browser/editor.markdown.tsx | 4 +- packages/markdown/src/browser/index.ts | 4 +- .../markdown/src/browser/markdown-widget.tsx | 2 + .../markdown/src/browser/markdown.service.ts | 12 +- .../__tests__/browser/markes-service.test.ts | 9 +- packages/markers/src/browser/index.ts | 2 + .../src/browser/markers-contribution.ts | 2 + .../src/browser/markers-filter.model.ts | 2 + .../src/browser/markers-filter.view.tsx | 13 +- .../src/browser/markers-seriverty-icon.ts | 3 +- .../markers/src/browser/markers-service.ts | 9 +- .../markers/src/browser/markers-tree.view.tsx | 13 +- packages/markers/src/browser/markers.model.ts | 5 +- packages/markers/src/common/match.ts | 4 +- .../menu-bar/__tests__/menu-bar.store.test.ts | 6 +- packages/menu-bar/src/browser/index.ts | 2 +- .../src/browser/menu-bar.contribution.ts | 5 +- .../menu-bar/src/browser/menu-bar.store.ts | 6 +- .../menu-bar/src/browser/menu-bar.view.tsx | 12 +- .../src/browser/toolbar-action.view.tsx | 6 +- .../src/browser/folded-code-widget.ts | 9 +- .../monaco-enhance/src/browser/peek-view.ts | 1 + .../monaco-enhance/src/browser/zone-widget.ts | 8 +- .../__mocks__/monaco.context-key.service.ts | 2 +- .../monaco/__mocks__/monaco.service.mock.ts | 6 +- .../monaco/__mocks__/monaco/common/uri.ts | 2 +- packages/monaco/__mocks__/monaco/editor.ts | 1 + .../__mocks__/monaco/editor/code-editor.ts | 2 +- .../__mocks__/monaco/editor/diff-editor.ts | 3 +- .../monaco/__mocks__/monaco/editor/model.ts | 8 +- packages/monaco/__mocks__/monaco/index.ts | 6 +- packages/monaco/__mocks__/monaco/range.ts | 2 +- packages/monaco/__mocks__/monaco/textModel.ts | 2 +- .../__tests__/browser/monaco-command.test.ts | 24 ++-- .../__tests__/browser/monaco-service.test.ts | 12 +- .../monaco/__tests__/browser/textmate.test.ts | 19 +-- .../src/browser/contrib/callHierarchy.ts | 4 +- .../monaco/src/browser/contrib/command.ts | 1 + .../monaco/src/browser/contrib/tokenizer.ts | 1 + packages/monaco/src/browser/index.ts | 9 +- .../monaco/src/browser/monaco-api/editor.ts | 72 +++++----- .../src/browser/monaco-api/languages.ts | 2 +- packages/monaco/src/browser/monaco-mime.ts | 4 +- .../monaco-snippet-suggest-provider.ts | 10 +- .../src/browser/monaco.context-key.service.ts | 39 +++--- .../monaco/src/browser/monaco.contribution.ts | 41 +++--- .../monaco/src/browser/monaco.keycode-map.ts | 2 +- .../src/browser/monaco.resolved-keybinding.ts | 30 +++-- packages/monaco/src/browser/monaco.service.ts | 9 +- .../monaco/src/browser/schema-registry.ts | 8 +- packages/monaco/src/common/index.ts | 1 + .../opened-editor-model.service.test.ts | 20 +-- .../browser/opened-editor.service.test.ts | 32 ++--- packages/opened-editor/src/browser/index.ts | 3 +- .../src/browser/opened-editor-node.define.ts | 6 +- .../src/browser/opened-editor-node.tsx | 11 +- .../src/browser/opened-editor.contribution.ts | 13 +- .../src/browser/opened-editor.tsx | 11 +- .../opened-editor-decoration.service.ts | 2 +- .../services/opened-editor-event.service.ts | 2 +- .../services/opened-editor-model.service.ts | 19 +-- .../browser/services/opened-editor-model.ts | 6 +- .../services/opened-editor-tree.service.ts | 7 +- .../browser/outline-node.define.test.ts | 4 +- .../browser/outline.contribution.test.ts | 7 +- .../outline-decoration.service.test.ts | 3 +- .../services/outline-event.service.test.ts | 6 +- .../services/outline-model.service.test.ts | 26 ++-- .../services/outline-tree.service.test.ts | 10 +- packages/outline/src/browser/index.ts | 6 +- .../src/browser/outline-node.define.ts | 3 +- packages/outline/src/browser/outline-node.tsx | 12 +- .../src/browser/outline.contribution.ts | 12 +- packages/outline/src/browser/outline.tsx | 12 +- .../services/outline-decoration.service.ts | 1 + .../browser/services/outline-event.service.ts | 2 +- .../browser/services/outline-model.service.ts | 15 ++- .../src/browser/services/outline-model.ts | 3 +- .../browser/services/outline-tree.service.ts | 4 +- packages/outline/src/common/index.ts | 2 +- .../__tests__/browser/output.channel.test.ts | 11 +- .../__tests__/browser/output.service.test.ts | 15 ++- packages/output/src/browser/index.ts | 3 +- .../output/src/browser/output-contribution.ts | 22 ++-- .../src/browser/output-link.provider.ts | 8 +- packages/output/src/browser/output.channel.ts | 13 +- packages/output/src/browser/output.service.ts | 5 +- packages/output/src/browser/output.view.tsx | 8 +- .../browser/ctx-menu.service.test.ts | 3 +- .../__tests__/browser/dialog.service.test.tsx | 3 +- .../src/browser/ctx-menu/ctx-menu.service.ts | 1 + .../src/browser/ctx-menu/ctx-menu.view.tsx | 8 +- .../overlay/src/browser/dialog.service.ts | 6 +- packages/overlay/src/browser/dialog.view.tsx | 5 +- packages/overlay/src/browser/index.ts | 9 +- packages/overlay/src/browser/index.view.tsx | 7 +- .../overlay/src/browser/message.service.tsx | 8 +- packages/overlay/src/common/index.ts | 1 + .../browser/preference-service.test.ts | 23 ++-- .../browser/preference-settings.test.ts | 10 +- .../abstract-resource-preference-provider.ts | 4 +- .../src/browser/folder-preference-provider.ts | 3 +- .../browser/folders-preferences-provider.ts | 3 +- packages/preferences/src/browser/index.ts | 17 ++- .../src/browser/preference-contribution.ts | 19 +-- .../browser/preference-settings.service.ts | 9 +- .../src/browser/preferenceItem.view.tsx | 12 +- .../src/browser/preferences.view.tsx | 18 ++- .../src/browser/user-preference-provider.ts | 4 +- .../userstorage/user-storage.contribution.ts | 1 + .../userstorage/user-storage.service.ts | 7 +- .../workspace-file-preference-provider.ts | 1 + .../browser/workspace-preference-provider.ts | 1 + packages/process/__tests__/node/index.test.ts | 6 +- packages/process/src/common/index.ts | 1 + packages/process/src/node/index.ts | 6 +- packages/process/src/node/process-manager.ts | 4 +- packages/process/src/node/process.ts | 9 +- .../browser/prefix-quick-open.service.test.ts | 10 +- .../browser/quick-open.service.test.ts | 7 +- .../browser/quick-pick.service.test.ts | 8 +- .../components/highlight-label/index.tsx | 3 +- .../browser/components/keybinding/index.tsx | 4 +- .../components/quick-open-tabs/index.tsx | 4 +- packages/quick-open/src/browser/index.ts | 10 +- .../src/browser/prefix-quick-open.service.ts | 10 +- .../src/browser/quick-input-service.ts | 5 +- .../src/browser/quick-open.command.service.ts | 11 +- .../src/browser/quick-open.contribution.ts | 4 +- .../src/browser/quick-open.help.service.ts | 6 +- .../src/browser/quick-open.service.tsx | 8 +- .../quick-open/src/browser/quick-open.type.ts | 1 + .../src/browser/quick-open.view.tsx | 11 +- .../src/browser/quick-open.widget.tsx | 6 +- .../src/browser/quick-pick.service.ts | 6 +- .../quick-open/src/browser/quick-title-bar.ts | 6 +- .../src/common/mocks/quick-open.service.ts | 5 +- packages/remote-cli/src/index.ts | 7 +- packages/remote-cli/webpack.config.js | 3 +- .../browser/remote-opener-converter.test.ts | 3 +- .../browser/remote.opener.service.test.ts | 3 +- .../__tests__/node/opener.client.test.ts | 3 +- .../__tests__/node/opener.service.test.ts | 4 +- packages/remote-opener/src/browser/index.ts | 2 + .../src/browser/remote.opener.contribution.ts | 4 +- .../src/browser/remote.opener.service.ts | 8 +- packages/remote-opener/src/node/index.ts | 1 + .../remote-opener/src/node/opener.service.ts | 2 +- .../dirty-diff/dirty-diff-decorator.test.ts | 9 +- .../dirty-diff/dirty-diff-model.test.ts | 20 ++- .../dirty-diff/dirty-diff-widget.test.ts | 9 +- .../browser/dirty-diff/index.test.ts | 15 +-- .../__tests__/browser/scm-activity.test.ts | 10 +- .../scm/__tests__/browser/scm-menu.test.ts | 8 +- .../scm/__tests__/browser/scm-model.test.ts | 7 +- .../scm/__tests__/browser/scm-util.test.ts | 2 +- .../scm/__tests__/common/scm.service.test.ts | 2 +- packages/scm/__tests__/scm-test-util.ts | 2 +- .../browser/components/scm-provider-list.tsx | 7 +- .../browser/components/scm-resource-input.tsx | 5 +- .../components/scm-resource-tree/index.tsx | 13 +- .../scm-resource-tree/scm-tree-api.ts | 2 +- .../scm-tree-decoration.service.ts | 2 +- .../scm-tree-model.service.ts | 10 +- .../scm-resource-tree/scm-tree-model.ts | 2 +- .../scm-resource-tree/scm-tree-node.ts | 5 +- .../scm-resource-tree/scm-tree-node.view.tsx | 15 ++- .../scm-resource-tree/scm-tree.service.ts | 7 +- .../dirty-diff/dirty-diff-controller.ts | 2 +- .../dirty-diff/dirty-diff-decorator.ts | 11 +- .../browser/dirty-diff/dirty-diff-model.ts | 13 +- .../browser/dirty-diff/dirty-diff-widget.ts | 12 +- packages/scm/src/browser/dirty-diff/index.ts | 11 +- packages/scm/src/browser/index.ts | 6 +- packages/scm/src/browser/scm-activity.ts | 9 +- packages/scm/src/browser/scm-menu.ts | 5 +- packages/scm/src/browser/scm-model.ts | 3 +- packages/scm/src/browser/scm-preference.ts | 1 + packages/scm/src/browser/scm-util.ts | 1 + .../scm/src/browser/scm-view-container.tsx | 16 +-- packages/scm/src/browser/scm.contribution.ts | 30 +++-- packages/scm/src/common/dirty-diff.ts | 2 +- packages/scm/src/common/scm-menus.ts | 1 + packages/scm/src/common/scm.service.ts | 4 +- packages/scm/src/common/scm.ts | 2 +- .../browser/search-tree.service.test.ts | 17 +-- .../__tests__/browser/search.service.test.ts | 13 +- .../node/content-search.service.test.ts | 9 +- packages/search/src/browser/index.ts | 7 +- packages/search/src/browser/replace.ts | 7 +- packages/search/src/browser/search-history.ts | 3 +- .../search/src/browser/search-tree.service.ts | 23 ++-- .../search/src/browser/search-tree.view.tsx | 14 +- .../search/src/browser/search.contribution.ts | 23 ++-- .../src/browser/search.input.widget.tsx | 5 +- .../src/browser/search.replace.widget.tsx | 6 +- .../src/browser/search.rules.widget.tsx | 9 +- packages/search/src/browser/search.service.ts | 49 +++---- packages/search/src/browser/search.view.tsx | 14 +- packages/search/src/common/content-search.ts | 2 +- .../search/src/node/content-search.service.ts | 7 +- packages/search/src/node/index.ts | 4 +- .../editor-empty-component.contribution.tsx | 7 +- .../editor-title-menu.contribution.ts | 2 +- .../menu-bar/menu-bar.contribution.ts | 1 + .../sample-modules/menu-bar/menu-bar.view.tsx | 1 + .../menu-component.contribution.tsx | 3 +- .../select-menu.contribution.ts | 1 + packages/startup/entry/web-lite/app.tsx | 11 +- .../startup/entry/web-lite/common-modules.ts | 43 +++--- .../web-lite/lite-module/extension/index.ts | 1 + .../web-lite/lite-module/extension/utils.ts | 7 +- .../file-provider/browser-fs-provider.ts | 29 +++-- .../file-provider/http-file.service.ts | 1 + .../file-provider/index.contribution.ts | 2 +- .../lite-module/grammar/index.contribution.ts | 2 +- .../entry/web-lite/lite-module/index.ts | 7 +- .../language-service/language.contribution.ts | 6 +- .../language-service/lsif-service/index.ts | 3 +- .../lsif-service/lsif-client.ts | 1 + .../language-service/simple.service.ts | 23 ++-- .../overrides/browser-file-scheme.ts | 3 +- .../lite-module/overrides/doc-client.ts | 7 +- .../lite-module/overrides/mock-storage.ts | 2 +- .../web-lite/modules/view/sample.view.tsx | 2 +- .../startup/entry/web-lite/render-app.tsx | 10 +- packages/startup/entry/web/app.tsx | 6 +- packages/startup/entry/web/render-app.tsx | 3 +- packages/startup/entry/web/server.ts | 1 + .../startup/src/browser/common-modules.ts | 73 +++++------ .../src/browser/editor-bottom-example.tsx | 1 + packages/startup/src/browser/index.ts | 1 + .../src/browser/startup.contribution.ts | 11 +- packages/startup/src/node/common-modules.ts | 14 +- packages/startup/webpack.lite.config.js | 4 +- packages/startup/webpack.standard.config.js | 3 +- .../__test__/browser/static.service.test.ts | 3 +- packages/static-resource/src/browser/index.ts | 1 + .../src/browser/static.service.ts | 5 +- .../browser/status-bar.service.test.ts | 10 +- packages/status-bar/src/browser/index.ts | 7 +- .../src/browser/status-bar-item.view.tsx | 12 +- .../src/browser/status-bar.contribution.ts | 3 +- .../src/browser/status-bar.service.ts | 7 +- .../src/browser/status-bar.view.tsx | 13 +- .../storage/__tests__/browser/index.test.ts | 27 ++-- packages/storage/src/browser/index.ts | 4 +- packages/storage/src/browser/storage-path.ts | 5 +- .../src/browser/storage.contribution.ts | 9 +- .../storage/src/browser/storage.service.ts | 5 +- packages/storage/src/browser/storage.ts | 3 +- .../__test__/browser/task.service.test.ts | 25 ++-- .../browser/terminal-task-system.test.ts | 3 +- packages/task/src/browser/index.ts | 8 +- packages/task/src/browser/parser.ts | 3 +- .../task/src/browser/problem-collector.ts | 3 +- .../task/src/browser/problem-line-matcher.ts | 3 +- packages/task/src/browser/task-config.ts | 2 + .../browser/task-preferences.contribution.ts | 1 + packages/task/src/browser/task-preferences.ts | 1 + .../task/src/browser/task.contribution.ts | 2 + packages/task/src/browser/task.service.ts | 27 ++-- .../task/src/browser/terminal-task-system.ts | 21 +-- packages/task/src/common/index.ts | 6 +- packages/task/src/common/task.ts | 3 +- .../__tests__/browser/client.test.ts | 23 ++-- .../__tests__/browser/controller.test.ts | 7 +- .../terminal-next/__tests__/browser/inject.ts | 25 ++-- .../links/protocol-link-provider.test.ts | 3 +- .../validated-local-link-provider.test.ts | 2 + .../__tests__/browser/mock.service.ts | 8 +- .../__tests__/browser/network.test.ts | 1 + .../terminal-next/__tests__/browser/proxy.ts | 4 +- .../__tests__/browser/render.test.ts | 1 + .../terminal.environment.service.test.ts | 3 +- .../browser/terminal.hover.manager.test.ts | 14 +- .../browser/terminal.service.test.ts | 11 +- .../__tests__/browser/view.test.ts | 6 +- .../environmentVariableCollection.test.ts | 1 + .../terminal-next/__tests__/node/pty.test.ts | 4 +- .../__tests__/node/termina.profile.test.ts | 1 + .../node/terminal.service.client.test.ts | 6 +- .../src/browser/component/resize.delegate.tsx | 1 + .../src/browser/component/resize.view.tsx | 5 +- .../src/browser/component/tab.item.tsx | 7 +- .../src/browser/component/tab.view.tsx | 6 +- .../src/browser/component/terminal.select.tsx | 4 +- .../browser/component/terminal.variable.tsx | 2 + .../src/browser/component/terminal.view.tsx | 9 +- .../src/browser/component/terminal.widget.tsx | 2 + .../browser/contribution/terminal.command.ts | 9 +- .../contribution/terminal.keybinding.ts | 5 +- .../contribution/terminal.lifecycle.ts | 1 + .../src/browser/contribution/terminal.menu.ts | 15 ++- .../browser/contribution/terminal.network.ts | 3 +- .../contribution/terminal.preference.ts | 1 + .../src/browser/contribution/terminal.view.ts | 3 +- packages/terminal-next/src/browser/index.ts | 30 +++-- .../terminal-next/src/browser/links/base.ts | 1 + .../links/external-link-provider-adapter.ts | 7 +- .../src/browser/links/helpers.ts | 1 + .../src/browser/links/link-manager.ts | 20 +-- .../terminal-next/src/browser/links/link.ts | 4 +- .../browser/links/protocol-link-provider.ts | 5 +- .../links/validated-local-link-provider.ts | 11 +- .../src/browser/terminal.addon.ts | 8 +- .../terminal-next/src/browser/terminal.api.ts | 4 +- .../src/browser/terminal.client.ts | 14 +- .../src/browser/terminal.context-menu.ts | 7 +- .../src/browser/terminal.contribution.ts | 1 + .../src/browser/terminal.controller.ts | 15 ++- .../browser/terminal.environment.service.ts | 21 +-- .../src/browser/terminal.error.ts | 2 + .../src/browser/terminal.ext.host.proxy.ts | 1 + .../src/browser/terminal.hover.manager.ts | 2 + .../src/browser/terminal.internal.service.ts | 5 +- .../src/browser/terminal.network.ts | 1 + .../src/browser/terminal.preference.ts | 1 + .../src/browser/terminal.profile.internal.ts | 7 +- .../src/browser/terminal.profile.ts | 6 +- .../src/browser/terminal.render.ts | 4 +- .../src/browser/terminal.restore.ts | 1 + .../src/browser/terminal.search.ts | 2 + .../src/browser/terminal.service.ts | 10 +- .../src/browser/terminal.theme.ts | 5 +- .../src/browser/terminal.view.ts | 2 + packages/terminal-next/src/browser/xterm.ts | 5 +- packages/terminal-next/src/common/api.ts | 5 +- packages/terminal-next/src/common/client.ts | 2 + .../terminal-next/src/common/controller.ts | 12 +- .../common/environmentVariableCollection.ts | 1 + .../terminal-next/src/common/extension.ts | 3 +- .../terminal-next/src/common/preference.ts | 7 +- packages/terminal-next/src/common/profile.ts | 6 +- packages/terminal-next/src/common/pty.ts | 8 +- packages/terminal-next/src/common/service.ts | 8 +- packages/terminal-next/src/node/index.ts | 8 +- packages/terminal-next/src/node/pty.ts | 21 +-- packages/terminal-next/src/node/shell.ts | 4 +- .../src/node/terminal.process.service.ts | 1 + .../src/node/terminal.profile.service.ts | 16 ++- .../src/node/terminal.service.client.ts | 9 +- .../src/node/terminal.service.ts | 9 +- .../components/testing.explorer.tree.tsx | 17 +-- .../src/browser/components/testing.view.tsx | 10 +- packages/testing/src/browser/icons/icons.ts | 1 + packages/testing/src/browser/index.ts | 9 +- .../outputPeek/test-message-container.tsx | 11 +- .../browser/outputPeek/test-output-peek.ts | 16 ++- .../outputPeek/test-peek-message.service.ts | 2 + .../outputPeek/test-peek-opener.service.ts | 6 +- .../browser/outputPeek/test-peek-widget.tsx | 24 ++-- .../outputPeek/test-tree-container.tsx | 7 +- .../src/browser/test-contextkey.service.ts | 4 +- .../testing/src/browser/test-decorations.ts | 51 ++++---- .../src/browser/test-profile.service.ts | 2 +- .../src/browser/test-tree-view.model.ts | 16 ++- .../src/browser/test.result.service.ts | 2 + packages/testing/src/browser/test.service.ts | 13 +- .../src/browser/testing.contribution.ts | 56 ++++---- packages/testing/src/common/constants.ts | 1 + .../testing/src/common/getComputedState.ts | 1 + packages/testing/src/common/index.ts | 1 + packages/testing/src/common/test-profile.ts | 1 + packages/testing/src/common/test-result.ts | 1 + packages/testing/src/common/testing-view.ts | 1 + .../testing/src/common/testingPeekOpener.ts | 1 + packages/testing/src/common/testingStates.ts | 4 +- .../__tests__/browser/icon.service.test.ts | 14 +- .../browser/semantic-tokens-registry.test.ts | 1 + .../__tests__/browser/theme.service.test.ts | 18 +-- packages/theme/src/browser/icon-theme-data.ts | 3 +- .../theme/src/browser/icon-theme-store.ts | 4 +- packages/theme/src/browser/icon.service.ts | 7 +- packages/theme/src/browser/index.ts | 12 +- .../src/browser/semantic-tokens-registry.ts | 1 + packages/theme/src/browser/style.service.ts | 1 + packages/theme/src/browser/theme-data.ts | 35 ++--- packages/theme/src/browser/theme-store.ts | 3 +- .../theme/src/browser/theme.contribution.ts | 5 +- .../src/browser/workbench.theme.service.ts | 56 ++++---- packages/theme/src/common/color-registry.ts | 1 + .../src/common/color-tokens/activity-bar.ts | 4 +- .../theme/src/common/color-tokens/badge.ts | 3 +- .../theme/src/common/color-tokens/base.ts | 1 + .../src/common/color-tokens/breadcrumb.ts | 2 + .../theme/src/common/color-tokens/button.ts | 3 +- .../theme/src/common/color-tokens/charts.ts | 2 + .../theme/src/common/color-tokens/checkbox.ts | 1 + .../common/color-tokens/custom/actionbar.ts | 1 + .../src/common/color-tokens/custom/badge.ts | 1 + .../src/common/color-tokens/custom/base.ts | 2 +- .../src/common/color-tokens/custom/button.ts | 3 +- .../common/color-tokens/custom/checkbox.ts | 1 + .../common/color-tokens/custom/decoration.ts | 1 + .../src/common/color-tokens/custom/editor.ts | 5 +- .../common/color-tokens/custom/extension.ts | 1 + .../src/common/color-tokens/custom/icon.ts | 1 + .../src/common/color-tokens/custom/input.ts | 1 + .../src/common/color-tokens/custom/menu.ts | 4 +- .../src/common/color-tokens/custom/modal.ts | 1 + .../src/common/color-tokens/custom/panel.ts | 9 +- .../src/common/color-tokens/custom/select.ts | 3 +- .../common/color-tokens/custom/settings.ts | 1 + .../common/color-tokens/custom/statusbar.ts | 1 + .../src/common/color-tokens/custom/tab.ts | 1 + .../src/common/color-tokens/custom/tree.ts | 1 + .../theme/src/common/color-tokens/debug.ts | 1 + .../theme/src/common/color-tokens/dropdown.ts | 4 +- .../theme/src/common/color-tokens/editor.ts | 6 +- .../theme/src/common/color-tokens/global.ts | 1 + .../theme/src/common/color-tokens/input.ts | 4 +- .../src/common/color-tokens/list-tree.ts | 4 +- .../theme/src/common/color-tokens/menu-bar.ts | 4 +- .../theme/src/common/color-tokens/menu.ts | 2 + .../src/common/color-tokens/merge-conflict.ts | 3 +- .../theme/src/common/color-tokens/minimap.ts | 4 +- .../src/common/color-tokens/notification.ts | 4 +- .../theme/src/common/color-tokens/panel.ts | 6 +- .../src/common/color-tokens/pick-view.ts | 6 +- .../theme/src/common/color-tokens/picker.ts | 3 +- .../src/common/color-tokens/progress-bar.ts | 4 +- .../src/common/color-tokens/quick-input.ts | 2 + .../src/common/color-tokens/scrollbar.ts | 4 +- .../theme/src/common/color-tokens/settings.ts | 6 +- .../theme/src/common/color-tokens/sidebar.ts | 4 +- .../theme/src/common/color-tokens/snippet.ts | 3 +- .../src/common/color-tokens/status-bar.ts | 5 +- packages/theme/src/common/color-tokens/tab.ts | 6 +- .../theme/src/common/color-tokens/testing.ts | 2 + .../theme/src/common/color-tokens/text.ts | 3 +- .../src/common/color-tokens/title-bar.ts | 2 + .../src/common/color-tokens/welcome-page.ts | 1 + packages/theme/src/common/event.ts | 1 + .../theme/src/common/mocks/theme.service.ts | 3 +- .../src/common/semantic-tokens-registry.ts | 1 + packages/theme/src/common/theme.service.ts | 6 +- .../theme/src/common/themeCompatibility.ts | 2 +- packages/toolbar/src/browser/index.ts | 3 +- .../src/browser/toolbar.view.service.tsx | 3 +- packages/toolbar/src/browser/toolbar.view.tsx | 6 +- packages/types/build.ts | 10 +- packages/types/sumi-browser.d.ts | 2 +- .../variable-quick-open.service.test.ts | 7 +- .../browser/variable-resolver.service.test.ts | 9 +- packages/variable/src/browser/index.ts | 6 +- .../browser/variable-quick-open.service.ts | 2 +- .../browser/variable-resolver.contribution.ts | 1 + .../src/browser/variable-resolver.service.ts | 1 + .../__tests__/browser/webview.service.test.ts | 12 +- .../__tests__/browser/window-webview.test.ts | 7 +- .../__tests__/webview/webview.channel.test.ts | 8 +- .../webview/src/browser/abstract-webview.ts | 7 +- packages/webview/src/browser/contribution.ts | 5 +- .../webview/src/browser/editor-webview.tsx | 4 +- .../src/browser/electron-webview-webview.ts | 8 +- .../webview/src/browser/iframe-webview.ts | 6 +- packages/webview/src/browser/index.ts | 3 +- packages/webview/src/browser/plain-webview.ts | 3 +- packages/webview/src/browser/types.ts | 2 +- .../webview/src/browser/webview-window.ts | 7 +- .../webview/src/browser/webview.service.ts | 39 +++--- packages/webview/src/electron-main/index.ts | 9 +- .../src/electron-webview/host-channel.ts | 3 +- .../workspace-edit/__tests__/index.test.ts | 16 ++- .../src/browser/bulk-edit.service.ts | 20 +-- packages/workspace-edit/src/browser/index.ts | 14 +- .../src/browser/refactor-preview.service.tsx | 11 +- .../src/browser/refactor-preview.tsx | 26 ++-- packages/workspace-edit/src/browser/utils.ts | 4 +- .../src/browser/workspace-edit.service.ts | 20 +-- .../src/browser/workspace-file.service.ts | 5 +- .../browser/workspace-contribution.test.ts | 12 +- .../browser/workspace-service.test.ts | 20 +-- .../browser/workspace-storage-service.test.ts | 10 +- .../workspace-variable-cnotribution.test.ts | 12 +- packages/workspace/src/browser/index.ts | 8 +- .../src/browser/workspace-contribution.ts | 6 +- .../src/browser/workspace-service.ts | 23 ++-- .../src/browser/workspace-storage-service.ts | 3 +- .../workspace-variable-contribution.ts | 3 +- .../src/common/mocks/workspace-service.ts | 5 +- .../src/common/workspace-defination.ts | 5 +- .../dev-tool/__tests__/mock-injector.test.ts | 3 +- tools/dev-tool/src/ext-host.js | 2 +- tools/dev-tool/src/ext-host.ts | 2 +- tools/dev-tool/src/injector-helper.ts | 3 +- tools/dev-tool/src/server.ts | 12 +- tools/dev-tool/src/webpack.js | 13 +- tools/electron/build/pack.js | 4 +- .../electron/build/webpack.browser.config.js | 5 +- .../build/webpack.extension-host.config.js | 3 +- tools/electron/build/webpack.main.config.js | 5 +- tools/electron/build/webpack.node.config.js | 5 +- .../electron/build/webpack.webview.config.js | 5 +- tools/electron/src/browser/app.tsx | 3 +- tools/electron/src/browser/index.ts | 75 +++++------ tools/electron/src/extension/index.ts | 1 + tools/electron/src/main/index.ts | 10 +- tools/electron/src/main/services/hello.ts | 3 +- tools/electron/src/main/services/index.ts | 4 +- .../electron/src/modules/demo/browser/demo.ts | 1 + .../src/modules/demo/browser/index.ts | 2 + .../src/modules/topbar/browser/index.ts | 2 + .../modules/topbar/browser/topbar.service.ts | 1 + .../modules/topbar/browser/topbar.view.tsx | 6 +- .../electron/src/modules/topbar/node/index.ts | 2 + .../modules/topbar/node/topbar-node-server.ts | 1 + tools/electron/src/node/index.ts | 19 ++- tools/electron/src/node/server.ts | 2 + .../template/src/browser/hello-world.view.tsx | 3 +- tools/template/src/browser/index.ts | 2 + 1411 files changed, 7369 insertions(+), 5252 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a0de8d0b82..6929e6647a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -148,18 +148,17 @@ module.exports = { 'prefer-rest-params': 'warn', 'no-control-regex': 'warn', // 让 import 中的内部包和外部包分组,看起来更美观 - // TODO: 会触发大量代码改动,暂时不开启 - // 'import/order': [ - // 'error', - // { - // groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'unknown'], - // alphabetize: { - // order: 'asc', - // caseInsensitive: true, - // }, - // 'newlines-between': 'always', - // }, - // ], + 'import/order': [ + 'error', + { + groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'unknown'], + alphabetize: { + order: 'asc', + caseInsensitive: true, + }, + 'newlines-between': 'always', + }, + ], 'import/no-restricted-paths': [ 'error', { diff --git a/jest.config.js b/jest.config.js index 8e40fcddd5..dde4423c49 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,8 @@ +const os = require('os'); + const { pathsToModuleNameMapper } = require('ts-jest'); + const tsconfig = require('./configs/ts/tsconfig.resolve.json'); -const os = require('os'); const tsModuleNameMapper = pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '/configs/' }); diff --git a/packages/addons/__test__/browser/file-search.contribution.test.ts b/packages/addons/__test__/browser/file-search.contribution.test.ts index b066fa6f3d..a139f689a5 100644 --- a/packages/addons/__test__/browser/file-search.contribution.test.ts +++ b/packages/addons/__test__/browser/file-search.contribution.test.ts @@ -1,11 +1,3 @@ -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { - CommandService, - CommandServiceImpl, - CommandRegistryImpl, - CommandRegistry, - DisposableCollection, -} from '@opensumi/ide-core-common'; import { KeybindingRegistry, KeybindingRegistryImpl, @@ -13,17 +5,24 @@ import { ILogger, PreferenceService, } from '@opensumi/ide-core-browser'; +import { + CommandService, + CommandServiceImpl, + CommandRegistryImpl, + CommandRegistry, + DisposableCollection, +} from '@opensumi/ide-core-common'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { DocumentSymbol } from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol'; +import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common'; import { PrefixQuickOpenService } from '@opensumi/ide-quick-open'; import { QuickOpenHandlerRegistry } from '@opensumi/ide-quick-open/lib/browser/prefix-quick-open.service'; -import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common'; import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { DocumentSymbol } from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - import { ClientAddonModule } from '../../src/browser'; import { FileSearchContribution, diff --git a/packages/addons/__test__/browser/status-bar.contribution.test.ts b/packages/addons/__test__/browser/status-bar.contribution.test.ts index a25129d4d0..b9ad9b538d 100644 --- a/packages/addons/__test__/browser/status-bar.contribution.test.ts +++ b/packages/addons/__test__/browser/status-bar.contribution.test.ts @@ -8,7 +8,6 @@ import { import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - import { ClientAddonModule } from '../../src/browser'; import { StatusBarContribution } from '../../src/browser/status-bar-contribution'; diff --git a/packages/addons/__test__/node/inde.test.ts b/packages/addons/__test__/node/inde.test.ts index b6c284f987..ab4f56031a 100644 --- a/packages/addons/__test__/node/inde.test.ts +++ b/packages/addons/__test__/node/inde.test.ts @@ -1,6 +1,5 @@ import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - import { AddonsModule } from '../../src'; describe('test for ', () => { diff --git a/packages/addons/src/browser/file-content-update-time.contribution.ts b/packages/addons/src/browser/file-content-update-time.contribution.ts index 35546ab122..ad15a107c0 100644 --- a/packages/addons/src/browser/file-content-update-time.contribution.ts +++ b/packages/addons/src/browser/file-content-update-time.contribution.ts @@ -1,15 +1,15 @@ import { Injectable, Autowired } from '@opensumi/di'; import { ClientAppContribution, Domain } from '@opensumi/ide-core-browser'; +import { PreferenceSchema, PreferenceSchemaProvider, PreferenceService } from '@opensumi/ide-core-browser'; import { debounce, IReporterService, StaleLRUMap, OnEvent, URI, WithEventBus } from '@opensumi/ide-core-common'; +import { EditorDocumentModelSavedEvent, EditorDocumentModelWillSaveEvent } from '@opensumi/ide-editor/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { FileOperation, WorkspaceFileEvent, IWorkspaceFileOperationParticipant, IWorkspaceFileService, } from '@opensumi/ide-workspace-edit'; -import { PreferenceSchema, PreferenceSchemaProvider, PreferenceService } from '@opensumi/ide-core-browser'; -import { EditorDocumentModelSavedEvent, EditorDocumentModelWillSaveEvent } from '@opensumi/ide-editor/lib/browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; enum ContentUpdateOperation { /** diff --git a/packages/addons/src/browser/file-drop.contribution.ts b/packages/addons/src/browser/file-drop.contribution.ts index 463f5fc559..0b9e72f0e5 100644 --- a/packages/addons/src/browser/file-drop.contribution.ts +++ b/packages/addons/src/browser/file-drop.contribution.ts @@ -1,8 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; import { ClientAppContribution, Domain } from '@opensumi/ide-core-browser'; -import { IFileDropFrontendService, IFileDropFrontendServiceToken } from '../common'; import { OnEvent, FileTreeDropEvent, WithEventBus } from '@opensumi/ide-core-common'; +import { IFileDropFrontendService, IFileDropFrontendServiceToken } from '../common'; + @Injectable() @Domain(ClientAppContribution) export class FileDropContribution extends WithEventBus { diff --git a/packages/addons/src/browser/file-drop.service.ts b/packages/addons/src/browser/file-drop.service.ts index 98af540340..0a1ba91430 100644 --- a/packages/addons/src/browser/file-drop.service.ts +++ b/packages/addons/src/browser/file-drop.service.ts @@ -1,8 +1,11 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { WithEventBus } from '@opensumi/ide-core-common/lib'; +import { Path } from '@opensumi/ide-components/lib/utils/path'; import { Uri, formatLocalize } from '@opensumi/ide-core-browser/lib'; -import { FileTreeDropEvent } from '@opensumi/ide-core-common/lib/types/dnd'; import { IStatusBarService, StatusBarAlignment, StatusBarEntryAccessor } from '@opensumi/ide-core-browser/lib/services'; +import { WithEventBus } from '@opensumi/ide-core-common/lib'; +import { FileTreeDropEvent } from '@opensumi/ide-core-common/lib/types/dnd'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; + import { IFileDropFrontendService, IFileDropBackendService, @@ -10,8 +13,6 @@ import { IWebkitDataTransfer, IWebkitDataTransferItemEntry, } from '../common'; -import { Path } from '@opensumi/ide-components/lib/utils/path'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; @Injectable() export class FileDropService extends WithEventBus implements IFileDropFrontendService { diff --git a/packages/addons/src/browser/file-search.contribution.ts b/packages/addons/src/browser/file-search.contribution.ts index 0ee7bc5e06..4e6a59c89b 100644 --- a/packages/addons/src/browser/file-search.contribution.ts +++ b/packages/addons/src/browser/file-search.contribution.ts @@ -1,21 +1,9 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { matchesFuzzy } from '@opensumi/monaco-editor-core/esm/vs/base/common/filters'; /** * 用于快速打开,检索文件 */ import fuzzy from 'fuzzy'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { - CommandContribution, - CommandRegistry, - Command, - CancellationTokenSource, - Schemas, - CancellationToken, - IRange, - IReporterService, - REPORT_NAME, -} from '@opensumi/ide-core-common'; import { localize, formatLocalize, @@ -29,29 +17,42 @@ import { Highlight, Mode, } from '@opensumi/ide-core-browser'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; import { KeybindingContribution, KeybindingRegistry, ILogger } from '@opensumi/ide-core-browser'; +import { getIcon } from '@opensumi/ide-core-browser'; +import { RecentFilesManager } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { + CommandContribution, + CommandRegistry, + Command, + CancellationTokenSource, + Schemas, + CancellationToken, + IRange, + IReporterService, + REPORT_NAME, +} from '@opensumi/ide-core-common'; import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; +import { EditorGroupSplitAction, WorkbenchEditorService } from '@opensumi/ide-editor'; import { - QuickOpenContribution, - QuickOpenHandlerRegistry, -} from '@opensumi/ide-quick-open/lib/browser/prefix-quick-open.service'; + DocumentSymbolStore, + IDummyRoot, + INormalizedDocumentSymbol, +} from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol'; +import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common'; import { QuickOpenModel, QuickOpenOptions, PrefixQuickOpenService, QuickOpenBaseAction, } from '@opensumi/ide-quick-open'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { EditorGroupSplitAction, WorkbenchEditorService } from '@opensumi/ide-editor'; import { - DocumentSymbolStore, - IDummyRoot, - INormalizedDocumentSymbol, -} from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol'; -import { getIcon } from '@opensumi/ide-core-browser'; -import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common'; -import { RecentFilesManager } from '@opensumi/ide-core-browser'; + QuickOpenContribution, + QuickOpenHandlerRegistry, +} from '@opensumi/ide-quick-open/lib/browser/prefix-quick-open.service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { matchesFuzzy } from '@opensumi/monaco-editor-core/esm/vs/base/common/filters'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; const DEFAULT_FILE_SEARCH_LIMIT = 200; diff --git a/packages/addons/src/browser/index.ts b/packages/addons/src/browser/index.ts index 45d19bf95a..a428639560 100644 --- a/packages/addons/src/browser/index.ts +++ b/packages/addons/src/browser/index.ts @@ -1,12 +1,15 @@ import { Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + +import { IFileDropFrontendServiceToken, FileDropServicePath } from '../common'; + +import { FileDropContribution } from './file-drop.contribution'; +import { FileDropService } from './file-drop.service'; import { FileSearchContribution } from './file-search.contribution'; +import { LanguageChangeHintContribution } from './langauge-change.contribution'; import { StatusBarContribution } from './status-bar-contribution'; import { ToolbarCustomizeContribution } from './toolbar-customize/toolbar-customize.contribution'; -import { LanguageChangeHintContribution } from './langauge-change.contribution'; -import { FileDropContribution } from './file-drop.contribution'; -import { FileDropService } from './file-drop.service'; -import { IFileDropFrontendServiceToken, FileDropServicePath } from '../common'; + @Injectable() export class ClientAddonModule extends BrowserModule { diff --git a/packages/addons/src/browser/langauge-change.contribution.ts b/packages/addons/src/browser/langauge-change.contribution.ts index 350deebd88..e92a7e1e9e 100644 --- a/packages/addons/src/browser/langauge-change.contribution.ts +++ b/packages/addons/src/browser/langauge-change.contribution.ts @@ -1,5 +1,5 @@ -import { Domain, ClientAppContribution, PreferenceService, IClientApp, localize } from '@opensumi/ide-core-browser'; import { Autowired } from '@opensumi/di'; +import { Domain, ClientAppContribution, PreferenceService, IClientApp, localize } from '@opensumi/ide-core-browser'; import { IDialogService } from '@opensumi/ide-overlay'; @Domain(ClientAppContribution) diff --git a/packages/addons/src/browser/status-bar-contribution.ts b/packages/addons/src/browser/status-bar-contribution.ts index 6a6c531f95..f49db0acc3 100644 --- a/packages/addons/src/browser/status-bar-contribution.ts +++ b/packages/addons/src/browser/status-bar-contribution.ts @@ -1,4 +1,5 @@ import { Autowired } from '@opensumi/di'; +import { ClientAppContribution } from '@opensumi/ide-core-browser'; import { BrowserConnectionCloseEvent, BrowserConnectionOpenEvent, @@ -7,7 +8,6 @@ import { CommandService, Domain, } from '@opensumi/ide-core-common'; -import { ClientAppContribution } from '@opensumi/ide-core-browser'; @Domain(ClientAppContribution) export class StatusBarContribution extends WithEventBus implements ClientAppContribution { diff --git a/packages/addons/src/browser/toolbar-customize/toolbar-customize.contribution.ts b/packages/addons/src/browser/toolbar-customize/toolbar-customize.contribution.ts index 38b7bd6cd7..fc75e87393 100644 --- a/packages/addons/src/browser/toolbar-customize/toolbar-customize.contribution.ts +++ b/packages/addons/src/browser/toolbar-customize/toolbar-customize.contribution.ts @@ -1,3 +1,4 @@ +import { Autowired } from '@opensumi/di'; import { Domain, CommandContribution, @@ -8,10 +9,11 @@ import { SlotLocation, localize, } from '@opensumi/ide-core-browser'; -import { Autowired } from '@opensumi/di'; -import { ToolbarCustomizeComponent, ToolbarCustomizeViewService } from './toolbar-customize'; import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { ToolbarCustomizeComponent, ToolbarCustomizeViewService } from './toolbar-customize'; + + @Domain(CommandContribution, ComponentContribution, MenuContribution) export class ToolbarCustomizeContribution implements CommandContribution, ComponentContribution, MenuContribution { @Autowired(AppConfig) diff --git a/packages/addons/src/browser/toolbar-customize/toolbar-customize.tsx b/packages/addons/src/browser/toolbar-customize/toolbar-customize.tsx index 74fb7fd6eb..c38348eff2 100644 --- a/packages/addons/src/browser/toolbar-customize/toolbar-customize.tsx +++ b/packages/addons/src/browser/toolbar-customize/toolbar-customize.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { Injectable, Autowired } from '@opensumi/di'; +import { CheckBox, Select, Button } from '@opensumi/ide-components'; import { useInjectable, PreferenceService, @@ -7,8 +9,8 @@ import { IToolbarRegistry, localize, } from '@opensumi/ide-core-browser'; + import styles from './style.module.less'; -import { CheckBox, Select, Button } from '@opensumi/ide-components'; @Injectable() export class ToolbarCustomizeViewService { diff --git a/packages/addons/src/node/file-drop.service.ts b/packages/addons/src/node/file-drop.service.ts index 4d42e41ed1..17c08e5671 100644 --- a/packages/addons/src/node/file-drop.service.ts +++ b/packages/addons/src/node/file-drop.service.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { Uri } from '@opensumi/ide-core-common'; + import { Injectable } from '@opensumi/di'; +import { Uri } from '@opensumi/ide-core-common'; import { IFileDropBackendService } from '../common'; @Injectable() diff --git a/packages/addons/src/node/index.ts b/packages/addons/src/node/index.ts index 831aaca2af..eadf803ad3 100644 --- a/packages/addons/src/node/index.ts +++ b/packages/addons/src/node/index.ts @@ -1,8 +1,10 @@ import { Provider, Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; -import { FileDropService } from './file-drop.service'; + import { IFileDropServiceToken, FileDropServicePath } from '../common'; +import { FileDropService } from './file-drop.service'; + @Injectable() export class AddonsModule extends NodeModule { providers: Provider[] = [ diff --git a/packages/comments/__test__/browser/comment-thread.test.ts b/packages/comments/__test__/browser/comment-thread.test.ts index 3262758a65..f5c5654b7d 100644 --- a/packages/comments/__test__/browser/comment-thread.test.ts +++ b/packages/comments/__test__/browser/comment-thread.test.ts @@ -1,15 +1,16 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { CommentsModule } from '../../src/browser'; import { Injector } from '@opensumi/di'; -import { ICommentsService, CommentMode } from '../../src/common'; -import { URI, positionToRange } from '@opensumi/ide-core-common'; import { IContextKeyService } from '@opensumi/ide-core-browser'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { URI, positionToRange } from '@opensumi/ide-core-common'; import { IIconService } from '@opensumi/ide-theme'; import { IconService } from '@opensumi/ide-theme/lib/browser'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; +import { CommentsModule } from '../../src/browser'; +import { ICommentsService, CommentMode } from '../../src/common'; + describe('comment service test', () => { let injector: MockInjector; let commentsService: ICommentsService; diff --git a/packages/comments/__test__/browser/comment.service.test.ts b/packages/comments/__test__/browser/comment.service.test.ts index e475f4ab72..3f1cce02d0 100644 --- a/packages/comments/__test__/browser/comment.service.test.ts +++ b/packages/comments/__test__/browser/comment.service.test.ts @@ -1,17 +1,18 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { CommentsModule } from '../../src/browser'; import { Injector } from '@opensumi/di'; -import { ICommentsService, CommentMode } from '../../src/common'; -import { URI, positionToRange, Disposable } from '@opensumi/ide-core-common'; import { IContextKeyService } from '@opensumi/ide-core-browser'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; -import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; -import { IIconService } from '@opensumi/ide-theme'; -import { IconService } from '@opensumi/ide-theme/lib/browser'; +import { URI, positionToRange, Disposable } from '@opensumi/ide-core-common'; import { IEditor, EditorCollectionService, ResourceService } from '@opensumi/ide-editor'; -import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; import { IEditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser'; +import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; +import { IIconService } from '@opensumi/ide-theme'; +import { IconService } from '@opensumi/ide-theme/lib/browser'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; +import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; +import { CommentsModule } from '../../src/browser'; +import { ICommentsService, CommentMode } from '../../src/common'; describe('comment service test', () => { let injector: MockInjector; diff --git a/packages/comments/__test__/browser/comments-feature.registry.test.ts b/packages/comments/__test__/browser/comments-feature.registry.test.ts index bd03c31cb9..24435779c8 100644 --- a/packages/comments/__test__/browser/comments-feature.registry.test.ts +++ b/packages/comments/__test__/browser/comments-feature.registry.test.ts @@ -1,15 +1,16 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { CommentsModule } from '../../src/browser'; import { Injector } from '@opensumi/di'; -import { ICommentsService, CommentMode, ICommentsFeatureRegistry } from '../../src/common'; -import { URI, positionToRange } from '@opensumi/ide-core-common'; import { IContextKeyService } from '@opensumi/ide-core-browser'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { URI, positionToRange } from '@opensumi/ide-core-common'; import { IIconService } from '@opensumi/ide-theme'; import { IconService } from '@opensumi/ide-theme/lib/browser'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; +import { CommentsModule } from '../../src/browser'; +import { ICommentsService, CommentMode, ICommentsFeatureRegistry } from '../../src/common'; + describe('comment service test', () => { let injector: MockInjector; let commentsService: ICommentsService; diff --git a/packages/comments/src/browser/comment-reactions.view.tsx b/packages/comments/src/browser/comment-reactions.view.tsx index ef5d89f06b..058d4be99b 100644 --- a/packages/comments/src/browser/comment-reactions.view.tsx +++ b/packages/comments/src/browser/comment-reactions.view.tsx @@ -1,5 +1,13 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + + +import { useInjectable, IEventBus, getExternalIcon, Disposable } from '@opensumi/ide-core-browser'; +import { Button } from '@opensumi/ide-core-browser/lib/components'; +import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { AbstractMenuService, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; +import { IIconService, IconType } from '@opensumi/ide-theme'; + import { IThreadComment, ICommentsThread, @@ -7,11 +15,7 @@ import { CommentReactionClick, SwitchCommandReaction, } from '../common'; -import { Button } from '@opensumi/ide-core-browser/lib/components'; -import { useInjectable, IEventBus, getExternalIcon, Disposable } from '@opensumi/ide-core-browser'; -import { IIconService, IconType } from '@opensumi/ide-theme'; -import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { AbstractMenuService, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; + import styles from './comments.module.less'; export const CommentReactionSwitcher: React.FC<{ diff --git a/packages/comments/src/browser/comments-body.tsx b/packages/comments/src/browser/comments-body.tsx index b1a110c01b..f4979bb06a 100644 --- a/packages/comments/src/browser/comments-body.tsx +++ b/packages/comments/src/browser/comments-body.tsx @@ -1,8 +1,9 @@ +import { marked } from 'marked'; import React from 'react'; import ReactDOM from 'react-dom'; -import { marked } from 'marked'; -import { markdownCss } from './markdown.style'; + import styles from './comments.module.less'; +import { markdownCss } from './markdown.style'; const ShadowContent = ({ root, children }) => ReactDOM.createPortal(children, root); diff --git a/packages/comments/src/browser/comments-feature.registry.ts b/packages/comments/src/browser/comments-feature.registry.ts index 8b7bf5a4c8..0ed72dc1b5 100644 --- a/packages/comments/src/browser/comments-feature.registry.ts +++ b/packages/comments/src/browser/comments-feature.registry.ts @@ -1,4 +1,5 @@ import { Injectable } from '@opensumi/di'; + import { CommentsPanelOptions, ICommentsFeatureRegistry, diff --git a/packages/comments/src/browser/comments-item.view.tsx b/packages/comments/src/browser/comments-item.view.tsx index 6639c642e4..e70220e206 100644 --- a/packages/comments/src/browser/comments-item.view.tsx +++ b/packages/comments/src/browser/comments-item.view.tsx @@ -1,5 +1,12 @@ +import { marked } from 'marked'; +import { observer } from 'mobx-react-lite'; import React from 'react'; -import styles from './comments.module.less'; + +import { Button } from '@opensumi/ide-components'; +import { useInjectable, localize, IContextKeyService, isUndefined } from '@opensumi/ide-core-browser'; +import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { AbstractMenuService, MenuId, IMenu } from '@opensumi/ide-core-browser/lib/menu/next'; + import { IThreadComment, ICommentsCommentTitle, @@ -10,15 +17,11 @@ import { ICommentsFeatureRegistry, ICommentsThread, } from '../common'; -import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { observer } from 'mobx-react-lite'; -import { CommentsTextArea } from './comments-textarea.view'; -import { AbstractMenuService, MenuId, IMenu } from '@opensumi/ide-core-browser/lib/menu/next'; -import { useInjectable, localize, IContextKeyService, isUndefined } from '@opensumi/ide-core-browser'; -import { Button } from '@opensumi/ide-components'; -import { CommentsBody } from './comments-body'; -import { marked } from 'marked'; + import { CommentReactions, CommentReactionSwitcher } from './comment-reactions.view'; +import { CommentsBody } from './comments-body'; +import { CommentsTextArea } from './comments-textarea.view'; +import styles from './comments.module.less'; const useCommentContext = ( contextKeyService: IContextKeyService, diff --git a/packages/comments/src/browser/comments-panel.view.tsx b/packages/comments/src/browser/comments-panel.view.tsx index be0b829b28..9cc4bdfe64 100644 --- a/packages/comments/src/browser/comments-panel.view.tsx +++ b/packages/comments/src/browser/comments-panel.view.tsx @@ -1,11 +1,14 @@ -import React from 'react'; -import { DeprecatedRecycleTree } from '@opensumi/ide-core-browser/lib/components'; +import clx from 'classnames'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { useInjectable, isUndefined, ViewState, IEventBus, localize } from '@opensumi/ide-core-browser'; +import { DeprecatedRecycleTree } from '@opensumi/ide-core-browser/lib/components'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; + import { ICommentsService, ICommentsTreeNode, CommentPanelCollapse, ICommentsFeatureRegistry } from '../common'; + import styles from './comments.module.less'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import clx from 'classnames'; export const CommentsPanel = observer<{ viewState: ViewState; className?: string }>((props) => { const commentsService = useInjectable(ICommentsService); diff --git a/packages/comments/src/browser/comments-textarea.view.tsx b/packages/comments/src/browser/comments-textarea.view.tsx index b2c753d0bf..1547e35236 100644 --- a/packages/comments/src/browser/comments-textarea.view.tsx +++ b/packages/comments/src/browser/comments-textarea.view.tsx @@ -1,12 +1,16 @@ import React from 'react'; -import styles from './comments.module.less'; +import { MentionsInput, Mention } from 'react-mentions'; + import { Tabs } from '@opensumi/ide-components'; -import { CommentsBody } from './comments-body'; import { localize, useInjectable } from '@opensumi/ide-core-browser'; -import { MentionsInput, Mention } from 'react-mentions'; -import { getMentionBoxStyle } from './mentions.style'; + import { ICommentsFeatureRegistry } from '../common'; +import { CommentsBody } from './comments-body'; +import styles from './comments.module.less'; +import { getMentionBoxStyle } from './mentions.style'; + + export interface ICommentTextAreaProps extends React.TextareaHTMLAttributes { focusDelay?: number; minRows?: number; diff --git a/packages/comments/src/browser/comments-thread.ts b/packages/comments/src/browser/comments-thread.ts index ae1c819d5b..0fe9eb330e 100644 --- a/packages/comments/src/browser/comments-thread.ts +++ b/packages/comments/src/browser/comments-thread.ts @@ -1,7 +1,10 @@ -import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { observable, computed, autorun } from 'mobx'; + +import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IRange, Disposable, URI, IContextKeyService, uuid, localize } from '@opensumi/ide-core-browser'; -import { CommentsZoneWidget } from './comments-zone.view'; +import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; +import { IEditor, EditorCollectionService } from '@opensumi/ide-editor'; + import { ICommentsThread, IComment, @@ -10,8 +13,9 @@ import { IThreadComment, ICommentsZoneWidget, } from '../common'; -import { IEditor, EditorCollectionService } from '@opensumi/ide-editor'; -import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; + +import { CommentsZoneWidget } from './comments-zone.view'; + @Injectable({ multiple: true }) export class CommentsThread extends Disposable implements ICommentsThread { diff --git a/packages/comments/src/browser/comments-zone.service.ts b/packages/comments/src/browser/comments-zone.service.ts index 289f8c3b27..2e00c7eac7 100644 --- a/packages/comments/src/browser/comments-zone.service.ts +++ b/packages/comments/src/browser/comments-zone.service.ts @@ -1,6 +1,6 @@ -import { Disposable, memoize } from '@opensumi/ide-core-common'; import { Autowired, Injectable, Optional } from '@opensumi/di'; import { AbstractMenuService, MenuId, IMenu } from '@opensumi/ide-core-browser/lib/menu/next'; +import { Disposable, memoize } from '@opensumi/ide-core-common'; import { CommentsThread } from './comments-thread'; diff --git a/packages/comments/src/browser/comments-zone.view.tsx b/packages/comments/src/browser/comments-zone.view.tsx index 8ecc5867f3..80fdba45db 100644 --- a/packages/comments/src/browser/comments-zone.view.tsx +++ b/packages/comments/src/browser/comments-zone.view.tsx @@ -1,11 +1,15 @@ +import clx from 'classnames'; +import { observer } from 'mobx-react-lite'; import React from 'react'; -import { INJECTOR_TOKEN, Injectable, Autowired } from '@opensumi/di'; import ReactDOM from 'react-dom'; -import { observer } from 'mobx-react-lite'; -import styles from './comments.module.less'; + +import { INJECTOR_TOKEN, Injectable, Autowired } from '@opensumi/di'; import { ConfigProvider, localize, AppConfig, useInjectable, Event, Emitter } from '@opensumi/ide-core-browser'; -import { CommentItem } from './comments-item.view'; -import { CommentsTextArea } from './comments-textarea.view'; +import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { IEditor } from '@opensumi/ide-editor'; +import { ResizeZoneWidget } from '@opensumi/ide-monaco-enhance'; + import { ICommentReply, ICommentsZoneWidget, @@ -13,12 +17,11 @@ import { ICommentsFeatureRegistry, ICommentsThread, } from '../common'; -import clx from 'classnames'; -import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { ResizeZoneWidget } from '@opensumi/ide-monaco-enhance'; -import { IEditor } from '@opensumi/ide-editor'; + +import { CommentItem } from './comments-item.view'; +import { CommentsTextArea } from './comments-textarea.view'; import { CommentsZoneService } from './comments-zone.service'; -import { MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import styles from './comments.module.less'; export interface ICommentProps { thread: ICommentsThread; diff --git a/packages/comments/src/browser/comments.contribution.ts b/packages/comments/src/browser/comments.contribution.ts index 6515efdecc..e669bef61d 100644 --- a/packages/comments/src/browser/comments.contribution.ts +++ b/packages/comments/src/browser/comments.contribution.ts @@ -13,6 +13,11 @@ import { TabBarToolbarContribution, IEventBus, } from '@opensumi/ide-core-browser'; +import { IMenuRegistry, MenuId, MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next'; +import { IEditor } from '@opensumi/ide-editor'; +import { BrowserEditorContribution, IEditorFeatureRegistry } from '@opensumi/ide-editor/lib/browser'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; + import { ICommentsService, CommentPanelId, @@ -27,10 +32,6 @@ import { CommentReactionPayload, CommentReactionClick, } from '../common'; -import { IEditor } from '@opensumi/ide-editor'; -import { BrowserEditorContribution, IEditorFeatureRegistry } from '@opensumi/ide-editor/lib/browser'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { IMenuRegistry, MenuId, MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next'; @Domain( ClientAppContribution, diff --git a/packages/comments/src/browser/comments.service.ts b/packages/comments/src/browser/comments.service.ts index 0682732dff..468c3b92fe 100644 --- a/packages/comments/src/browser/comments.service.ts +++ b/packages/comments/src/browser/comments.service.ts @@ -1,6 +1,8 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as textModel from '@opensumi/monaco-editor-core/esm/vs/editor/common/model/textModel'; -import * as model from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import debounce = require('lodash.debounce'); +import flattenDeep from 'lodash.flattendeep'; +import groupBy from 'lodash.groupby'; +import { observable, computed, action } from 'mobx'; + import { INJECTOR_TOKEN, Injector, Injectable, Autowired } from '@opensumi/di'; import { Disposable, @@ -16,6 +18,8 @@ import { positionToRange, Deferred, } from '@opensumi/ide-core-browser'; +import { LRUCache } from '@opensumi/ide-core-common/lib/map'; +import { dirname } from '@opensumi/ide-core-common/lib/path'; import { IEditor } from '@opensumi/ide-editor'; import { IEditorDecorationCollectionService, @@ -23,6 +27,12 @@ import { ResourceService, WorkbenchEditorService, } from '@opensumi/ide-editor/lib/browser'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { IIconService, IconType } from '@opensumi/ide-theme'; +import * as model from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as textModel from '@opensumi/monaco-editor-core/esm/vs/editor/common/model/textModel'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { ICommentsService, ICommentsThread, @@ -32,16 +42,10 @@ import { ICommentRangeProvider, ICommentsThreadOptions, } from '../common'; -import { CommentsThread } from './comments-thread'; -import { observable, computed, action } from 'mobx'; -import flattenDeep from 'lodash.flattendeep'; -import groupBy from 'lodash.groupby'; -import { dirname } from '@opensumi/ide-core-common/lib/path'; -import { IIconService, IconType } from '@opensumi/ide-theme'; + import { CommentsPanel } from './comments-panel.view'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { LRUCache } from '@opensumi/ide-core-common/lib/map'; -import debounce = require('lodash.debounce'); +import { CommentsThread } from './comments-thread'; + @Injectable() export class CommentsService extends Disposable implements ICommentsService { diff --git a/packages/comments/src/browser/index.ts b/packages/comments/src/browser/index.ts index 27652c1e4c..40f71904d7 100644 --- a/packages/comments/src/browser/index.ts +++ b/packages/comments/src/browser/index.ts @@ -1,9 +1,12 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { CommentsService } from './comments.service'; + +import { CommentsContribution, ICommentsService, ICommentsFeatureRegistry } from '../common'; + import { CommentsFeatureRegistry } from './comments-feature.registry'; import { CommentsBrowserContribution } from './comments.contribution'; -import { CommentsContribution, ICommentsService, ICommentsFeatureRegistry } from '../common'; +import { CommentsService } from './comments.service'; + import './comments.module.less'; @Injectable() diff --git a/packages/comments/src/common/index.ts b/packages/comments/src/common/index.ts index eb636b3675..7bbf831c9c 100644 --- a/packages/comments/src/common/index.ts +++ b/packages/comments/src/common/index.ts @@ -1,4 +1,3 @@ -import { IEditor } from '@opensumi/ide-editor'; import { IRange, URI, @@ -10,9 +9,10 @@ import { positionToRange, IContextKeyService, } from '@opensumi/ide-core-browser'; +import { RecycleTreeProps } from '@opensumi/ide-core-browser/lib/components'; +import { IEditor } from '@opensumi/ide-editor'; // eslint-disable-next-line import/no-restricted-paths import type { IEditorDocumentModel } from '@opensumi/ide-editor/lib/browser'; -import { RecycleTreeProps } from '@opensumi/ide-core-browser/lib/components'; type Writeable = { -readonly [P in keyof T]: T[P] }; diff --git a/packages/components/__tests__/recycle-tree/prompt/index.test.ts b/packages/components/__tests__/recycle-tree/prompt/index.test.ts index 7bea555fe4..dd5615c497 100644 --- a/packages/components/__tests__/recycle-tree/prompt/index.test.ts +++ b/packages/components/__tests__/recycle-tree/prompt/index.test.ts @@ -1,7 +1,7 @@ -import { TreeNode, CompositeTreeNode } from '../../../src/recycle-tree/tree/TreeNode'; -import { Tree } from '../../../src/recycle-tree/tree/Tree'; -import { NewPromptHandle, RenamePromptHandle } from '../../../src/recycle-tree/prompt'; import { TreeNodeType, PromptValidateMessage, PROMPT_VALIDATE_TYPE } from '../../../src'; +import { NewPromptHandle, RenamePromptHandle } from '../../../src/recycle-tree/prompt'; +import { Tree } from '../../../src/recycle-tree/tree/Tree'; +import { TreeNode, CompositeTreeNode } from '../../../src/recycle-tree/tree/TreeNode'; describe('NewPromptHandle', () => { class TreeA extends Tree { diff --git a/packages/components/__tests__/recycle-tree/tree/TreeNode.test.ts b/packages/components/__tests__/recycle-tree/tree/TreeNode.test.ts index 66720f87fd..78b21948d0 100644 --- a/packages/components/__tests__/recycle-tree/tree/TreeNode.test.ts +++ b/packages/components/__tests__/recycle-tree/tree/TreeNode.test.ts @@ -1,5 +1,5 @@ -import { TreeNode, CompositeTreeNode } from '../../../src/recycle-tree/tree/TreeNode'; import { Tree } from '../../../src/recycle-tree/tree/Tree'; +import { TreeNode, CompositeTreeNode } from '../../../src/recycle-tree/tree/TreeNode'; import { TreeNodeEvent, MetadataChangeType, WatchEvent } from '../../../src/recycle-tree/types'; describe('Tree', () => { diff --git a/packages/components/src/badge/index.tsx b/packages/components/src/badge/index.tsx index fdbc176a9f..87df26d9aa 100644 --- a/packages/components/src/badge/index.tsx +++ b/packages/components/src/badge/index.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; import './styles.less'; diff --git a/packages/components/src/button/index.tsx b/packages/components/src/button/index.tsx index 62267b91c4..e048d0abe5 100644 --- a/packages/components/src/button/index.tsx +++ b/packages/components/src/button/index.tsx @@ -1,9 +1,9 @@ -import React from 'react'; -import { Dropdown } from '../dropdown'; import classNames from 'classnames'; +import React from 'react'; -import './style.less'; +import { Dropdown } from '../dropdown'; import { Icon, getKaitianIcon, DefaultIconKeys } from '../icon'; +import './style.less'; export type ButtonType = 'primary' | 'secondary' | 'ghost' | 'danger' | 'link' | 'icon' | 'default'; diff --git a/packages/components/src/checkbox/index.tsx b/packages/components/src/checkbox/index.tsx index 0c1c3376b1..00ac7fc683 100644 --- a/packages/components/src/checkbox/index.tsx +++ b/packages/components/src/checkbox/index.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import classNames from 'classnames'; +import React from 'react'; + import { warning } from '../utils/warning'; import './style.less'; diff --git a/packages/components/src/dialog/index.tsx b/packages/components/src/dialog/index.tsx index b4c65db06c..1e7a524ff4 100644 --- a/packages/components/src/dialog/index.tsx +++ b/packages/components/src/dialog/index.tsx @@ -1,11 +1,10 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; -import { Overlay, IOverlayProps } from '../overlay'; -import { IconContext, getKaitianIcon } from '../icon'; import { Button } from '../button'; - import { MessageType } from '../common'; +import { IconContext, getKaitianIcon } from '../icon'; +import { Overlay, IOverlayProps } from '../overlay'; import './styles.less'; export type ModalType = 'basic' | 'confirm' | 'info'; diff --git a/packages/components/src/dropdown/dropdown.tsx b/packages/components/src/dropdown/dropdown.tsx index 83764da436..1764b53c78 100644 --- a/packages/components/src/dropdown/dropdown.tsx +++ b/packages/components/src/dropdown/dropdown.tsx @@ -1,7 +1,8 @@ -import React from 'react'; -import RcDropdown from 'rc-dropdown'; -import classNames from 'classnames'; import RightOutlined from '@ant-design/icons/RightOutlined'; +import classNames from 'classnames'; +import RcDropdown from 'rc-dropdown'; +import React from 'react'; + import { tuple } from '../utils/type'; import { warning } from '../utils/warning'; diff --git a/packages/components/src/icon/icon.tsx b/packages/components/src/icon/icon.tsx index 3de9adebe0..fddc8af066 100644 --- a/packages/components/src/icon/icon.tsx +++ b/packages/components/src/icon/icon.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; import { defaultIconMap, defaultIconfont } from './iconfont/iconManager'; import { getKaitianIcon, IIconShapeOptions } from './util'; diff --git a/packages/components/src/icon/iconfont-cn.tsx b/packages/components/src/icon/iconfont-cn.tsx index fc943c545b..572780c6d5 100644 --- a/packages/components/src/icon/iconfont-cn.tsx +++ b/packages/components/src/icon/iconfont-cn.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; + import { _InternalIcon, IconProps } from './icon'; import { getIconShapeClxList } from './util'; diff --git a/packages/components/src/input/HistoryInputBox.tsx b/packages/components/src/input/HistoryInputBox.tsx index 304615a587..f012947eb1 100644 --- a/packages/components/src/input/HistoryInputBox.tsx +++ b/packages/components/src/input/HistoryInputBox.tsx @@ -1,7 +1,9 @@ import React from 'react'; -import { IInputBaseProps, Input } from './Input'; + import { HistoryNavigator } from '@opensumi/monaco-editor-core/esm/vs/base/common/history'; +import { IInputBaseProps, Input } from './Input'; + export interface HistoryInputBoxProp extends IInputBaseProps { // 上层自己持久化历史记录 history?: string[]; diff --git a/packages/components/src/input/Input.tsx b/packages/components/src/input/Input.tsx index 2222690eef..d890987cd1 100644 --- a/packages/components/src/input/Input.tsx +++ b/packages/components/src/input/Input.tsx @@ -1,8 +1,8 @@ -import React from 'react'; import clx from 'classnames'; -import warning from '../utils/warning'; +import React from 'react'; import { Icon } from '../icon'; +import warning from '../utils/warning'; import './input.less'; diff --git a/packages/components/src/input/ProxiedInput.tsx b/packages/components/src/input/ProxiedInput.tsx index 4696fb8e46..8622181f76 100644 --- a/packages/components/src/input/ProxiedInput.tsx +++ b/packages/components/src/input/ProxiedInput.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { IInputBaseProps, Input as BaseInput } from './Input'; export interface ProxiedInputProp extends IInputBaseProps { diff --git a/packages/components/src/input/ValidateInput.tsx b/packages/components/src/input/ValidateInput.tsx index 565118a966..9b62fe8b86 100644 --- a/packages/components/src/input/ValidateInput.tsx +++ b/packages/components/src/input/ValidateInput.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import classNames from 'classnames'; +import React from 'react'; + import warning from '../utils/warning'; import { IInputBaseProps, Input } from './Input'; diff --git a/packages/components/src/locale-context-provider.tsx b/packages/components/src/locale-context-provider.tsx index 98fa677cdc..d361b639f0 100644 --- a/packages/components/src/locale-context-provider.tsx +++ b/packages/components/src/locale-context-provider.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { warning } from './utils/warning'; + import { IiconContext, IconContextProvider } from './icon'; +import { warning } from './utils/warning'; type LocalizeFn = (v: string) => string; diff --git a/packages/components/src/menu/MenuItem.tsx b/packages/components/src/menu/MenuItem.tsx index 127ca6c57f..e7e0b8fff3 100644 --- a/packages/components/src/menu/MenuItem.tsx +++ b/packages/components/src/menu/MenuItem.tsx @@ -1,8 +1,11 @@ -import React from 'react'; import { Item } from 'rc-menu'; -import { ClickParam } from '.'; +import React from 'react'; + import MenuContext, { MenuContextProps } from './MenuContext'; +import { ClickParam } from '.'; + + export interface MenuItemProps extends Omit, 'title' | 'onClick' | 'onMouseEnter' | 'onMouseLeave'> { rootPrefixCls?: string; diff --git a/packages/components/src/menu/SubMenu.tsx b/packages/components/src/menu/SubMenu.tsx index 2bcde351e7..e8805c6389 100644 --- a/packages/components/src/menu/SubMenu.tsx +++ b/packages/components/src/menu/SubMenu.tsx @@ -1,6 +1,6 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { SubMenu as RcSubMenu } from 'rc-menu'; +import React from 'react'; interface TitleEventEntity { key: string; diff --git a/packages/components/src/menu/index.tsx b/packages/components/src/menu/index.tsx index 0104393d23..8a2f2e879e 100644 --- a/packages/components/src/menu/index.tsx +++ b/packages/components/src/menu/index.tsx @@ -1,13 +1,15 @@ -import React from 'react'; -import RcMenu, { Divider, ItemGroup } from 'rc-menu'; import classNames from 'classnames'; +import RcMenu, { Divider, ItemGroup } from 'rc-menu'; +import React from 'react'; import { polyfill } from 'react-lifecycles-compat'; -import SubMenu from './SubMenu'; -import Item from './MenuItem'; -import { warning } from '../utils/warning'; -import raf from '../utils/raf'; + import collapseMotion from '../utils/motion'; +import raf from '../utils/raf'; +import { warning } from '../utils/warning'; + import MenuContext from './MenuContext'; +import Item from './MenuItem'; +import SubMenu from './SubMenu'; import './style.less'; export interface SelectParam { diff --git a/packages/components/src/message/index.ts b/packages/components/src/message/index.ts index 81a2316711..b48e4b689f 100644 --- a/packages/components/src/message/index.ts +++ b/packages/components/src/message/index.ts @@ -1,4 +1,5 @@ import React from 'react'; + import antdMessage from './message'; import './style.less'; diff --git a/packages/components/src/message/message.tsx b/packages/components/src/message/message.tsx index 4d8929efc7..dd0cea2904 100644 --- a/packages/components/src/message/message.tsx +++ b/packages/components/src/message/message.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import Notification from 'rc-notification'; -import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; -import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; -import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled'; +import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; +import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; +import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; +import Notification from 'rc-notification'; +import React from 'react'; let defaultDuration = 3; let defaultTop: number; diff --git a/packages/components/src/modal/Modal.tsx b/packages/components/src/modal/Modal.tsx index d37a1f75e6..f6edc0c4bf 100644 --- a/packages/components/src/modal/Modal.tsx +++ b/packages/components/src/modal/Modal.tsx @@ -1,13 +1,16 @@ -import React from 'react'; -import Dialog from 'rc-dialog'; -import PropTypes from 'prop-types'; +import CloseOutlined from '@ant-design/icons/CloseOutlined'; import classNames from 'classnames'; +import PropTypes from 'prop-types'; +import Dialog from 'rc-dialog'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; -import CloseOutlined from '@ant-design/icons/CloseOutlined'; -import { getConfirmLocale, ModalLocale } from './locale'; +import React from 'react'; + import { Button } from '../button'; import type { ButtonType, ButtonProps } from '../button'; +import { getConfirmLocale, ModalLocale } from './locale'; + + let mousePosition: { x: number; y: number } | null; export const destroyFns: Array<() => void> = []; diff --git a/packages/components/src/notification/index.tsx b/packages/components/src/notification/index.tsx index 129bb74d91..13f9c0f5bb 100644 --- a/packages/components/src/notification/index.tsx +++ b/packages/components/src/notification/index.tsx @@ -1,12 +1,12 @@ import clx from 'classnames'; import React from 'react'; -import antdNotification, { ArgsProps } from './notification'; - import { Button } from '../button'; -import './notification.less'; import { MessageType } from '../common'; +import antdNotification, { ArgsProps } from './notification'; +import './notification.less'; + const DURATION: { [type: number]: number } = { [MessageType.Info]: 15000, [MessageType.Warning]: 18000, diff --git a/packages/components/src/notification/notification.tsx b/packages/components/src/notification/notification.tsx index 65c6a86af7..f824724bf6 100644 --- a/packages/components/src/notification/notification.tsx +++ b/packages/components/src/notification/notification.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import Notification from 'rc-notification'; -import CloseOutlined from '@ant-design/icons/CloseOutlined'; import CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined'; import CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined'; +import CloseOutlined from '@ant-design/icons/CloseOutlined'; import ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined'; import InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined'; +import Notification from 'rc-notification'; +import React from 'react'; export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; diff --git a/packages/components/src/overlay/index.tsx b/packages/components/src/overlay/index.tsx index ec4b9876d7..74a33befb1 100644 --- a/packages/components/src/overlay/index.tsx +++ b/packages/components/src/overlay/index.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import clsx from 'classnames'; +import React from 'react'; + import { Modal, ModalProps } from '../modal'; import './styles.less'; diff --git a/packages/components/src/popover/index.tsx b/packages/components/src/popover/index.tsx index 7766a89773..944f76bafd 100644 --- a/packages/components/src/popover/index.tsx +++ b/packages/components/src/popover/index.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; import './styles.less'; import { Button } from '../button'; diff --git a/packages/components/src/recycle-list/RecycleList.tsx b/packages/components/src/recycle-list/RecycleList.tsx index 604062c0c9..38db5efdec 100644 --- a/packages/components/src/recycle-list/RecycleList.tsx +++ b/packages/components/src/recycle-list/RecycleList.tsx @@ -1,8 +1,9 @@ +import cls from 'classnames'; import React from 'react'; +import AutoSizer from 'react-virtualized-auto-sizer'; import { FixedSizeList, VariableSizeList, Align } from 'react-window'; + import { ScrollbarsVirtualList } from '../scrollbars'; -import AutoSizer from 'react-virtualized-auto-sizer'; -import cls from 'classnames'; export interface IRecycleListProps { /** diff --git a/packages/components/src/recycle-tree/RecycleTree.tsx b/packages/components/src/recycle-tree/RecycleTree.tsx index 73247fb2af..1a9bbdb94a 100644 --- a/packages/components/src/recycle-tree/RecycleTree.tsx +++ b/packages/components/src/recycle-tree/RecycleTree.tsx @@ -1,14 +1,17 @@ +import fuzzy from 'fuzzy'; import React from 'react'; import { FixedSizeList, VariableSizeList, shouldComponentUpdate, ListProps } from 'react-window'; -import { TreeModel } from './tree/model/TreeModel'; -import { TreeNode, CompositeTreeNode, spliceArray } from './tree'; + +import { ScrollbarsVirtualList } from '../scrollbars'; +import { DisposableCollection, Emitter, Event, Disposable } from '../utils'; + import { RenamePromptHandle, PromptHandle } from './prompt'; import { NewPromptHandle } from './prompt/NewPromptHandle'; -import { DisposableCollection, Emitter, Event, Disposable } from '../utils'; +import { TreeNode, CompositeTreeNode, spliceArray } from './tree'; +import { TreeModel } from './tree/model/TreeModel'; import { INodeRendererProps, NodeRendererWrap, INodeRenderer } from './TreeNodeRendererWrap'; import { TreeNodeType, TreeNodeEvent } from './types'; -import { ScrollbarsVirtualList } from '../scrollbars'; -import fuzzy from 'fuzzy'; + export type IRecycleTreeAlign = 'smart' | 'start' | 'center' | 'end' | 'auto'; diff --git a/packages/components/src/recycle-tree/TreeNodeRendererWrap.ts b/packages/components/src/recycle-tree/TreeNodeRendererWrap.ts index 25643ff1ad..eff00dbedf 100644 --- a/packages/components/src/recycle-tree/TreeNodeRendererWrap.ts +++ b/packages/components/src/recycle-tree/TreeNodeRendererWrap.ts @@ -1,6 +1,7 @@ import React from 'react'; -import { TreeNode, CompositeTreeNode } from './tree/TreeNode'; + import { RenamePromptHandle, NewPromptHandle } from './prompt'; +import { TreeNode, CompositeTreeNode } from './tree/TreeNode'; import { TreeNodeType } from './types'; export interface ITreeNodeRendererProps { diff --git a/packages/components/src/recycle-tree/basic/index.tsx b/packages/components/src/recycle-tree/basic/index.tsx index f383a579fe..a23ddcf74d 100644 --- a/packages/components/src/recycle-tree/basic/index.tsx +++ b/packages/components/src/recycle-tree/basic/index.tsx @@ -1,16 +1,19 @@ +import cls from 'classnames'; import React, { useCallback, useRef, useEffect, useState } from 'react'; +import CtxMenuTrigger from 'react-ctxmenu-trigger'; + +import { ClickOutside } from '../../click-outside'; import { RecycleTree, IRecycleTreeHandle } from '../RecycleTree'; -import { ITreeNodeOrCompositeTreeNode } from '../types'; import { INodeRendererWrapProps } from '../TreeNodeRendererWrap'; -import { IBasicContextMenu, IBasicRecycleTreeProps, IBasicTreeMenu } from './types'; -import { BasicTreeModel, BasicTreeService } from './tree-service'; -import { BasicTreeNodeRenderer } from './tree-node'; -import { BasicCompositeTreeNode, BasicTreeNode } from './tree-node.define'; -import { ClickOutside } from '../../click-outside'; +import { ITreeNodeOrCompositeTreeNode } from '../types'; + import { BasicMenuItem } from './menubar-item'; import { placements } from './placements'; -import CtxMenuTrigger from 'react-ctxmenu-trigger'; -import cls from 'classnames'; +import { BasicTreeNodeRenderer } from './tree-node'; +import { BasicCompositeTreeNode, BasicTreeNode } from './tree-node.define'; +import { BasicTreeModel, BasicTreeService } from './tree-service'; +import { IBasicContextMenu, IBasicRecycleTreeProps, IBasicTreeMenu } from './types'; + import './styles.less'; import 'react-ctxmenu-trigger/assets/index.css'; diff --git a/packages/components/src/recycle-tree/basic/menubar-item.tsx b/packages/components/src/recycle-tree/basic/menubar-item.tsx index 06cbe078f2..6bc6dab790 100644 --- a/packages/components/src/recycle-tree/basic/menubar-item.tsx +++ b/packages/components/src/recycle-tree/basic/menubar-item.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; + import { IBasicTreeMenu } from './types'; export const BasicMenuItem: React.FC< diff --git a/packages/components/src/recycle-tree/basic/tree-node.define.ts b/packages/components/src/recycle-tree/basic/tree-node.define.ts index a714dc1ea2..a8917ca619 100644 --- a/packages/components/src/recycle-tree/basic/tree-node.define.ts +++ b/packages/components/src/recycle-tree/basic/tree-node.define.ts @@ -1,5 +1,6 @@ import { CompositeTreeNode, TreeNode } from '../tree'; import { ITree } from '../types'; + import { IBasicTreeData } from './types'; export class BasicTreeRoot extends CompositeTreeNode { diff --git a/packages/components/src/recycle-tree/basic/tree-node.tsx b/packages/components/src/recycle-tree/basic/tree-node.tsx index 629841a87d..c63ff052e5 100644 --- a/packages/components/src/recycle-tree/basic/tree-node.tsx +++ b/packages/components/src/recycle-tree/basic/tree-node.tsx @@ -1,10 +1,12 @@ +import cls from 'classnames'; import React, { useCallback } from 'react'; -import { IBasicInlineMenuPosition, IBasicNodeRendererProps, DECORATIONS } from './types'; -import { Icon } from '../../icon'; + import { Button } from '../../button'; +import { Icon } from '../../icon'; import { Loading } from '../../loading'; + import { BasicCompositeTreeNode, BasicTreeNode } from './tree-node.define'; -import cls from 'classnames'; +import { IBasicInlineMenuPosition, IBasicNodeRendererProps, DECORATIONS } from './types'; import './styles.less'; export const BasicTreeNodeRenderer: React.FC< diff --git a/packages/components/src/recycle-tree/basic/tree-service.ts b/packages/components/src/recycle-tree/basic/tree-service.ts index 6f28ba9c51..093996ffad 100644 --- a/packages/components/src/recycle-tree/basic/tree-service.ts +++ b/packages/components/src/recycle-tree/basic/tree-service.ts @@ -1,8 +1,9 @@ +import { DisposableCollection, Emitter } from '../../utils'; import { TreeModel, Tree, Decoration, DecorationsManager } from '../tree'; -import { IBasicTreeData, DECORATIONS } from './types'; import { TreeNodeEvent } from '../types'; -import { DisposableCollection, Emitter } from '../../utils'; + import { BasicCompositeTreeNode, BasicTreeNode, BasicTreeRoot } from './tree-node.define'; +import { IBasicTreeData, DECORATIONS } from './types'; export class BasicTreeService extends Tree { private selectedDecoration: Decoration = new Decoration(DECORATIONS.SELECTED); // 选中态 diff --git a/packages/components/src/recycle-tree/basic/types.ts b/packages/components/src/recycle-tree/basic/types.ts index 12d76f0007..07f4064c71 100644 --- a/packages/components/src/recycle-tree/basic/types.ts +++ b/packages/components/src/recycle-tree/basic/types.ts @@ -1,7 +1,7 @@ -import { ITreeNodeOrCompositeTreeNode } from '../types'; -import { INodeRendererProps } from '../TreeNodeRendererWrap'; -import { ClasslistComposite } from '../tree/decoration'; import { IRecycleTreeHandle } from '../RecycleTree'; +import { ClasslistComposite } from '../tree/decoration'; +import { INodeRendererProps } from '../TreeNodeRendererWrap'; +import { ITreeNodeOrCompositeTreeNode } from '../types'; export enum IBasicInlineMenuPosition { TREE_NODE = 1, diff --git a/packages/components/src/recycle-tree/decorators/Adaptive/index.tsx b/packages/components/src/recycle-tree/decorators/Adaptive/index.tsx index e24d60bea0..a088c733fc 100644 --- a/packages/components/src/recycle-tree/decorators/Adaptive/index.tsx +++ b/packages/components/src/recycle-tree/decorators/Adaptive/index.tsx @@ -1,7 +1,8 @@ import React from 'react'; + import { IRecycleTreeProps, IRecycleTreeHandle } from '../../RecycleTree'; -import { TreeNodeEvent } from '../../types'; import { TreeModel } from '../../tree'; +import { TreeNodeEvent } from '../../types'; type AdaptiveTreeHoc = ( Component: React.ComponentType, diff --git a/packages/components/src/recycle-tree/decorators/Filter/index.tsx b/packages/components/src/recycle-tree/decorators/Filter/index.tsx index 69ac755758..53656719ec 100644 --- a/packages/components/src/recycle-tree/decorators/Filter/index.tsx +++ b/packages/components/src/recycle-tree/decorators/Filter/index.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import throttle from 'lodash/throttle'; +import React from 'react'; import { Icon } from '../../../icon'; import { IInputBaseProps, Input } from '../../../input'; diff --git a/packages/components/src/recycle-tree/prompt/NewPromptHandle.ts b/packages/components/src/recycle-tree/prompt/NewPromptHandle.ts index 5d6de8ce6a..78c5894920 100644 --- a/packages/components/src/recycle-tree/prompt/NewPromptHandle.ts +++ b/packages/components/src/recycle-tree/prompt/NewPromptHandle.ts @@ -1,7 +1,8 @@ -import { PromptHandle } from './PromptHandle'; import { TreeNode, CompositeTreeNode } from '../tree'; import { TreeNodeType } from '../types'; +import { PromptHandle } from './PromptHandle'; + export class NewPromptHandle extends PromptHandle { private _id: number = TreeNode.nextId(); diff --git a/packages/components/src/recycle-tree/prompt/RenamePromptHandle.ts b/packages/components/src/recycle-tree/prompt/RenamePromptHandle.ts index cdf2f4bfb8..def4fb186b 100644 --- a/packages/components/src/recycle-tree/prompt/RenamePromptHandle.ts +++ b/packages/components/src/recycle-tree/prompt/RenamePromptHandle.ts @@ -1,6 +1,7 @@ -import { PromptHandle } from './PromptHandle'; import { TreeNode, CompositeTreeNode } from '../tree'; +import { PromptHandle } from './PromptHandle'; + export class RenamePromptHandle extends PromptHandle { constructor(public readonly originalFileName: string, public readonly target: CompositeTreeNode | TreeNode) { super(); diff --git a/packages/components/src/recycle-tree/tree/Tree.ts b/packages/components/src/recycle-tree/tree/Tree.ts index ed14db1eca..a09da09f47 100644 --- a/packages/components/src/recycle-tree/tree/Tree.ts +++ b/packages/components/src/recycle-tree/tree/Tree.ts @@ -1,7 +1,8 @@ -import { TreeNode, CompositeTreeNode } from './TreeNode'; import { Emitter, DisposableCollection } from '../../utils'; import { ITreeNodeOrCompositeTreeNode, ITree, ICompositeTreeNode } from '../types'; +import { TreeNode, CompositeTreeNode } from './TreeNode'; + export abstract class Tree implements ITree { protected _root: CompositeTreeNode | undefined; protected readonly onChangedEmitter = new Emitter(); diff --git a/packages/components/src/recycle-tree/tree/TreeNode.ts b/packages/components/src/recycle-tree/tree/TreeNode.ts index d18dd5e112..d3f4977528 100644 --- a/packages/components/src/recycle-tree/tree/TreeNode.ts +++ b/packages/components/src/recycle-tree/tree/TreeNode.ts @@ -1,3 +1,4 @@ +import { Event, Emitter, DisposableCollection, Path } from '../../utils'; import { IWatcherCallback, IWatchTerminator, @@ -15,7 +16,6 @@ import { TreeNodeType, IAccessibilityInformation, } from '../types'; -import { Event, Emitter, DisposableCollection, Path } from '../../utils'; /** * 裁剪数组 diff --git a/packages/components/src/recycle-tree/tree/decoration/CompositeDecoration.ts b/packages/components/src/recycle-tree/tree/decoration/CompositeDecoration.ts index 74af72d092..6591ec666c 100644 --- a/packages/components/src/recycle-tree/tree/decoration/CompositeDecoration.ts +++ b/packages/components/src/recycle-tree/tree/decoration/CompositeDecoration.ts @@ -1,7 +1,8 @@ -import { Decoration, TargetMatchMode, IDecorationEventData } from './Decoration'; import { DisposableCollection } from '../../../utils'; import { ITreeNodeOrCompositeTreeNode } from '../../types'; +import { Decoration, TargetMatchMode, IDecorationEventData } from './Decoration'; + export class ClasslistComposite { public classlist: ReadonlyArray; constructor( diff --git a/packages/components/src/recycle-tree/tree/decoration/Decoration.ts b/packages/components/src/recycle-tree/tree/decoration/Decoration.ts index 54bdf4096b..2da0fd5cf6 100644 --- a/packages/components/src/recycle-tree/tree/decoration/Decoration.ts +++ b/packages/components/src/recycle-tree/tree/decoration/Decoration.ts @@ -1,6 +1,6 @@ -import { TreeNode } from '../TreeNode'; import { IDisposable, Disposable, Emitter } from '../../../utils'; import { ITreeNode, ICompositeTreeNode } from '../../types'; +import { TreeNode } from '../TreeNode'; export enum TargetMatchMode { None = 1, diff --git a/packages/components/src/recycle-tree/tree/decoration/DecorationManager.ts b/packages/components/src/recycle-tree/tree/decoration/DecorationManager.ts index b1137e84ce..536cc5805e 100644 --- a/packages/components/src/recycle-tree/tree/decoration/DecorationManager.ts +++ b/packages/components/src/recycle-tree/tree/decoration/DecorationManager.ts @@ -1,8 +1,9 @@ import { IDisposable, DisposableCollection } from '../../../utils'; +import { TreeNodeEvent, ITreeNodeOrCompositeTreeNode } from '../../types'; import { TreeNode, CompositeTreeNode } from '../TreeNode'; -import { Decoration, IDecorationTargetChangeEventData } from './Decoration'; + import { CompositeDecoration, CompositeDecorationType, ClasslistComposite } from './CompositeDecoration'; -import { TreeNodeEvent, ITreeNodeOrCompositeTreeNode } from '../../types'; +import { Decoration, IDecorationTargetChangeEventData } from './Decoration'; interface IDecorationMeta { /** diff --git a/packages/components/src/recycle-tree/tree/model/TreeModel.ts b/packages/components/src/recycle-tree/tree/model/TreeModel.ts index 7024ca3f9a..7f092f2f02 100644 --- a/packages/components/src/recycle-tree/tree/model/TreeModel.ts +++ b/packages/components/src/recycle-tree/tree/model/TreeModel.ts @@ -1,7 +1,9 @@ import { Event, Emitter } from '../../../utils'; -import { ISerializableState, TreeStateManager, TreeStateWatcher } from './treeState'; -import { CompositeTreeNode, TreeNode } from '../TreeNode'; import { ICompositeTreeNode, TreeNodeEvent } from '../../types'; +import { CompositeTreeNode, TreeNode } from '../TreeNode'; + +import { ISerializableState, TreeStateManager, TreeStateWatcher } from './treeState'; + export class TreeModel { private _state: TreeStateManager; diff --git a/packages/components/src/recycle-tree/tree/model/treeState/TreeStateManager.ts b/packages/components/src/recycle-tree/tree/model/treeState/TreeStateManager.ts index ca74366bc5..08600dc89a 100644 --- a/packages/components/src/recycle-tree/tree/model/treeState/TreeStateManager.ts +++ b/packages/components/src/recycle-tree/tree/model/treeState/TreeStateManager.ts @@ -1,7 +1,8 @@ import { Event, Emitter, Path } from '../../../../utils'; -import { ISerializableState } from './types'; -import { CompositeTreeNode, TreeNode } from '../../TreeNode'; import { TreeNodeEvent, ITreeNodeOrCompositeTreeNode } from '../../../types'; +import { CompositeTreeNode, TreeNode } from '../../TreeNode'; + +import { ISerializableState } from './types'; export enum Operation { SetExpanded = 1, diff --git a/packages/components/src/recycle-tree/tree/model/treeState/TreeStateWatcher.ts b/packages/components/src/recycle-tree/tree/model/treeState/TreeStateWatcher.ts index ccce48c0dc..0248230ab7 100644 --- a/packages/components/src/recycle-tree/tree/model/treeState/TreeStateWatcher.ts +++ b/packages/components/src/recycle-tree/tree/model/treeState/TreeStateWatcher.ts @@ -1,4 +1,5 @@ import { Event, Emitter, IDisposable, DisposableCollection } from '../../../../utils'; + import { TreeStateManager, IPathChange, IExpansionStateChange } from './TreeStateManager'; import { ISerializableState, TreeStateWatcherChangeType as TreeStateChangeType } from './types'; diff --git a/packages/components/src/recycle-tree/types/tree.ts b/packages/components/src/recycle-tree/types/tree.ts index 348c254a8d..c0cd8eb973 100644 --- a/packages/components/src/recycle-tree/types/tree.ts +++ b/packages/components/src/recycle-tree/types/tree.ts @@ -1,4 +1,5 @@ import { CompositeTreeNode } from '../tree/TreeNode'; + import { ITreeNodeOrCompositeTreeNode, ICompositeTreeNode } from './tree-node'; export interface ITree { diff --git a/packages/components/src/recycle-tree/types/watcher.ts b/packages/components/src/recycle-tree/types/watcher.ts index 7373f2fc13..6eef78c924 100644 --- a/packages/components/src/recycle-tree/types/watcher.ts +++ b/packages/components/src/recycle-tree/types/watcher.ts @@ -1,6 +1,7 @@ -import { ITreeNode, ICompositeTreeNode, ITreeNodeOrCompositeTreeNode } from './tree-node'; import { IDisposable } from '../../utils'; +import { ITreeNode, ICompositeTreeNode, ITreeNodeOrCompositeTreeNode } from './tree-node'; + export enum TreeNodeEvent { WillChangeExpansionState = 1, DidChangeExpansionState, diff --git a/packages/components/src/scrollbars/index.tsx b/packages/components/src/scrollbars/index.tsx index c18451ccd7..8532dccad0 100644 --- a/packages/components/src/scrollbars/index.tsx +++ b/packages/components/src/scrollbars/index.tsx @@ -1,8 +1,8 @@ +import cls from 'classnames'; +import throttle from 'lodash/throttle'; import React from 'react'; import { Scrollbars as CustomScrollbars } from 'react-custom-scrollbars'; -import cls from 'classnames'; import './styles.less'; -import throttle from 'lodash/throttle'; export interface ICustomScrollbarProps { forwardedRef?: any; diff --git a/packages/components/src/select/index.tsx b/packages/components/src/select/index.tsx index 40083dde67..735f75de2b 100644 --- a/packages/components/src/select/index.tsx +++ b/packages/components/src/select/index.tsx @@ -1,6 +1,6 @@ +import classNames from 'classnames'; import React, { useCallback } from 'react'; import { useState, useEffect } from 'react'; -import classNames from 'classnames'; import './style.less'; import { Icon, getKaitianIcon } from '../icon'; diff --git a/packages/components/src/tabs/index.tsx b/packages/components/src/tabs/index.tsx index 84b43dbb50..484414f626 100644 --- a/packages/components/src/tabs/index.tsx +++ b/packages/components/src/tabs/index.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; import './style.less'; diff --git a/packages/components/src/tooltip/index.tsx b/packages/components/src/tooltip/index.tsx index 69ed87a7ad..c23de78674 100644 --- a/packages/components/src/tooltip/index.tsx +++ b/packages/components/src/tooltip/index.tsx @@ -1,6 +1,6 @@ +import cxs from 'classnames'; import React from 'react'; import { useState, useRef } from 'react'; -import cxs from 'classnames'; import './style.less'; diff --git a/packages/components/src/utils/deprecated.tsx b/packages/components/src/utils/deprecated.tsx index a64332e135..f5edd46e59 100644 --- a/packages/components/src/utils/deprecated.tsx +++ b/packages/components/src/utils/deprecated.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import warning from './warning'; // @deprecated wrapper diff --git a/packages/components/src/utils/path.ts b/packages/components/src/utils/path.ts index af0d177dba..2729055c60 100644 --- a/packages/components/src/utils/path.ts +++ b/packages/components/src/utils/path.ts @@ -1,6 +1,6 @@ // Modify from @opensumi/ide-core-common/src/path.ts -import { Process } from './process'; import { isWindows } from './os'; +import { Process } from './process'; const SystemPathSeparatorRegex = isWindows ? /\\/g : /\//g; /** diff --git a/packages/components/webpack.config.js b/packages/components/webpack.config.js index 13f5e2caa0..1730046355 100644 --- a/packages/components/webpack.config.js +++ b/packages/components/webpack.config.js @@ -1,7 +1,8 @@ const path = require('path'); -const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); + const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const { ProgressPlugin } = require('webpack'); const tsConfigPath = path.join(__dirname, '../../configs/ts/references/tsconfig.components.json'); diff --git a/packages/connection/__test__/browser/index.test.ts b/packages/connection/__test__/browser/index.test.ts index 405f39673e..3c64e35732 100644 --- a/packages/connection/__test__/browser/index.test.ts +++ b/packages/connection/__test__/browser/index.test.ts @@ -1,6 +1,7 @@ +import { WebSocket, Server } from 'mock-socket'; + import { WSChannelHandler } from '../../src/browser/ws-channel-handler'; import { stringify, parse } from '../../src/common/utils'; -import { WebSocket, Server } from 'mock-socket'; (global as any).WebSocket = WebSocket; describe('connection browser', () => { diff --git a/packages/connection/__test__/node/index.test.ts b/packages/connection/__test__/node/index.test.ts index 34a84260a7..648b6b1ff4 100644 --- a/packages/connection/__test__/node/index.test.ts +++ b/packages/connection/__test__/node/index.test.ts @@ -1,16 +1,18 @@ -import { WebSocketServerRoute, CommonChannelHandler, commonChannelPathHandler } from '../../src/node'; +import http from 'http'; + +import ws from 'ws'; + +import { Emitter, Uri } from '@opensumi/ide-core-common'; + +import { RPCService } from '../../src'; import { RPCServiceCenter, initRPCService, RPCMessageConnection } from '../../src/common'; import { createWebSocketConnection } from '../../src/common/message'; - import { RPCProtocol, createMainContextProxyIdentifier } from '../../src/common/rpcProtocol'; -import { RPCService } from '../../src'; -import { WSChannel } from '../../src/common/ws-channel'; import { parse } from '../../src/common/utils'; +import { WSChannel } from '../../src/common/ws-channel'; +import { WebSocketServerRoute, CommonChannelHandler, commonChannelPathHandler } from '../../src/node'; -import { Emitter, Uri } from '@opensumi/ide-core-common'; -import ws from 'ws'; -import http from 'http'; const WebSocket = ws; class MockFileService extends RPCService { diff --git a/packages/connection/src/browser/ws-channel-handler.ts b/packages/connection/src/browser/ws-channel-handler.ts index 631cbdc2da..1e1dbafdb7 100644 --- a/packages/connection/src/browser/ws-channel-handler.ts +++ b/packages/connection/src/browser/ws-channel-handler.ts @@ -1,8 +1,10 @@ -import { WSChannel, MessageString } from '../common/ws-channel'; import shortid from 'shortid'; -import { stringify, parse } from '../common/utils'; + import { IReporterService, REPORT_NAME } from '@opensumi/ide-core-common'; +import { stringify, parse } from '../common/utils'; +import { WSChannel, MessageString } from '../common/ws-channel'; + let ReconnectingWebSocket = require('reconnecting-websocket'); if (ReconnectingWebSocket.default) { diff --git a/packages/connection/src/common/message.ts b/packages/connection/src/common/message.ts index 4ef64403bf..d01ec2f1bb 100644 --- a/packages/connection/src/common/message.ts +++ b/packages/connection/src/common/message.ts @@ -3,9 +3,9 @@ import { AbstractMessageWriter, createMessageConnection, } from '@opensumi/vscode-jsonrpc/lib/common/api'; -import { MessageWriter } from '@opensumi/vscode-jsonrpc/lib/common/messageWriter'; -import { MessageReader, DataCallback } from '@opensumi/vscode-jsonrpc/lib/common/messageReader'; import { Disposable } from '@opensumi/vscode-jsonrpc/lib/common/disposable'; +import { MessageReader, DataCallback } from '@opensumi/vscode-jsonrpc/lib/common/messageReader'; +import { MessageWriter } from '@opensumi/vscode-jsonrpc/lib/common/messageWriter'; export class WebSocketMessageReader extends AbstractMessageReader implements MessageReader { protected state: 'initial' | 'listening' | 'closed' = 'initial'; diff --git a/packages/connection/src/node/common-channel-handler.ts b/packages/connection/src/node/common-channel-handler.ts index 09195c4d0a..15a165ad2b 100644 --- a/packages/connection/src/node/common-channel-handler.ts +++ b/packages/connection/src/node/common-channel-handler.ts @@ -1,8 +1,10 @@ -import { WebSocketHandler } from './ws'; import pathMatch from 'path-match'; import ws from 'ws'; + import { stringify, parse } from '../common/utils'; import { WSChannel, ChannelMessage } from '../common/ws-channel'; + +import { WebSocketHandler } from './ws'; const route = pathMatch(); export interface IPathHander { diff --git a/packages/connection/src/node/connect.ts b/packages/connection/src/node/connect.ts index 700093ff55..1cc31dafe3 100644 --- a/packages/connection/src/node/connect.ts +++ b/packages/connection/src/node/connect.ts @@ -1,10 +1,11 @@ +import type net from 'net'; + import { SocketMessageReader, SocketMessageWriter, createMessageConnection, } from '@opensumi/vscode-jsonrpc/lib/node/main'; -import type net from 'net'; export function createSocketConnection(socket: net.Socket) { return createMessageConnection(new SocketMessageReader(socket), new SocketMessageWriter(socket)); diff --git a/packages/core-browser/__mocks__/preference.ts b/packages/core-browser/__mocks__/preference.ts index c71a7907bf..e110d2ab60 100644 --- a/packages/core-browser/__mocks__/preference.ts +++ b/packages/core-browser/__mocks__/preference.ts @@ -1,5 +1,6 @@ -import { PreferenceScope, ISettingGroup, ISettingSection } from '../src'; import { Injectable, Injector, Optional } from '@opensumi/di'; + +import { PreferenceScope, ISettingGroup, ISettingSection } from '../src'; import { PreferenceProvider } from '../src/preferences'; @Injectable() diff --git a/packages/core-browser/__mocks__/storage.ts b/packages/core-browser/__mocks__/storage.ts index 462dd55fac..aac65a2209 100644 --- a/packages/core-browser/__mocks__/storage.ts +++ b/packages/core-browser/__mocks__/storage.ts @@ -1,3 +1,4 @@ +import { Injector } from '@opensumi/di'; import { isUndefinedOrNull, StorageProvider, @@ -7,7 +8,6 @@ import { Disposable, URI, } from '@opensumi/ide-core-common'; -import { Injector } from '@opensumi/di'; let mockedStorage: MockedStorage | null = null; diff --git a/packages/core-browser/__tests__/application/application.service.test.ts b/packages/core-browser/__tests__/application/application.service.test.ts index 84528c9120..ffd55ac5ba 100644 --- a/packages/core-browser/__tests__/application/application.service.test.ts +++ b/packages/core-browser/__tests__/application/application.service.test.ts @@ -1,4 +1,5 @@ import { IApplicationService, CommonServerPath, OS } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { ApplicationService } from '../../src/application/application.service'; diff --git a/packages/core-browser/__tests__/bootstrap/connection.test.ts b/packages/core-browser/__tests__/bootstrap/connection.test.ts index 93f798278a..0e5537941b 100644 --- a/packages/core-browser/__tests__/bootstrap/connection.test.ts +++ b/packages/core-browser/__tests__/bootstrap/connection.test.ts @@ -1,9 +1,10 @@ +import { WebSocket, Server } from 'mock-socket'; + import { IEventBus, EventBusImpl, BrowserConnectionErrorEvent } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - import { createClientConnection2 } from '../../src/bootstrap/connection'; -import { WebSocket, Server } from 'mock-socket'; (global as any).WebSocket = WebSocket; describe('packages/core-browser/src/bootstrap/connection.test.ts', () => { diff --git a/packages/core-browser/__tests__/external-preference.test.ts b/packages/core-browser/__tests__/external-preference.test.ts index 96379596e5..a03015d500 100644 --- a/packages/core-browser/__tests__/external-preference.test.ts +++ b/packages/core-browser/__tests__/external-preference.test.ts @@ -1,3 +1,4 @@ +import { IPreferences } from '../src'; import { registerExternalPreferenceProvider, getPreferenceLanguageId, @@ -8,7 +9,6 @@ import { getExternalPreference, registerLocalStorageProvider, } from '../src/preferences'; -import { IPreferences } from '../src'; describe('external preference tests', () => { it('should be able to register preference provider and work properly', () => { diff --git a/packages/core-browser/__tests__/keybinding/keybinding.test.ts b/packages/core-browser/__tests__/keybinding/keybinding.test.ts index d39027d379..f53d1c63be 100644 --- a/packages/core-browser/__tests__/keybinding/keybinding.test.ts +++ b/packages/core-browser/__tests__/keybinding/keybinding.test.ts @@ -1,13 +1,3 @@ -import { - ContextKeyDefinedExpr, - ContextKeyEqualsExpr, - ContextKeyNotEqualsExpr, - ContextKeyNotExpr, - ContextKeyRegexExpr, - ContextKeyExpr, -} from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { IContextKeyService, KeybindingContribution, @@ -20,14 +10,25 @@ import { KeybindingService, SpecialCases, } from '@opensumi/ide-core-browser'; -import { GlobalBrowserStorageService, IStatusBarService } from '../../src/services'; -import { KeybindingsResultCollection } from '../../src'; import { KeyboardLayoutChangeNotifierService, KeyboardNativeLayoutService, } from '@opensumi/ide-core-common/lib/keyboard/keyboard-layout-provider'; -import { KeyboardLayoutService } from '../../src/keyboard/keyboard-layout-service'; +import { + ContextKeyDefinedExpr, + ContextKeyEqualsExpr, + ContextKeyNotEqualsExpr, + ContextKeyNotExpr, + ContextKeyRegexExpr, + ContextKeyExpr, +} from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { MockLogger } from '../../__mocks__/logger'; +import { KeybindingsResultCollection } from '../../src'; +import { KeyboardLayoutService } from '../../src/keyboard/keyboard-layout-service'; +import { GlobalBrowserStorageService, IStatusBarService } from '../../src/services'; describe('KeybindingRegistry', () => { let keybindingRegistry: KeybindingRegistry; diff --git a/packages/core-browser/__tests__/keyboard/keyboard-layout-provider.test.ts b/packages/core-browser/__tests__/keyboard/keyboard-layout-provider.test.ts index 1e240287b0..3e5df66fec 100644 --- a/packages/core-browser/__tests__/keyboard/keyboard-layout-provider.test.ts +++ b/packages/core-browser/__tests__/keyboard/keyboard-layout-provider.test.ts @@ -1,5 +1,3 @@ -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { ILogger, GlobalBrowserStorageService, @@ -7,6 +5,9 @@ import { BrowserKeyboardLayoutImpl, Key, } from '@opensumi/ide-core-browser'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { MockLogger } from '../../__mocks__/logger'; describe('BrowserKeyboardLayoutService should be work', () => { diff --git a/packages/core-browser/__tests__/keyboard/keyboard-layout-service.test.ts b/packages/core-browser/__tests__/keyboard/keyboard-layout-service.test.ts index 1ca28f9984..8b95aa9869 100644 --- a/packages/core-browser/__tests__/keyboard/keyboard-layout-service.test.ts +++ b/packages/core-browser/__tests__/keyboard/keyboard-layout-service.test.ts @@ -1,5 +1,3 @@ -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { ILogger, GlobalBrowserStorageService, @@ -10,8 +8,11 @@ import { ILinuxKeyboardLayoutInfo, isOSX, } from '@opensumi/ide-core-browser'; -import { KeyboardLayoutContribution } from '../../src/keyboard/layouts/_.contribution'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { MockLogger } from '../../__mocks__/logger'; +import { KeyboardLayoutContribution } from '../../src/keyboard/layouts/_.contribution'; describe('KeyboardLayoutService should be work', () => { let keyboardLayoutService: KeyboardLayoutService; diff --git a/packages/core-browser/__tests__/menu/next/ctxmenu-service.test.ts b/packages/core-browser/__tests__/menu/next/ctxmenu-service.test.ts index 7861d0ec77..66cac6c9fe 100644 --- a/packages/core-browser/__tests__/menu/next/ctxmenu-service.test.ts +++ b/packages/core-browser/__tests__/menu/next/ctxmenu-service.test.ts @@ -1,9 +1,10 @@ -import { CoreCommandRegistryImpl, CommandRegistry, DisposableStore } from '@opensumi/ide-core-common'; -import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; import { Injector } from '@opensumi/di'; +import { CoreCommandRegistryImpl, CommandRegistry, DisposableStore } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; +import { IContextKeyService } from '../../../src/context-key'; import { AbstractMenuService, MenuRegistryImpl, @@ -12,7 +13,6 @@ import { AbstractContextMenuService, ContextMenuServiceImpl, } from '../../../src/menu/next'; -import { IContextKeyService } from '../../../src/context-key'; jest.useFakeTimers(); diff --git a/packages/core-browser/__tests__/menu/next/menu-service.test.tsx b/packages/core-browser/__tests__/menu/next/menu-service.test.tsx index f54bae2a29..6154d7aa4a 100644 --- a/packages/core-browser/__tests__/menu/next/menu-service.test.tsx +++ b/packages/core-browser/__tests__/menu/next/menu-service.test.tsx @@ -1,11 +1,13 @@ -import { CoreCommandRegistryImpl, CommandRegistry, DisposableStore } from '@opensumi/ide-core-common'; -import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; +import React from 'react'; + import { Injector } from '@opensumi/di'; import { Command } from '@opensumi/ide-core-common'; -import React from 'react'; +import { CoreCommandRegistryImpl, CommandRegistry, DisposableStore } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; +import { IContextKeyService } from '../../../src/context-key'; import { SeparatorMenuItemNode, IComponentMenuItemProps, @@ -18,7 +20,6 @@ import { generateMergedCtxMenu, ComponentMenuItemNode, } from '../../../src/menu/next'; -import { IContextKeyService } from '../../../src/context-key'; const contextKeyService = new (class extends MockContextKeyService { match(context: string) { diff --git a/packages/core-browser/__tests__/menu/next/menubar-service.test.ts b/packages/core-browser/__tests__/menu/next/menubar-service.test.ts index 417b9ae8ee..493be31dac 100644 --- a/packages/core-browser/__tests__/menu/next/menubar-service.test.ts +++ b/packages/core-browser/__tests__/menu/next/menubar-service.test.ts @@ -1,9 +1,10 @@ -import { CoreCommandRegistryImpl, CommandRegistry, DisposableStore } from '@opensumi/ide-core-common'; -import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; import { Injector } from '@opensumi/di'; +import { CoreCommandRegistryImpl, CommandRegistry, DisposableStore } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; +import { IContextKeyService } from '../../../src/context-key'; import { AbstractMenubarService, MenubarServiceImpl, @@ -12,7 +13,6 @@ import { MenuServiceImpl, IMenuRegistry, } from '../../../src/menu/next'; -import { IContextKeyService } from '../../../src/context-key'; jest.useFakeTimers(); diff --git a/packages/core-browser/__tests__/opener/opener.service.test.ts b/packages/core-browser/__tests__/opener/opener.service.test.ts index 8d6e6df0d7..742e9a6c48 100644 --- a/packages/core-browser/__tests__/opener/opener.service.test.ts +++ b/packages/core-browser/__tests__/opener/opener.service.test.ts @@ -1,8 +1,8 @@ import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { URI } from '../../src'; import { IOpenerService, IOpener } from '../../src/opener'; -import { OpenerService } from '../../src/opener/opener.service'; import { DefaultOpener } from '../../src/opener/default-opener'; -import { URI } from '../../src'; +import { OpenerService } from '../../src/opener/opener.service'; describe('packages/core-browser/src/opener/opener.service.ts', () => { let openerService: IOpenerService; diff --git a/packages/core-browser/__tests__/preferences/preference-proxy.test.ts b/packages/core-browser/__tests__/preferences/preference-proxy.test.ts index 8aebbab915..124871f87c 100644 --- a/packages/core-browser/__tests__/preferences/preference-proxy.test.ts +++ b/packages/core-browser/__tests__/preferences/preference-proxy.test.ts @@ -1,5 +1,3 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { createPreferenceProxy, DefaultPreferenceProvider, @@ -17,8 +15,11 @@ import { PreferenceService, PreferenceServiceImpl, } from '@opensumi/ide-core-browser'; -import { injectMockPreferences, MockPreferenceProvider } from '../../__mocks__/preference'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { MockLogger } from '../../__mocks__/logger'; +import { injectMockPreferences, MockPreferenceProvider } from '../../__mocks__/preference'; describe('Preference Proxy', () => { let injector: MockInjector; diff --git a/packages/core-browser/__tests__/progress-service.test.ts b/packages/core-browser/__tests__/progress-service.test.ts index b60095de42..fd6d3b58b7 100644 --- a/packages/core-browser/__tests__/progress-service.test.ts +++ b/packages/core-browser/__tests__/progress-service.test.ts @@ -1,8 +1,9 @@ -import { ProgressService } from '../src/progress/progress.service'; -import { MockInjector } from '../../../tools/dev-tool/src/mock-injector'; +import { ProgressLocation, CommandRegistry } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../tools/dev-tool/src/mock-injector'; import { IProgressService } from '../src/progress'; -import { ProgressLocation, CommandRegistry } from '@opensumi/ide-core-common'; +import { ProgressService } from '../src/progress/progress.service'; import { StatusBarEntry } from '../src/services'; // https://stackoverflow.com/questions/52177631/jest-timer-and-promise-dont-work-well-settimeout-and-async-function diff --git a/packages/core-browser/__tests__/raw-context-key.test.ts b/packages/core-browser/__tests__/raw-context-key.test.ts index 2771b511e2..92b9433ad8 100644 --- a/packages/core-browser/__tests__/raw-context-key.test.ts +++ b/packages/core-browser/__tests__/raw-context-key.test.ts @@ -1,5 +1,4 @@ import { MockContextKeyService } from '../../monaco/__mocks__/monaco.context-key.service'; - import { RawContextKey } from '../src/raw-context-key'; const contextKeyService = new (class extends MockContextKeyService { diff --git a/packages/core-browser/__tests__/services/clipboard.service.test.ts b/packages/core-browser/__tests__/services/clipboard.service.test.ts index 8725e213bf..f01b9b35a6 100644 --- a/packages/core-browser/__tests__/services/clipboard.service.test.ts +++ b/packages/core-browser/__tests__/services/clipboard.service.test.ts @@ -1,7 +1,8 @@ +import { ILoggerManagerClient } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { IClipboardService } from '../../src/services'; -import { ILoggerManagerClient } from '@opensumi/ide-core-common'; describe(__filename, () => { let injector: MockInjector; diff --git a/packages/core-browser/__tests__/services/credentials-service.test.ts b/packages/core-browser/__tests__/services/credentials-service.test.ts index b5a22d6c4b..f52aa6a8bb 100644 --- a/packages/core-browser/__tests__/services/credentials-service.test.ts +++ b/packages/core-browser/__tests__/services/credentials-service.test.ts @@ -1,9 +1,9 @@ +import { KeytarServicePath } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { CredentialsService } from '../../src/services'; -import { KeytarServicePath } from '@opensumi/ide-core-common'; import { ICredentialsService } from '../../src'; +import { CredentialsService } from '../../src/services'; describe('test for core-browser/src/services/credentials-service.ts', () => { let injector: MockInjector; diff --git a/packages/core-browser/__tests__/services/cryptr-service.test.ts b/packages/core-browser/__tests__/services/cryptr-service.test.ts index 8f0f3f51fd..d1c48f6f71 100644 --- a/packages/core-browser/__tests__/services/cryptr-service.test.ts +++ b/packages/core-browser/__tests__/services/cryptr-service.test.ts @@ -1,7 +1,7 @@ +import { CryptrServicePath } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { CryptrServicePath } from '@opensumi/ide-core-common'; import { CryptrService, ICryptrService } from '../../src'; describe('test for core-browser/src/services/cryptr-service.ts', () => { diff --git a/packages/core-browser/__tests__/services/external-uri.service.test.ts b/packages/core-browser/__tests__/services/external-uri.service.test.ts index fc89bd9f2d..197e4edae7 100644 --- a/packages/core-browser/__tests__/services/external-uri.service.test.ts +++ b/packages/core-browser/__tests__/services/external-uri.service.test.ts @@ -1,7 +1,7 @@ import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IExternalUriService } from '../../src/services'; import { URI, AppConfig } from '../../src'; +import { IExternalUriService } from '../../src/services'; describe(__filename, () => { const oldWindowLocationHostname = window.location.hostname; diff --git a/packages/core-browser/__tests__/services/storage.service.test.ts b/packages/core-browser/__tests__/services/storage.service.test.ts index 42d7f1c6fe..1335533780 100644 --- a/packages/core-browser/__tests__/services/storage.service.test.ts +++ b/packages/core-browser/__tests__/services/storage.service.test.ts @@ -1,8 +1,8 @@ +import { ILoggerManagerClient } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - import { GlobalBrowserStorageService } from '../../src/services'; -import { ILoggerManagerClient } from '@opensumi/ide-core-common'; describe('test for core-browser/src/services/storage-service.ts', () => { let injector: MockInjector; diff --git a/packages/core-browser/__tests__/window/window.service.test.ts b/packages/core-browser/__tests__/window/window.service.test.ts index 376fc9499a..7fe8fb9956 100644 --- a/packages/core-browser/__tests__/window/window.service.test.ts +++ b/packages/core-browser/__tests__/window/window.service.test.ts @@ -1,9 +1,10 @@ +import { WindowService } from '@opensumi/ide-core-browser/lib/window/window.service'; +import { IElectronMainLifeCycleService, IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IExternalUriService } from '../../src/services'; import { URI, IWindowService } from '../../src'; -import { WindowService } from '@opensumi/ide-core-browser/lib/window/window.service'; -import { IElectronMainLifeCycleService, IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; +import { IExternalUriService } from '../../src/services'; describe(`test ${__filename} on Electron env`, () => { let injector: MockInjector; diff --git a/packages/core-browser/src/application/application.service.ts b/packages/core-browser/src/application/application.service.ts index 9c1fd6cb98..83b42cac3b 100644 --- a/packages/core-browser/src/application/application.service.ts +++ b/packages/core-browser/src/application/application.service.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { OS, IApplicationService, CommonServerPath, ICommonServer, Deferred } from '@opensumi/ide-core-common'; + import { AppConfig } from '../react-providers'; @Injectable() diff --git a/packages/core-browser/src/authentication/authentication.contribution.ts b/packages/core-browser/src/authentication/authentication.contribution.ts index c3fd276ae7..9eb4372836 100644 --- a/packages/core-browser/src/authentication/authentication.contribution.ts +++ b/packages/core-browser/src/authentication/authentication.contribution.ts @@ -1,5 +1,4 @@ import { Autowired } from '@opensumi/di'; -import { ClientAppContribution } from '../common/common.define'; import { Domain, IAuthenticationService, @@ -8,6 +7,8 @@ import { noAccountsId, } from '@opensumi/ide-core-common'; +import { ClientAppContribution } from '../common/common.define'; + @Domain(ClientAppContribution, CommandContribution) export class AuthenticationContribution implements ClientAppContribution, CommandContribution { @Autowired(IAuthenticationService) diff --git a/packages/core-browser/src/authentication/authentication.service.ts b/packages/core-browser/src/authentication/authentication.service.ts index 97fd20b693..584c5105fc 100644 --- a/packages/core-browser/src/authentication/authentication.service.ts +++ b/packages/core-browser/src/authentication/authentication.service.ts @@ -1,3 +1,4 @@ +import { Autowired, Injectable } from '@opensumi/di'; import { AllowedExtension, IAuthenticationService, @@ -23,7 +24,7 @@ import { noAccountsId, DisposableCollection, } from '@opensumi/ide-core-common'; -import { Autowired, Injectable } from '@opensumi/di'; + import { IMenuRegistry, MenuId } from '../menu/next'; @Injectable() diff --git a/packages/core-browser/src/bootstrap/app.ts b/packages/core-browser/src/bootstrap/app.ts index 17a3668890..307c8eabab 100644 --- a/packages/core-browser/src/bootstrap/app.ts +++ b/packages/core-browser/src/bootstrap/app.ts @@ -3,11 +3,11 @@ * 并且 editor.main 也包含对 editor.all 的导入 */ import '@opensumi/monaco-editor-core/esm/vs/editor/editor.main'; +import ResizeObserver from 'resize-observer-polyfill'; + import { Injector, ConstructorOf } from '@opensumi/di'; -import { BrowserModule, IClientApp } from '../browser-module'; -import { AppConfig } from '../react-providers'; -import { injectInnerProviders } from './inner-providers'; -import { KeybindingRegistry, KeybindingService, NO_KEYBINDING_NAME } from '../keybinding'; +import { RPCMessageConnection } from '@opensumi/ide-connection'; +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; import { CommandRegistry, isOSX, @@ -31,11 +31,22 @@ import { IDisposable, Deferred, } from '@opensumi/ide-core-common'; +import { + DEFAULT_APPLICATION_DESKTOP_HOST, + DEFAULT_APPLICATION_NAME, + DEFAULT_APPLICATION_WEB_HOST, + DEFAULT_URI_SCHEME, +} from '@opensumi/ide-core-common/lib/const/application'; +import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron'; + import { ClientAppStateService } from '../application'; +import { BrowserModule, IClientApp } from '../browser-module'; import { ClientAppContribution } from '../common'; -import { createNetClientConnection, createClientConnection2, bindConnectionService } from './connection'; -import { RPCMessageConnection } from '@opensumi/ide-connection'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; +import { CorePreferences } from '../core-preferences'; +import { injectCorePreferences } from '../core-preferences'; +import { KeybindingRegistry, KeybindingService, NO_KEYBINDING_NAME } from '../keybinding'; +import { RenderedEvent } from '../layout'; +import { MenuRegistryImpl, IMenuRegistry } from '../menu/next'; import { PreferenceProviderProvider, injectPreferenceSchemaProvider, @@ -47,21 +58,13 @@ import { getPreferenceLanguageId, registerLocalStorageProvider, } from '../preferences'; -import { injectCorePreferences } from '../core-preferences'; -import { CorePreferences } from '../core-preferences'; -import { renderClientApp, IAppRenderer } from './app.view'; -import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron'; -import { - DEFAULT_APPLICATION_DESKTOP_HOST, - DEFAULT_APPLICATION_NAME, - DEFAULT_APPLICATION_WEB_HOST, - DEFAULT_URI_SCHEME, -} from '@opensumi/ide-core-common/lib/const/application'; -import { electronEnv } from '../utils'; -import { MenuRegistryImpl, IMenuRegistry } from '../menu/next'; +import { AppConfig } from '../react-providers'; import { DEFAULT_CDN_ICON, IDE_OCTICONS_CN_CSS, IDE_CODICONS_CN_CSS, updateIconMap } from '../style/icon/icon'; -import ResizeObserver from 'resize-observer-polyfill'; -import { RenderedEvent } from '../layout'; +import { electronEnv } from '../utils'; + +import { renderClientApp, IAppRenderer } from './app.view'; +import { createNetClientConnection, createClientConnection2, bindConnectionService } from './connection'; +import { injectInnerProviders } from './inner-providers'; export type ModuleConstructor = ConstructorOf; export type ContributionConstructor = ConstructorOf; diff --git a/packages/core-browser/src/bootstrap/app.view.tsx b/packages/core-browser/src/bootstrap/app.view.tsx index c06407de2c..0b25151954 100644 --- a/packages/core-browser/src/bootstrap/app.view.tsx +++ b/packages/core-browser/src/bootstrap/app.view.tsx @@ -1,15 +1,16 @@ import React from 'react'; import ReactDom from 'react-dom'; -import { getDebugLogger, IEventBus, URI } from '@opensumi/ide-core-common'; + import { ComponentContextProvider, IIconResourceOptions } from '@opensumi/ide-components'; +import { getDebugLogger, IEventBus, URI } from '@opensumi/ide-core-common'; +import { localize } from '@opensumi/ide-core-common'; -import { ResizeEvent } from '../layout'; import { IClientApp } from '../browser-module'; -import { getIcon } from '../style/icon/icon'; import { DefaultLayout } from '../components/layout/default-layout'; +import { ResizeEvent } from '../layout'; import { ConfigProvider, allSlot } from '../react-providers'; -import { localize } from '@opensumi/ide-core-common'; import { LabelService } from '../services'; +import { getIcon } from '../style/icon/icon'; export interface AppProps { app: IClientApp; diff --git a/packages/core-browser/src/bootstrap/connection.ts b/packages/core-browser/src/bootstrap/connection.ts index 1f4763ca3d..a82a79afbd 100644 --- a/packages/core-browser/src/bootstrap/connection.ts +++ b/packages/core-browser/src/bootstrap/connection.ts @@ -1,7 +1,7 @@ +import { Injector, Provider } from '@opensumi/di'; import { RPCServiceCenter, initRPCService, RPCMessageConnection } from '@opensumi/ide-connection'; import { WSChannelHandler, createSocketConnection } from '@opensumi/ide-connection/lib/browser'; import { createWebSocketConnection } from '@opensumi/ide-connection/lib/common/message'; -import { Injector, Provider } from '@opensumi/di'; import { getDebugLogger, IReporterService, diff --git a/packages/core-browser/src/bootstrap/inner-providers.ts b/packages/core-browser/src/bootstrap/inner-providers.ts index f3989cdc26..0700acd947 100644 --- a/packages/core-browser/src/bootstrap/inner-providers.ts +++ b/packages/core-browser/src/bootstrap/inner-providers.ts @@ -24,29 +24,29 @@ import { IApplicationService, IAuthenticationService, } from '@opensumi/ide-core-common'; -import { ClientAppContribution } from '../common'; -import { ClientAppStateService } from '../application/application-state-service'; -import { ApplicationService } from '../application/application.service'; +import { + IElectronMainUIService, + IElectronMainLifeCycleService, + IElectronURLService, +} from '@opensumi/ide-core-common/lib/electron'; +import { + HashCalculateServiceImpl, + IHashCalculateService, +} from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; import { KeyboardNativeLayoutService, KeyboardLayoutChangeNotifierService, } from '@opensumi/ide-core-common/lib/keyboard/keyboard-layout-provider'; +import { ClientAppStateService } from '../application/application-state-service'; +import { ApplicationService } from '../application/application.service'; +import { AuthenticationService } from '../authentication/authentication.service'; +import { ClientAppContribution } from '../common'; +import { FsProviderContribution } from '../fs'; import { KeybindingContribution, KeybindingService, KeybindingRegistryImpl, KeybindingRegistry } from '../keybinding'; import { BrowserKeyboardLayoutImpl, KeyValidator } from '../keyboard'; - -import { Logger, ILogger } from '../logger'; import { ComponentRegistry, ComponentRegistryImpl, ComponentContribution, TabBarToolbarContribution } from '../layout'; -import { useNativeContextMenu } from '../utils'; -import { createElectronMainApi } from '../utils/electron'; -import { - IElectronMainUIService, - IElectronMainLifeCycleService, - IElectronURLService, -} from '@opensumi/ide-core-common/lib/electron'; -import { PreferenceContribution } from '../preferences'; -import { VariableRegistry, VariableRegistryImpl, VariableContribution } from '../variable'; - +import { Logger, ILogger } from '../logger'; import { AbstractMenuService, MenuServiceImpl, @@ -59,6 +59,7 @@ import { ContextMenuServiceImpl, } from '../menu/next'; import { ICtxMenuRenderer } from '../menu/next/renderer/ctxmenu/base'; +import { BrowserCtxMenuRenderer } from '../menu/next/renderer/ctxmenu/browser'; import { ElectronCtxMenuRenderer, ElectronMenuBarService, @@ -66,27 +67,25 @@ import { IElectronMenuBarService, ElectronMenuFactory, } from '../menu/next/renderer/ctxmenu/electron'; -import { BrowserCtxMenuRenderer } from '../menu/next/renderer/ctxmenu/browser'; -import { AppConfig, SlotRendererContribution } from '../react-providers'; import { ToolbarActionService, IToolbarActionService } from '../menu/next/toolbar-action.service'; -import { IProgressService } from '../progress'; -import { ProgressService } from '../progress/progress.service'; -import { NextToolbarRegistryImpl, ToolbarClientAppContribution } from '../toolbar/toolbar.registry'; -import { IToolbarPopoverRegistry, IToolbarRegistry, ToolBarActionContribution } from '../toolbar'; -import { FsProviderContribution } from '../fs'; import { IOpenerService } from '../opener'; import { OpenerService } from '../opener/opener.service'; -import { IWindowService } from '../window'; -import { WindowService } from '../window/window.service'; +import { PreferenceContribution } from '../preferences'; +import { IProgressService } from '../progress'; +import { ProgressService } from '../progress/progress.service'; +import { AppConfig, SlotRendererContribution } from '../react-providers'; +import { CredentialsService, ICredentialsService, CryptrService, ICryptrService } from '../services'; import { IClipboardService, BrowserClipboardService } from '../services/clipboard.service'; import { IExternalUriService, ExternalUriService } from '../services/external-uri.service'; +import { IToolbarPopoverRegistry, IToolbarRegistry, ToolBarActionContribution } from '../toolbar'; import { ToolbarPopoverRegistry } from '../toolbar/toolbar.popover.registry'; -import { AuthenticationService } from '../authentication/authentication.service'; -import { CredentialsService, ICredentialsService, CryptrService, ICryptrService } from '../services'; -import { - HashCalculateServiceImpl, - IHashCalculateService, -} from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { NextToolbarRegistryImpl, ToolbarClientAppContribution } from '../toolbar/toolbar.registry'; +import { useNativeContextMenu } from '../utils'; +import { createElectronMainApi } from '../utils/electron'; +import { VariableRegistry, VariableRegistryImpl, VariableContribution } from '../variable'; +import { IWindowService } from '../window'; +import { WindowService } from '../window/window.service'; + export function injectInnerProviders(injector: Injector) { // 生成 ContributionProvider diff --git a/packages/core-browser/src/browser-module.ts b/packages/core-browser/src/browser-module.ts index e1d518c933..61b8c1636e 100644 --- a/packages/core-browser/src/browser-module.ts +++ b/packages/core-browser/src/browser-module.ts @@ -1,6 +1,7 @@ +import { Injector, Autowired } from '@opensumi/di'; import { BasicModule, CommandRegistry, Deferred } from '@opensumi/ide-core-common'; + import { AppConfig } from './react-providers'; -import { Injector, Autowired } from '@opensumi/di'; export const IClientApp = Symbol('CLIENT_APP_TOKEN'); diff --git a/packages/core-browser/src/common/common.contribution.ts b/packages/core-browser/src/common/common.contribution.ts index 3da4999740..e5372f907a 100644 --- a/packages/core-browser/src/common/common.contribution.ts +++ b/packages/core-browser/src/common/common.contribution.ts @@ -1,6 +1,4 @@ import { Autowired } from '@opensumi/di'; -import { FILE_COMMANDS, COMMON_COMMANDS, EDITOR_COMMANDS } from './common.command'; -import { corePreferenceSchema } from '../core-preferences'; import { CommandContribution, CommandService, @@ -11,13 +9,17 @@ import { Event, replaceLocalizePlaceholder, } from '@opensumi/ide-core-common'; -import { PreferenceContribution } from '../preferences'; -import { ClientAppContribution } from './common.define'; + import { IContextKeyService, IContextKey } from '../context-key'; +import { corePreferenceSchema } from '../core-preferences'; import { trackFocus } from '../dom'; -import { AppConfig } from '../react-providers/config-provider'; -import { MenuContribution, IMenuRegistry, MenuId } from '../menu/next'; import { KeybindingContribution, KeybindingRegistry } from '../keybinding'; +import { MenuContribution, IMenuRegistry, MenuId } from '../menu/next'; +import { PreferenceContribution } from '../preferences'; +import { AppConfig } from '../react-providers/config-provider'; + +import { FILE_COMMANDS, COMMON_COMMANDS, EDITOR_COMMANDS } from './common.command'; +import { ClientAppContribution } from './common.define'; export const inputFocusedContextKey = 'inputFocus'; export const locationProtocolContextKey = 'locationProtocol'; diff --git a/packages/core-browser/src/common/common.define.ts b/packages/core-browser/src/common/common.define.ts index a3a78b369d..6724f70ba4 100644 --- a/packages/core-browser/src/common/common.define.ts +++ b/packages/core-browser/src/common/common.define.ts @@ -1,4 +1,5 @@ import { MaybePromise } from '@opensumi/ide-core-common'; + import { IClientApp } from '../browser-module'; export const ClientAppContribution = Symbol('ClientAppContribution'); diff --git a/packages/core-browser/src/common/common.module.ts b/packages/core-browser/src/common/common.module.ts index d5c4f805cb..ee86e1f3e3 100644 --- a/packages/core-browser/src/common/common.module.ts +++ b/packages/core-browser/src/common/common.module.ts @@ -1,11 +1,13 @@ import { Injectable } from '@opensumi/di'; -import { BrowserModule } from '../browser-module'; -import { ClientCommonContribution } from './common.contribution'; -import { OpenerContribution } from '../opener'; -import { DefaultOpenerContribution, OpenerContributionClient } from '../opener/opener.contribution'; import { CommonServerPath, CryptrServicePath, KeytarServicePath } from '@opensumi/ide-core-common'; + import { AuthenticationContribution } from '../authentication/authentication.contribution'; +import { BrowserModule } from '../browser-module'; import { HashCalculateContribution } from '../hash-calculate/hash-calculate.contribution'; +import { OpenerContribution } from '../opener'; +import { DefaultOpenerContribution, OpenerContributionClient } from '../opener/opener.contribution'; + +import { ClientCommonContribution } from './common.contribution'; @Injectable() export class ClientCommonModule extends BrowserModule { diff --git a/packages/core-browser/src/components/actions/index.tsx b/packages/core-browser/src/components/actions/index.tsx index 98c3a46622..79e2cc81ba 100644 --- a/packages/core-browser/src/components/actions/index.tsx +++ b/packages/core-browser/src/components/actions/index.tsx @@ -1,10 +1,10 @@ -import React from 'react'; import clsx from 'classnames'; -import { mnemonicButtonLabel } from '@opensumi/ide-core-common/lib/utils/strings'; +import React from 'react'; +import { Button, CheckBox, Icon } from '@opensumi/ide-components'; import { ClickParam, Menu } from '@opensumi/ide-components/lib/menu'; +import { mnemonicButtonLabel } from '@opensumi/ide-core-common/lib/utils/strings'; -import { Button, CheckBox, Icon } from '@opensumi/ide-components'; import { MenuNode, ICtxMenuRenderer, @@ -21,7 +21,6 @@ import { useInjectable } from '../../react-hooks'; import { useMenus, useContextMenus } from '../../utils'; import placements from './placements'; - import styles from './styles.module.less'; const MenuAction: React.FC<{ diff --git a/packages/core-browser/src/components/layout/box-panel.tsx b/packages/core-browser/src/components/layout/box-panel.tsx index b40d1e251e..655cd7dfa8 100644 --- a/packages/core-browser/src/components/layout/box-panel.tsx +++ b/packages/core-browser/src/components/layout/box-panel.tsx @@ -1,7 +1,8 @@ -import React from 'react'; import clsx from 'classnames'; -import styles from './styles.module.less'; +import React from 'react'; + import { Layout } from './layout'; +import styles from './styles.module.less'; export interface IChildComponentProps { flex?: number; diff --git a/packages/core-browser/src/components/layout/default-layout.tsx b/packages/core-browser/src/components/layout/default-layout.tsx index 8504eb6e2a..129e6ab0a9 100644 --- a/packages/core-browser/src/components/layout/default-layout.tsx +++ b/packages/core-browser/src/components/layout/default-layout.tsx @@ -1,6 +1,8 @@ import React from 'react'; -import { BoxPanel } from './box-panel'; + import { SlotRenderer } from '../../react-providers'; + +import { BoxPanel } from './box-panel'; import { SplitPanel } from './split-panel'; export const getStorageValue = () => { diff --git a/packages/core-browser/src/components/layout/split-panel.tsx b/packages/core-browser/src/components/layout/split-panel.tsx index 04ff203492..dfa7882ba9 100644 --- a/packages/core-browser/src/components/layout/split-panel.tsx +++ b/packages/core-browser/src/components/layout/split-panel.tsx @@ -1,12 +1,15 @@ -import React from 'react'; import clsx from 'classnames'; -import styles from './styles.module.less'; -import { Layout } from './layout'; -import { useInjectable } from '../../react-hooks'; -import { IResizeHandleDelegate, ResizeFlexMode } from '../resize/resize'; +import React from 'react'; + import { IEventBus } from '@opensumi/ide-core-common'; + import { ResizeEvent } from '../../layout'; +import { useInjectable } from '../../react-hooks'; +import { IResizeHandleDelegate, ResizeFlexMode } from '../resize/resize'; + +import { Layout } from './layout'; import { SplitPanelManager } from './split-panel.service'; +import styles from './styles.module.less'; export interface ResizeHandle { setSize: (targetSize?: number, isLatter?: boolean) => void; diff --git a/packages/core-browser/src/components/portal/index.tsx b/packages/core-browser/src/components/portal/index.tsx index b4463f9502..554326bc10 100644 --- a/packages/core-browser/src/components/portal/index.tsx +++ b/packages/core-browser/src/components/portal/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; + import { usePortal } from '../../react-hooks'; const Portal: React.FC<{ diff --git a/packages/core-browser/src/components/recycle-tree/recycle-tree.view.tsx b/packages/core-browser/src/components/recycle-tree/recycle-tree.view.tsx index 7390ad6fa4..e35db56a26 100644 --- a/packages/core-browser/src/components/recycle-tree/recycle-tree.view.tsx +++ b/packages/core-browser/src/components/recycle-tree/recycle-tree.view.tsx @@ -1,8 +1,10 @@ +import fuzzy from 'fuzzy'; import React from 'react'; -import { TreeProps, TreeContainer, TreeNode, ExpandableTreeNode, TEMP_FILE_NAME } from '../tree'; -import { PerfectScrollbar } from '../scrollbar'; + import { Deprecated } from '@opensumi/ide-components/lib/utils'; -import fuzzy from 'fuzzy'; + +import { PerfectScrollbar } from '../scrollbar'; +import { TreeProps, TreeContainer, TreeNode, ExpandableTreeNode, TEMP_FILE_NAME } from '../tree'; export interface RecycleTreeProps extends TreeProps { /** diff --git a/packages/core-browser/src/components/resize/resize.tsx b/packages/core-browser/src/components/resize/resize.tsx index 2759e8dfb9..3f7940e0aa 100644 --- a/packages/core-browser/src/components/resize/resize.tsx +++ b/packages/core-browser/src/components/resize/resize.tsx @@ -1,6 +1,7 @@ +import classnames from 'classnames'; import React from 'react'; + import styles from './resize.module.less'; -import classnames from 'classnames'; export const RESIZE_LOCK = 'resize-lock'; diff --git a/packages/core-browser/src/components/tree/tree-node.view.tsx b/packages/core-browser/src/components/tree/tree-node.view.tsx index caeee134d8..a93b7aa6d9 100644 --- a/packages/core-browser/src/components/tree/tree-node.view.tsx +++ b/packages/core-browser/src/components/tree/tree-node.view.tsx @@ -1,15 +1,18 @@ -import React from 'react'; -import styles from './tree.module.less'; import cls from 'classnames'; -import { isUndefined, isString } from '@opensumi/ide-core-common'; +import React from 'react'; + import { Badge, Loading } from '@opensumi/ide-components'; +import { ValidateInput, InputSelection, Icon } from '@opensumi/ide-components'; +import { isUndefined, isString } from '@opensumi/ide-core-common'; +import { KeyCode, Key } from '../../keyboard'; +import { getIcon } from '../../style/icon/icon'; import { TreeViewAction, isTreeViewActionComponent } from '../../tree'; -import { TreeNode, TreeViewActionTypes, ExpandableTreeNode, SelectableTreeNode, TreeNodeHighlightRange } from './'; + +import styles from './tree.module.less'; import { TEMP_FILE_NAME } from './tree.view'; -import { getIcon } from '../../style/icon/icon'; -import { ValidateInput, InputSelection, Icon } from '@opensumi/ide-components'; -import { KeyCode, Key } from '../../keyboard'; + +import { TreeNode, TreeViewActionTypes, ExpandableTreeNode, SelectableTreeNode, TreeNodeHighlightRange } from './'; export type CommandActuator = (commandId: string, params: T) => void; diff --git a/packages/core-browser/src/components/tree/tree.view.tsx b/packages/core-browser/src/components/tree/tree.view.tsx index 7a87b3bd9d..9410a0c19a 100644 --- a/packages/core-browser/src/components/tree/tree.view.tsx +++ b/packages/core-browser/src/components/tree/tree.view.tsx @@ -1,7 +1,9 @@ +import cls from 'classnames'; import React from 'react'; -import { TreeNode, SelectableTreeNode } from './'; -import { TreeContainerNode, CommandActuator } from './tree-node.view'; + +import { ValidateMessage } from '@opensumi/ide-components'; import { isOSX, Event } from '@opensumi/ide-core-common'; + import { FileDecorationsProvider, ThemeProvider, @@ -9,9 +11,12 @@ import { ExpandableTreeNode, TreeViewAction, } from '../../tree'; -import cls from 'classnames'; + +import { TreeContainerNode, CommandActuator } from './tree-node.view'; import styles from './tree.module.less'; -import { ValidateMessage } from '@opensumi/ide-components'; + +import { TreeNode, SelectableTreeNode } from './'; + export const TEMP_FILE_NAME = 'kt_template_file'; export interface TreeProps extends React.PropsWithChildren { diff --git a/packages/core-browser/src/context-key.ts b/packages/core-browser/src/context-key.ts index d152643ce4..b7f876397b 100644 --- a/packages/core-browser/src/context-key.ts +++ b/packages/core-browser/src/context-key.ts @@ -1,9 +1,9 @@ +import { Event, BasicEvent } from '@opensumi/ide-core-common'; +import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService'; import { ContextKeyExpr, IContextKeyServiceTarget, } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; -import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService'; -import { Event, BasicEvent } from '@opensumi/ide-core-common'; export interface IContextKey { set(value: T | undefined): void; diff --git a/packages/core-browser/src/encoding-registry.ts b/packages/core-browser/src/encoding-registry.ts index daa0158a09..78db5990e6 100644 --- a/packages/core-browser/src/encoding-registry.ts +++ b/packages/core-browser/src/encoding-registry.ts @@ -9,6 +9,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { URI, Disposable, IDisposable } from '@opensumi/ide-core-common'; import { UTF8, encodingExists } from '@opensumi/ide-core-common/lib/encoding'; + import { PreferenceService } from './preferences'; import { getLanguageIdFromMonaco } from './services/label-service'; diff --git a/packages/core-browser/src/fs/index.ts b/packages/core-browser/src/fs/index.ts index facdbac94b..3848dce0d1 100644 --- a/packages/core-browser/src/fs/index.ts +++ b/packages/core-browser/src/fs/index.ts @@ -1,4 +1,5 @@ import { FileSystemProvider, IDisposable, FileChange } from '@opensumi/ide-core-common'; + import { BasicEvent } from '..'; export class FilesChangeEvent extends BasicEvent {} diff --git a/packages/core-browser/src/keybinding/keybinding.ts b/packages/core-browser/src/keybinding/keybinding.ts index bd6e4fb551..efc73123d2 100644 --- a/packages/core-browser/src/keybinding/keybinding.ts +++ b/packages/core-browser/src/keybinding/keybinding.ts @@ -1,4 +1,3 @@ -import { ContextKeyExpression } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; import { Injectable, Autowired } from '@opensumi/di'; import { ILogger, @@ -13,9 +12,11 @@ import { CommandService, isUndefined, } from '@opensumi/ide-core-common'; -import { KeyCode, KeySequence, Key, SpecialCases } from '../keyboard/keys'; -import { KeyboardLayoutService } from '../keyboard/keyboard-layout-service'; +import { ContextKeyExpression } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; + import { IContextKeyService } from '../context-key'; +import { KeyboardLayoutService } from '../keyboard/keyboard-layout-service'; +import { KeyCode, KeySequence, Key, SpecialCases } from '../keyboard/keys'; import { StatusBarAlignment, IStatusBarService } from '../services'; export enum KeybindingScope { diff --git a/packages/core-browser/src/keyboard/keyboard-layout-provider.ts b/packages/core-browser/src/keyboard/keyboard-layout-provider.ts index 08cc00b51e..916f3f7d9d 100644 --- a/packages/core-browser/src/keyboard/keyboard-layout-provider.ts +++ b/packages/core-browser/src/keyboard/keyboard-layout-provider.ts @@ -10,7 +10,9 @@ import { KeymapInfo, getKeyboardLayoutId, } from '@opensumi/ide-core-common/lib/keyboard'; + import { GlobalBrowserStorageService } from '../services'; + import { KeyCode } from './keys'; import { KeyboardLayoutContribution, requireRegister } from './layouts/layout.contribution'; diff --git a/packages/core-browser/src/keyboard/keyboard-layout-service.ts b/packages/core-browser/src/keyboard/keyboard-layout-service.ts index afffd86cbf..7e7857b177 100644 --- a/packages/core-browser/src/keyboard/keyboard-layout-service.ts +++ b/packages/core-browser/src/keyboard/keyboard-layout-service.ts @@ -23,6 +23,7 @@ import { KeymapInfo, IWindowsKeyMapping, } from '@opensumi/ide-core-common/lib/keyboard'; + import { KeyValidator } from './keyboard-layout-provider'; import { KeyCode, Key } from './keys'; diff --git a/packages/core-browser/src/keyboard/keys.ts b/packages/core-browser/src/keyboard/keys.ts index d915b4d933..e6bc48b1e2 100644 --- a/packages/core-browser/src/keyboard/keys.ts +++ b/packages/core-browser/src/keyboard/keys.ts @@ -15,9 +15,9 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/browser/keyboard/keys.ts -import { KeyCode as KeyCodeEnum } from '@opensumi/monaco-editor-core/esm/vs/base/common/keyCodes'; import { isOSX } from '@opensumi/ide-core-common'; import { isWindows } from '@opensumi/ide-core-common/lib/platform'; +import { KeyCode as KeyCodeEnum } from '@opensumi/monaco-editor-core/esm/vs/base/common/keyCodes'; export type KeySequence = KeyCode[]; diff --git a/packages/core-browser/src/keyboard/layouts/layout.contribution.ts b/packages/core-browser/src/keyboard/layouts/layout.contribution.ts index d6c78ec55a..c77e62a825 100644 --- a/packages/core-browser/src/keyboard/layouts/layout.contribution.ts +++ b/packages/core-browser/src/keyboard/layouts/layout.contribution.ts @@ -1,8 +1,8 @@ import { isOSX, isWindows } from '@opensumi/ide-core-common'; import { requireRegister as requireDarwinRegister } from './layout.contribution.darwin'; -import { requireRegister as requireWinRegister } from './layout.contribution.win'; import { requireRegister as requireLinuxRegister } from './layout.contribution.linux'; +import { requireRegister as requireWinRegister } from './layout.contribution.win'; export const requireRegister = isWindows ? requireWinRegister : isOSX ? requireDarwinRegister : requireLinuxRegister; diff --git a/packages/core-browser/src/layout/accordion/tab-bar-toolbar.tsx b/packages/core-browser/src/layout/accordion/tab-bar-toolbar.tsx index 7d6d42adaf..dc8a708cec 100644 --- a/packages/core-browser/src/layout/accordion/tab-bar-toolbar.tsx +++ b/packages/core-browser/src/layout/accordion/tab-bar-toolbar.tsx @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Event, IDisposable } from '@opensumi/ide-core-common'; + import { IMenuRegistry, MenuId, IMenuItem } from '../../menu/next'; export const TabBarToolbarContribution = Symbol('TabBarToolbarContribution'); diff --git a/packages/core-browser/src/layout/accordion/view-context-key.registry.ts b/packages/core-browser/src/layout/accordion/view-context-key.registry.ts index 5d4e15418c..7dea4b88ea 100644 --- a/packages/core-browser/src/layout/accordion/view-context-key.registry.ts +++ b/packages/core-browser/src/layout/accordion/view-context-key.registry.ts @@ -1,7 +1,8 @@ import { Injectable } from '@opensumi/di'; -import { IContextKeyService } from '../../context-key'; import { Emitter } from '@opensumi/ide-core-common'; +import { IContextKeyService } from '../../context-key'; + @Injectable() export class ViewContextKeyRegistry { private contextKeyMap: Map = new Map(); diff --git a/packages/core-browser/src/layout/index.ts b/packages/core-browser/src/layout/index.ts index 8ba491d364..b7d9ed6836 100644 --- a/packages/core-browser/src/layout/index.ts +++ b/packages/core-browser/src/layout/index.ts @@ -1,9 +1,12 @@ -import { SlotLocation, AppConfig } from '../react-providers'; +import React = require('react'); + import { Autowired, Injectable } from '@opensumi/di'; import { BasicEvent, getDebugLogger, IEventBus, MaybeNull } from '@opensumi/ide-core-common'; + import { IMenu, IContextMenu } from '../menu/next'; import { useInjectable } from '../react-hooks'; -import React = require('react'); +import { SlotLocation, AppConfig } from '../react-providers'; + export class VisibleChangedPayload { constructor(public isVisible: boolean, public slotLocation: SlotLocation) {} diff --git a/packages/core-browser/src/layout/layout-state.ts b/packages/core-browser/src/layout/layout-state.ts index 2aa9f60c61..ef60a6c4e5 100644 --- a/packages/core-browser/src/layout/layout-state.ts +++ b/packages/core-browser/src/layout/layout-state.ts @@ -1,6 +1,8 @@ +import debounce = require('lodash.debounce'); + import { Injectable, Autowired } from '@opensumi/di'; import { StorageProvider, IStorage, STORAGE_NAMESPACE, DisposableCollection, ILogger } from '@opensumi/ide-core-common'; -import debounce = require('lodash.debounce'); + import { PreferenceService } from '../preferences'; @Injectable() diff --git a/packages/core-browser/src/menu/next/base.ts b/packages/core-browser/src/menu/next/base.ts index d28ebe2411..204168fb75 100644 --- a/packages/core-browser/src/menu/next/base.ts +++ b/packages/core-browser/src/menu/next/base.ts @@ -1,6 +1,8 @@ -import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; +import ReactIs from 'react-is'; + import { Injectable, Autowired } from '@opensumi/di'; import { ButtonType } from '@opensumi/ide-components'; +import { warning } from '@opensumi/ide-components/lib/utils'; import { replaceLocalizePlaceholder, ILogger, @@ -14,8 +16,8 @@ import { ContributionProvider, ISumiMenuExtendInfo, } from '@opensumi/ide-core-common'; -import { warning } from '@opensumi/ide-components/lib/utils'; -import ReactIs from 'react-is'; +import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; + import { MenuId } from './menu-id'; diff --git a/packages/core-browser/src/menu/next/ctxmenu-service.ts b/packages/core-browser/src/menu/next/ctxmenu-service.ts index cd89b742f6..a30457355e 100644 --- a/packages/core-browser/src/menu/next/ctxmenu-service.ts +++ b/packages/core-browser/src/menu/next/ctxmenu-service.ts @@ -1,8 +1,9 @@ +import { Autowired, Injectable, Optional, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IDisposable, Disposable } from '@opensumi/ide-core-common/lib/disposable'; import { Event, Emitter } from '@opensumi/ide-core-common/lib/event'; -import { Autowired, Injectable, Optional, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IContextKeyService } from '../../context-key'; + import { MenuNode } from './base'; import { generateMergedCtxMenu, generateCtxMenu, mergeTupleMenuNodeResult } from './menu-util'; import { diff --git a/packages/core-browser/src/menu/next/menu-service.ts b/packages/core-browser/src/menu/next/menu-service.ts index 4926937d67..ac143ec3ea 100644 --- a/packages/core-browser/src/menu/next/menu-service.ts +++ b/packages/core-browser/src/menu/next/menu-service.ts @@ -1,8 +1,9 @@ -import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; -import { CommandRegistry, Disposable, Event, Emitter } from '@opensumi/ide-core-common'; import { Autowired, Injectable, Optional, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { CommandRegistry, Disposable, Event, Emitter } from '@opensumi/ide-core-common'; +import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; import { ContextKeyChangeEvent, IContextKeyService } from '../../context-key'; + import { IMenuItem, isIMenuItem, ISubmenuItem, IComponentMenuItem, isIComponentMenuItem, IMenuRegistry } from './base'; import { MenuId } from './menu-id'; import { diff --git a/packages/core-browser/src/menu/next/menu.contrib.interface.ts b/packages/core-browser/src/menu/next/menu.contrib.interface.ts index e897643ee5..367643371c 100644 --- a/packages/core-browser/src/menu/next/menu.contrib.interface.ts +++ b/packages/core-browser/src/menu/next/menu.contrib.interface.ts @@ -1,6 +1,7 @@ -import { URI, IChange } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; +import { URI, IChange } from '@opensumi/ide-core-common'; + // explorer/context // 资源管理器 ctxmenu // 第一个参数是当前 ctx-menu 出现在的那个 ExplorerItem 的 URI diff --git a/packages/core-browser/src/menu/next/menu.interface.ts b/packages/core-browser/src/menu/next/menu.interface.ts index 9d567f1631..f9bbc9c6fd 100644 --- a/packages/core-browser/src/menu/next/menu.interface.ts +++ b/packages/core-browser/src/menu/next/menu.interface.ts @@ -1,12 +1,13 @@ +import { Autowired, Injectable, Optional } from '@opensumi/di'; import { CommandRegistry, CommandService, Command, isOSX } from '@opensumi/ide-core-common'; import { IDisposable } from '@opensumi/ide-core-common/lib/disposable'; import { Event } from '@opensumi/ide-core-common/lib/event'; -import { Autowired, Injectable, Optional } from '@opensumi/di'; import { IContextKeyService } from '../../context-key'; +import { KeybindingRegistry } from '../../keybinding'; + import { ISubmenuItem, MenuNode, IMenuActionDisplayType, IComponentMenuItem, IComponentMenuItemProps } from './base'; import { MenuId } from './menu-id'; -import { KeybindingRegistry } from '../../keybinding'; import { ICtxMenuRenderer } from './renderer/ctxmenu/base'; export type TupleMenuNodeResult = [MenuNode[], MenuNode[]]; diff --git a/packages/core-browser/src/menu/next/menubar-service.ts b/packages/core-browser/src/menu/next/menubar-service.ts index eb923b5bc2..c0b42fce44 100644 --- a/packages/core-browser/src/menu/next/menubar-service.ts +++ b/packages/core-browser/src/menu/next/menubar-service.ts @@ -1,10 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { Event, Emitter } from '@opensumi/ide-core-common/lib/event'; import { IDisposable, Disposable } from '@opensumi/ide-core-common/lib/disposable'; +import { Event, Emitter } from '@opensumi/ide-core-common/lib/event'; -import { AbstractMenuService, IMenu, SubmenuItemNode } from './menu.interface'; import { IMenubarItem, IMenuRegistry, MenuNode } from './base'; import { generateMergedCtxMenu } from './menu-util'; +import { AbstractMenuService, IMenu, SubmenuItemNode } from './menu.interface'; export abstract class AbstractMenubarService extends Disposable { readonly onDidMenubarChange: Event; diff --git a/packages/core-browser/src/menu/next/renderer/ctxmenu/base.ts b/packages/core-browser/src/menu/next/renderer/ctxmenu/base.ts index 5e7562f66f..49f119a19e 100644 --- a/packages/core-browser/src/menu/next/renderer/ctxmenu/base.ts +++ b/packages/core-browser/src/menu/next/renderer/ctxmenu/base.ts @@ -1,5 +1,5 @@ -import { MenuNode } from '../../base'; import { IContextKeyService } from '../../../../context-key'; +import { MenuNode } from '../../base'; import { MenuId } from '../../menu-id'; import { IMenuNodeOptions } from '../../menu.interface'; diff --git a/packages/core-browser/src/menu/next/renderer/ctxmenu/browser.ts b/packages/core-browser/src/menu/next/renderer/ctxmenu/browser.ts index 2477ca23b0..a268d75c07 100644 --- a/packages/core-browser/src/menu/next/renderer/ctxmenu/browser.ts +++ b/packages/core-browser/src/menu/next/renderer/ctxmenu/browser.ts @@ -1,10 +1,12 @@ -import { Injectable, Autowired } from '@opensumi/di'; import omit from 'lodash.omit'; +import { Injectable, Autowired } from '@opensumi/di'; + import { MenuNode } from '../../base'; -import { ICtxMenuRenderer, CtxMenuRenderParams } from './base'; import { AbstractContextMenuService } from '../../menu.interface'; +import { ICtxMenuRenderer, CtxMenuRenderParams } from './base'; + export abstract class IBrowserCtxMenu extends ICtxMenuRenderer { visible: boolean; onHide: ((canceled: boolean) => void) | undefined; diff --git a/packages/core-browser/src/menu/next/renderer/ctxmenu/electron.ts b/packages/core-browser/src/menu/next/renderer/ctxmenu/electron.ts index 7f556a6790..ea3f3aeb43 100644 --- a/packages/core-browser/src/menu/next/renderer/ctxmenu/electron.ts +++ b/packages/core-browser/src/menu/next/renderer/ctxmenu/electron.ts @@ -1,12 +1,13 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { mnemonicButtonLabel } from '@opensumi/ide-core-common/lib/utils/strings'; import { Disposable, INativeMenuTemplate, CommandService, IElectronMainMenuService } from '@opensumi/ide-core-common'; +import { mnemonicButtonLabel } from '@opensumi/ide-core-common/lib/utils/strings'; -import { CtxMenuRenderParams, ICtxMenuRenderer } from './base'; +import { electronEnv } from '../../../../utils'; import { MenuNode } from '../../base'; import { SeparatorMenuItemNode, SubmenuItemNode, AbstractContextMenuService } from '../../menu.interface'; import { AbstractMenubarService } from '../../menubar-service'; -import { electronEnv } from '../../../../utils'; + +import { CtxMenuRenderParams, ICtxMenuRenderer } from './base'; export abstract class IElectronCtxMenuRenderer extends ICtxMenuRenderer {} diff --git a/packages/core-browser/src/menu/next/toolbar-action.service.ts b/packages/core-browser/src/menu/next/toolbar-action.service.ts index 7f5f502252..654cd5df5e 100644 --- a/packages/core-browser/src/menu/next/toolbar-action.service.ts +++ b/packages/core-browser/src/menu/next/toolbar-action.service.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { IDisposable, Disposable } from '@opensumi/ide-core-common/lib/disposable'; + import { IToolbarRegistry, createToolbarActionBtn } from '../../toolbar'; import { createToolbarActionSelect } from '../../toolbar/components/select'; diff --git a/packages/core-browser/src/monaco/index.ts b/packages/core-browser/src/monaco/index.ts index 20069df72b..fd7e4aaddd 100644 --- a/packages/core-browser/src/monaco/index.ts +++ b/packages/core-browser/src/monaco/index.ts @@ -3,10 +3,11 @@ import type { IDiffEditor, IEditorConstructionOptions, } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/editorBrowser'; -import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { IDiffEditorConstructionOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/editorBrowser'; +import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import * as suggest from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/suggest/suggestWidget'; import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { Event, IJSONSchema, IContextKeyService, IDisposable, BasicEvent } from '..'; export enum ServiceNames { CODE_EDITOR_SERVICE = 'codeEditorService', diff --git a/packages/core-browser/src/opener/command-opener.ts b/packages/core-browser/src/opener/command-opener.ts index 980c794c3d..25b80e4aff 100644 --- a/packages/core-browser/src/opener/command-opener.ts +++ b/packages/core-browser/src/opener/command-opener.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { URI, Schemas, CommandService } from '@opensumi/ide-core-common'; + import { IOpener } from '.'; @Injectable() diff --git a/packages/core-browser/src/opener/default-opener.ts b/packages/core-browser/src/opener/default-opener.ts index 44eb12c12e..da3aa81509 100644 --- a/packages/core-browser/src/opener/default-opener.ts +++ b/packages/core-browser/src/opener/default-opener.ts @@ -1,9 +1,11 @@ import { Injectable, Autowired } from '@opensumi/di'; import { URI, Schemas, isElectronRenderer } from '@opensumi/ide-core-common'; -import { IOpener } from '.'; + import { AppConfig } from '../react-providers'; import { IWindowService } from '../window'; +import { IOpener } from '.'; + @Injectable() export class DefaultOpener implements IOpener { @Autowired(AppConfig) diff --git a/packages/core-browser/src/opener/http-opener.ts b/packages/core-browser/src/opener/http-opener.ts index 5bd6f69396..6382348443 100644 --- a/packages/core-browser/src/opener/http-opener.ts +++ b/packages/core-browser/src/opener/http-opener.ts @@ -1,8 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; import { URI, Schemas } from '@opensumi/ide-core-common'; -import { IOpener } from '.'; + import { IWindowService } from '../window'; +import { IOpener } from '.'; + @Injectable() export class HttpOpener implements IOpener { static standardSupportedLinkSchemes = new Set([Schemas.http, Schemas.https, Schemas.mailto]); diff --git a/packages/core-browser/src/opener/opener.contribution.ts b/packages/core-browser/src/opener/opener.contribution.ts index 43b2fd6e8a..ca05f6c105 100644 --- a/packages/core-browser/src/opener/opener.contribution.ts +++ b/packages/core-browser/src/opener/opener.contribution.ts @@ -1,12 +1,15 @@ import { Injector, Autowired, INJECTOR_TOKEN } from '@opensumi/di'; -import { ClientAppContribution } from '../common/common.define'; import { Domain, ContributionProvider } from '@opensumi/ide-core-common'; -import { OpenerContribution, IOpenerService } from '.'; -import { CommandOpener } from './command-opener'; -import { HttpOpener } from './http-opener'; import { IElectronRendererURLService, IElectronURLService } from '@opensumi/ide-core-common/lib/electron'; -import { electronEnv } from '../utils/electron'; + +import { ClientAppContribution } from '../common/common.define'; import { AppConfig } from '../react-providers'; +import { electronEnv } from '../utils/electron'; + +import { CommandOpener } from './command-opener'; +import { HttpOpener } from './http-opener'; + +import { OpenerContribution, IOpenerService } from '.'; @Domain(OpenerContribution) export class DefaultOpenerContribution implements OpenerContribution { diff --git a/packages/core-browser/src/opener/opener.service.ts b/packages/core-browser/src/opener/opener.service.ts index 9b6226711f..1ce3a78a41 100644 --- a/packages/core-browser/src/opener/opener.service.ts +++ b/packages/core-browser/src/opener/opener.service.ts @@ -1,8 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IOpenerService, IOpener } from '.'; import { URI, ILogger } from '@opensumi/ide-core-common'; + import { DefaultOpener } from './default-opener'; +import { IOpenerService, IOpener } from '.'; + @Injectable() export class OpenerService implements IOpenerService { @Autowired(ILogger) diff --git a/packages/core-browser/src/preferences/early-preferences.ts b/packages/core-browser/src/preferences/early-preferences.ts index 2c854c5747..24cac8eb4a 100644 --- a/packages/core-browser/src/preferences/early-preferences.ts +++ b/packages/core-browser/src/preferences/early-preferences.ts @@ -1,7 +1,9 @@ -import { PreferenceScope } from './preference-scope'; import { PreferenceItem, Event } from '@opensumi/ide-core-common'; + import { IPreferences } from '../bootstrap'; + import { PreferenceProvider } from './preference-provider'; +import { PreferenceScope } from './preference-scope'; // 这些设置选项生效时间太早, 并且可能在app生命周期外生效,不能只由preference服务进行管理 export interface IExternalPreferenceProvider { diff --git a/packages/core-browser/src/preferences/preference-configurations.ts b/packages/core-browser/src/preferences/preference-configurations.ts index 80bc7b3410..0bd1e4ec37 100644 --- a/packages/core-browser/src/preferences/preference-configurations.ts +++ b/packages/core-browser/src/preferences/preference-configurations.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired, Injector } from '@opensumi/di'; import { URI, createContributionProvider } from '@opensumi/ide-core-common'; import { ContributionProvider, DEFAULT_WORKSPACE_STORAGE_DIR_NAME } from '@opensumi/ide-core-common'; + import { AppConfig } from '../react-providers'; export const PreferenceConfiguration = Symbol('PreferenceConfiguration'); diff --git a/packages/core-browser/src/preferences/preference-contribution.ts b/packages/core-browser/src/preferences/preference-contribution.ts index 0232005d7b..7732a0d677 100644 --- a/packages/core-browser/src/preferences/preference-contribution.ts +++ b/packages/core-browser/src/preferences/preference-contribution.ts @@ -1,4 +1,5 @@ import Ajv from 'ajv'; + import { Injectable, Autowired, Injector } from '@opensumi/di'; import { Mutable, @@ -9,8 +10,6 @@ import { Disposable, IDisposable, } from '@opensumi/ide-core-common'; -import { PreferenceScope } from './preference-scope'; -import { PreferenceProvider, PreferenceProviderDataChange, IResolvedPreferences } from './preference-provider'; import { PreferenceSchema, PreferenceSchemaProperties, @@ -20,9 +19,13 @@ import { PreferenceDataProperty, JsonType, } from '@opensumi/ide-core-common/lib/preferences/preference-schema'; -import { PreferenceConfigurations, injectPreferenceConfigurations } from './preference-configurations'; + import { AppConfig } from '../react-providers'; +import { PreferenceConfigurations, injectPreferenceConfigurations } from './preference-configurations'; +import { PreferenceProvider, PreferenceProviderDataChange, IResolvedPreferences } from './preference-provider'; +import { PreferenceScope } from './preference-scope'; + export { PreferenceSchema, PreferenceSchemaProperties, diff --git a/packages/core-browser/src/preferences/preference-provider.ts b/packages/core-browser/src/preferences/preference-provider.ts index e7761df226..a6eae6818b 100644 --- a/packages/core-browser/src/preferences/preference-provider.ts +++ b/packages/core-browser/src/preferences/preference-provider.ts @@ -12,6 +12,7 @@ import { FileStat, } from '@opensumi/ide-core-common'; import { PreferenceScope } from '@opensumi/ide-core-common/lib/preferences/preference-scope'; + import { getExternalPreferenceProvider, getAllExternalProviders } from './early-preferences'; export interface IResolvedPreferences { default: { [key: string]: any }; diff --git a/packages/core-browser/src/preferences/preference-proxy.ts b/packages/core-browser/src/preferences/preference-proxy.ts index 366aa3ec32..b8c824c8ff 100644 --- a/packages/core-browser/src/preferences/preference-proxy.ts +++ b/packages/core-browser/src/preferences/preference-proxy.ts @@ -1,6 +1,7 @@ import { Disposable, Event, isObject, isUndefined, PreferenceScope } from '@opensumi/ide-core-common'; -import { PreferenceService } from './preference-service'; + import { PreferenceSchema } from './preference-contribution'; +import { PreferenceService } from './preference-service'; export interface PreferenceChangeEvent { readonly preferenceName: keyof T; diff --git a/packages/core-browser/src/preferences/preference-service.ts b/packages/core-browser/src/preferences/preference-service.ts index 445b86cd4c..b3d4f4f5c4 100644 --- a/packages/core-browser/src/preferences/preference-service.ts +++ b/packages/core-browser/src/preferences/preference-service.ts @@ -1,5 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; - import { Deferred, Event, @@ -13,15 +12,16 @@ import { LRUMap, deepClone, } from '@opensumi/ide-core-common'; + +import { PreferenceConfigurations } from './preference-configurations'; +import { PreferenceSchemaProvider } from './preference-contribution'; import { PreferenceProvider, PreferenceProviderDataChange, PreferenceProviderDataChanges, PreferenceResolveResult, } from './preference-provider'; -import { PreferenceSchemaProvider } from './preference-contribution'; import { PreferenceScope } from './preference-scope'; -import { PreferenceConfigurations } from './preference-configurations'; export interface PreferenceChange { readonly preferenceName: string; diff --git a/packages/core-browser/src/preferences/settings.ts b/packages/core-browser/src/preferences/settings.ts index 0c12d43f02..743fab5035 100644 --- a/packages/core-browser/src/preferences/settings.ts +++ b/packages/core-browser/src/preferences/settings.ts @@ -1,6 +1,7 @@ -import { PreferenceScope } from './preference-scope'; import { IDisposable } from '@opensumi/ide-core-common'; +import { PreferenceScope } from './preference-scope'; + export interface IPreferenceSettingsService { setPreference(key: string, value: any, scope: PreferenceScope); diff --git a/packages/core-browser/src/progress/progress-bar.tsx b/packages/core-browser/src/progress/progress-bar.tsx index 14717dd090..b2a970cdc4 100644 --- a/packages/core-browser/src/progress/progress-bar.tsx +++ b/packages/core-browser/src/progress/progress-bar.tsx @@ -1,8 +1,11 @@ +import clsx from 'classnames'; +import { observer } from 'mobx-react-lite'; import React = require('react'); + import styles from './progress.module.less'; -import clsx from 'classnames'; + import { IProgressModel } from '.'; -import { observer } from 'mobx-react-lite'; + export const ProgressBar: React.FC<{ progressModel: IProgressModel; className?: string }> = observer( ({ progressModel, className }) => { diff --git a/packages/core-browser/src/progress/progress-indicator.ts b/packages/core-browser/src/progress/progress-indicator.ts index f3977dfde8..685c526549 100644 --- a/packages/core-browser/src/progress/progress-indicator.ts +++ b/packages/core-browser/src/progress/progress-indicator.ts @@ -1,6 +1,8 @@ +import { observable, action } from 'mobx'; + import { Injectable } from '@opensumi/di'; + import { IProgressIndicator, IProgressRunner, IProgressModel } from '.'; -import { observable, action } from 'mobx'; @Injectable({ multiple: true }) export class ProgressIndicator implements IProgressIndicator { diff --git a/packages/core-browser/src/progress/progress.service.tsx b/packages/core-browser/src/progress/progress.service.tsx index 6602208957..c01eadcf89 100644 --- a/packages/core-browser/src/progress/progress.service.tsx +++ b/packages/core-browser/src/progress/progress.service.tsx @@ -3,7 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import React = require('react'); + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { MessageType, update, close } from '@opensumi/ide-components'; import { localize, IProgressOptions, @@ -22,15 +25,17 @@ import { toDisposable, dispose, } from '@opensumi/ide-core-common'; -import { IProgressService, IProgressIndicator, IProgressRunner } from '.'; -import { timeout, IDisposable } from '..'; -import { StatusBarEntry, StatusBarAlignment, StatusBarEntryAccessor } from '../services'; -import { ProgressIndicator } from './progress-indicator'; import { parseLinkedText } from '@opensumi/ide-core-common/lib/linkedText'; + +import { timeout, IDisposable } from '..'; import { open } from '../components'; -import { MessageType, update, close } from '@opensumi/ide-components'; -import React = require('react'); +import { StatusBarEntry, StatusBarAlignment, StatusBarEntryAccessor } from '../services'; + import { ProgressBar } from './progress-bar'; +import { ProgressIndicator } from './progress-indicator'; + + +import { IProgressService, IProgressIndicator, IProgressRunner } from '.'; @Injectable() export class ProgressService implements IProgressService { diff --git a/packages/core-browser/src/quick-open/index.ts b/packages/core-browser/src/quick-open/index.ts index e96d3e9c93..554271c431 100644 --- a/packages/core-browser/src/quick-open/index.ts +++ b/packages/core-browser/src/quick-open/index.ts @@ -1,7 +1,9 @@ +import { observable } from 'mobx'; import React from 'react'; + import { VALIDATE_TYPE } from '@opensumi/ide-components'; import { URI, MaybePromise, IDisposable, Event } from '@opensumi/ide-core-common'; -import { observable } from 'mobx'; + import { Keybinding } from '../keybinding'; export enum Mode { diff --git a/packages/core-browser/src/quick-open/recent-files.ts b/packages/core-browser/src/quick-open/recent-files.ts index ca21aef1e2..db1d8f4658 100644 --- a/packages/core-browser/src/quick-open/recent-files.ts +++ b/packages/core-browser/src/quick-open/recent-files.ts @@ -1,7 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { RecentStorage } from '../common/common.storage'; -import { WithEventBus } from '..'; import { OnEvent, FileChangeType, IPosition } from '@opensumi/ide-core-common'; + +import { WithEventBus } from '..'; +import { RecentStorage } from '../common/common.storage'; import { FilesChangeEvent } from '../fs'; const OPENED_FILE = 'OPENED_FILE'; diff --git a/packages/core-browser/src/react-hooks/event.tsx b/packages/core-browser/src/react-hooks/event.tsx index 2856c60ebe..2c51950d5d 100644 --- a/packages/core-browser/src/react-hooks/event.tsx +++ b/packages/core-browser/src/react-hooks/event.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { Event, Disposable, ConstructorOf, BasicEvent, IEventBus } from '@opensumi/ide-core-common'; + import { useInjectable } from './injectable-hooks'; /** diff --git a/packages/core-browser/src/react-hooks/hot-key.tsx b/packages/core-browser/src/react-hooks/hot-key.tsx index 4e4a565f56..f837355172 100644 --- a/packages/core-browser/src/react-hooks/hot-key.tsx +++ b/packages/core-browser/src/react-hooks/hot-key.tsx @@ -1,5 +1,5 @@ -import { useState, useCallback } from 'react'; import keycode from 'keycode'; +import { useState, useCallback } from 'react'; // todo: hotkeys 增加类型提示 // 键位值请查看 https://github.com/timoxley/keycode diff --git a/packages/core-browser/src/react-hooks/injectable-hooks.tsx b/packages/core-browser/src/react-hooks/injectable-hooks.tsx index fb7bf49197..f46d6f17c4 100644 --- a/packages/core-browser/src/react-hooks/injectable-hooks.tsx +++ b/packages/core-browser/src/react-hooks/injectable-hooks.tsx @@ -1,7 +1,9 @@ import React from 'react'; + +import { Token, Injector } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-core-common'; + import { ConfigContext } from '../react-providers'; -import { Token, Injector } from '@opensumi/di'; function isDisposable(target: any): target is Disposable { return target && (target as any).dispose; diff --git a/packages/core-browser/src/react-providers/config-provider.tsx b/packages/core-browser/src/react-providers/config-provider.tsx index 64f68afa47..e5803e5af4 100644 --- a/packages/core-browser/src/react-providers/config-provider.tsx +++ b/packages/core-browser/src/react-providers/config-provider.tsx @@ -1,6 +1,8 @@ import React from 'react'; + import { Injector } from '@opensumi/di'; import { ExtensionCandidate, ExtensionConnectOption } from '@opensumi/ide-core-common'; + import { IPreferences, LayoutConfig } from '../bootstrap'; export const AppConfig = Symbol('AppConfig'); diff --git a/packages/core-browser/src/react-providers/slot.tsx b/packages/core-browser/src/react-providers/slot.tsx index f4768ed606..1b8cb6fc01 100644 --- a/packages/core-browser/src/react-providers/slot.tsx +++ b/packages/core-browser/src/react-providers/slot.tsx @@ -1,11 +1,14 @@ import React from 'react'; + +import { Button } from '@opensumi/ide-components'; import { getDebugLogger, localize } from '@opensumi/ide-core-common'; + import { LayoutConfig } from '../bootstrap'; -import { useInjectable } from '../react-hooks'; +import { IClientApp } from '../browser-module'; import { ComponentRegistry, ComponentRegistryInfo } from '../layout'; +import { useInjectable } from '../react-hooks'; + import { ConfigContext } from './config-provider'; -import { Button } from '@opensumi/ide-components'; -import { IClientApp } from '../browser-module'; import styles from './slot.module.less'; const logger = getDebugLogger(); diff --git a/packages/core-browser/src/services/clipboard.service.ts b/packages/core-browser/src/services/clipboard.service.ts index 71cec9aa05..eacd60205f 100644 --- a/packages/core-browser/src/services/clipboard.service.ts +++ b/packages/core-browser/src/services/clipboard.service.ts @@ -1,4 +1,5 @@ import { Autowired, Injectable } from '@opensumi/di'; + import { ILogger } from '../logger'; export const IClipboardService = Symbol('IClipboardService'); diff --git a/packages/core-browser/src/services/credentials-service.ts b/packages/core-browser/src/services/credentials-service.ts index 426e5b1c07..6fa561db86 100644 --- a/packages/core-browser/src/services/credentials-service.ts +++ b/packages/core-browser/src/services/credentials-service.ts @@ -1,10 +1,10 @@ +import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, ICredentialsChangeEvent, INativeCredentialService, KeytarServicePath, } from '@opensumi/ide-core-common'; -import { Injectable, Autowired } from '@opensumi/di'; import { Event } from '@opensumi/ide-core-common'; export const ICredentialsService = Symbol('ICredentialsService'); diff --git a/packages/core-browser/src/services/cryptr-service.ts b/packages/core-browser/src/services/cryptr-service.ts index 9598c51a4c..3d536d5cf6 100644 --- a/packages/core-browser/src/services/cryptr-service.ts +++ b/packages/core-browser/src/services/cryptr-service.ts @@ -1,5 +1,5 @@ -import { INativeCryptrService, CryptrServicePath } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; +import { INativeCryptrService, CryptrServicePath } from '@opensumi/ide-core-common'; export const ICryptrService = Symbol('ICryptrService'); diff --git a/packages/core-browser/src/services/external-uri.service.ts b/packages/core-browser/src/services/external-uri.service.ts index 276d67a295..0717f92051 100644 --- a/packages/core-browser/src/services/external-uri.service.ts +++ b/packages/core-browser/src/services/external-uri.service.ts @@ -1,5 +1,6 @@ -import { URI } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; +import { URI } from '@opensumi/ide-core-common'; + import { AppConfig } from '../react-providers'; export const IExternalUriService = Symbol('IExternalUriService'); diff --git a/packages/core-browser/src/services/label-service.ts b/packages/core-browser/src/services/label-service.ts index 890e5a15bf..97d3646782 100644 --- a/packages/core-browser/src/services/label-service.ts +++ b/packages/core-browser/src/services/label-service.ts @@ -1,7 +1,5 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; -import type { IModeService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/modeService'; -import type { IModelService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/modelService'; +import classnames from 'classnames'; + import { Autowired, Injectable } from '@opensumi/di'; import { URI, @@ -14,8 +12,13 @@ import { BasicEvent, Disposable, } from '@opensumi/ide-core-common'; +import type { IModelService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/modelService'; +import type { IModeService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/modeService'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; + import { getIcon } from '../style/icon/icon'; -import classnames from 'classnames'; + /** * Data URI related helpers. diff --git a/packages/core-browser/src/services/status-bar-service.ts b/packages/core-browser/src/services/status-bar-service.ts index e4978fa542..e81adcd120 100644 --- a/packages/core-browser/src/services/status-bar-service.ts +++ b/packages/core-browser/src/services/status-bar-service.ts @@ -1,4 +1,5 @@ import { IDisposable, IThemeColor, StatusBarHoverCommand } from '@opensumi/ide-core-common'; + import { IMenu } from '../menu/next'; export const IStatusBarService = Symbol('IStatusBarService'); diff --git a/packages/core-browser/src/style/icon/icon.ts b/packages/core-browser/src/style/icon/icon.ts index f403be1794..831557e946 100644 --- a/packages/core-browser/src/style/icon/icon.ts +++ b/packages/core-browser/src/style/icon/icon.ts @@ -1,5 +1,5 @@ -import { SymbolKind as SymbolKindEnum } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import { updateKaitianIconMap, getKaitianIcon } from '@opensumi/ide-components/lib/icon'; +import { SymbolKind as SymbolKindEnum } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import { IDE_ICONFONT_CN_CSS, IDE_OCTICONS_CN_CSS, IDE_CODICONS_CN_CSS } from './ide-iconfont'; diff --git a/packages/core-browser/src/toolbar/components/button.tsx b/packages/core-browser/src/toolbar/components/button.tsx index 361545c82e..f826214650 100644 --- a/packages/core-browser/src/toolbar/components/button.tsx +++ b/packages/core-browser/src/toolbar/components/button.tsx @@ -1,6 +1,15 @@ +import classnames from 'classnames'; import React from 'react'; import ReactDOM from 'react-dom'; + import { Injectable, Autowired } from '@opensumi/di'; +import { Button } from '@opensumi/ide-components'; +import { BasicEvent, Disposable, Emitter, IDisposable } from '@opensumi/ide-core-common'; + +import { DomListener } from '../../dom'; +import { PreferenceService } from '../../preferences'; +import { useInjectable } from '../../react-hooks'; +import { AppConfig, ConfigProvider } from '../../react-providers'; import { IToolbarActionReactElement, IToolbarActionElementProps, @@ -10,13 +19,6 @@ import { IToolbarPopoverStyle, IToolbarPopoverRegistry, } from '../types'; -import { useInjectable } from '../../react-hooks'; -import { BasicEvent, Disposable, Emitter, IDisposable } from '@opensumi/ide-core-common'; -import classnames from 'classnames'; -import { AppConfig, ConfigProvider } from '../../react-providers'; -import { Button } from '@opensumi/ide-components'; -import { PreferenceService } from '../../preferences'; -import { DomListener } from '../../dom'; enum BUTTON_TITLE_STYLE { HORIZONTAL = 'horizontal', diff --git a/packages/core-browser/src/toolbar/components/select.tsx b/packages/core-browser/src/toolbar/components/select.tsx index 4654dadc4d..db58ddbf21 100644 --- a/packages/core-browser/src/toolbar/components/select.tsx +++ b/packages/core-browser/src/toolbar/components/select.tsx @@ -1,5 +1,6 @@ +import classnames from 'classnames'; import React from 'react'; -import { IToolbarActionElementProps, IToolbarActionReactElement, IToolbarActionSelectProps } from '../types'; + import { Select, SelectOptionsList, @@ -9,8 +10,9 @@ import { isDataOptionGroups, } from '@opensumi/ide-components'; import { Emitter } from '@opensumi/ide-core-common'; -import classnames from 'classnames'; + import { getIcon } from '../../style/icon/icon'; +import { IToolbarActionElementProps, IToolbarActionReactElement, IToolbarActionSelectProps } from '../types'; export function ToolbarActionSelect(props: IToolbarActionSelectProps & IToolbarActionElementProps) { const [viewState, setViewState] = React.useState(props.defaultState || 'default'); diff --git a/packages/core-browser/src/toolbar/toolbar.popover.registry.ts b/packages/core-browser/src/toolbar/toolbar.popover.registry.ts index 9f4b1aa862..98abc4ad87 100644 --- a/packages/core-browser/src/toolbar/toolbar.popover.registry.ts +++ b/packages/core-browser/src/toolbar/toolbar.popover.registry.ts @@ -1,4 +1,5 @@ import React from 'react'; + import { Injectable } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-components/lib/utils'; import { Emitter, Event } from '@opensumi/ide-core-common'; diff --git a/packages/core-browser/src/toolbar/toolbar.registry.ts b/packages/core-browser/src/toolbar/toolbar.registry.ts index 4f3c6e1c39..5ed7f6d259 100644 --- a/packages/core-browser/src/toolbar/toolbar.registry.ts +++ b/packages/core-browser/src/toolbar/toolbar.registry.ts @@ -1,3 +1,9 @@ +import { Injectable, Autowired } from '@opensumi/di'; +import { IDisposable, Emitter, WithEventBus, ContributionProvider, Domain } from '@opensumi/ide-core-common'; + +import { ClientAppContribution } from '../common'; +import { PreferenceService } from '../preferences'; + import { IToolbarRegistry, IToolbarActionGroup, @@ -9,10 +15,6 @@ import { ToolbarActionGroupsChangedEvent, ToolbarRegistryReadyEvent, } from './types'; -import { IDisposable, Emitter, WithEventBus, ContributionProvider, Domain } from '@opensumi/ide-core-common'; -import { Injectable, Autowired } from '@opensumi/di'; -import { ClientAppContribution } from '../common'; -import { PreferenceService } from '../preferences'; type LocationName = string; type GroupName = string; diff --git a/packages/core-browser/src/toolbar/toolbar.tsx b/packages/core-browser/src/toolbar/toolbar.tsx index 8f6e71d04d..3d6ed02188 100644 --- a/packages/core-browser/src/toolbar/toolbar.tsx +++ b/packages/core-browser/src/toolbar/toolbar.tsx @@ -1,6 +1,17 @@ +import classnames from 'classnames'; +import throttle = require('lodash.throttle'); import React from 'react'; import ReactDOM from 'react-dom'; + +import { IEventBus, Disposable, Emitter } from '@opensumi/ide-core-common'; + +import { DomListener } from '../dom'; +import { AbstractMenuService, MenuId, generateCtxMenu, ICtxMenuRenderer } from '../menu/next'; +import { PreferenceService } from '../preferences'; import { useInjectable } from '../react-hooks'; +import { ConfigContext, ConfigProvider, AppConfig } from '../react-providers'; +import { getIcon } from '../style/icon/icon'; + import { IToolbarRegistry, ToolbarActionGroupsChangedEvent, @@ -12,14 +23,7 @@ import { IToolbarActionElementProps, ToolbarRegistryReadyEvent, } from './types'; -import { IEventBus, Disposable, Emitter } from '@opensumi/ide-core-common'; -import { ConfigContext, ConfigProvider, AppConfig } from '../react-providers'; -import { getIcon } from '../style/icon/icon'; -import { DomListener } from '../dom'; -import classnames from 'classnames'; -import { PreferenceService } from '../preferences'; -import { AbstractMenuService, MenuId, generateCtxMenu, ICtxMenuRenderer } from '../menu/next'; -import throttle = require('lodash.throttle'); + export const DEFAULT_TOOLBAR_ACTION_MARGIN = 5; export const DEFAULT_TOOLBAR_MORE_WIDTH = 14; diff --git a/packages/core-browser/src/toolbar/types.ts b/packages/core-browser/src/toolbar/types.ts index a2444357a2..c501776f59 100644 --- a/packages/core-browser/src/toolbar/types.ts +++ b/packages/core-browser/src/toolbar/types.ts @@ -1,5 +1,5 @@ -import { IDisposable, BasicEvent, Event } from '@opensumi/ide-core-common'; import { IDataOption, IDataOptionGroup } from '@opensumi/ide-components'; +import { IDisposable, BasicEvent, Event } from '@opensumi/ide-core-common'; export const IToolbarRegistry = Symbol('IToolbarRegistry'); diff --git a/packages/core-browser/src/utils/react-hooks.ts b/packages/core-browser/src/utils/react-hooks.ts index 96896aa856..9f588d84d3 100644 --- a/packages/core-browser/src/utils/react-hooks.ts +++ b/packages/core-browser/src/utils/react-hooks.ts @@ -1,11 +1,12 @@ +import _debounce from 'lodash.debounce'; import { useState, useEffect, DependencyList } from 'react'; + import { Disposable, DisposableStore, IDisposable } from '@opensumi/ide-core-common'; +import { PreferenceService, useInjectable } from '..'; import { MenuNode } from '../menu/next/base'; -import { IMenu, IMenuSeparator, IContextMenu } from '../menu/next/menu.interface'; import { generateInlineActions } from '../menu/next/menu-util'; -import _debounce from 'lodash.debounce'; -import { PreferenceService, useInjectable } from '..'; +import { IMenu, IMenuSeparator, IContextMenu } from '../menu/next/menu.interface'; export function useDebounce(value, delay) { const [denouncedValue, setDenouncedValue] = useState(value); diff --git a/packages/core-browser/src/window/window.service.ts b/packages/core-browser/src/window/window.service.ts index 1b75698ae3..ed61f4b0dc 100644 --- a/packages/core-browser/src/window/window.service.ts +++ b/packages/core-browser/src/window/window.service.ts @@ -1,10 +1,12 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { IWindowService, IOpenWorkspaceOption, NewWindowOptions } from '.'; import { URI } from '@opensumi/ide-core-common'; import { IElectronMainLifeCycleService, IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { electronEnv } from '../utils/electron'; -import { IExternalUriService } from '../services'; + import { AppConfig } from '../react-providers'; +import { IExternalUriService } from '../services'; +import { electronEnv } from '../utils/electron'; + +import { IWindowService, IOpenWorkspaceOption, NewWindowOptions } from '.'; @Injectable() export class WindowService implements IWindowService { diff --git a/packages/core-common/__tests__/character-classifier.test.ts b/packages/core-common/__tests__/character-classifier.test.ts index 68f9e5dc25..1596f7b02c 100644 --- a/packages/core-common/__tests__/character-classifier.test.ts +++ b/packages/core-common/__tests__/character-classifier.test.ts @@ -1,6 +1,7 @@ import assert from 'assert'; -import { CharCode } from '../lib/charCode'; + import { CharacterClassifier } from '../lib/character-classifier'; +import { CharCode } from '../lib/charCode'; describe('CharacterClassifier', () => { test('works', () => { diff --git a/packages/core-common/__tests__/di-helper.test.ts b/packages/core-common/__tests__/di-helper.test.ts index 385fc184de..afe3f21c49 100644 --- a/packages/core-common/__tests__/di-helper.test.ts +++ b/packages/core-common/__tests__/di-helper.test.ts @@ -1,4 +1,5 @@ import { Injectable, Injector } from '@opensumi/di'; + import { Domain } from '../src/di-helper'; describe('di-helper', () => { diff --git a/packages/core-common/__tests__/encodings.test.ts b/packages/core-common/__tests__/encodings.test.ts index fa76c03f74..badb375b89 100644 --- a/packages/core-common/__tests__/encodings.test.ts +++ b/packages/core-common/__tests__/encodings.test.ts @@ -1,7 +1,8 @@ +import * as iconv from 'iconv-lite'; + import { SUPPORTED_ENCODINGS } from '../src/const'; import { toIconvLiteEncoding, toCanonicalName, detectEncodingFromBuffer } from '../src/encoding'; import { BinaryBuffer } from '../src/utils/buffer'; -import * as iconv from 'iconv-lite'; const utf8BOM = [0xef, 0xbb, 0xbf]; diff --git a/packages/core-common/__tests__/event-bus.test.ts b/packages/core-common/__tests__/event-bus.test.ts index a044e7133e..121e55dd11 100644 --- a/packages/core-common/__tests__/event-bus.test.ts +++ b/packages/core-common/__tests__/event-bus.test.ts @@ -1,4 +1,5 @@ import { Injectable, Injector } from '@opensumi/di'; + import { EventBusImpl, BasicEvent, WithEventBus, OnEvent, IEventBus } from '../src/event-bus'; describe('event-bus', () => { diff --git a/packages/core-common/__tests__/event.test.ts b/packages/core-common/__tests__/event.test.ts index 66a8c68057..c96950df59 100644 --- a/packages/core-common/__tests__/event.test.ts +++ b/packages/core-common/__tests__/event.test.ts @@ -6,6 +6,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { timeout } from '../src/async'; +import { CancellationToken } from '../src/cancellation'; +import { IDisposable, Disposable } from '../src/disposable'; +import { errorHandler, setUnexpectedErrorHandler } from '../src/errors'; import { Event, Emitter, @@ -15,10 +19,6 @@ import { AsyncEmitter, WaitUntilEvent, } from '../src/event'; -import { IDisposable, Disposable } from '../src/disposable'; -import { errorHandler, setUnexpectedErrorHandler } from '../src/errors'; -import { timeout } from '../src/async'; -import { CancellationToken } from '../src/cancellation'; function deepStrictEqual(a, b) { expect(a).toEqual(b); diff --git a/packages/core-common/__tests__/map.test.ts b/packages/core-common/__tests__/map.test.ts index 6ca2c9d3c1..9bcf3bd20a 100644 --- a/packages/core-common/__tests__/map.test.ts +++ b/packages/core-common/__tests__/map.test.ts @@ -6,6 +6,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { URI } from 'vscode-uri'; + +import { IteratorResult } from '../src/iterator'; import { ResourceMap, TernarySearchTree, @@ -18,8 +21,6 @@ import { serializableToMap, SetMap, } from '../src/map'; -import { URI } from 'vscode-uri'; -import { IteratorResult } from '../src/iterator'; function assertDeepStrictEqual(a, b) { expect(a).toEqual(b); diff --git a/packages/core-common/__tests__/reporter.service.test.ts b/packages/core-common/__tests__/reporter.service.test.ts index 4d834f6378..83b0f0cd33 100644 --- a/packages/core-common/__tests__/reporter.service.test.ts +++ b/packages/core-common/__tests__/reporter.service.test.ts @@ -1,5 +1,5 @@ -import { REPORT_HOST } from '../src/types/reporter'; import { ReporterService } from '../src/reporter'; +import { REPORT_HOST } from '../src/types/reporter'; const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/core-common/__tests__/utils/glob.test.ts b/packages/core-common/__tests__/utils/glob.test.ts index 7837f29f5e..3428b0ebee 100644 --- a/packages/core-common/__tests__/utils/glob.test.ts +++ b/packages/core-common/__tests__/utils/glob.test.ts @@ -6,9 +6,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { isWindows } from '../../src/platform'; import * as glob from '../../src/utils/glob'; import * as path from '../../src/utils/paths'; -import { isWindows } from '../../src/platform'; describe('Glob', () => { // it('perf', () => { diff --git a/packages/core-common/__tests__/utils/marshalling.test.ts b/packages/core-common/__tests__/utils/marshalling.test.ts index 7373eb699a..3a4f8eddca 100644 --- a/packages/core-common/__tests__/utils/marshalling.test.ts +++ b/packages/core-common/__tests__/utils/marshalling.test.ts @@ -6,6 +6,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { URI } from 'vscode-uri'; + import { parse, stringify } from '../../src/utils/marshalling'; describe('Marshalling', () => { diff --git a/packages/core-common/__tests__/utils/paths.test.ts b/packages/core-common/__tests__/utils/paths.test.ts index 67143005d3..ccd5fd7b51 100644 --- a/packages/core-common/__tests__/utils/paths.test.ts +++ b/packages/core-common/__tests__/utils/paths.test.ts @@ -1,5 +1,5 @@ -import * as paths from '../../src/utils/paths'; import { URI } from '../../src/uri'; +import * as paths from '../../src/utils/paths'; describe('paths', () => { // 测试 uri#toString 传入 skipEncoding#true 时 diff --git a/packages/core-common/src/browser-fs/ensure-dir.ts b/packages/core-common/src/browser-fs/ensure-dir.ts index 3a20d2b766..d7c12a08dd 100644 --- a/packages/core-common/src/browser-fs/ensure-dir.ts +++ b/packages/core-common/src/browser-fs/ensure-dir.ts @@ -1,4 +1,5 @@ import fs from 'fs'; + import { promisify } from './util'; const PATH_SEPARATOR = '/'; diff --git a/packages/core-common/src/cancellation.ts b/packages/core-common/src/cancellation.ts index 94df5f1a01..44bbd06a0a 100644 --- a/packages/core-common/src/cancellation.ts +++ b/packages/core-common/src/cancellation.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/cancellation.ts -import { Emitter, Event } from './event'; import { IDisposable } from './disposable'; +import { Emitter, Event } from './event'; export interface CancellationToken { readonly isCancellationRequested: boolean; diff --git a/packages/core-common/src/command.ts b/packages/core-common/src/command.ts index 11d3937d9a..e427c7a52d 100644 --- a/packages/core-common/src/command.ts +++ b/packages/core-common/src/command.ts @@ -1,4 +1,5 @@ import { Autowired, Injectable } from '@opensumi/di'; + import { MaybePromise } from './async'; import { ContributionProvider } from './contribution-provider'; import { Disposable, IDisposable } from './disposable'; diff --git a/packages/core-common/src/di-helper/domain-helper.ts b/packages/core-common/src/di-helper/domain-helper.ts index f39014ae44..8226f2b421 100644 --- a/packages/core-common/src/di-helper/domain-helper.ts +++ b/packages/core-common/src/di-helper/domain-helper.ts @@ -1,4 +1,5 @@ import { markInjectable, getInjectableOpts, Domain } from '@opensumi/di'; + import { ConstructorOf } from '../declare'; /** diff --git a/packages/core-common/src/electron.ts b/packages/core-common/src/electron.ts index a88e572c9b..64b4078985 100644 --- a/packages/core-common/src/electron.ts +++ b/packages/core-common/src/electron.ts @@ -1,5 +1,6 @@ -import { IDisposable } from './disposable'; import Electron from 'electron'; + +import { IDisposable } from './disposable'; import { ExtensionCandidate } from './types'; export interface IElectronMainApi { diff --git a/packages/core-common/src/event-bus/event-bus-types.ts b/packages/core-common/src/event-bus/event-bus-types.ts index 6bf896b10e..691966e9af 100644 --- a/packages/core-common/src/event-bus/event-bus-types.ts +++ b/packages/core-common/src/event-bus/event-bus-types.ts @@ -1,5 +1,5 @@ -import { IDisposable } from '../disposable'; import { ConstructorOf } from '../declare'; +import { IDisposable } from '../disposable'; import { IAsyncResult } from '../event'; export interface IEventFireOpts { diff --git a/packages/core-common/src/event-bus/event-bus.ts b/packages/core-common/src/event-bus/event-bus.ts index be9174f5da..2371cadbf0 100644 --- a/packages/core-common/src/event-bus/event-bus.ts +++ b/packages/core-common/src/event-bus/event-bus.ts @@ -1,8 +1,11 @@ import { Injectable } from '@opensumi/di'; -import { IEventBus, IEventListener, IEventFireOpts, IAsyncEventFireOpts } from './event-bus-types'; + +import { ConstructorOf } from '../declare'; import { Emitter, IAsyncResult, Event } from '../event'; + import { BasicEvent } from './basic-event'; -import { ConstructorOf } from '../declare'; +import { IEventBus, IEventListener, IEventFireOpts, IAsyncEventFireOpts } from './event-bus-types'; + @Injectable() export class EventBusImpl implements IEventBus { diff --git a/packages/core-common/src/event-bus/event-decorator.ts b/packages/core-common/src/event-bus/event-decorator.ts index 59961ac849..28e159820e 100644 --- a/packages/core-common/src/event-bus/event-decorator.ts +++ b/packages/core-common/src/event-bus/event-decorator.ts @@ -1,12 +1,13 @@ -import { BasicEvent } from './basic-event'; +import { Autowired } from '@opensumi/di'; + import { ConstructorOf } from '../declare'; +import { Disposable } from '../disposable'; + +import { BasicEvent } from './basic-event'; import { IEventBus } from './event-bus-types'; const EVENT_TOKEN = Symbol('EVENT_TOKEN'); -import { Autowired } from '@opensumi/di'; -import { Disposable } from '../disposable'; - export class WithEventBus extends Disposable { @Autowired(IEventBus) protected eventBus: IEventBus; diff --git a/packages/core-common/src/event.ts b/packages/core-common/src/event.ts index c7947b2102..d82207e8e3 100644 --- a/packages/core-common/src/event.ts +++ b/packages/core-common/src/event.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/event.ts +import { CancellationToken } from './cancellation'; +import { DisposableStore, combinedDisposable, Disposable, IDisposable, toDisposable } from './disposable'; import { onUnexpectedError } from './errors'; import { once as onceFn } from './functional'; -import { DisposableStore, combinedDisposable, Disposable, IDisposable, toDisposable } from './disposable'; import { LinkedList } from './linked-list'; -import { CancellationToken } from './cancellation'; /** * 重要备注 diff --git a/packages/core-common/src/hash-calculate/hash-calculate.ts b/packages/core-common/src/hash-calculate/hash-calculate.ts index d6210bf2a9..055bd2b0f4 100644 --- a/packages/core-common/src/hash-calculate/hash-calculate.ts +++ b/packages/core-common/src/hash-calculate/hash-calculate.ts @@ -1,8 +1,8 @@ import { Injectable } from '@opensumi/di'; -import { lockedCreate } from './lockedCreate'; -import { Mutex } from './mutex'; +import { lockedCreate } from './lockedCreate'; import wasmJson from './md5.wasm.json'; +import { Mutex } from './mutex'; import { IDataType } from './util'; export const IHashCalculateService = Symbol('IHashCalculateService'); diff --git a/packages/core-common/src/keyboard/keyboard-layout-provider.ts b/packages/core-common/src/keyboard/keyboard-layout-provider.ts index 002f08da81..6951c01ab4 100644 --- a/packages/core-common/src/keyboard/keyboard-layout-provider.ts +++ b/packages/core-common/src/keyboard/keyboard-layout-provider.ts @@ -15,9 +15,10 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts -import { KeymapInfo } from './keymap'; import { Event } from '../event'; +import { KeymapInfo } from './keymap'; + export const keyboardPath = '/services/keyboard'; export const KeyboardNativeLayoutService = Symbol('KeyboardNativeLayoutService'); diff --git a/packages/core-common/src/lifecycle.ts b/packages/core-common/src/lifecycle.ts index 99bf866c36..f6fd51180e 100644 --- a/packages/core-common/src/lifecycle.ts +++ b/packages/core-common/src/lifecycle.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { once } from './functional'; import { IDisposable } from './disposable'; +import { once } from './functional'; // 保留 export interface IReference extends IDisposable { diff --git a/packages/core-common/src/localize.ts b/packages/core-common/src/localize.ts index afdc7039d2..11d7bd58ad 100644 --- a/packages/core-common/src/localize.ts +++ b/packages/core-common/src/localize.ts @@ -1,5 +1,5 @@ -import { format, mnemonicButtonLabel } from './utils/strings'; import { CaseInsensitiveMap } from './map'; +import { format, mnemonicButtonLabel } from './utils/strings'; export type ILocalizationKey = string; // ts不支持symbol作为key diff --git a/packages/core-common/src/map.ts b/packages/core-common/src/map.ts index 7809d52d10..2950844e3f 100644 --- a/packages/core-common/src/map.ts +++ b/packages/core-common/src/map.ts @@ -1,6 +1,7 @@ import { URI as Uri } from 'vscode-uri'; -import { Iterator, IteratorResult, FIN } from './iterator'; + import { CharCode } from './charCode'; +import { Iterator, IteratorResult, FIN } from './iterator'; export function values(set: Set): V[]; export function values(map: Map): V[]; diff --git a/packages/core-common/src/problem-matcher.ts b/packages/core-common/src/problem-matcher.ts index 847ad78f2b..660a9bf376 100644 --- a/packages/core-common/src/problem-matcher.ts +++ b/packages/core-common/src/problem-matcher.ts @@ -16,6 +16,9 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/task/src/browser/task-problem-matcher-registry.ts import { Injectable, Autowired } from '@opensumi/di'; + +import { DisposableCollection, Disposable, IDisposable } from './disposable'; +import { Emitter } from './event'; import { IProblemPatternRegistry, ApplyToKind, @@ -25,8 +28,6 @@ import { ProblemPattern, WatchingPattern, } from './problem-pattern'; -import { DisposableCollection, Disposable, IDisposable } from './disposable'; -import { Emitter } from './event'; import { URI } from './uri'; export interface WatchingMatcherContribution { diff --git a/packages/core-common/src/problem-pattern.ts b/packages/core-common/src/problem-pattern.ts index 3ae7670747..6c76e4c23e 100644 --- a/packages/core-common/src/problem-pattern.ts +++ b/packages/core-common/src/problem-pattern.ts @@ -15,12 +15,14 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/common/severity.ts -import { Injectable } from '@opensumi/di'; import { Diagnostic } from 'vscode'; -import { ProblemMatcher } from './problem-matcher'; -import { isArray, isString } from './utils/types'; + +import { Injectable } from '@opensumi/di'; + import { IDisposable, Disposable, DisposableCollection } from './disposable'; +import { ProblemMatcher } from './problem-matcher'; import { URI } from './uri'; +import { isArray, isString } from './utils/types'; export enum ApplyToKind { allDocuments, diff --git a/packages/core-common/src/reference.ts b/packages/core-common/src/reference.ts index fe0452595b..990dea8062 100644 --- a/packages/core-common/src/reference.ts +++ b/packages/core-common/src/reference.ts @@ -1,5 +1,5 @@ -import { Disposable } from './disposable'; import { MaybePromise } from './async'; +import { Disposable } from './disposable'; import { Emitter, Event } from './event'; export interface IRef { diff --git a/packages/core-common/src/reporter.ts b/packages/core-common/src/reporter.ts index 506536f81d..ff20afe52f 100644 --- a/packages/core-common/src/reporter.ts +++ b/packages/core-common/src/reporter.ts @@ -1,3 +1,7 @@ +import { Injectable, Inject } from '@opensumi/di'; + +import { IDisposable } from './disposable'; +import { getDebugLogger } from './log'; import { IReporterService, ReporterMetadata, @@ -7,9 +11,6 @@ import { IReporterTimer, REPORT_NAME, } from './types/reporter'; -import { getDebugLogger } from './log'; -import { Injectable, Inject } from '@opensumi/di'; -import { IDisposable } from './disposable'; class ReporterTimer implements IReporterTimer { private now: number; diff --git a/packages/core-common/src/storage.ts b/packages/core-common/src/storage.ts index 7c58f6dbd7..4dd71225d9 100644 --- a/packages/core-common/src/storage.ts +++ b/packages/core-common/src/storage.ts @@ -1,9 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { Event } from './event'; -import { IDisposable } from './disposable'; + import { MaybePromise } from './async'; -import { URI } from './uri'; import { ContributionProvider } from './contribution-provider'; +import { IDisposable } from './disposable'; +import { Event } from './event'; +import { URI } from './uri'; export const StorageProvider = Symbol('StorageProvider'); export type StorageProvider = (storageId: URI) => Promise; diff --git a/packages/core-common/src/task-definition.ts b/packages/core-common/src/task-definition.ts index 1c9a6b93b7..cb14811896 100644 --- a/packages/core-common/src/task-definition.ts +++ b/packages/core-common/src/task-definition.ts @@ -1,9 +1,10 @@ import { Injectable } from '@opensumi/di'; + +import { IDisposable, Disposable } from './disposable'; import { IJSONSchemaMap, IJSONSchema } from './json-schema'; +import { formatLocalize } from './localize'; import { IStringDictionary } from './types/string'; import { deepClone } from './utils/objects'; -import { IDisposable, Disposable } from './disposable'; -import { formatLocalize } from './localize'; interface TaskDefinition { extensionId: string; diff --git a/packages/core-common/src/types/authentication.ts b/packages/core-common/src/types/authentication.ts index e068671a28..06f4227b0e 100644 --- a/packages/core-common/src/types/authentication.ts +++ b/packages/core-common/src/types/authentication.ts @@ -1,5 +1,5 @@ -import { Event } from '../event'; import { IDisposable } from '../disposable'; +import { Event } from '../event'; export const noAccountsId = 'authentication.noAccounts'; diff --git a/packages/core-common/src/types/markers/markers-manager.ts b/packages/core-common/src/types/markers/markers-manager.ts index 8692060247..391f1c8aaf 100644 --- a/packages/core-common/src/types/markers/markers-manager.ts +++ b/packages/core-common/src/types/markers/markers-manager.ts @@ -1,8 +1,10 @@ import { Injectable } from '@opensumi/di'; -import { IMarker, IMarkerData, MarkerStatistics, MarkerSeverity } from './markers'; + +import { isFalsyOrEmpty } from '../../arrays'; import { IDisposable } from '../../disposable'; import { Emitter, MapMap, Event, WithEventBus } from '../../index'; -import { isFalsyOrEmpty } from '../../arrays'; + +import { IMarker, IMarkerData, MarkerStatistics, MarkerSeverity } from './markers'; export interface IBaseMarkerManager { /** diff --git a/packages/core-common/src/uri.ts b/packages/core-common/src/uri.ts index e62899be5a..16bfe2d1ae 100644 --- a/packages/core-common/src/uri.ts +++ b/packages/core-common/src/uri.ts @@ -1,4 +1,5 @@ import { URI as Uri } from 'vscode-uri'; + import { Path } from './path'; import { IRelativePattern, match } from './utils/glob'; diff --git a/packages/core-common/src/utils/arrays.ts b/packages/core-common/src/utils/arrays.ts index 6551f51437..9f8541f666 100644 --- a/packages/core-common/src/utils/arrays.ts +++ b/packages/core-common/src/utils/arrays.ts @@ -1,6 +1,6 @@ -import { ISplice } from '../sequence'; import { IDisposable } from '../disposable'; import { Emitter, Event } from '../event'; +import { ISplice } from '../sequence'; export function isNonEmptyArray(obj: ReadonlyArray | undefined | null): obj is Array { return Array.isArray(obj) && obj.length > 0; diff --git a/packages/core-common/src/utils/buffer.ts b/packages/core-common/src/utils/buffer.ts index e169026f61..f87e6fc3fd 100644 --- a/packages/core-common/src/utils/buffer.ts +++ b/packages/core-common/src/utils/buffer.ts @@ -4,9 +4,10 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/arrays.ts -import * as strings from './strings'; import { toCanonicalName, iconvDecode, UTF8 } from '../encoding'; +import * as strings from './strings'; + let textEncoder: TextEncoder | null; const hasBuffer = typeof Buffer !== 'undefined'; diff --git a/packages/core-common/src/utils/comparers.ts b/packages/core-common/src/utils/comparers.ts index c787d63306..7878da8ee1 100644 --- a/packages/core-common/src/utils/comparers.ts +++ b/packages/core-common/src/utils/comparers.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/comparers.ts -import { sep } from '../path'; -import { IdleValue } from '../async'; import { IRange } from '..'; +import { IdleValue } from '../async'; +import { sep } from '../path'; const intlFileNameCollator: IdleValue<{ collator: Intl.Collator; collatorIsNumeric: boolean }> = new IdleValue(() => { const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); diff --git a/packages/core-common/src/utils/file-uri.ts b/packages/core-common/src/utils/file-uri.ts index 94735f9bd7..cff677dd94 100644 --- a/packages/core-common/src/utils/file-uri.ts +++ b/packages/core-common/src/utils/file-uri.ts @@ -1,4 +1,5 @@ import { URI, Uri } from '../uri'; + import { isWindows } from './os'; export namespace FileUri { diff --git a/packages/core-common/src/utils/glob.ts b/packages/core-common/src/utils/glob.ts index f6b1a2a0d6..3e4fd0720a 100644 --- a/packages/core-common/src/utils/glob.ts +++ b/packages/core-common/src/utils/glob.ts @@ -7,11 +7,12 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/glob.ts -import * as paths from './paths'; -import * as strings from './strings'; import { CharCode } from '../charCode'; import { LRUCache } from '../map'; +import * as paths from './paths'; +import * as strings from './strings'; + export interface IExpression { [pattern: string]: boolean | SiblingClause; } diff --git a/packages/core-common/src/utils/ipc.ts b/packages/core-common/src/utils/ipc.ts index 92a0716f6f..b0bd7255d4 100644 --- a/packages/core-common/src/utils/ipc.ts +++ b/packages/core-common/src/utils/ipc.ts @@ -1,9 +1,12 @@ import { tmpdir } from 'os'; -import { isWindows } from '../platform'; import { join, dirname } from 'path'; -import { uuid } from '../uuid'; + import { ensureDirSync } from 'fs-extra'; +import { isWindows } from '../platform'; +import { uuid } from '../uuid'; + + export function normalizedIpcHandlerPath(name: string, uuidSuffix = false, ipcPath = tmpdir()) { let handler; if (!isWindows) { diff --git a/packages/core-common/src/utils/marshalling.ts b/packages/core-common/src/utils/marshalling.ts index af6507f820..53111e979f 100644 --- a/packages/core-common/src/utils/marshalling.ts +++ b/packages/core-common/src/utils/marshalling.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { URI } from '../uri'; + import { regExpFlags } from './strings'; export function stringify(obj: any): string { diff --git a/packages/core-common/src/utils/paths.ts b/packages/core-common/src/utils/paths.ts index d8b94e3cf9..78e05d5a69 100644 --- a/packages/core-common/src/utils/paths.ts +++ b/packages/core-common/src/utils/paths.ts @@ -6,10 +6,12 @@ 'use strict'; -import { isWindows } from '../platform'; import { CharCode } from '../charCode'; -import { startsWithIgnoreCase } from './strings'; import { posix } from '../path'; +import { isWindows } from '../platform'; + +import { startsWithIgnoreCase } from './strings'; + /** * The forward slash path separator. */ diff --git a/packages/core-common/src/utils/strings.ts b/packages/core-common/src/utils/strings.ts index c6e8be9959..2dafbfde01 100644 --- a/packages/core-common/src/utils/strings.ts +++ b/packages/core-common/src/utils/strings.ts @@ -1,5 +1,6 @@ import { CharCode } from '../charCode'; import { Constants } from '../uint'; + import { isOSX, isWindows } from './os'; /** * The empty string. diff --git a/packages/core-electron-main/__tests__/menu.service.test.ts b/packages/core-electron-main/__tests__/menu.service.test.ts index fe2c40c58f..225cd6c535 100644 --- a/packages/core-electron-main/__tests__/menu.service.test.ts +++ b/packages/core-electron-main/__tests__/menu.service.test.ts @@ -1,7 +1,9 @@ -import { mockService } from '../../../tools/dev-tool/src/mock-injector'; import { EventEmitter } from 'events'; + import { Injector } from '@opensumi/di'; +import { mockService } from '../../../tools/dev-tool/src/mock-injector'; + const mockedWindows = new Map(); jest.mock('electron', () => ({ @@ -27,9 +29,11 @@ jest.mock('electron', () => ({ }, })); -import { ElectronMainMenuService } from '../src/bootstrap/services/menu'; +// eslint-disable-next-line import/order import { BrowserWindow, Menu } from 'electron'; + import { isWindows } from '../../core-node/lib'; +import { ElectronMainMenuService } from '../src/bootstrap/services/menu'; async function delay(ms: number) { return new Promise((resolve) => { diff --git a/packages/core-electron-main/browser-preload/index.js b/packages/core-electron-main/browser-preload/index.js index e50573ad52..efe77aa687 100644 --- a/packages/core-electron-main/browser-preload/index.js +++ b/packages/core-electron-main/browser-preload/index.js @@ -1,5 +1,6 @@ const net = require('net'); const os = require('os'); + const { ipcRenderer } = require('electron'); const electronEnv = {}; diff --git a/packages/core-electron-main/src/bootstrap/api.ts b/packages/core-electron-main/src/bootstrap/api.ts index 0ca5cb1c9d..ca6e3aa326 100644 --- a/packages/core-electron-main/src/bootstrap/api.ts +++ b/packages/core-electron-main/src/bootstrap/api.ts @@ -1,7 +1,9 @@ import { ipcMain } from 'electron'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IDisposable, Disposable, getDebugLogger } from '@opensumi/ide-core-common'; import { IElectronURLService, IURLHandler } from '@opensumi/ide-core-common/lib/electron'; + import { ElectronMainApiRegistry, ElectronURLHandlerRegistry, diff --git a/packages/core-electron-main/src/bootstrap/app.ts b/packages/core-electron-main/src/bootstrap/app.ts index dcb7e2e03d..da33c9d3e3 100644 --- a/packages/core-electron-main/src/bootstrap/app.ts +++ b/packages/core-electron-main/src/bootstrap/app.ts @@ -1,16 +1,7 @@ -import { - ElectronAppConfig, - ElectronMainApiRegistry, - ElectronMainContribution, - IElectronMainApp, - IElectronMainApiProvider, - IParsedArgs, - ElectronURLHandlerRegistry, -} from './types'; -import { CodeWindow } from './window'; -import { Injector, ConstructorOf } from '@opensumi/di'; import { app, BrowserWindow, BrowserWindowConstructorOptions } from 'electron'; -import { ElectronMainApiRegistryImpl, ElectronURLHandlerRegistryImpl } from './api'; +import { argv } from 'yargs'; + +import { Injector, ConstructorOf } from '@opensumi/di'; import { createContributionProvider, ContributionProvider, @@ -20,12 +11,24 @@ import { EventBusImpl, asExtensionCandidate, } from '@opensumi/ide-core-common'; -import { serviceProviders } from './services'; -import { ICodeWindowOptions } from './types'; +import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron'; + import { ElectronMainModule } from '../electron-main-module'; -import { argv } from 'yargs'; + +import { ElectronMainApiRegistryImpl, ElectronURLHandlerRegistryImpl } from './api'; +import { serviceProviders } from './services'; import { WindowDestroyedEvent, WindowCreatedEvent } from './services/events'; -import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron'; +import { ICodeWindowOptions } from './types'; +import { + ElectronAppConfig, + ElectronMainApiRegistry, + ElectronMainContribution, + IElectronMainApp, + IElectronMainApiProvider, + IParsedArgs, + ElectronURLHandlerRegistry, +} from './types'; +import { CodeWindow } from './window'; export interface IWindowOpenOptions { windowId: number; diff --git a/packages/core-electron-main/src/bootstrap/services/events.ts b/packages/core-electron-main/src/bootstrap/services/events.ts index 20055b95dc..b41792ce52 100644 --- a/packages/core-electron-main/src/bootstrap/services/events.ts +++ b/packages/core-electron-main/src/bootstrap/services/events.ts @@ -1,4 +1,5 @@ import { BasicEvent } from '@opensumi/ide-core-common'; + import { ICodeWindow } from '../types'; export class WindowCreatedEvent extends BasicEvent {} diff --git a/packages/core-electron-main/src/bootstrap/services/index.ts b/packages/core-electron-main/src/bootstrap/services/index.ts index 1a73b4c72e..a5336b799c 100644 --- a/packages/core-electron-main/src/bootstrap/services/index.ts +++ b/packages/core-electron-main/src/bootstrap/services/index.ts @@ -1,7 +1,8 @@ import { Provider } from '@opensumi/di'; + import { MenuElectronMainContribution } from './menu'; -import { UIElectronMainContribution } from './ui'; import { ProtocolElectronMainContribution } from './protocol'; +import { UIElectronMainContribution } from './ui'; import { UrlElectronMainContribution } from './url'; export const serviceProviders: Provider[] = [ diff --git a/packages/core-electron-main/src/bootstrap/services/menu/index.ts b/packages/core-electron-main/src/bootstrap/services/menu/index.ts index ca1d89b151..d062af2a05 100644 --- a/packages/core-electron-main/src/bootstrap/services/menu/index.ts +++ b/packages/core-electron-main/src/bootstrap/services/menu/index.ts @@ -1,3 +1,5 @@ +import { Menu, MenuItemConstructorOptions, BrowserWindow } from 'electron'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { INativeMenuTemplate, @@ -6,8 +8,8 @@ import { IDisposable, IElectronMainMenuService, } from '@opensumi/ide-core-common'; + import { ElectronMainContribution, ElectronMainApiRegistry, ElectronMainApiProvider } from '../../types'; -import { Menu, MenuItemConstructorOptions, BrowserWindow } from 'electron'; @Injectable() export class ElectronMainMenuService extends ElectronMainApiProvider<'menuClick' | 'menuClose'> { diff --git a/packages/core-electron-main/src/bootstrap/services/protocol.ts b/packages/core-electron-main/src/bootstrap/services/protocol.ts index f2b5add94e..51dfeec9ee 100644 --- a/packages/core-electron-main/src/bootstrap/services/protocol.ts +++ b/packages/core-electron-main/src/bootstrap/services/protocol.ts @@ -1,8 +1,10 @@ -import { ElectronMainContribution } from '../types'; -import { Domain, URI, getDebugLogger } from '@opensumi/ide-core-common'; import { protocol } from 'electron'; import { readFile } from 'fs-extra'; +import { Domain, URI, getDebugLogger } from '@opensumi/ide-core-common'; + +import { ElectronMainContribution } from '../types'; + @Domain(ElectronMainContribution) export class ProtocolElectronMainContribution implements ElectronMainContribution { /** diff --git a/packages/core-electron-main/src/bootstrap/services/ui.ts b/packages/core-electron-main/src/bootstrap/services/ui.ts index f3e911d7d6..931675730a 100644 --- a/packages/core-electron-main/src/bootstrap/services/ui.ts +++ b/packages/core-electron-main/src/bootstrap/services/ui.ts @@ -1,19 +1,25 @@ -import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { ElectronMainApiProvider, ElectronMainContribution, ElectronMainApiRegistry } from '../types'; +import { spawn } from 'child_process'; +import { dirname } from 'path'; +import qs from 'querystring'; + import { BrowserWindow, dialog, shell, webContents } from 'electron'; -import { Domain, isWindows, IEventBus, URI } from '@opensumi/ide-core-common'; import { stat } from 'fs-extra'; -import { dirname } from 'path'; -import { spawn } from 'child_process'; import semver from 'semver'; -import qs from 'querystring'; -import { WindowCreatedEvent } from './events'; + +import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { Domain, isWindows, IEventBus, URI } from '@opensumi/ide-core-common'; import { IElectronMainUIService, IElectronMainUIServiceShape, IElectronPlainWebviewWindowOptions, } from '@opensumi/ide-core-common/lib/electron'; +import { ElectronMainApiProvider, ElectronMainContribution, ElectronMainApiRegistry } from '../types'; + + +import { WindowCreatedEvent } from './events'; + + @Injectable() export class ElectronMainUIService extends ElectronMainApiProvider<'fullScreenStatusChange' | 'windowClosed' | 'maximizeStatusChange'> diff --git a/packages/core-electron-main/src/bootstrap/services/url.ts b/packages/core-electron-main/src/bootstrap/services/url.ts index 875fc6dfb7..6e05a42c1d 100644 --- a/packages/core-electron-main/src/bootstrap/services/url.ts +++ b/packages/core-electron-main/src/bootstrap/services/url.ts @@ -1,13 +1,15 @@ import { app, BrowserWindow } from 'electron'; + import { Injector, INJECTOR_TOKEN, Injectable, Autowired } from '@opensumi/di'; import { Disposable, Domain } from '@opensumi/ide-core-common'; +import { IElectronURLService, IURLHandler } from '@opensumi/ide-core-common/lib/electron'; + import { ElectronAppConfig, ElectronMainApiRegistry, ElectronMainContribution, ElectronURLHandlerRegistry, } from '../types'; -import { IElectronURLService, IURLHandler } from '@opensumi/ide-core-common/lib/electron'; @Injectable() export class ElectronURLService extends Disposable implements IElectronURLService { diff --git a/packages/core-electron-main/src/bootstrap/types.ts b/packages/core-electron-main/src/bootstrap/types.ts index 682d2019a3..c43181a4b1 100644 --- a/packages/core-electron-main/src/bootstrap/types.ts +++ b/packages/core-electron-main/src/bootstrap/types.ts @@ -1,8 +1,10 @@ import { BrowserWindowConstructorOptions } from 'electron'; + import { Injector } from '@opensumi/di'; import { ConstructorOf, ExtensionCandidate } from '@opensumi/ide-core-common'; import { IDisposable } from '@opensumi/ide-core-common/lib/disposable'; import { IURLHandler } from '@opensumi/ide-core-common/lib/electron'; + import { ElectronMainModule } from '../electron-main-module'; export interface ElectronAppConfig { diff --git a/packages/core-electron-main/src/bootstrap/window.ts b/packages/core-electron-main/src/bootstrap/window.ts index 10bda40701..2da6d4fca2 100644 --- a/packages/core-electron-main/src/bootstrap/window.ts +++ b/packages/core-electron-main/src/bootstrap/window.ts @@ -1,12 +1,16 @@ -import semver from 'semver'; +import { ChildProcess, fork, ForkOptions } from 'child_process'; import qs from 'querystring'; -import treeKill from 'tree-kill'; + import { app, BrowserWindow, shell, ipcMain, BrowserWindowConstructorOptions, IpcMainEvent } from 'electron'; -import { ChildProcess, fork, ForkOptions } from 'child_process'; +import semver from 'semver'; +import treeKill from 'tree-kill'; + + import { Injectable, Autowired } from '@opensumi/di'; import { ExtensionCandidate } from '@opensumi/ide-core-common'; -import { normalizedIpcHandlerPath } from '@opensumi/ide-core-common/lib/utils/ipc'; import { Disposable, getDebugLogger, isOSX, URI, FileUri, Deferred } from '@opensumi/ide-core-common'; +import { normalizedIpcHandlerPath } from '@opensumi/ide-core-common/lib/utils/ipc'; + import { ElectronAppConfig, ICodeWindow, ICodeWindowOptions } from './types'; const DEFAULT_WINDOW_HEIGHT = 700; diff --git a/packages/core-node/__tests__/bootstrap/app.test.ts b/packages/core-node/__tests__/bootstrap/app.test.ts index 9b2043b0c9..b2f4c5d657 100644 --- a/packages/core-node/__tests__/bootstrap/app.test.ts +++ b/packages/core-node/__tests__/bootstrap/app.test.ts @@ -1,11 +1,14 @@ -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { ILogServiceManager, INodeLogger, ServerApp, ServerCommonModule } from '@opensumi/ide-core-node'; -import Koa from 'koa'; import http from 'http'; import net from 'net'; import path from 'path'; + +import Koa from 'koa'; + import { normalizedIpcHandlerPath } from '@opensumi/ide-core-common/lib/utils/ipc'; +import { ILogServiceManager, INodeLogger, ServerApp, ServerCommonModule } from '@opensumi/ide-core-node'; + +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; describe('ServerApp', () => { let injector: MockInjector; diff --git a/packages/core-node/__tests__/common-module/credential.server.test.ts b/packages/core-node/__tests__/common-module/credential.server.test.ts index 57d753a937..d27b59d71f 100644 --- a/packages/core-node/__tests__/common-module/credential.server.test.ts +++ b/packages/core-node/__tests__/common-module/credential.server.test.ts @@ -1,9 +1,9 @@ +import { INativeCredentialService, isLinux } from '@opensumi/ide-core-common'; +import { AppConfig } from '@opensumi/ide-core-node'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - import { CredentialService } from '../../src/common-module/credential.server'; -import { INativeCredentialService, isLinux } from '@opensumi/ide-core-common'; -import { AppConfig } from '@opensumi/ide-core-node'; describe('test for core-browser/src/services/credentials-service.ts', () => { let injector: MockInjector; diff --git a/packages/core-node/__tests__/common-module/cryptr.server.test.ts b/packages/core-node/__tests__/common-module/cryptr.server.test.ts index 516173a8b4..4a0d6a54fe 100644 --- a/packages/core-node/__tests__/common-module/cryptr.server.test.ts +++ b/packages/core-node/__tests__/common-module/cryptr.server.test.ts @@ -1,7 +1,7 @@ +import { INativeCryptrService } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { INativeCryptrService } from '@opensumi/ide-core-common'; import { CryptrService } from '../../src/common-module/cryptr.server'; describe('test for core-browser/src/services/cryptr-service.ts', () => { diff --git a/packages/core-node/__tests__/common-module/index.test.ts b/packages/core-node/__tests__/common-module/index.test.ts index d50a7a6e30..f237d2f901 100644 --- a/packages/core-node/__tests__/common-module/index.test.ts +++ b/packages/core-node/__tests__/common-module/index.test.ts @@ -1,9 +1,10 @@ -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { ServerCommonModule } from '@opensumi/ide-core-node'; import { ICommonServer } from '@opensumi/ide-core-common'; +import { ServerCommonModule } from '@opensumi/ide-core-node'; import { CommonServer } from '@opensumi/ide-core-node/lib/common-module/common.server'; +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; + describe('NodeLogger', () => { let server: CommonServer; let injector: MockInjector; diff --git a/packages/core-node/__tests__/logger/node-logger.test.ts b/packages/core-node/__tests__/logger/node-logger.test.ts index 90d2029c85..f7f7a2b680 100644 --- a/packages/core-node/__tests__/logger/node-logger.test.ts +++ b/packages/core-node/__tests__/logger/node-logger.test.ts @@ -1,7 +1,8 @@ +import { ILogServiceManager, LogLevel } from '@opensumi/ide-core-common'; +import { INodeLogger, NodeLogger } from '@opensumi/ide-core-node'; + import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { INodeLogger, NodeLogger } from '@opensumi/ide-core-node'; -import { ILogServiceManager, LogLevel } from '@opensumi/ide-core-common'; describe('NodeLogger', () => { let logger: INodeLogger; diff --git a/packages/core-node/src/bootstrap/app.ts b/packages/core-node/src/bootstrap/app.ts index 6ae7c1d680..9c2788ddbb 100644 --- a/packages/core-node/src/bootstrap/app.ts +++ b/packages/core-node/src/bootstrap/app.ts @@ -1,15 +1,15 @@ -import { Injector, ConstructorOf } from '@opensumi/di'; -import Koa from 'koa'; +import cp from 'child_process'; import http from 'http'; import https from 'https'; import net from 'net'; -import cp from 'child_process'; import os from 'os'; import path from 'path'; -import { MaybePromise, ContributionProvider, createContributionProvider, isWindows } from '@opensumi/ide-core-common'; -import { createServerConnection2, createNetServerConnection, RPCServiceCenter } from '../connection'; -import { NodeModule } from '../node-module'; + +import Koa from 'koa'; + +import { Injector, ConstructorOf } from '@opensumi/di'; import { WebSocketHandler } from '@opensumi/ide-connection/lib/node'; +import { MaybePromise, ContributionProvider, createContributionProvider, isWindows } from '@opensumi/ide-core-common'; import { LogLevel, ILogServiceManager, @@ -17,6 +17,10 @@ import { SupportLogNamespace, StoragePaths, } from '@opensumi/ide-core-common'; + +import { createServerConnection2, createNetServerConnection, RPCServiceCenter } from '../connection'; +import { NodeModule } from '../node-module'; + import { injectInnerProviders } from './inner-providers'; export type ModuleConstructor = ConstructorOf; diff --git a/packages/core-node/src/bootstrap/inner-providers.ts b/packages/core-node/src/bootstrap/inner-providers.ts index dcbbee1488..529a1970cd 100644 --- a/packages/core-node/src/bootstrap/inner-providers.ts +++ b/packages/core-node/src/bootstrap/inner-providers.ts @@ -1,5 +1,4 @@ import { Injector } from '@opensumi/di'; -import { INodeLogger, NodeLogger } from '../logger/node-logger'; import { IReporter, DefaultReporter, @@ -13,6 +12,8 @@ import { IHashCalculateService, } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { INodeLogger, NodeLogger } from '../logger/node-logger'; + export function injectInnerProviders(injector: Injector) { injector.addProviders( { diff --git a/packages/core-node/src/bootstrap/shell-path.ts b/packages/core-node/src/bootstrap/shell-path.ts index 16a60f940a..c37ffb684f 100644 --- a/packages/core-node/src/bootstrap/shell-path.ts +++ b/packages/core-node/src/bootstrap/shell-path.ts @@ -1,6 +1,7 @@ -import { isWindows, stripAnsi } from '@opensumi/ide-core-common'; import { spawn } from 'child_process'; +import { isWindows, stripAnsi } from '@opensumi/ide-core-common'; + // 成功过一次后,取 PATH 的超时时间 const MAX_WAIT_AFTER_SUCCESS = 3 * 1000; diff --git a/packages/core-node/src/common-module/credential.server.ts b/packages/core-node/src/common-module/credential.server.ts index 5d01d34398..642313c581 100644 --- a/packages/core-node/src/common-module/credential.server.ts +++ b/packages/core-node/src/common-module/credential.server.ts @@ -1,7 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { AppConfig } from '../bootstrap'; import { IChunkedPassword, INativeCredentialService, isWindows } from '@opensumi/ide-core-common'; +import { AppConfig } from '../bootstrap'; + @Injectable() export class CredentialService implements INativeCredentialService { private static readonly MAX_PASSWORD_LENGTH = 2500; diff --git a/packages/core-node/src/common-module/cryptr.server.ts b/packages/core-node/src/common-module/cryptr.server.ts index 9855a5a1a2..8ab269668c 100644 --- a/packages/core-node/src/common-module/cryptr.server.ts +++ b/packages/core-node/src/common-module/cryptr.server.ts @@ -1,6 +1,7 @@ +import crypto from 'crypto'; + import { Injectable } from '@opensumi/di'; import { INativeCryptrService } from '@opensumi/ide-core-common'; -import crypto from 'crypto'; @Injectable() export class CryptrService implements INativeCryptrService { diff --git a/packages/core-node/src/common-module/index.ts b/packages/core-node/src/common-module/index.ts index ff8bdc12c5..d40edcf632 100644 --- a/packages/core-node/src/common-module/index.ts +++ b/packages/core-node/src/common-module/index.ts @@ -7,11 +7,13 @@ import { INativeCryptrService, CryptrServicePath, } from '@opensumi/ide-core-common'; + +import { HashCalculateContribution } from '../hash-calculate/hash-calculate.contribution'; import { NodeModule } from '../node-module'; -import { CryptrService } from './cryptr.server'; + import { CommonServer } from './common.server'; import { CredentialService } from './credential.server'; -import { HashCalculateContribution } from '../hash-calculate/hash-calculate.contribution'; +import { CryptrService } from './cryptr.server'; @Injectable() export class ServerCommonModule extends NodeModule { diff --git a/packages/core-node/src/connection.ts b/packages/core-node/src/connection.ts index 421492fa75..a2a1156810 100644 --- a/packages/core-node/src/connection.ts +++ b/packages/core-node/src/connection.ts @@ -1,7 +1,11 @@ import http from 'http'; import net from 'net'; -import { NodeModule } from './node-module'; + +import ws from 'ws'; + +import { Injector, InstanceCreator, ClassCreator, FactoryCreator } from '@opensumi/di'; import { WSChannel, initRPCService, RPCServiceCenter } from '@opensumi/ide-connection'; +import { createWebSocketConnection } from '@opensumi/ide-connection/lib/common/message'; import { WebSocketServerRoute, WebSocketHandler, @@ -9,10 +13,10 @@ import { commonChannelPathHandler, createSocketConnection, } from '@opensumi/ide-connection/lib/node'; -import { Injector, InstanceCreator, ClassCreator, FactoryCreator } from '@opensumi/di'; -import ws from 'ws'; -import { createWebSocketConnection } from '@opensumi/ide-connection/lib/common/message'; + + import { INodeLogger } from './logger/node-logger'; +import { NodeModule } from './node-module'; export { RPCServiceCenter }; diff --git a/packages/core-node/src/hash-calculate/hash-calculate.contribution.ts b/packages/core-node/src/hash-calculate/hash-calculate.contribution.ts index eecfeaf921..adbc13b792 100644 --- a/packages/core-node/src/hash-calculate/hash-calculate.contribution.ts +++ b/packages/core-node/src/hash-calculate/hash-calculate.contribution.ts @@ -1,6 +1,7 @@ import { Autowired } from '@opensumi/di'; import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; + import { ServerAppContribution } from '../bootstrap'; @Domain(ServerAppContribution) diff --git a/packages/debug/__tests__/browser/breakpoint/breakpoint-manager.test.ts b/packages/debug/__tests__/browser/breakpoint/breakpoint-manager.test.ts index 66e67b3925..43b8319f86 100644 --- a/packages/debug/__tests__/browser/breakpoint/breakpoint-manager.test.ts +++ b/packages/debug/__tests__/browser/breakpoint/breakpoint-manager.test.ts @@ -1,8 +1,8 @@ import { URI, StorageProvider, IFileServiceClient } from '@opensumi/ide-core-browser'; import { DebugBreakpoint, BreakpointManager, BREAKPOINT_KIND } from '@opensumi/ide-debug/lib/browser'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { IWorkspaceStorageService } from '@opensumi/ide-workspace'; import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; +import { IWorkspaceStorageService } from '@opensumi/ide-workspace'; describe('Breakpoints Manager', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/debug-ansi-handle.test.ts b/packages/debug/__tests__/browser/debug-ansi-handle.test.ts index d40fd5fbeb..456dfc9359 100644 --- a/packages/debug/__tests__/browser/debug-ansi-handle.test.ts +++ b/packages/debug/__tests__/browser/debug-ansi-handle.test.ts @@ -5,20 +5,21 @@ // Some code copied and modified from https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/debug/test/browser/debugANSIHandling.test.ts import assert from 'assert'; -import { LinkDetector } from '@opensumi/ide-debug/lib/browser/debug-link-detector'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; + import { IOpenerService, uuid } from '@opensumi/ide-core-browser'; -import { OpenerService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/openerService'; -import { Color, IThemeService, RGBA } from '@opensumi/ide-theme'; import { appendStylizedStringToContainer, calcANSI8bitColor, handleANSIOutput, } from '@opensumi/ide-debug/lib/browser/debug-ansi-handle'; +import { LinkDetector } from '@opensumi/ide-debug/lib/browser/debug-link-detector'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { Color, IThemeService, RGBA } from '@opensumi/ide-theme'; import { WorkbenchThemeService } from '@opensumi/ide-theme/lib/browser/workbench.theme.service'; +import { OpenerService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/openerService'; describe('Debug - ANSI escape sequence', () => { let linkDetector: LinkDetector; diff --git a/packages/debug/__tests__/browser/debug-configuration-manager.test.ts b/packages/debug/__tests__/browser/debug-configuration-manager.test.ts index 39dc55d9ab..4a4a37d537 100644 --- a/packages/debug/__tests__/browser/debug-configuration-manager.test.ts +++ b/packages/debug/__tests__/browser/debug-configuration-manager.test.ts @@ -7,12 +7,13 @@ import { FileStat, StorageProvider, } from '@opensumi/ide-core-browser'; +import { IDebugServer } from '@opensumi/ide-debug'; import { DebugConfigurationManager, DebugPreferences } from '@opensumi/ide-debug/lib/browser'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { IDebugServer } from '@opensumi/ide-debug'; import { IFileServiceClient } from '@opensumi/ide-file-service'; import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; describe('Debug Configuration Manager', () => { diff --git a/packages/debug/__tests__/browser/debug-link-detector.test.ts b/packages/debug/__tests__/browser/debug-link-detector.test.ts index f1a9e76a1e..6c469d427a 100644 --- a/packages/debug/__tests__/browser/debug-link-detector.test.ts +++ b/packages/debug/__tests__/browser/debug-link-detector.test.ts @@ -5,13 +5,14 @@ // Some code copied and modified from https://github.com/microsoft/vscode/blob/94c9ea46838a9a619aeafb7e8afd1170c967bb55/src/vs/workbench/contrib/debug/browser/linkDetector.ts import assert from 'assert'; + +import { IOpenerService } from '@opensumi/ide-core-browser'; +import { isWindows } from '@opensumi/ide-core-browser'; import { LinkDetector } from '@opensumi/ide-debug/lib/browser/debug-link-detector'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; -import { IOpenerService } from '@opensumi/ide-core-browser'; -import { isWindows } from '@opensumi/ide-core-browser'; import { OpenerService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/openerService'; describe('Debug - Link Detector', () => { diff --git a/packages/debug/__tests__/browser/debug-progress.service.test.ts b/packages/debug/__tests__/browser/debug-progress.service.test.ts index ed4d9ea317..050824d248 100644 --- a/packages/debug/__tests__/browser/debug-progress.service.test.ts +++ b/packages/debug/__tests__/browser/debug-progress.service.test.ts @@ -1,18 +1,21 @@ -import { DebugProgressService } from './../../src/browser/debug-progress.service'; -import { DebugPreferences } from '@opensumi/ide-debug/lib/browser'; -import { IDebugServer } from './../../src/common/debug-service'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks/file-service-client'; +import { IContextKeyService, QuickPickService } from '@opensumi/ide-core-browser'; import { IFileServiceClient } from '@opensumi/ide-core-common'; -import { DebugModelFactory } from './../../src/common/debug-model'; +import { DebugPreferences } from '@opensumi/ide-debug/lib/browser'; import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks/file-service-client'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { IContextKeyService, QuickPickService } from '@opensumi/ide-core-browser'; + +import { DebugProgressService } from './../../src/browser/debug-progress.service'; import { DebugSessionManager } from './../../src/browser/debug-session-manager'; -import { IDebugSessionManager } from './../../src/common/debug-session'; +import { DebugModelFactory } from './../../src/common/debug-model'; import { IDebugProgress } from './../../src/common/debug-progress'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { IDebugServer } from './../../src/common/debug-service'; +import { IDebugSessionManager } from './../../src/common/debug-session'; + describe('DebugProgressService', () => { let debugProgressService: IDebugProgress; diff --git a/packages/debug/__tests__/browser/debug-service.test.ts b/packages/debug/__tests__/browser/debug-service.test.ts index 230433fbc7..b98b1e28fb 100644 --- a/packages/debug/__tests__/browser/debug-service.test.ts +++ b/packages/debug/__tests__/browser/debug-service.test.ts @@ -1,7 +1,8 @@ import { IDebugService } from '@opensumi/ide-debug'; +import { DebugService } from '@opensumi/ide-debug/lib/browser/debug-service'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { DebugService } from '@opensumi/ide-debug/lib/browser/debug-service'; describe('DebugService', () => { let debugService: IDebugService; diff --git a/packages/debug/__tests__/browser/debug-session-connection.test.ts b/packages/debug/__tests__/browser/debug-session-connection.test.ts index 090df4fbfb..a8d0be6dd5 100644 --- a/packages/debug/__tests__/browser/debug-session-connection.test.ts +++ b/packages/debug/__tests__/browser/debug-session-connection.test.ts @@ -1,10 +1,12 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; +import { Emitter } from '@opensumi/ide-core-browser'; import { CancellationToken, CancellationTokenSource, Disposable } from '@opensumi/ide-core-common'; import { IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugSessionConnection } from '@opensumi/ide-debug/lib/browser'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { DebugSessionConnection } from '@opensumi/ide-debug/lib/browser'; -import { Emitter } from '@opensumi/ide-core-browser'; + describe('DebugSessionConnection', () => { let debugSessionConnection: DebugSessionConnection; diff --git a/packages/debug/__tests__/browser/debug-session-manager.test.ts b/packages/debug/__tests__/browser/debug-session-manager.test.ts index 24a71c21ab..79be300936 100644 --- a/packages/debug/__tests__/browser/debug-session-manager.test.ts +++ b/packages/debug/__tests__/browser/debug-session-manager.test.ts @@ -1,6 +1,6 @@ +import { Emitter, IContextKeyService, IReporterService, LabelService } from '@opensumi/ide-core-browser'; +import { Disposable } from '@opensumi/ide-core-common'; import { IDebugServer, IDebugSessionManager, IDebugProgress } from '@opensumi/ide-debug'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { BreakpointManager, DebugModelManager, @@ -8,13 +8,14 @@ import { DebugSessionFactory, DebugSessionManager, } from '@opensumi/ide-debug/lib/browser'; -import { Emitter, IContextKeyService, IReporterService, LabelService } from '@opensumi/ide-core-browser'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IMessageService } from '@opensumi/ide-overlay'; -import { IVariableResolverService } from '@opensumi/ide-variable'; import { ITaskService } from '@opensumi/ide-task'; -import { Disposable } from '@opensumi/ide-core-common'; +import { IVariableResolverService } from '@opensumi/ide-variable'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; describe('DebugSessionManager', () => { let debugSessionManager: IDebugSessionManager; diff --git a/packages/debug/__tests__/browser/debugModel.test.ts b/packages/debug/__tests__/browser/debugModel.test.ts index 6d7d7ea00d..c554b03aad 100644 --- a/packages/debug/__tests__/browser/debugModel.test.ts +++ b/packages/debug/__tests__/browser/debugModel.test.ts @@ -5,8 +5,9 @@ import { IFileServiceClient, IContextKeyService, } from '@opensumi/ide-core-browser'; -import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; -import { DebugModel, DebugModelManager } from '@opensumi/ide-debug/lib/browser/editor'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { DebugSessionOptions, IDebugSessionManager } from '@opensumi/ide-debug'; import { DebugModule, DebugStackFrame, @@ -15,15 +16,15 @@ import { DebugSessionConnection, BreakpointManager, } from '@opensumi/ide-debug/lib/browser'; -import { DebugSessionOptions, IDebugSessionManager } from '@opensumi/ide-debug'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { DebugModel, DebugModelManager } from '@opensumi/ide-debug/lib/browser/editor'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; import { IMessageService } from '@opensumi/ide-overlay'; +import { ITerminalApiService } from '@opensumi/ide-terminal-next'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { ITerminalApiService } from '@opensumi/ide-terminal-next'; +import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; process.on('unhandledRejection', (reason, promise) => { // console.error(reason); diff --git a/packages/debug/__tests__/browser/editor/debug-breakpoint-widget.test.ts b/packages/debug/__tests__/browser/editor/debug-breakpoint-widget.test.ts index 67f324973f..89f0a7ce57 100644 --- a/packages/debug/__tests__/browser/editor/debug-breakpoint-widget.test.ts +++ b/packages/debug/__tests__/browser/editor/debug-breakpoint-widget.test.ts @@ -1,11 +1,11 @@ -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import type { Position } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Disposable, IFileServiceClient } from '@opensumi/ide-core-browser'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { DebugBreakpointWidget } from '@opensumi/ide-debug/lib/browser/editor'; -import { DebugEditor, IDebugSessionManager } from '@opensumi/ide-debug'; import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { DebugEditor, IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugBreakpointWidget } from '@opensumi/ide-debug/lib/browser/editor'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import type { Position } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; describe('Debug Breakpoint Widget', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/editor/debug-expression-provider.test.ts b/packages/debug/__tests__/browser/editor/debug-expression-provider.test.ts index 90de496544..64921e1d2d 100644 --- a/packages/debug/__tests__/browser/editor/debug-expression-provider.test.ts +++ b/packages/debug/__tests__/browser/editor/debug-expression-provider.test.ts @@ -1,11 +1,11 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { DebugExpressionProvider } from '@opensumi/ide-debug/lib/browser/editor'; -import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { EvaluatableExpressionServiceImpl, IEvaluatableExpressionService, } from '@opensumi/ide-debug/lib/browser/editor/evaluatable-expression'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; describe('Debug Expression Provider', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/editor/debug-hover-model.test.ts b/packages/debug/__tests__/browser/editor/debug-hover-model.test.ts index 23b256f5ca..8256f34533 100644 --- a/packages/debug/__tests__/browser/editor/debug-hover-model.test.ts +++ b/packages/debug/__tests__/browser/editor/debug-hover-model.test.ts @@ -1,6 +1,6 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { DebugHoverModel } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-model'; import { Disposable } from '@opensumi/ide-core-common'; +import { DebugHoverModel } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-model'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; describe('Debug Hover Model', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/editor/debug-hover-tree.model.service.test.ts b/packages/debug/__tests__/browser/editor/debug-hover-tree.model.service.test.ts index b7cf42157c..7692130479 100644 --- a/packages/debug/__tests__/browser/editor/debug-hover-tree.model.service.test.ts +++ b/packages/debug/__tests__/browser/editor/debug-hover-tree.model.service.test.ts @@ -1,10 +1,11 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; import { Disposable } from '@opensumi/ide-core-common'; -import { DebugHoverTreeModelService } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-tree.model.service'; -import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; import { IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; +import { DebugHoverTreeModelService } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-tree.model.service'; import { ExpressionContainer } from '@opensumi/ide-debug/lib/browser/tree'; -import { ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import styles from '../../../src/browser/editor/debug-hover.module.less'; describe('Debug Hover Model', () => { diff --git a/packages/debug/__tests__/browser/editor/debug-model-manager.test.ts b/packages/debug/__tests__/browser/editor/debug-model-manager.test.ts index 3919e640ae..77adf34c38 100644 --- a/packages/debug/__tests__/browser/editor/debug-model-manager.test.ts +++ b/packages/debug/__tests__/browser/editor/debug-model-manager.test.ts @@ -1,4 +1,5 @@ import { Disposable, QuickPickService, IContextKeyService } from '@opensumi/ide-core-browser'; +import { DebugModelFactory, IDebugServer } from '@opensumi/ide-debug'; import { BreakpointManager, DebugConfigurationManager, @@ -7,7 +8,6 @@ import { } from '@opensumi/ide-debug/lib/browser'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { EditorCollectionService, WorkbenchEditorService } from '@opensumi/ide-editor'; -import { DebugModelFactory, IDebugServer } from '@opensumi/ide-debug'; import { IFileServiceClient } from '@opensumi/ide-file-service'; import { IWorkspaceStorageService, IWorkspaceService } from '@opensumi/ide-workspace'; diff --git a/packages/debug/__tests__/browser/editor/debug-model.test.ts b/packages/debug/__tests__/browser/editor/debug-model.test.ts index 79dcb724bf..a3bf1a82e0 100644 --- a/packages/debug/__tests__/browser/editor/debug-model.test.ts +++ b/packages/debug/__tests__/browser/editor/debug-model.test.ts @@ -1,12 +1,14 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { Injector } from '@opensumi/di'; import { URI, IContextKeyService, Disposable } from '@opensumi/ide-core-browser'; -import { DebugBreakpoint, BreakpointManager } from '@opensumi/ide-debug/lib/browser'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { DebugModel, DebugHoverWidget, DebugBreakpointWidget } from '../../../src/browser/editor'; import { ICtxMenuRenderer, AbstractMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { IDebugModel, IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugBreakpoint, BreakpointManager } from '@opensumi/ide-debug/lib/browser'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; -import { Injector } from '@opensumi/di'; +import { DebugModel, DebugHoverWidget, DebugBreakpointWidget } from '../../../src/browser/editor'; + describe('Debug Model', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/editor/editor-hover-contribution.test.ts b/packages/debug/__tests__/browser/editor/editor-hover-contribution.test.ts index 148aa186a4..2a8b361950 100644 --- a/packages/debug/__tests__/browser/editor/editor-hover-contribution.test.ts +++ b/packages/debug/__tests__/browser/editor/editor-hover-contribution.test.ts @@ -1,16 +1,17 @@ -import { IWorkspaceService } from '@opensumi/ide-workspace'; import { Disposable, IContextKeyService, IFileServiceClient, MonacoOverrideServiceRegistry, } from '@opensumi/ide-core-browser'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { DebugEditorContribution } from '@opensumi/ide-debug/lib/browser/editor/debug-editor-contribution'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { DebugModelFactory, IDebugServer } from '@opensumi/ide-debug'; import { QuickPickService } from '@opensumi/ide-core-browser'; +import { DebugModelFactory, IDebugServer } from '@opensumi/ide-debug'; import { DebugPreferences } from '@opensumi/ide-debug/lib/browser'; +import { DebugEditorContribution } from '@opensumi/ide-debug/lib/browser/editor/debug-editor-contribution'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { IDebugSessionManager } from './../../../src/common/debug-session'; describe('Editor Hover Contribution', () => { diff --git a/packages/debug/__tests__/browser/launch-preferences.test.ts b/packages/debug/__tests__/browser/launch-preferences.test.ts index 3f293ed2c0..4d04ae1d62 100644 --- a/packages/debug/__tests__/browser/launch-preferences.test.ts +++ b/packages/debug/__tests__/browser/launch-preferences.test.ts @@ -1,8 +1,9 @@ -import { Injectable } from '@opensumi/di'; +import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; -import os from 'os'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; + +import { Injectable } from '@opensumi/di'; import { PreferenceService, FileUri, @@ -14,23 +15,26 @@ import { URI, IContextKeyService, } from '@opensumi/ide-core-browser'; +import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; import { AppConfig } from '@opensumi/ide-core-node'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; -import { WorkspaceService } from '@opensumi/ide-workspace/lib/browser/workspace-service'; +import { DebugContribution, DebugModule } from '@opensumi/ide-debug/lib/browser'; +import { EditorCollectionService } from '@opensumi/ide-editor/lib/browser'; import { IFileServiceClient, IDiskFileProvider } from '@opensumi/ide-file-service'; +import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; import { FileServiceContribution } from '@opensumi/ide-file-service/lib/browser/file-service-contribution'; -import { WorkspacePreferences } from '@opensumi/ide-workspace/lib/browser/workspace-preferences'; import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; -import { UserStorageContribution, UserStorageServiceImpl } from '@opensumi/ide-preferences/lib/browser/userstorage'; +import { IMessageService } from '@opensumi/ide-overlay'; import { IUserStorageService } from '@opensumi/ide-preferences'; -import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; -import { DebugContribution, DebugModule } from '@opensumi/ide-debug/lib/browser'; -import { EditorCollectionService } from '@opensumi/ide-editor/lib/browser'; +import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; +import { UserStorageContribution, UserStorageServiceImpl } from '@opensumi/ide-preferences/lib/browser/userstorage'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkspacePreferences } from '@opensumi/ide-workspace/lib/browser/workspace-preferences'; +import { WorkspaceService } from '@opensumi/ide-workspace/lib/browser/workspace-service'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; + @Injectable() export class MockLoggerManagerClient { diff --git a/packages/debug/__tests__/browser/model/debug-breakpoint.test.ts b/packages/debug/__tests__/browser/model/debug-breakpoint.test.ts index 9178ee298b..f1d7cda7eb 100644 --- a/packages/debug/__tests__/browser/model/debug-breakpoint.test.ts +++ b/packages/debug/__tests__/browser/model/debug-breakpoint.test.ts @@ -1,7 +1,7 @@ import { join } from 'path'; + import { URI, uuid } from '@opensumi/ide-core-browser'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; +import { IDebugBreakpoint } from '@opensumi/ide-debug'; import { BreakpointManager, DebugBreakpoint, @@ -9,7 +9,8 @@ import { isDebugBreakpoint, DebugDecorator, } from '@opensumi/ide-debug/lib/browser'; -import { IDebugBreakpoint } from '@opensumi/ide-debug'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; describe('Debug Breakpoints', () => { const mockInjector = createBrowserInjector([FileServiceClientModule]); diff --git a/packages/debug/__tests__/browser/model/debug-source.test.ts b/packages/debug/__tests__/browser/model/debug-source.test.ts index c01f89e917..bf06e6bc55 100644 --- a/packages/debug/__tests__/browser/model/debug-source.test.ts +++ b/packages/debug/__tests__/browser/model/debug-source.test.ts @@ -1,5 +1,5 @@ -import { DebugSource } from '@opensumi/ide-debug/lib/browser'; import { URI } from '@opensumi/ide-core-browser'; +import { DebugSource } from '@opensumi/ide-debug/lib/browser'; import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; describe('DebugSource Model', () => { diff --git a/packages/debug/__tests__/browser/model/debug-watch.test.ts b/packages/debug/__tests__/browser/model/debug-watch.test.ts index 6e16b702bf..638299c741 100644 --- a/packages/debug/__tests__/browser/model/debug-watch.test.ts +++ b/packages/debug/__tests__/browser/model/debug-watch.test.ts @@ -1,11 +1,13 @@ +import { ILogger } from '@opensumi/ide-core-browser'; +import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; import { IReporterService } from '@opensumi/ide-core-common'; +import { IDebugSessionManager } from '@opensumi/ide-debug'; import { DebugWatch, DebugThread } from '@opensumi/ide-debug/lib/browser'; -import { ILogger } from '@opensumi/ide-core-browser'; import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; -import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { IDebugSessionManager } from '@opensumi/ide-debug'; + describe('DebugWatch Model', () => { describe('DebugWatch should be work after init', () => { diff --git a/packages/debug/__tests__/browser/view/breakpoint/debug-breakpoints.service.test.ts b/packages/debug/__tests__/browser/view/breakpoint/debug-breakpoints.service.test.ts index bd80f32b13..1442272844 100644 --- a/packages/debug/__tests__/browser/view/breakpoint/debug-breakpoints.service.test.ts +++ b/packages/debug/__tests__/browser/view/breakpoint/debug-breakpoints.service.test.ts @@ -1,16 +1,16 @@ -import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; import { Disposable, URI, IFileServiceClient, IEventBus, EventBusImpl } from '@opensumi/ide-core-common'; import { IDebugSessionManager } from '@opensumi/ide-debug'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; -import { DebugViewModel } from '@opensumi/ide-debug/lib/browser/view/debug-view-model'; import { BreakpointManager, DebugBreakpoint } from '@opensumi/ide-debug/lib/browser'; import { DebugBreakpointsService } from '@opensumi/ide-debug/lib/browser/view/breakpoints/debug-breakpoints.service'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; -import { IWorkspaceStorageService } from '@opensumi/ide-workspace/lib/common/workspace-defination'; +import { DebugViewModel } from '@opensumi/ide-debug/lib/browser/view/debug-view-model'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { WorkspaceEditDidRenameFileEvent, WorkspaceEditDidDeleteFileEvent } from '@opensumi/ide-workspace-edit'; +import { IWorkspaceStorageService } from '@opensumi/ide-workspace/lib/common/workspace-defination'; describe('Debug Breakpoints Service', () => { const mockInjector = createBrowserInjector( diff --git a/packages/debug/__tests__/browser/view/configuration/debug-configuration.service.test.ts b/packages/debug/__tests__/browser/view/configuration/debug-configuration.service.test.ts index 234be4b08a..e43a4094dc 100644 --- a/packages/debug/__tests__/browser/view/configuration/debug-configuration.service.test.ts +++ b/packages/debug/__tests__/browser/view/configuration/debug-configuration.service.test.ts @@ -1,14 +1,14 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { PreferenceService } from '@opensumi/ide-core-browser'; import { Disposable, IEventBus, EventBusImpl, StorageProvider, URI } from '@opensumi/ide-core-common'; import { IDebugSessionManager } from '@opensumi/ide-debug'; -import { PreferenceService } from '@opensumi/ide-core-browser'; -import { DebugViewModel } from '@opensumi/ide-debug/lib/browser/view/debug-view-model'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; +import { DEFAULT_CONFIGURATION_NAME_SEPARATOR } from '@opensumi/ide-debug'; +import { DebugConfigurationManager } from '@opensumi/ide-debug/lib/browser/debug-configuration-manager'; import { DebugConfigurationService } from '@opensumi/ide-debug/lib/browser/view/configuration/debug-configuration.service'; import { DebugConsoleService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console.service'; -import { DebugConfigurationManager } from '@opensumi/ide-debug/lib/browser/debug-configuration-manager'; -import { DEFAULT_CONFIGURATION_NAME_SEPARATOR } from '@opensumi/ide-debug'; +import { DebugViewModel } from '@opensumi/ide-debug/lib/browser/view/debug-view-model'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; describe('Debug Configuration Service', () => { const mockInjector = createBrowserInjector( diff --git a/packages/debug/__tests__/browser/view/configuration/debug-toolbar.service.test.ts b/packages/debug/__tests__/browser/view/configuration/debug-toolbar.service.test.ts index 2ffdd12a79..0bb9c132f4 100644 --- a/packages/debug/__tests__/browser/view/configuration/debug-toolbar.service.test.ts +++ b/packages/debug/__tests__/browser/view/configuration/debug-toolbar.service.test.ts @@ -1,8 +1,8 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { IEventBus, EventBusImpl } from '@opensumi/ide-core-common'; +import { DebugToolbarService } from '@opensumi/ide-debug/lib/browser/view/configuration/debug-toolbar.service'; import { DebugViewModel } from '@opensumi/ide-debug/lib/browser/view/debug-view-model'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; -import { DebugToolbarService } from '@opensumi/ide-debug/lib/browser/view/configuration/debug-toolbar.service'; describe('Debug Configuration Service', () => { const mockInjector = createBrowserInjector( diff --git a/packages/debug/__tests__/browser/view/console/debug-console-tree.model.service.test.ts b/packages/debug/__tests__/browser/view/console/debug-console-tree.model.service.test.ts index 0fb466ffc2..c16c103051 100644 --- a/packages/debug/__tests__/browser/view/console/debug-console-tree.model.service.test.ts +++ b/packages/debug/__tests__/browser/view/console/debug-console-tree.model.service.test.ts @@ -1,6 +1,8 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { QuickPickService } from '@opensumi/ide-core-browser'; +import { ICtxMenuRenderer, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { Disposable, IFileServiceClient } from '@opensumi/ide-core-common'; -import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; import { IDebugSessionManager, IDebugSession, @@ -8,32 +10,32 @@ import { DebugModelFactory, IDebugServer, } from '@opensumi/ide-debug'; -import { DebugConsoleNode } from '@opensumi/ide-debug/lib/browser/tree'; -import { ICtxMenuRenderer, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; -import styles from '../../../../src/browser/view/console/debug-console.module.less'; -import { - DebugConsoleModelService, - IDebugConsoleModel, -} from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; import { DebugSessionFactory, DefaultDebugSessionFactory, DebugPreferences, DebugSessionContributionRegistry, } from '@opensumi/ide-debug/lib/browser'; +import { DebugContextKey } from '@opensumi/ide-debug/lib/browser/contextkeys/debug-contextkey.service'; +import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; +import { DebugConsoleNode } from '@opensumi/ide-debug/lib/browser/tree'; +import { DebugConsoleFilterService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-filter.service'; +import { + DebugConsoleModelService, + IDebugConsoleModel, +} from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; import { IMessageService } from '@opensumi/ide-overlay'; +import { ITaskService } from '@opensumi/ide-task'; import { ITerminalApiService } from '@opensumi/ide-terminal-next'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { QuickPickService } from '@opensumi/ide-core-browser'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; import { IVariableResolverService } from '@opensumi/ide-variable'; -import { ITaskService } from '@opensumi/ide-task'; -import { DebugConsoleFilterService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-filter.service'; -import { DebugContextKey } from '@opensumi/ide-debug/lib/browser/contextkeys/debug-contextkey.service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import styles from '../../../../src/browser/view/console/debug-console.module.less'; + describe('Debug Console Tree Model', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/view/console/debug-console.view.test.tsx b/packages/debug/__tests__/browser/view/console/debug-console.view.test.tsx index 51731d9142..4667a76687 100644 --- a/packages/debug/__tests__/browser/view/console/debug-console.view.test.tsx +++ b/packages/debug/__tests__/browser/view/console/debug-console.view.test.tsx @@ -1,15 +1,20 @@ +import { observer } from 'mobx-react-lite'; import React from 'react'; import ReactDOM from 'react-dom'; -import { observer } from 'mobx-react-lite'; import { act } from 'react-dom/test-utils'; + import { RecycleTree, IRecycleTreeHandle, INodeRendererWrapProps } from '@opensumi/ide-components'; +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; +import { IContextKeyService } from '@opensumi/ide-core-browser/src'; +import { Disposable } from '@opensumi/ide-core-common'; +import { IFileServiceClient } from '@opensumi/ide-core-node'; import { - DebugConsoleModelService, - IDebugConsoleModel, -} from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { IMessageService } from '@opensumi/ide-overlay'; + DebugModelFactory, + IDebugServer, + IDebugSessionManager, + IDebugSession, + DebugSessionOptions, +} from '@opensumi/ide-debug'; import { DebugPreferences, DebugSessionContributionRegistry, @@ -17,29 +22,25 @@ import { DefaultDebugSessionFactory, DebugSession, } from '@opensumi/ide-debug/lib/browser'; -import { IFileServiceClient } from '@opensumi/ide-core-node'; -import { ITerminalApiService } from '@opensumi/ide-terminal-next'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; +import { DebugConsoleNode, AnsiConsoleNode, DebugVariableContainer } from '@opensumi/ide-debug/lib/browser/tree'; +import { DebugConsoleFilterService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-filter.service'; import { - DebugModelFactory, - IDebugServer, - IDebugSessionManager, - IDebugSession, - DebugSessionOptions, -} from '@opensumi/ide-debug'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { QuickPickService } from '@opensumi/ide-quick-open'; + DebugConsoleModelService, + IDebugConsoleModel, +} from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; +import { DebugConsoleRenderedNode } from '@opensumi/ide-debug/lib/browser/view/console/debug-console.view'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; -import { IVariableResolverService } from '@opensumi/ide-variable'; -import { ITaskService } from '@opensumi/ide-task'; -import { DebugConsoleFilterService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-filter.service'; -import { DebugConsoleNode, AnsiConsoleNode, DebugVariableContainer } from '@opensumi/ide-debug/lib/browser/tree'; -import { IContextKeyService } from '@opensumi/ide-core-browser/src'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { Disposable } from '@opensumi/ide-core-common'; import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; -import { DebugConsoleRenderedNode } from '@opensumi/ide-debug/lib/browser/view/console/debug-console.view'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; +import { IMessageService } from '@opensumi/ide-overlay'; +import { QuickPickService } from '@opensumi/ide-quick-open'; +import { ITaskService } from '@opensumi/ide-task'; +import { ITerminalApiService } from '@opensumi/ide-terminal-next'; +import { IVariableResolverService } from '@opensumi/ide-variable'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; describe('Debug console component Test Suites', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/view/frames/debug-call-stack.service.test.ts b/packages/debug/__tests__/browser/view/frames/debug-call-stack.service.test.ts index da342efcc7..a20d5e93cc 100644 --- a/packages/debug/__tests__/browser/view/frames/debug-call-stack.service.test.ts +++ b/packages/debug/__tests__/browser/view/frames/debug-call-stack.service.test.ts @@ -1,13 +1,13 @@ -import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService'; -import { IContextKeyServiceTarget } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; +import { AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { URI } from '@opensumi/ide-core-common'; import { Disposable } from '@opensumi/ide-core-common'; -import { ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; -import { DebugCallStackService } from '@opensumi/ide-debug/lib/browser/view/frames/debug-call-stack.service'; import { DebugStackFrame } from '@opensumi/ide-debug/lib/browser'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; -import { AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; +import { DebugCallStackService } from '@opensumi/ide-debug/lib/browser/view/frames/debug-call-stack.service'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService'; +import { IContextKeyServiceTarget } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; describe('Debug Call Frames Service', () => { const mockInjector = createBrowserInjector([]); diff --git a/packages/debug/__tests__/browser/view/variables/debug-variables-tree.model.service.test.ts b/packages/debug/__tests__/browser/view/variables/debug-variables-tree.model.service.test.ts index ef462a8114..baaa4ea57a 100644 --- a/packages/debug/__tests__/browser/view/variables/debug-variables-tree.model.service.test.ts +++ b/packages/debug/__tests__/browser/view/variables/debug-variables-tree.model.service.test.ts @@ -1,15 +1,17 @@ -import { DebugContextKey } from './../../../../src/browser/contextkeys/debug-contextkey.service'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { ICtxMenuRenderer, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { Disposable } from '@opensumi/ide-core-common'; -import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; import { IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; import { DebugConsoleNode } from '@opensumi/ide-debug/lib/browser/tree'; -import { ICtxMenuRenderer, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; -import { DebugVariablesModelService } from '@opensumi/ide-debug/lib/browser/view/variables/debug-variables-tree.model.service'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; import { DebugViewModel } from '@opensumi/ide-debug/lib/browser/view/debug-view-model'; +import { DebugVariablesModelService } from '@opensumi/ide-debug/lib/browser/view/variables/debug-variables-tree.model.service'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import styles from '../../../../src/browser/view/variables/debug-variables.module.less'; +import { DebugContextKey } from './../../../../src/browser/contextkeys/debug-contextkey.service'; + describe('Debug Variables Tree Model', () => { const mockInjector = createBrowserInjector([]); let debugVariablesModelService: DebugVariablesModelService; diff --git a/packages/debug/__tests__/browser/view/watch/debug-watch-tree.model.service.test.ts b/packages/debug/__tests__/browser/view/watch/debug-watch-tree.model.service.test.ts index 2b46aeab03..e1cb19242a 100644 --- a/packages/debug/__tests__/browser/view/watch/debug-watch-tree.model.service.test.ts +++ b/packages/debug/__tests__/browser/view/watch/debug-watch-tree.model.service.test.ts @@ -1,12 +1,13 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { IContextKeyService, StorageProvider } from '@opensumi/ide-core-browser'; +import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { ICtxMenuRenderer, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { Disposable } from '@opensumi/ide-core-common'; -import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; import { IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugHoverSource } from '@opensumi/ide-debug/lib/browser/editor/debug-hover-source'; import { DebugWatchNode } from '@opensumi/ide-debug/lib/browser/tree'; -import { ICtxMenuRenderer, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { DebugWatchModelService } from '@opensumi/ide-debug/lib/browser/view/watch/debug-watch-tree.model.service'; -import { IContextKeyService, StorageProvider } from '@opensumi/ide-core-browser'; -import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import styles from '../../../../src/browser/view/watch/debug-watch.module.less'; describe('Debug Watch Tree Model', () => { diff --git a/packages/debug/src/browser/breakpoint/breakpoint-decoration.ts b/packages/debug/src/browser/breakpoint/breakpoint-decoration.ts index 2d7148a129..30f7a1713c 100644 --- a/packages/debug/src/browser/breakpoint/breakpoint-decoration.ts +++ b/packages/debug/src/browser/breakpoint/breakpoint-decoration.ts @@ -1,5 +1,7 @@ import { localize } from '@opensumi/ide-core-browser'; + import { IDebugBreakpoint } from '../../common'; + import { isRuntimeBreakpoint } from './breakpoint-marker'; export interface IBreakpointDecoration { diff --git a/packages/debug/src/browser/breakpoint/breakpoint-manager.ts b/packages/debug/src/browser/breakpoint/breakpoint-manager.ts index f8fd0cd817..ebd9e57d5c 100644 --- a/packages/debug/src/browser/breakpoint/breakpoint-manager.ts +++ b/packages/debug/src/browser/breakpoint/breakpoint-manager.ts @@ -1,5 +1,3 @@ -import { Deferred } from '@opensumi/ide-core-common'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, @@ -11,11 +9,15 @@ import { STORAGE_NAMESPACE, IReporterService, } from '@opensumi/ide-core-browser'; -import { DebugExceptionBreakpoint, BREAKPOINT_KIND } from './breakpoint-marker'; -import { MarkerManager, Marker } from '../markers'; +import { Deferred } from '@opensumi/ide-core-common'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { DebugModel } from '../editor'; + import { BreakpointsChangeEvent, DEBUG_REPORT_NAME, IDebugBreakpoint } from '../../common'; +import { DebugModel } from '../editor'; +import { MarkerManager, Marker } from '../markers'; + +import { DebugExceptionBreakpoint, BREAKPOINT_KIND } from './breakpoint-marker'; export interface ExceptionBreakpointsChangeEvent { filters: string[]; diff --git a/packages/debug/src/browser/breakpoint/breakpoint-marker.ts b/packages/debug/src/browser/breakpoint/breakpoint-marker.ts index 37dc2ed77b..8d5ea7fdcc 100644 --- a/packages/debug/src/browser/breakpoint/breakpoint-marker.ts +++ b/packages/debug/src/browser/breakpoint/breakpoint-marker.ts @@ -1,6 +1,8 @@ +import btoa = require('btoa'); + import { URI } from '@opensumi/ide-core-common'; import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; -import btoa = require('btoa'); + import { IRuntimeBreakpoint, IDebugBreakpoint } from '../../common'; import { Marker } from '../markers'; diff --git a/packages/debug/src/browser/components/debug-action/index.tsx b/packages/debug/src/browser/components/debug-action/index.tsx index 294ff520e4..47b2095f22 100644 --- a/packages/debug/src/browser/components/debug-action/index.tsx +++ b/packages/debug/src/browser/components/debug-action/index.tsx @@ -1,8 +1,10 @@ -import React from 'react'; -import styles from './index.module.less'; import cls from 'classnames'; +import React from 'react'; + import { getIcon } from '@opensumi/ide-core-browser'; +import styles from './index.module.less'; + export interface DebugActionProps { icon: string; label: string; diff --git a/packages/debug/src/browser/components/floating-click-widget/index.tsx b/packages/debug/src/browser/components/floating-click-widget/index.tsx index 48bf369169..a99e829752 100644 --- a/packages/debug/src/browser/components/floating-click-widget/index.tsx +++ b/packages/debug/src/browser/components/floating-click-widget/index.tsx @@ -1,10 +1,13 @@ import React from 'react'; -import styles from './index.module.less'; -import { localize } from '@opensumi/ide-core-browser'; + import { Button } from '@opensumi/ide-components'; +import { localize } from '@opensumi/ide-core-browser'; import { useInjectable } from '@opensumi/ide-core-browser'; + import { DebugConfigurationService } from '../../view/configuration/debug-configuration.service'; +import styles from './index.module.less'; + export const FloatingClickWidget = (_: React.HtmlHTMLAttributes) => { const { addConfiguration } = useInjectable(DebugConfigurationService); diff --git a/packages/debug/src/browser/contextkeys/debug-contextkey.service.ts b/packages/debug/src/browser/contextkeys/debug-contextkey.service.ts index 9d812d3db9..49efd85cfe 100644 --- a/packages/debug/src/browser/contextkeys/debug-contextkey.service.ts +++ b/packages/debug/src/browser/contextkeys/debug-contextkey.service.ts @@ -1,5 +1,8 @@ import { Optional, Injectable, Autowired } from '@opensumi/di'; import { IContextKeyService, IContextKey, IScopedContextKeyService } from '@opensumi/ide-core-browser'; + +import { DebugState } from '../../common'; + import { CONTEXT_IN_DEBUG_REPL, CONTEXT_IN_DEBUG_CONSOLE, @@ -10,7 +13,6 @@ import { CONTEXT_RESTART_FRAME_SUPPORTED, CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT, } from './../../common/constants'; -import { DebugState } from '../../common'; @Injectable() export class DebugContextKey { diff --git a/packages/debug/src/browser/debug-ansi-handle.ts b/packages/debug/src/browser/debug-ansi-handle.ts index d3610ce4f5..09bc0569a8 100644 --- a/packages/debug/src/browser/debug-ansi-handle.ts +++ b/packages/debug/src/browser/debug-ansi-handle.ts @@ -4,10 +4,11 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts -import { IWorkspaceFolder } from '@opensumi/monaco-editor-core/esm/vs/platform/workspace/common/workspace'; +import { ansiColorIdentifiers } from '@opensumi/ide-terminal-next/lib/browser/terminal.color'; import { Color, IThemeService, RGBA } from '@opensumi/ide-theme'; +import { IWorkspaceFolder } from '@opensumi/monaco-editor-core/esm/vs/platform/workspace/common/workspace'; + import { LinkDetector } from './debug-link-detector'; -import { ansiColorIdentifiers } from '@opensumi/ide-terminal-next/lib/browser/terminal.color'; import styles from './view/console/debug-console.module.less'; /** diff --git a/packages/debug/src/browser/debug-configuration-manager.ts b/packages/debug/src/browser/debug-configuration-manager.ts index 5fae284393..72c70e9b65 100644 --- a/packages/debug/src/browser/debug-configuration-manager.ts +++ b/packages/debug/src/browser/debug-configuration-manager.ts @@ -1,10 +1,6 @@ -import { CONTEXT_DEBUGGERS_AVAILABLE } from './../common/constants'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { visit } from 'jsonc-parser'; + import { Injectable, Autowired } from '@opensumi/di'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { DebugServer, IDebugServer, IDebuggerContribution, launchSchemaUri } from '../common'; -import { QuickPickService } from '@opensumi/ide-quick-open'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { PreferenceConfigurations, IContextKey, @@ -22,15 +18,24 @@ import { ThrottledDelayer, Deferred, } from '@opensumi/ide-core-browser'; -import { visit } from 'jsonc-parser'; +import { WorkbenchEditorService, IOpenResourceResult } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { FileSystemError } from '@opensumi/ide-file-service'; +import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { QuickPickService } from '@opensumi/ide-quick-open'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { WorkspaceVariableContribution } from '@opensumi/ide-workspace/lib/browser/workspace-variable-contribution'; -import { DebugConfigurationModel } from './debug-configuration-model'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + + +import { DebugServer, IDebugServer, IDebuggerContribution, launchSchemaUri } from '../common'; import { DebugSessionOptions } from '../common'; -import { FileSystemError } from '@opensumi/ide-file-service'; import { DebugConfiguration } from '../common'; -import { WorkbenchEditorService, IOpenResourceResult } from '@opensumi/ide-editor'; + +import { CONTEXT_DEBUGGERS_AVAILABLE } from './../common/constants'; +import { DebugConfigurationModel } from './debug-configuration-model'; import { DebugPreferences } from './debug-preferences'; -import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; + export type WillProvideDebugConfiguration = WaitUntilEvent; export type WillInitialConfiguration = WaitUntilEvent; diff --git a/packages/debug/src/browser/debug-configuration-model.ts b/packages/debug/src/browser/debug-configuration-model.ts index c16d249089..be8c97cea0 100644 --- a/packages/debug/src/browser/debug-configuration-model.ts +++ b/packages/debug/src/browser/debug-configuration-model.ts @@ -1,4 +1,5 @@ import { URI, Emitter, Event, IDisposable, DisposableCollection, PreferenceService } from '@opensumi/ide-core-browser'; + import { DebugConfiguration } from '../common'; export class DebugConfigurationModel implements IDisposable { diff --git a/packages/debug/src/browser/debug-contribution.ts b/packages/debug/src/browser/debug-contribution.ts index 23e1bc429c..dbbc925fda 100644 --- a/packages/debug/src/browser/debug-contribution.ts +++ b/packages/debug/src/browser/debug-contribution.ts @@ -1,9 +1,4 @@ -import { - CONTEXT_DEBUGGERS_AVAILABLE, - CONTEXT_IN_DEBUG_MODE, - CONTEXT_BREAKPOINT_INPUT_FOCUSED, -} from './../common/constants'; -import { URI } from '@opensumi/ide-core-common'; +import { Autowired } from '@opensumi/di'; import { Domain, ClientAppContribution, @@ -27,26 +22,21 @@ import { IPreferenceSettingsService, COMMON_COMMANDS, } from '@opensumi/ide-core-browser'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { DebugBreakpointView } from './view/breakpoints/debug-breakpoints.view'; -import { DebugVariableView } from './view/variables/debug-variables.view'; -import { DebugCallStackView } from './view/frames/debug-call-stack.view'; -import { DebugConfigurationView } from './view/configuration/debug-configuration.view'; +import { ToolbarRegistry, TabBarToolbarContribution } from '@opensumi/ide-core-browser/lib/layout'; +import { MenuContribution, MenuId, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; +import { URI } from '@opensumi/ide-core-common'; +import { + BrowserEditorContribution, + IEditorFeatureRegistry, + EditorComponentRegistry, + IEditor, +} from '@opensumi/ide-editor/lib/browser'; +import { IFileServiceClient, IShadowFileProvider } from '@opensumi/ide-file-service'; +import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; import { IMainLayoutService, IViewsRegistry } from '@opensumi/ide-main-layout'; -import { Autowired } from '@opensumi/di'; -import { DebugModelManager } from './editor/debug-model-manager'; -import { BreakpointManager, SelectedBreakpoint } from './breakpoint'; -import { DebugConfigurationManager } from './debug-configuration-manager'; -import { launchSchema } from './debug-schema-updater'; -import { DebugWatchView } from './view/watch/debug-watch.view'; +import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { ToolbarRegistry, TabBarToolbarContribution } from '@opensumi/ide-core-browser/lib/layout'; -import { DebugBreakpointsService } from './view/breakpoints/debug-breakpoints.service'; -import { DebugConfigurationService } from './view/configuration/debug-configuration.service'; -import { DebugViewModel } from './view/debug-view-model'; -import { DebugSession } from './debug-session'; -import { DebugSessionManager } from './debug-session-manager'; -import { DebugPreferences, debugPreferencesSchema } from './debug-preferences'; import { IDebugSessionManager, launchSchemaUri, @@ -61,23 +51,34 @@ import { DEBUG_SCHEME, TSourceBrekpointProperties, } from '../common'; -import { DebugConsoleService } from './view/console/debug-console.service'; -import { DebugToolbarService } from './view/configuration/debug-toolbar.service'; -import { MenuContribution, MenuId, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; + import { - BrowserEditorContribution, - IEditorFeatureRegistry, - EditorComponentRegistry, - IEditor, -} from '@opensumi/ide-editor/lib/browser'; -import { DebugEditorContribution } from './editor/debug-editor-contribution'; + CONTEXT_DEBUGGERS_AVAILABLE, + CONTEXT_IN_DEBUG_MODE, + CONTEXT_BREAKPOINT_INPUT_FOCUSED, +} from './../common/constants'; +import { BreakpointManager, SelectedBreakpoint } from './breakpoint'; import { FloatingClickWidget } from './components/floating-click-widget'; -import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; -import { IFileServiceClient, IShadowFileProvider } from '@opensumi/ide-file-service'; -import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; +import { DebugContextKey } from './contextkeys/debug-contextkey.service'; +import { DebugConfigurationManager } from './debug-configuration-manager'; +import { DebugPreferences, debugPreferencesSchema } from './debug-preferences'; import { DebugProgressService } from './debug-progress.service'; +import { launchSchema } from './debug-schema-updater'; +import { DebugSession } from './debug-session'; +import { DebugSessionManager } from './debug-session-manager'; +import { DebugEditorContribution } from './editor/debug-editor-contribution'; +import { DebugModelManager } from './editor/debug-model-manager'; import { DebugRunToCursorService } from './editor/debug-run-to-cursor.service'; -import { DebugContextKey } from './contextkeys/debug-contextkey.service'; +import { DebugBreakpointsService } from './view/breakpoints/debug-breakpoints.service'; +import { DebugBreakpointView } from './view/breakpoints/debug-breakpoints.view'; +import { DebugConfigurationService } from './view/configuration/debug-configuration.service'; +import { DebugConfigurationView } from './view/configuration/debug-configuration.view'; +import { DebugToolbarService } from './view/configuration/debug-toolbar.service'; +import { DebugConsoleService } from './view/console/debug-console.service'; +import { DebugViewModel } from './view/debug-view-model'; +import { DebugCallStackView } from './view/frames/debug-call-stack.view'; +import { DebugVariableView } from './view/variables/debug-variables.view'; +import { DebugWatchView } from './view/watch/debug-watch.view'; const LAUNCH_JSON_REGEX = /launch\.json$/; diff --git a/packages/debug/src/browser/debug-link-detector.ts b/packages/debug/src/browser/debug-link-detector.ts index 17292c32f1..afc7f8c068 100644 --- a/packages/debug/src/browser/debug-link-detector.ts +++ b/packages/debug/src/browser/debug-link-detector.ts @@ -4,14 +4,15 @@ *--------------------------------------------------------------------------------------------*/ // Some code copied and modified from https://github.com/microsoft/vscode/blob/94c9ea46838a9a619aeafb7e8afd1170c967bb55/src/vs/workbench/contrib/debug/browser/linkDetector.ts -import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { Injectable, Autowired } from '@opensumi/di'; import { Schemas, IOpenerService, OS, formatLocalize } from '@opensumi/ide-core-browser'; import { URI, IRange } from '@opensumi/ide-core-common'; import * as osPath from '@opensumi/ide-core-common/lib/path'; import * as platform from '@opensumi/ide-core-common/lib/platform'; -import { IWorkspaceFolder } from '@opensumi/monaco-editor-core/esm/vs/platform/workspace/common/workspace'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service/lib/common'; +import { IWorkspaceFolder } from '@opensumi/monaco-editor-core/esm/vs/platform/workspace/common/workspace'; + import styles from './view/console/debug-console.module.less'; const CONTROL_CODES = '\\u0000-\\u0020\\u007f-\\u009f'; diff --git a/packages/debug/src/browser/debug-preferences.ts b/packages/debug/src/browser/debug-preferences.ts index c60b6a8cca..b04e4e3a55 100644 --- a/packages/debug/src/browser/debug-preferences.ts +++ b/packages/debug/src/browser/debug-preferences.ts @@ -1,3 +1,4 @@ +import { Injector } from '@opensumi/di'; import { PreferenceSchema, PreferenceProxy, @@ -6,7 +7,6 @@ import { PreferenceContribution, localize, } from '@opensumi/ide-core-browser'; -import { Injector } from '@opensumi/di'; export const debugPreferencesSchema: PreferenceSchema = { type: 'object', diff --git a/packages/debug/src/browser/debug-progress.service.ts b/packages/debug/src/browser/debug-progress.service.ts index 987b52ea8d..6e0ee3befb 100644 --- a/packages/debug/src/browser/debug-progress.service.ts +++ b/packages/debug/src/browser/debug-progress.service.ts @@ -2,15 +2,18 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IProgress, IProgressStep } from '@opensumi/ide-core-common'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { ProgressLocation } from '@opensumi/ide-core-common'; -import { DebugSession } from './debug-session'; import { Injectable, Autowired } from '@opensumi/di'; -import { DebugState, IDebugSessionManager } from '../common/debug-session'; -import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; import { Event, IDisposable } from '@opensumi/ide-core-browser'; +import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { IProgress, IProgressStep } from '@opensumi/ide-core-common'; +import { ProgressLocation } from '@opensumi/ide-core-common'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + import { IDebugProgress } from '../common/debug-progress'; +import { DebugState, IDebugSessionManager } from '../common/debug-session'; + +import { DebugSession } from './debug-session'; + @Injectable() export class DebugProgressService implements IDebugProgress { diff --git a/packages/debug/src/browser/debug-schema-updater.ts b/packages/debug/src/browser/debug-schema-updater.ts index 5be203148a..7ca596b158 100644 --- a/packages/debug/src/browser/debug-schema-updater.ts +++ b/packages/debug/src/browser/debug-schema-updater.ts @@ -1,8 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; import { deepClone, IJSONSchema, IJSONSchemaRegistry } from '@opensumi/ide-core-browser'; + +import { launchSchemaUri } from '../common'; import { DebugServer, IDebugServer } from '../common/debug-service'; + import { DebugConfigurationManager } from './debug-configuration-manager'; -import { launchSchemaUri } from '../common'; @Injectable() export class DebugSchemaUpdater { diff --git a/packages/debug/src/browser/debug-service.ts b/packages/debug/src/browser/debug-service.ts index e8903b9912..0785867522 100644 --- a/packages/debug/src/browser/debug-service.ts +++ b/packages/debug/src/browser/debug-service.ts @@ -1,7 +1,8 @@ import { Injectable } from '@opensumi/di'; -import { IDebugService, IDebugServiceContributionPoint } from '../common'; import { IJSONSchema, Event, Emitter } from '@opensumi/ide-core-browser'; +import { IDebugService, IDebugServiceContributionPoint } from '../common'; + @Injectable() export class DebugService implements IDebugService { private onDidDebugContributionPointChangeEmitter: Emitter = diff --git a/packages/debug/src/browser/debug-session-connection.ts b/packages/debug/src/browser/debug-session-connection.ts index f2de2368a4..1e974e3ffe 100644 --- a/packages/debug/src/browser/debug-session-connection.ts +++ b/packages/debug/src/browser/debug-session-connection.ts @@ -1,6 +1,7 @@ -import { CancellationToken } from '@opensumi/ide-core-common'; +import { DebugConfiguration } from 'vscode'; + import { Injectable, Optional, Autowired } from '@opensumi/di'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; +import { IWebSocket } from '@opensumi/ide-connection'; import { Event, Emitter, @@ -10,8 +11,10 @@ import { Deferred, getDebugLogger, } from '@opensumi/ide-core-browser'; -import { IWebSocket } from '@opensumi/ide-connection'; +import { CancellationToken } from '@opensumi/ide-core-common'; import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + import { DebugEventTypes, DebugExitEvent, @@ -20,7 +23,8 @@ import { getSequenceId, IDebugSessionManager, } from '../common'; -import { DebugConfiguration } from 'vscode'; + + import { DebugSessionManager } from './debug-session-manager'; export type DebugRequestHandler = (request: DebugProtocol.Request) => any; diff --git a/packages/debug/src/browser/debug-session-contribution.ts b/packages/debug/src/browser/debug-session-contribution.ts index d3d7529fd5..e86c6324fd 100644 --- a/packages/debug/src/browser/debug-session-contribution.ts +++ b/packages/debug/src/browser/debug-session-contribution.ts @@ -1,20 +1,23 @@ import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; import { ContributionProvider } from '@opensumi/ide-core-browser'; -import { DebugSession } from './debug-session'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; +import { IMessageService } from '@opensumi/ide-overlay'; +import { ITerminalApiService } from '@opensumi/ide-terminal-next/lib/common'; + +import { DebugAdapterPath, DebugSessionOptions, IDebugSessionManager } from '../common'; + +import { BreakpointManager } from './breakpoint'; import { DebugPreferences } from './debug-preferences'; +import { DebugSession } from './debug-session'; import { DebugSessionConnection } from './debug-session-connection'; import { DebugSessionManager } from './debug-session-manager'; import { DebugModelManager } from './editor/debug-model-manager'; -import { DebugAdapterPath, DebugSessionOptions, IDebugSessionManager } from '../common'; -import { BreakpointManager } from './breakpoint'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { ITerminalApiService } from '@opensumi/ide-terminal-next/lib/common'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; -import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; + export const DebugSessionContribution = Symbol('DebugSessionContribution'); diff --git a/packages/debug/src/browser/debug-session-manager.ts b/packages/debug/src/browser/debug-session-manager.ts index ef5d98282b..8e3305eb63 100644 --- a/packages/debug/src/browser/debug-session-manager.ts +++ b/packages/debug/src/browser/debug-session-manager.ts @@ -16,7 +16,6 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/debug/src/browser/debug-session-manager.ts import { Injectable, Autowired } from '@opensumi/di'; -import { DebugSession } from './debug-session'; import { WaitUntilEvent, Emitter, @@ -33,7 +32,12 @@ import { COMMON_COMMANDS, CommandService, } from '@opensumi/ide-core-browser'; -import { BreakpointManager } from './breakpoint/breakpoint-manager'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IMessageService } from '@opensumi/ide-overlay'; +import { ITaskService } from '@opensumi/ide-task/lib/common'; +import { IVariableResolverService } from '@opensumi/ide-variable'; + import { DebugConfiguration, DebugError, @@ -50,18 +54,16 @@ import { CONTEXT_DEBUG_TYPE_KEY, DebugState, } from '../common'; -import { DebugStackFrame } from './model/debug-stack-frame'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { IVariableResolverService } from '@opensumi/ide-variable'; -import { DebugThread } from './model/debug-thread'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { DebugSessionContributionRegistry, DebugSessionFactory } from './debug-session-contribution'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { DebugModelManager } from './editor/debug-model-manager'; -import { ITaskService } from '@opensumi/ide-task/lib/common'; -import { isRemoteAttach } from './debugUtils'; import { IDebugProgress } from '../common/debug-progress'; + +import { BreakpointManager } from './breakpoint/breakpoint-manager'; import { DebugContextKey } from './contextkeys/debug-contextkey.service'; +import { DebugSession } from './debug-session'; +import { DebugSessionContributionRegistry, DebugSessionFactory } from './debug-session-contribution'; +import { isRemoteAttach } from './debugUtils'; +import { DebugModelManager } from './editor/debug-model-manager'; +import { DebugStackFrame } from './model/debug-stack-frame'; +import { DebugThread } from './model/debug-thread'; export type WillStartDebugSession = WaitUntilEvent; diff --git a/packages/debug/src/browser/debug-session.ts b/packages/debug/src/browser/debug-session.ts index da6ba904a7..44ec9f2424 100644 --- a/packages/debug/src/browser/debug-session.ts +++ b/packages/debug/src/browser/debug-session.ts @@ -1,4 +1,5 @@ -import { IDebugModel } from './../common/debug-model'; +import debounce = require('lodash.debounce'); + import { Emitter, Event, @@ -10,8 +11,14 @@ import { Mutable, canceled, } from '@opensumi/ide-core-browser'; -import debounce = require('lodash.debounce'); -import { DebugSessionConnection } from './debug-session-connection'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { CancellationTokenSource, CancellationToken, Disposable } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { IMessageService } from '@opensumi/ide-overlay'; +import { ITerminalApiService, TerminalOptions } from '@opensumi/ide-terminal-next'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + import { DebugSessionOptions, IDebugSessionDTO, @@ -26,21 +33,17 @@ import { BreakpointsChangeEvent, IDebugBreakpoint, } from '../common'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { DebugSource } from './model/debug-source'; import { DebugConfiguration } from '../common'; -import { StoppedDetails, DebugThread, DebugThreadData } from './model/debug-thread'; -import { IMessageService } from '@opensumi/ide-overlay'; + +import { DebugEditor } from './../common/debug-editor'; +import { IDebugModel } from './../common/debug-model'; import { BreakpointManager, DebugBreakpoint } from './breakpoint'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { DebugStackFrame } from './model/debug-stack-frame'; +import { DebugSessionConnection } from './debug-session-connection'; import { DebugModelManager } from './editor/debug-model-manager'; -import { CancellationTokenSource, CancellationToken, Disposable } from '@opensumi/ide-core-common'; -import { ITerminalApiService, TerminalOptions } from '@opensumi/ide-terminal-next'; +import { DebugSource } from './model/debug-source'; +import { DebugStackFrame } from './model/debug-stack-frame'; +import { StoppedDetails, DebugThread, DebugThreadData } from './model/debug-thread'; import { ExpressionContainer } from './tree/debug-tree-node.define'; -import { DebugEditor } from './../common/debug-editor'; export class DebugSession implements IDebugSession { protected readonly onDidChangeEmitter = new Emitter(); diff --git a/packages/debug/src/browser/debugUtils.ts b/packages/debug/src/browser/debugUtils.ts index 1b65e6eaca..347dffd960 100644 --- a/packages/debug/src/browser/debugUtils.ts +++ b/packages/debug/src/browser/debugUtils.ts @@ -1,4 +1,5 @@ import { equalsIgnoreCase } from '@opensumi/ide-core-browser'; + import { DebugConfiguration } from '../common'; export function isExtensionHostDebugging(config: DebugConfiguration) { diff --git a/packages/debug/src/browser/editor/debug-breakpoint-widget.ts b/packages/debug/src/browser/editor/debug-breakpoint-widget.ts index 96d2092e83..5baa063585 100644 --- a/packages/debug/src/browser/editor/debug-breakpoint-widget.ts +++ b/packages/debug/src/browser/editor/debug-breakpoint-widget.ts @@ -1,8 +1,8 @@ +import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IContextKey, IContextKeyService } from '@opensumi/ide-core-browser'; -import { CONTEXT_BREAKPOINT_INPUT_FOCUSED } from './../../common/constants'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Disposable, positionToRange } from '@opensumi/ide-core-common'; -import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { DebugBreakpointWidgetContext, DebugEditor, @@ -10,6 +10,8 @@ import { TSourceBrekpointProperties, } from '../../common'; import { DebugBreakpointsService } from '../view/breakpoints/debug-breakpoints.service'; + +import { CONTEXT_BREAKPOINT_INPUT_FOCUSED } from './../../common/constants'; import { DebugBreakpointZoneWidget } from './debug-breakpoint-zone-widget'; export enum TopStackType { diff --git a/packages/debug/src/browser/editor/debug-breakpoint-zone-widget.tsx b/packages/debug/src/browser/editor/debug-breakpoint-zone-widget.tsx index 0cd4ec8755..c1973a4669 100644 --- a/packages/debug/src/browser/editor/debug-breakpoint-zone-widget.tsx +++ b/packages/debug/src/browser/editor/debug-breakpoint-zone-widget.tsx @@ -1,21 +1,24 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as monacoModes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import React from 'react'; import ReactDOM from 'react-dom'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { Select, Option } from '@opensumi/ide-components'; +import { localize, Emitter, Event } from '@opensumi/ide-core-common'; +import { ICodeEditor } from '@opensumi/ide-editor'; import { ZoneWidget } from '@opensumi/ide-monaco-enhance'; +import { ICSSStyleService } from '@opensumi/ide-theme'; +import * as monacoModes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { BreakpointChangeData, DebugBreakpointWidgetContext, DebugEditor, TSourceBrekpointProperties, } from '../../common'; -import styles from './debug-breakpoint.module.less'; -import { Select, Option } from '@opensumi/ide-components'; -import { localize, Emitter, Event } from '@opensumi/ide-core-common'; import { DebugBreakpointsService } from '../view/breakpoints/debug-breakpoints.service'; -import { ICodeEditor } from '@opensumi/ide-editor'; -import { Injectable, Autowired } from '@opensumi/di'; -import { ICSSStyleService } from '@opensumi/ide-theme'; + +import styles from './debug-breakpoint.module.less'; @Injectable({ multiple: true }) export class DebugBreakpointZoneWidget extends ZoneWidget { diff --git a/packages/debug/src/browser/editor/debug-editor-contribution.ts b/packages/debug/src/browser/editor/debug-editor-contribution.ts index 48da1127f7..3d37a511ce 100644 --- a/packages/debug/src/browser/editor/debug-editor-contribution.ts +++ b/packages/debug/src/browser/editor/debug-editor-contribution.ts @@ -1,11 +1,10 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { DEFAULT_WORD_REGEXP } from './../debugUtils'; -import { InlineValueContext } from './../../common/inline-values'; -import { DebugModelManager } from './debug-model-manager'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as strings from '@opensumi/ide-core-common/lib/utils/strings'; -import { IEditorFeatureContribution } from '@opensumi/ide-editor/lib/browser'; -import { IEditor, IDecorationApplyOptions } from '@opensumi/ide-editor'; +import { Injectable, Autowired } from '@opensumi/di'; +import { + IContextKeyService, + PreferenceService, + MonacoOverrideServiceRegistry, + ServiceNames, +} from '@opensumi/ide-core-browser'; import { IDisposable, Disposable, @@ -17,19 +16,23 @@ import { Event, } from '@opensumi/ide-core-common'; import { flatten } from '@opensumi/ide-core-common/lib/arrays'; -import { Injectable, Autowired } from '@opensumi/di'; -import { - IContextKeyService, - PreferenceService, - MonacoOverrideServiceRegistry, - ServiceNames, -} from '@opensumi/ide-core-browser'; -import { InlineValuesProviderRegistry } from './inline-values'; -import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; -import { StandardTokenType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { Constants } from '@opensumi/ide-core-common/lib/uint'; +import * as strings from '@opensumi/ide-core-common/lib/utils/strings'; +import { IEditor, IDecorationApplyOptions } from '@opensumi/ide-editor'; +import { IEditorFeatureContribution } from '@opensumi/ide-editor/lib/browser'; import { MonacoCodeService } from '@opensumi/ide-editor/lib/browser/editor.override'; +import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; +import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import { StandardTokenType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + + +import { DebugContextKey } from '../contextkeys/debug-contextkey.service'; +import { DebugSessionManager } from '../debug-session-manager'; +import { DebugStackFrame } from '../model'; +import { DebugVariable, DebugWatchNode, DebugWatchRoot } from '../tree'; + import { CONTEXT_DEBUG_STOPPED_KEY, DebugState, @@ -37,10 +40,10 @@ import { CONTEXT_IN_DEBUG_MODE, CONTEXT_IN_DEBUG_MODE_KEY, } from './../../common'; -import { DebugSessionManager } from '../debug-session-manager'; -import { DebugStackFrame } from '../model'; -import { DebugVariable, DebugWatchNode, DebugWatchRoot } from '../tree'; -import { DebugContextKey } from '../contextkeys/debug-contextkey.service'; +import { InlineValueContext } from './../../common/inline-values'; +import { DEFAULT_WORD_REGEXP } from './../debugUtils'; +import { DebugModelManager } from './debug-model-manager'; +import { InlineValuesProviderRegistry } from './inline-values'; const INLINE_VALUE_DECORATION_KEY = 'inlinevaluedecoration'; const MAX_NUM_INLINE_VALUES = 100; diff --git a/packages/debug/src/browser/editor/debug-expression-provider.ts b/packages/debug/src/browser/editor/debug-expression-provider.ts index 895d164d99..51fd336c1f 100644 --- a/packages/debug/src/browser/editor/debug-expression-provider.ts +++ b/packages/debug/src/browser/editor/debug-expression-provider.ts @@ -1,8 +1,10 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { Injectable, Autowired } from '@opensumi/di'; -import { IEvaluatableExpressionService } from './evaluatable-expression'; import { CancellationTokenSource, coalesce, IRange } from '@opensumi/ide-core-common'; +import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { IEvaluatableExpressionService } from './evaluatable-expression'; + @Injectable() export class DebugExpressionProvider { diff --git a/packages/debug/src/browser/editor/debug-hover-model.ts b/packages/debug/src/browser/editor/debug-hover-model.ts index 9f7b3261c3..0959177ee5 100644 --- a/packages/debug/src/browser/editor/debug-hover-model.ts +++ b/packages/debug/src/browser/editor/debug-hover-model.ts @@ -1,6 +1,7 @@ -import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { Injectable, Optional } from '@opensumi/di'; +import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; + import { ExpressionContainer } from '../tree/debug-tree-node.define'; @Injectable({ multiple: true }) diff --git a/packages/debug/src/browser/editor/debug-hover-source.ts b/packages/debug/src/browser/editor/debug-hover-source.ts index 590fd4db08..57cbf39232 100644 --- a/packages/debug/src/browser/editor/debug-hover-source.ts +++ b/packages/debug/src/browser/editor/debug-hover-source.ts @@ -1,3 +1,7 @@ +import { Injectable, Autowired } from '@opensumi/di'; +import { Event, Emitter } from '@opensumi/ide-core-browser'; + +import { IDebugSessionManager } from '../../common'; import { DebugSessionManager } from '../debug-session-manager'; import { DebugVariable, @@ -5,9 +9,7 @@ import { DebugVariableContainer, DebugHoverVariableRoot, } from '../tree/debug-tree-node.define'; -import { Injectable, Autowired } from '@opensumi/di'; -import { IDebugSessionManager } from '../../common'; -import { Event, Emitter } from '@opensumi/ide-core-browser'; + export type ExpressionVariable = DebugHoverVariableRoot | DebugVariable | DebugVariableContainer | undefined; diff --git a/packages/debug/src/browser/editor/debug-hover-tree.model.service.ts b/packages/debug/src/browser/editor/debug-hover-tree.model.service.ts index dcac32bd7b..d9ac958e6d 100644 --- a/packages/debug/src/browser/editor/debug-hover-tree.model.service.ts +++ b/packages/debug/src/browser/editor/debug-hover-tree.model.service.ts @@ -1,3 +1,5 @@ +import pSeries = require('p-series'); + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { DecorationsManager, @@ -7,13 +9,14 @@ import { TreeNodeEvent, } from '@opensumi/ide-components'; import { Emitter, Deferred, Event, DisposableCollection } from '@opensumi/ide-core-browser'; -import { DebugHoverModel } from './debug-hover-model'; import { Path } from '@opensumi/ide-core-common/lib/path'; -import pSeries = require('p-series'); + import { DebugVariable, ExpressionContainer, ExpressionNode } from '../tree/debug-tree-node.define'; -import { ExpressionVariable, DebugHoverSource } from './debug-hover-source'; import styles from '../view/variables/debug-variables.module.less'; +import { DebugHoverModel } from './debug-hover-model'; +import { ExpressionVariable, DebugHoverSource } from './debug-hover-source'; + export interface IDebugVariablesHandle extends IRecycleTreeHandle { hasDirectFocus: () => boolean; } diff --git a/packages/debug/src/browser/editor/debug-hover-widget.tsx b/packages/debug/src/browser/editor/debug-hover-widget.tsx index 6e02f863cc..f6d35086bf 100644 --- a/packages/debug/src/browser/editor/debug-hover-widget.tsx +++ b/packages/debug/src/browser/editor/debug-hover-widget.tsx @@ -1,7 +1,7 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import debounce = require('lodash.debounce'); import React from 'react'; import ReactDOM from 'react-dom'; -import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; + import { Injectable, Autowired } from '@opensumi/di'; import { DisposableCollection, @@ -10,7 +10,9 @@ import { ConfigProvider, IReporterService, } from '@opensumi/ide-core-browser'; -import { DebugSessionManager } from '../debug-session-manager'; +import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { DebugEditor, IDebugSessionManager, @@ -19,10 +21,12 @@ import { ShowDebugHoverOptions, HideDebugHoverOptions, } from '../../common'; +import { DebugSessionManager } from '../debug-session-manager'; + import { DebugExpressionProvider } from './debug-expression-provider'; import { DebugHoverSource } from './debug-hover-source'; import { DebugHoverView } from './debug-hover.view'; -import debounce = require('lodash.debounce'); + @Injectable() export class DebugHoverWidget implements IDebugHoverWidget { diff --git a/packages/debug/src/browser/editor/debug-hover.view.tsx b/packages/debug/src/browser/editor/debug-hover.view.tsx index 719139e983..6359525ce0 100644 --- a/packages/debug/src/browser/editor/debug-hover.view.tsx +++ b/packages/debug/src/browser/editor/debug-hover.view.tsx @@ -1,11 +1,11 @@ -import React from 'react'; -import { useInjectable } from '@opensumi/ide-core-browser'; -import { observer } from 'mobx-react-lite'; -import styles from './debug-hover.module.less'; import cls from 'classnames'; -import { DebugHoverTreeModelService, IDebugHoverUpdateData } from './debug-hover-tree.model.service'; +import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { IRecycleTreeHandle, RecycleTree, INodeRendererWrapProps, TreeNodeEvent } from '@opensumi/ide-components'; -import { DebugHoverModel } from './debug-hover-model'; +import { useInjectable } from '@opensumi/ide-core-browser'; +import { IDisposable } from '@opensumi/ide-core-common'; + import { ExpressionNode, ExpressionContainer, @@ -13,7 +13,11 @@ import { DebugVariable, } from '../tree/debug-tree-node.define'; import { DebugVariableRenderedNode, DEBUG_VARIABLE_TREE_NODE_HEIGHT } from '../view/variables/debug-variables.view'; -import { IDisposable } from '@opensumi/ide-core-common'; + +import { DebugHoverModel } from './debug-hover-model'; +import { DebugHoverTreeModelService, IDebugHoverUpdateData } from './debug-hover-tree.model.service'; +import styles from './debug-hover.module.less'; + export const DebugHoverView = observer(() => { const debugHoverTreeModelService: DebugHoverTreeModelService = useInjectable(DebugHoverTreeModelService); diff --git a/packages/debug/src/browser/editor/debug-model-manager.ts b/packages/debug/src/browser/editor/debug-model-manager.ts index 6863742f8b..a6235b49cd 100644 --- a/packages/debug/src/browser/editor/debug-model-manager.ts +++ b/packages/debug/src/browser/editor/debug-model-manager.ts @@ -1,8 +1,9 @@ -import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { Disposable, URI, Emitter, Event, DisposableCollection } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; +import { Disposable, URI, Emitter, Event, DisposableCollection } from '@opensumi/ide-core-common'; import { EditorCollectionService, ICodeEditor, WorkbenchEditorService } from '@opensumi/ide-editor'; +import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { DebugModelFactory, IDebugModel, BreakpointsChangeEvent } from '../../common'; import { BreakpointManager } from '../breakpoint'; import { DebugConfigurationManager } from '../debug-configuration-manager'; diff --git a/packages/debug/src/browser/editor/debug-model.ts b/packages/debug/src/browser/editor/debug-model.ts index 39b479f8c5..4f26ac655e 100644 --- a/packages/debug/src/browser/editor/debug-model.ts +++ b/packages/debug/src/browser/editor/debug-model.ts @@ -1,15 +1,17 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { URI, DisposableCollection, isOSX, memoize, Disposable, uuid } from '@opensumi/ide-core-common'; -import { Injector, Injectable, Autowired } from '@opensumi/di'; -import { DebugSessionManager } from '../debug-session-manager'; -import { DebugBreakpointWidget } from './debug-breakpoint-widget'; -import { BreakpointManager } from '../breakpoint'; -import { DebugEditor } from '../../common/debug-editor'; -import { IDebugSessionManager } from '../../common/debug-session'; -import { DebugHoverWidget } from './debug-hover-widget'; import debounce = require('lodash.debounce'); -import * as options from './debug-styles'; -import { DebugBreakpoint, isDebugBreakpoint } from '../breakpoint'; + +import { Injector, Injectable, Autowired } from '@opensumi/di'; +import { DomListener, IContextKeyService, IReporterService } from '@opensumi/ide-core-browser'; +import { + ICtxMenuRenderer, + generateMergedCtxMenu, + IMenu, + MenuId, + AbstractMenuService, +} from '@opensumi/ide-core-browser/lib/menu/next'; +import { URI, DisposableCollection, isOSX, memoize, Disposable, uuid } from '@opensumi/ide-core-common'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IDebugModel, DEBUG_REPORT_NAME, @@ -18,15 +20,17 @@ import { DebugBreakpointWidgetContext, IDebugBreakpoint, } from '../../common'; -import { - ICtxMenuRenderer, - generateMergedCtxMenu, - IMenu, - MenuId, - AbstractMenuService, -} from '@opensumi/ide-core-browser/lib/menu/next'; -import { DomListener, IContextKeyService, IReporterService } from '@opensumi/ide-core-browser'; +import { DebugEditor } from '../../common/debug-editor'; +import { IDebugSessionManager } from '../../common/debug-session'; +import { BreakpointManager } from '../breakpoint'; +import { DebugBreakpoint, isDebugBreakpoint } from '../breakpoint'; import { DebugDecorator } from '../breakpoint/breakpoint-decoration'; +import { DebugSessionManager } from '../debug-session-manager'; + +import { DebugBreakpointWidget } from './debug-breakpoint-widget'; +import { DebugHoverWidget } from './debug-hover-widget'; +import * as options from './debug-styles'; + @Injectable() export class DebugModel implements IDebugModel { diff --git a/packages/debug/src/browser/editor/debug-run-to-cursor.service.ts b/packages/debug/src/browser/editor/debug-run-to-cursor.service.ts index 4c359b02cc..7aac4685a0 100644 --- a/packages/debug/src/browser/editor/debug-run-to-cursor.service.ts +++ b/packages/debug/src/browser/editor/debug-run-to-cursor.service.ts @@ -1,13 +1,15 @@ -import { DebugBreakpointsService } from './../view/breakpoints/debug-breakpoints.service'; -import { DebugBreakpoint } from './../breakpoint/breakpoint-marker'; +import { Injectable, Autowired } from '@opensumi/di'; +import { URI } from '@opensumi/ide-core-common'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { Position } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/position'; -import { URI } from '@opensumi/ide-core-common'; -import { DebugSessionManager } from './../debug-session-manager'; -import { Injectable, Autowired } from '@opensumi/di'; -import { IDebugSessionManager, DebugState } from './../../common/debug-session'; + import { IDebugBreakpoint } from '../../common'; +import { IDebugSessionManager, DebugState } from './../../common/debug-session'; +import { DebugBreakpoint } from './../breakpoint/breakpoint-marker'; +import { DebugSessionManager } from './../debug-session-manager'; +import { DebugBreakpointsService } from './../view/breakpoints/debug-breakpoints.service'; + @Injectable() export class DebugRunToCursorService { @Autowired(IDebugSessionManager) diff --git a/packages/debug/src/browser/editor/evaluatable-expression.ts b/packages/debug/src/browser/editor/evaluatable-expression.ts index 19817d9ff4..5e41b3a474 100644 --- a/packages/debug/src/browser/editor/evaluatable-expression.ts +++ b/packages/debug/src/browser/editor/evaluatable-expression.ts @@ -1,6 +1,6 @@ import { Injectable } from '@opensumi/di'; -import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { IDisposable } from '@opensumi/ide-core-common'; +import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { LanguageFeatureRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/languageFeatureRegistry'; import { EvaluatableExpressionProvider } from '../../common/evaluatable-expression'; diff --git a/packages/debug/src/browser/editor/inline-values.ts b/packages/debug/src/browser/editor/inline-values.ts index a0549e0e77..8ca4a6c709 100644 --- a/packages/debug/src/browser/editor/inline-values.ts +++ b/packages/debug/src/browser/editor/inline-values.ts @@ -1,4 +1,5 @@ -import { InlineValuesProvider } from './../../common/inline-values'; import { LanguageFeatureRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/languageFeatureRegistry'; +import { InlineValuesProvider } from './../../common/inline-values'; + export const InlineValuesProviderRegistry = new LanguageFeatureRegistry(); diff --git a/packages/debug/src/browser/index.ts b/packages/debug/src/browser/index.ts index 34d2e9f42a..39e25a4d0f 100644 --- a/packages/debug/src/browser/index.ts +++ b/packages/debug/src/browser/index.ts @@ -10,11 +10,13 @@ import { IDebugService, IDebugSessionManager, } from '../common'; + import { BreakpointManager } from './breakpoint'; import { DebugCallStackItemTypeKey } from './contextkeys'; import { DebugConfigurationManager } from './debug-configuration-manager'; import { DebugContribution } from './debug-contribution'; import { injectDebugPreferences } from './debug-preferences'; +import { DebugProgressService } from './debug-progress.service'; import { DebugService } from './debug-service'; import { DebugSessionContribution, @@ -26,17 +28,16 @@ import { import { DebugSessionManager } from './debug-session-manager'; import { DebugExpressionProvider, DebugModel, DebugModelManager } from './editor'; import { DebugHoverSource } from './editor/debug-hover-source'; +import { EvaluatableExpressionServiceImpl, IEvaluatableExpressionService } from './editor/evaluatable-expression'; import { LaunchFolderPreferenceProvider } from './preferences/launch-folder-preference-provider'; import { LaunchPreferencesContribution } from './preferences/launch-preferences-contribution'; import { DebugToolbarOverlayWidget } from './view/configuration/debug-toolbar.view'; -import { VariablesPanelContribution } from './view/variables/debug-variables.contribution'; import { DebugConsoleContribution } from './view/console/debug-console.contribution'; +import { DebugCallStackContribution } from './view/frames/debug-call-stack.contribution'; +import { VariablesPanelContribution } from './view/variables/debug-variables.contribution'; import { WatchPanelContribution } from './view/watch/debug-watch.contribution'; import './debug-style.less'; -import { EvaluatableExpressionServiceImpl, IEvaluatableExpressionService } from './editor/evaluatable-expression'; -import { DebugCallStackContribution } from './view/frames/debug-call-stack.contribution'; -import { DebugProgressService } from './debug-progress.service'; @Injectable() export class DebugModule extends BrowserModule { diff --git a/packages/debug/src/browser/markers/marker-manager.ts b/packages/debug/src/browser/markers/marker-manager.ts index f2d6ecb7e6..ce4a980b2d 100644 --- a/packages/debug/src/browser/markers/marker-manager.ts +++ b/packages/debug/src/browser/markers/marker-manager.ts @@ -19,6 +19,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Event, Emitter, URI } from '@opensumi/ide-core-browser'; import { FileChangeEvent, FileChangeType } from '@opensumi/ide-file-service'; import { IFileServiceClient } from '@opensumi/ide-file-service'; + import { Marker } from './marker'; /* diff --git a/packages/debug/src/browser/model/debug-source.ts b/packages/debug/src/browser/model/debug-source.ts index 1a96557cf0..10e43cfe81 100644 --- a/packages/debug/src/browser/model/debug-source.ts +++ b/packages/debug/src/browser/model/debug-source.ts @@ -15,15 +15,18 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/debug/src/browser/model/debug-source.ts -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; -import { DebugSession } from '../debug-session'; import { URI, Uri, IRange } from '@opensumi/ide-core-browser'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; import { WorkbenchEditorService, IResourceOpenOptions } from '@opensumi/ide-editor'; import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service'; -import { DebugStackFrame } from './debug-stack-frame'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + +import { DebugSession } from '../debug-session'; import { DebugModelManager } from '../editor'; +import { DebugStackFrame } from './debug-stack-frame'; + + export class DebugSourceData { readonly raw: DebugProtocol.Source; } diff --git a/packages/debug/src/browser/model/debug-stack-frame.ts b/packages/debug/src/browser/model/debug-stack-frame.ts index 6d2fa3d7a1..4df5c41b64 100644 --- a/packages/debug/src/browser/model/debug-stack-frame.ts +++ b/packages/debug/src/browser/model/debug-stack-frame.ts @@ -1,12 +1,15 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; -import { DebugSession } from '../debug-session'; -import { DebugThread } from './debug-thread'; -import { DebugSource } from './debug-source'; -import { IResourceOpenOptions } from '@opensumi/ide-editor'; import { IRange } from '@opensumi/ide-core-browser'; +import { IResourceOpenOptions } from '@opensumi/ide-editor'; import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + +import { DebugSession } from '../debug-session'; import { DebugScope, ExpressionContainer } from '../tree/debug-tree-node.define'; +import { DebugSource } from './debug-source'; +import { DebugThread } from './debug-thread'; + + export class DebugStackFrameData { readonly raw: DebugProtocol.StackFrame; } diff --git a/packages/debug/src/browser/model/debug-thread.ts b/packages/debug/src/browser/model/debug-thread.ts index a97e5b75cc..960588831d 100644 --- a/packages/debug/src/browser/model/debug-thread.ts +++ b/packages/debug/src/browser/model/debug-thread.ts @@ -1,8 +1,11 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; import { Event, Emitter } from '@opensumi/ide-core-browser'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + +import { DEBUG_REPORT_NAME } from '../../common'; import { DebugSession } from '../debug-session'; + import { DebugStackFrame } from './debug-stack-frame'; -import { DEBUG_REPORT_NAME } from '../../common'; + export type StoppedDetails = DebugProtocol.StoppedEvent['body'] & { framesErrorMessage?: string; diff --git a/packages/debug/src/browser/model/debug-watch.ts b/packages/debug/src/browser/model/debug-watch.ts index e5ee2df842..9dd7688c8a 100644 --- a/packages/debug/src/browser/model/debug-watch.ts +++ b/packages/debug/src/browser/model/debug-watch.ts @@ -1,9 +1,11 @@ +import throttle = require('lodash.throttle'); + +import { DisposableCollection, Emitter, Event, IReporterService } from '@opensumi/ide-core-browser'; + import { DEBUG_REPORT_NAME } from '../../common'; +import { DEBUG_COMMANDS } from '../debug-contribution'; import { DebugSessionManager } from '../debug-session-manager'; -import { DisposableCollection, Emitter, Event, IReporterService } from '@opensumi/ide-core-browser'; -import throttle = require('lodash.throttle'); import { DebugWatchRoot, DebugWatchNode } from '../tree/debug-tree-node.define'; -import { DEBUG_COMMANDS } from '../debug-contribution'; export const IDebugWatchData = Symbol('IDebugWatchData'); export interface IDebugWatchData { diff --git a/packages/debug/src/browser/preferences/launch-preferences-contribution.ts b/packages/debug/src/browser/preferences/launch-preferences-contribution.ts index 629b597013..e0f717a4f8 100644 --- a/packages/debug/src/browser/preferences/launch-preferences-contribution.ts +++ b/packages/debug/src/browser/preferences/launch-preferences-contribution.ts @@ -1,4 +1,5 @@ import { PreferenceContribution, PreferenceSchema, Domain, PreferenceConfiguration } from '@opensumi/ide-core-browser'; + import { launchPreferencesSchema } from './launch-preferences'; @Domain(PreferenceContribution, PreferenceConfiguration) diff --git a/packages/debug/src/browser/preferences/launch-preferences.ts b/packages/debug/src/browser/preferences/launch-preferences.ts index aed4970114..9b2a8660d3 100644 --- a/packages/debug/src/browser/preferences/launch-preferences.ts +++ b/packages/debug/src/browser/preferences/launch-preferences.ts @@ -1,4 +1,5 @@ import { PreferenceSchema } from '@opensumi/ide-core-browser'; + import { launchSchemaUri } from '../../common'; export const launchPreferencesSchema: PreferenceSchema = { diff --git a/packages/debug/src/browser/tree/debug-console-tree-node.define.tsx b/packages/debug/src/browser/tree/debug-console-tree-node.define.tsx index 251d9ed879..27f468e68f 100644 --- a/packages/debug/src/browser/tree/debug-console-tree-node.define.tsx +++ b/packages/debug/src/browser/tree/debug-console-tree-node.define.tsx @@ -1,11 +1,14 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; -import { MessageType } from '@opensumi/ide-core-browser'; -import { TreeNode, ITree, CompositeTreeNode } from '@opensumi/ide-components'; -import debugConsoleStyles from '../view/console/debug-console.module.less'; +import cls from 'classnames'; import React from 'react'; import ReactDOM from 'react-dom'; -import cls from 'classnames'; + +import { TreeNode, ITree, CompositeTreeNode } from '@opensumi/ide-components'; +import { MessageType } from '@opensumi/ide-core-browser'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + import { LinkDetector } from '../debug-link-detector'; +import debugConsoleStyles from '../view/console/debug-console.module.less'; + const getColor = (severity?: MessageType): string => { if (typeof severity === 'undefined') { diff --git a/packages/debug/src/browser/tree/debug-tree-node.define.ts b/packages/debug/src/browser/tree/debug-tree-node.define.ts index aad2c661e4..02378ee871 100644 --- a/packages/debug/src/browser/tree/debug-tree-node.define.ts +++ b/packages/debug/src/browser/tree/debug-tree-node.define.ts @@ -1,10 +1,13 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; -import { DebugSession } from '../debug-session'; -import { MessageType, localize } from '@opensumi/ide-core-browser'; import { TreeNode, CompositeTreeNode, ITree, ITreeNodeOrCompositeTreeNode } from '@opensumi/ide-components'; -import { AnsiConsoleNode } from './debug-console-tree-node.define'; +import { MessageType, localize } from '@opensumi/ide-core-browser'; import { IRange } from '@opensumi/ide-core-common'; import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + +import { DebugSession } from '../debug-session'; + +import { AnsiConsoleNode } from './debug-console-tree-node.define'; + export class ExpressionTreeService { constructor(private session?: DebugSession, private source?: DebugProtocol.Source, private line?: number | string) {} diff --git a/packages/debug/src/browser/view/breakpoints/debug-breakpoints.service.ts b/packages/debug/src/browser/view/breakpoints/debug-breakpoints.service.ts index 335620f2a2..e9a52c2be6 100644 --- a/packages/debug/src/browser/view/breakpoints/debug-breakpoints.service.ts +++ b/packages/debug/src/browser/view/breakpoints/debug-breakpoints.service.ts @@ -1,7 +1,15 @@ -import { ICodeEditor, EditorCollectionService, getSimpleEditorOptions } from '@opensumi/ide-editor'; -import { Injectable, Autowired } from '@opensumi/di'; import { observable, action, runInAction } from 'mobx'; -import { DebugViewModel } from '../debug-view-model'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { URI, WithEventBus, OnEvent, IContextKeyService, IReporterService, Schemas } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { ICodeEditor, EditorCollectionService, getSimpleEditorOptions } from '@opensumi/ide-editor'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkspaceEditDidRenameFileEvent, WorkspaceEditDidDeleteFileEvent } from '@opensumi/ide-workspace-edit'; + +import { DEBUG_REPORT_NAME, CONTEXT_IN_DEBUG_MODE_KEY, IDebugBreakpoint } from '../../../common'; +import { IDebugSessionManager } from '../../../common/debug-session'; import { DebugBreakpoint, DebugExceptionBreakpoint, @@ -10,15 +18,10 @@ import { BreakpointManager, DebugDecorator, } from '../../breakpoint'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { URI, WithEventBus, OnEvent, IContextKeyService, IReporterService, Schemas } from '@opensumi/ide-core-browser'; -import { BreakpointItem } from './debug-breakpoints.view'; -import { WorkspaceEditDidRenameFileEvent, WorkspaceEditDidDeleteFileEvent } from '@opensumi/ide-workspace-edit'; -import { IDebugSessionManager } from '../../../common/debug-session'; import { DebugSessionManager } from '../../debug-session-manager'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { DEBUG_REPORT_NAME, CONTEXT_IN_DEBUG_MODE_KEY, IDebugBreakpoint } from '../../../common'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { DebugViewModel } from '../debug-view-model'; + +import { BreakpointItem } from './debug-breakpoints.view'; @Injectable() export class DebugBreakpointsService extends WithEventBus { diff --git a/packages/debug/src/browser/view/breakpoints/debug-breakpoints.view.tsx b/packages/debug/src/browser/view/breakpoints/debug-breakpoints.view.tsx index 37bb0a629b..0e6cc93646 100644 --- a/packages/debug/src/browser/view/breakpoints/debug-breakpoints.view.tsx +++ b/packages/debug/src/browser/view/breakpoints/debug-breakpoints.view.tsx @@ -1,11 +1,13 @@ -import React from 'react'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; -import { DebugBreakpointsService } from './debug-breakpoints.service'; -import { useInjectable, ViewState, CommandService, EDITOR_COMMANDS, URI, getIcon } from '@opensumi/ide-core-browser'; -import styles from './debug-breakpoints.module.less'; import cls from 'classnames'; -import { CheckBox } from '@opensumi/ide-components'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + +import { CheckBox } from '@opensumi/ide-components'; +import { Badge, RecycleList } from '@opensumi/ide-components'; +import { useInjectable, ViewState, CommandService, EDITOR_COMMANDS, URI, getIcon } from '@opensumi/ide-core-browser'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + +import { IDebugBreakpoint, IDebugSessionManager, ISourceBreakpoint } from '../../../common'; import { DebugBreakpoint, DebugExceptionBreakpoint, @@ -13,9 +15,10 @@ import { isRuntimeBreakpoint, getStatus, } from '../../breakpoint'; -import { Badge, RecycleList } from '@opensumi/ide-components'; import { DebugSessionManager } from '../../debug-session-manager'; -import { IDebugBreakpoint, IDebugSessionManager, ISourceBreakpoint } from '../../../common'; + +import styles from './debug-breakpoints.module.less'; +import { DebugBreakpointsService } from './debug-breakpoints.service'; export interface BreakpointItem { name: string; diff --git a/packages/debug/src/browser/view/configuration/debug-configuration.service.ts b/packages/debug/src/browser/view/configuration/debug-configuration.service.ts index a37074c350..8c00ecd3a0 100644 --- a/packages/debug/src/browser/view/configuration/debug-configuration.service.ts +++ b/packages/debug/src/browser/view/configuration/debug-configuration.service.ts @@ -1,18 +1,20 @@ +import { observable, action } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; +import { URI, PreferenceService, isUndefined } from '@opensumi/ide-core-browser'; import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { DebugConfigurationManager } from '../../debug-configuration-manager'; -import { observable, action } from 'mobx'; + import { DebugSessionOptions, DEFAULT_ADD_CONFIGURATION_KEY, DEFAULT_CONFIGURATION_NAME_SEPARATOR, DEFAULT_CONFIGURATION_INDEX_SEPARATOR, } from '../../../common'; -import { URI, PreferenceService, isUndefined } from '@opensumi/ide-core-browser'; -import { DebugSessionManager } from '../../debug-session-manager'; -import { DebugViewModel } from '../debug-view-model'; import { IDebugSessionManager } from '../../../common/debug-session'; +import { DebugConfigurationManager } from '../../debug-configuration-manager'; +import { DebugSessionManager } from '../../debug-session-manager'; import { DebugConsoleService } from '../console/debug-console.service'; +import { DebugViewModel } from '../debug-view-model'; @Injectable() export class DebugConfigurationService { diff --git a/packages/debug/src/browser/view/configuration/debug-configuration.view.tsx b/packages/debug/src/browser/view/configuration/debug-configuration.view.tsx index b5ea95bfb9..abec7eda37 100644 --- a/packages/debug/src/browser/view/configuration/debug-configuration.view.tsx +++ b/packages/debug/src/browser/view/configuration/debug-configuration.view.tsx @@ -1,13 +1,12 @@ -import React from 'react'; -import styles from './debug-configuration.module.less'; import cls from 'classnames'; -import { useInjectable, localize, isElectronRenderer, URI } from '@opensumi/ide-core-browser'; -import { DebugAction } from '../../components'; -import { DebugConfigurationService } from './debug-configuration.service'; import { observer } from 'mobx-react-lite'; -import { DebugToolbarView } from './debug-toolbar.view'; +import React from 'react'; + + import { Select, Option } from '@opensumi/ide-components'; +import { useInjectable, localize, isElectronRenderer, URI } from '@opensumi/ide-core-browser'; import { Select as NativeSelect } from '@opensumi/ide-core-browser/lib/components/select'; + import { DEFAULT_ADD_CONFIGURATION_KEY, DEFAULT_NO_CONFIGURATION_KEY, @@ -15,6 +14,11 @@ import { DEFAULT_CONFIGURATION_NAME_SEPARATOR, DebugSessionOptions, } from '../../../common'; +import { DebugAction } from '../../components'; + +import styles from './debug-configuration.module.less'; +import { DebugConfigurationService } from './debug-configuration.service'; +import { DebugToolbarView } from './debug-toolbar.view'; interface ConfigurationSelectorProps { currentValue: string; diff --git a/packages/debug/src/browser/view/configuration/debug-toolbar.service.ts b/packages/debug/src/browser/view/configuration/debug-toolbar.service.ts index a9d298922a..1159e963a1 100644 --- a/packages/debug/src/browser/view/configuration/debug-toolbar.service.ts +++ b/packages/debug/src/browser/view/configuration/debug-toolbar.service.ts @@ -1,11 +1,13 @@ -import { Injectable, Autowired } from '@opensumi/di'; import { observable, action } from 'mobx'; -import { DebugViewModel } from '../debug-view-model'; -import { DebugSession } from '../../debug-session'; + +import { Injectable, Autowired } from '@opensumi/di'; import { IContextKeyService, IReporterService } from '@opensumi/ide-core-browser'; import { AbstractContextMenuService, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; + import { DebugState, DEBUG_REPORT_NAME } from '../../../common'; +import { DebugSession } from '../../debug-session'; +import { DebugViewModel } from '../debug-view-model'; @Injectable() export class DebugToolbarService { diff --git a/packages/debug/src/browser/view/configuration/debug-toolbar.view.tsx b/packages/debug/src/browser/view/configuration/debug-toolbar.view.tsx index b86441fd22..57eed3bc31 100644 --- a/packages/debug/src/browser/view/configuration/debug-toolbar.view.tsx +++ b/packages/debug/src/browser/view/configuration/debug-toolbar.view.tsx @@ -1,20 +1,23 @@ -import { Injectable } from '@opensumi/di'; -import { Option, Select } from '@opensumi/ide-components'; -import { getIcon, isElectronRenderer, localize, PreferenceService, useInjectable } from '@opensumi/ide-core-browser'; -import { Select as NativeSelect } from '@opensumi/ide-core-browser/lib/components/select'; import cls from 'classnames'; import { action, observable } from 'mobx'; import { observer } from 'mobx-react-lite'; import React from 'react'; +import { Injectable } from '@opensumi/di'; +import { Option, Select } from '@opensumi/ide-components'; +import { getIcon, isElectronRenderer, localize, PreferenceService, useInjectable } from '@opensumi/ide-core-browser'; +import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { Select as NativeSelect } from '@opensumi/ide-core-browser/lib/components/select'; + +import { DebugState } from '../../../common'; import { DebugAction } from '../../components'; import { DebugSession } from '../../debug-session'; import { isExtensionHostDebugging } from '../../debugUtils'; + +import styles from './debug-configuration.module.less'; import { DebugConfigurationService } from './debug-configuration.service'; import { DebugToolbarService } from './debug-toolbar.service'; -import styles from './debug-configuration.module.less'; -import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { DebugState } from '../../../common'; + @Injectable() class FloatController { diff --git a/packages/debug/src/browser/view/console/debug-console-filter.model.ts b/packages/debug/src/browser/view/console/debug-console-filter.model.ts index 3a11f5a388..cca363ad9d 100644 --- a/packages/debug/src/browser/view/console/debug-console-filter.model.ts +++ b/packages/debug/src/browser/view/console/debug-console-filter.model.ts @@ -1,5 +1,5 @@ -import { matchesFuzzy } from '@opensumi/ide-core-common/lib/filters'; import { Injectable } from '@opensumi/di'; +import { matchesFuzzy } from '@opensumi/ide-core-common/lib/filters'; import { splitGlobAware } from '@opensumi/ide-core-common/lib/utils/glob'; interface ParsedQuery { diff --git a/packages/debug/src/browser/view/console/debug-console-filter.service.ts b/packages/debug/src/browser/view/console/debug-console-filter.service.ts index 9a32baca3d..2f9064dc6f 100644 --- a/packages/debug/src/browser/view/console/debug-console-filter.service.ts +++ b/packages/debug/src/browser/view/console/debug-console-filter.service.ts @@ -1,8 +1,11 @@ import { Injectable } from '@opensumi/di'; import { Emitter, Event } from '@opensumi/ide-core-browser'; -import { DebugConsoleFilterModel } from './debug-console-filter.model'; import * as strings from '@opensumi/ide-core-common'; + import { matchAll } from '../../debugUtils'; + +import { DebugConsoleFilterModel } from './debug-console-filter.model'; + const Ansi = require('anser'); export interface IDebugConsoleFilter { diff --git a/packages/debug/src/browser/view/console/debug-console-filter.view.tsx b/packages/debug/src/browser/view/console/debug-console-filter.view.tsx index 9410f99c8b..6005185042 100644 --- a/packages/debug/src/browser/view/console/debug-console-filter.view.tsx +++ b/packages/debug/src/browser/view/console/debug-console-filter.view.tsx @@ -1,13 +1,16 @@ -import React from 'react'; +import debounce = require('lodash.debounce'); import { observer } from 'mobx-react-lite'; +import React from 'react'; + +import { HistoryInputBox, IHistoryInputBoxHandler } from '@opensumi/ide-components/lib/input/HistoryInputBox'; import { localize } from '@opensumi/ide-core-browser'; -import styles from './debug-console.module.less'; -import debounce = require('lodash.debounce'); import { useInjectable } from '@opensumi/ide-core-browser'; -import { DebugConsoleFilterService } from './debug-console-filter.service'; -import { HistoryInputBox, IHistoryInputBoxHandler } from '@opensumi/ide-components/lib/input/HistoryInputBox'; import { Key } from '@opensumi/ide-core-browser'; +import { DebugConsoleFilterService } from './debug-console-filter.service'; +import styles from './debug-console.module.less'; + + /** * 调试控制台筛选器 */ diff --git a/packages/debug/src/browser/view/console/debug-console-model.ts b/packages/debug/src/browser/view/console/debug-console-model.ts index 341cce1467..3187a08980 100644 --- a/packages/debug/src/browser/view/console/debug-console-model.ts +++ b/packages/debug/src/browser/view/console/debug-console-model.ts @@ -1,6 +1,7 @@ -import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { Injectable, Optional } from '@opensumi/di'; +import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; + import { ExpressionContainer } from '../../tree/debug-tree-node.define'; @Injectable({ multiple: true }) diff --git a/packages/debug/src/browser/view/console/debug-console-session.ts b/packages/debug/src/browser/view/console/debug-console-session.ts index cb9840ab47..c42bb92d45 100644 --- a/packages/debug/src/browser/view/console/debug-console-session.ts +++ b/packages/debug/src/browser/view/console/debug-console-session.ts @@ -1,13 +1,17 @@ +import throttle = require('lodash.throttle'); + import { Autowired, Injectable, Optional } from '@opensumi/di'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; import { DisposableCollection, Emitter, Event, MessageType, ILogger } from '@opensumi/ide-core-common'; -import { ExpressionContainer, AnsiConsoleNode, DebugConsoleNode, DebugVariableContainer } from '../../tree'; -import { DebugSession } from '../../debug-session'; -import throttle = require('lodash.throttle'); -import { DebugConsoleTreeModel } from './debug-console-model'; -import { LinkDetector } from '../../debug-link-detector'; import { IThemeService } from '@opensumi/ide-theme'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol'; + import { handleANSIOutput } from '../../debug-ansi-handle'; +import { LinkDetector } from '../../debug-link-detector'; +import { DebugSession } from '../../debug-session'; +import { ExpressionContainer, AnsiConsoleNode, DebugConsoleNode, DebugVariableContainer } from '../../tree'; + +import { DebugConsoleTreeModel } from './debug-console-model'; + type ConsoleNodes = DebugConsoleNode | AnsiConsoleNode | DebugVariableContainer; diff --git a/packages/debug/src/browser/view/console/debug-console-toolbar.view.tsx b/packages/debug/src/browser/view/console/debug-console-toolbar.view.tsx index 91fac7896c..fbc81196ac 100644 --- a/packages/debug/src/browser/view/console/debug-console-toolbar.view.tsx +++ b/packages/debug/src/browser/view/console/debug-console-toolbar.view.tsx @@ -1,8 +1,10 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; -import { localize, isElectronRenderer } from '@opensumi/ide-core-browser'; +import React from 'react'; + import { Select, Option } from '@opensumi/ide-components'; +import { localize, isElectronRenderer } from '@opensumi/ide-core-browser'; import { Select as NativeSelect } from '@opensumi/ide-core-browser/lib/components/select'; + import styles from './debug-console.module.less'; export const DebugConsoleToolbarView = observer(() => { diff --git a/packages/debug/src/browser/view/console/debug-console-tree.model.service.ts b/packages/debug/src/browser/view/console/debug-console-tree.model.service.ts index 7907601c8f..b9c11a9609 100644 --- a/packages/debug/src/browser/view/console/debug-console-tree.model.service.ts +++ b/packages/debug/src/browser/view/console/debug-console-tree.model.service.ts @@ -1,4 +1,5 @@ -import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; +import pSeries from 'p-series'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { DecorationsManager, @@ -19,8 +20,13 @@ import { IClipboardService, } from '@opensumi/ide-core-browser'; import { AbstractContextMenuService, MenuId, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; -import { DebugConsoleTreeModel } from './debug-console-model'; import { Path } from '@opensumi/ide-core-common/lib/path'; + +import { IDebugSessionManager } from '../../../common'; +import { LinkDetector } from '../../debug-link-detector'; +import { DebugSession } from '../../debug-session'; +import { DidChangeActiveDebugSession } from '../../debug-session-manager'; +import { AnsiConsoleNode } from '../../tree'; import { ExpressionContainer, ExpressionNode, @@ -28,14 +34,12 @@ import { DebugConsoleRoot, } from '../../tree/debug-tree-node.define'; import { DebugViewModel } from '../debug-view-model'; + +import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; +import { DebugConsoleTreeModel } from './debug-console-model'; import { DebugConsoleSession } from './debug-console-session'; -import pSeries from 'p-series'; import styles from './debug-console.module.less'; -import { DebugSession } from '../../debug-session'; -import { IDebugSessionManager } from '../../../common'; -import { AnsiConsoleNode } from '../../tree'; -import { DidChangeActiveDebugSession } from '../../debug-session-manager'; -import { LinkDetector } from '../../debug-link-detector'; + export interface IDebugConsoleHandle extends IRecycleTreeHandle { hasDirectFocus: () => boolean; diff --git a/packages/debug/src/browser/view/console/debug-console.contribution.ts b/packages/debug/src/browser/view/console/debug-console.contribution.ts index 741af40d6c..99efcad3d2 100644 --- a/packages/debug/src/browser/view/console/debug-console.contribution.ts +++ b/packages/debug/src/browser/view/console/debug-console.contribution.ts @@ -1,5 +1,3 @@ -import { DebugConsoleFilterService } from './debug-console-filter.service'; -import { CONTEXT_IN_DEBUG_REPL, CONTEXT_IN_DEBUG_MODE } from './../../../common/constants'; import { Autowired } from '@opensumi/di'; import { CommandContribution, @@ -14,17 +12,21 @@ import { KeybindingRegistry, IContextKeyService, } from '@opensumi/ide-core-browser'; +import { IMenuRegistry, MenuContribution, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; -import { DEBUG_CONSOLE_CONTAINER_ID } from '../../../common'; -import { DebugConsoleView } from './debug-console.view'; -import { DebugConsoleInputDocumentProvider, DebugConsoleService } from './debug-console.service'; import { BrowserEditorContribution, IEditorDocumentModelContentRegistry } from '@opensumi/ide-editor/lib/browser'; -import { DebugConsoleFilterView } from './debug-console-filter.view'; + +import { DEBUG_CONSOLE_CONTAINER_ID } from '../../../common'; +import { DebugContextKey } from '../../contextkeys/debug-contextkey.service'; import { DEBUG_COMMANDS } from '../../debug-contribution'; -import { DebugConsoleModelService } from './debug-console-tree.model.service'; -import { IMenuRegistry, MenuContribution, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { DebugConsoleNode } from '../../tree'; -import { DebugContextKey } from '../../contextkeys/debug-contextkey.service'; + +import { CONTEXT_IN_DEBUG_REPL, CONTEXT_IN_DEBUG_MODE } from './../../../common/constants'; +import { DebugConsoleFilterService } from './debug-console-filter.service'; +import { DebugConsoleFilterView } from './debug-console-filter.view'; +import { DebugConsoleModelService } from './debug-console-tree.model.service'; +import { DebugConsoleInputDocumentProvider, DebugConsoleService } from './debug-console.service'; +import { DebugConsoleView } from './debug-console.view'; export const DEBUG_CONSOLE_VIEW_ID = 'debug-console-view'; diff --git a/packages/debug/src/browser/view/console/debug-console.service.ts b/packages/debug/src/browser/view/console/debug-console.service.ts index 940fdc5de0..cceebfadc0 100644 --- a/packages/debug/src/browser/view/console/debug-console.service.ts +++ b/packages/debug/src/browser/view/console/debug-console.service.ts @@ -1,19 +1,4 @@ -import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; -import { MonacoCodeService } from '@opensumi/ide-editor/lib/browser/editor.override'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { IHistoryNavigationWidget } from '@opensumi/monaco-editor-core/esm/vs/base/browser/history'; -import { HistoryNavigator } from '@opensumi/monaco-editor-core/esm/vs/base/common/history'; -import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { Schemas, URI, CommandRegistry, Emitter, Event, STORAGE_NAMESPACE } from '@opensumi/ide-core-common'; -import { - IEditorDocumentModelService, - IEditorDocumentModelContentProvider, - ICodeEditor, - getSimpleEditorOptions, -} from '@opensumi/ide-editor/lib/browser'; -import { EditorCollectionService, IDecorationApplyOptions } from '@opensumi/ide-editor'; import { IContextKeyService, MonacoOverrideServiceRegistry, @@ -21,6 +6,22 @@ import { localize, StorageProvider, } from '@opensumi/ide-core-browser'; +import { Schemas, URI, CommandRegistry, Emitter, Event, STORAGE_NAMESPACE } from '@opensumi/ide-core-common'; +import { EditorCollectionService, IDecorationApplyOptions } from '@opensumi/ide-editor'; +import { + IEditorDocumentModelService, + IEditorDocumentModelContentProvider, + ICodeEditor, + getSimpleEditorOptions, +} from '@opensumi/ide-editor/lib/browser'; +import { MonacoCodeService } from '@opensumi/ide-editor/lib/browser/editor.override'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { transparent, editorForeground, IThemeService } from '@opensumi/ide-theme'; +import { IHistoryNavigationWidget } from '@opensumi/monaco-editor-core/esm/vs/base/browser/history'; +import { HistoryNavigator } from '@opensumi/monaco-editor-core/esm/vs/base/common/history'; +import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { DEBUG_CONSOLE_CONTAINER_ID, IDebugSessionManager, @@ -28,8 +29,10 @@ import { DebugState, } from '../../../common'; import { DebugSessionManager } from '../../debug-session-manager'; + +import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; import { DebugConsoleModelService } from './debug-console-tree.model.service'; -import { transparent, editorForeground, IThemeService } from '@opensumi/ide-theme'; + const DECORATION_KEY = 'consoleinputdecoration'; const HISTORY_STORAGE_KEY = 'debug.console.history'; diff --git a/packages/debug/src/browser/view/console/debug-console.view.tsx b/packages/debug/src/browser/view/console/debug-console.view.tsx index 9ceb356e76..c192a9679c 100644 --- a/packages/debug/src/browser/view/console/debug-console.view.tsx +++ b/packages/debug/src/browser/view/console/debug-console.view.tsx @@ -1,9 +1,8 @@ -import React from 'react'; import cls from 'classnames'; +import { debounce } from 'lodash'; import { observer } from 'mobx-react-lite'; -import styles from './debug-console.module.less'; -import { useInjectable, ViewState, getIcon } from '@opensumi/ide-core-browser'; -import { DebugConsoleService } from './debug-console.service'; +import React from 'react'; + import { RecycleTree, IRecycleTreeHandle, @@ -15,15 +14,19 @@ import { TreeNode, TreeNodeEvent, } from '@opensumi/ide-components'; -import { IDebugConsoleModel } from './debug-console-tree.model.service'; -import { DebugConsoleNode, AnsiConsoleNode, DebugVariableContainer, TreeWithLinkWrapper } from '../../tree'; import { Loading } from '@opensumi/ide-components'; -import { DebugConsoleFilterService } from './debug-console-filter.service'; -import { LinkDetector } from '../../debug-link-detector'; +import { useInjectable, ViewState, getIcon } from '@opensumi/ide-core-browser'; import { PreferenceService, PreferenceChange, CoreConfiguration } from '@opensumi/ide-core-browser'; import { Disposable } from '@opensumi/ide-core-common'; -import { debounce } from 'lodash'; + +import { LinkDetector } from '../../debug-link-detector'; import { CharWidthReader } from '../../debugUtils'; +import { DebugConsoleNode, AnsiConsoleNode, DebugVariableContainer, TreeWithLinkWrapper } from '../../tree'; + +import { DebugConsoleFilterService } from './debug-console-filter.service'; +import { IDebugConsoleModel } from './debug-console-tree.model.service'; +import styles from './debug-console.module.less'; +import { DebugConsoleService } from './debug-console.service'; declare const ResizeObserver: any; diff --git a/packages/debug/src/browser/view/debug-view-model.ts b/packages/debug/src/browser/view/debug-view-model.ts index adc23e9fa8..0efc7598b6 100644 --- a/packages/debug/src/browser/view/debug-view-model.ts +++ b/packages/debug/src/browser/view/debug-view-model.ts @@ -15,13 +15,15 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/debug/src/browser/view/debug-view-model.ts +import { Injectable, Autowired } from '@opensumi/di'; +import { URI, IDisposable, DisposableCollection, Event, Emitter } from '@opensumi/ide-core-browser'; + +import { DebugState, IDebugSessionManager } from '../../common/debug-session'; import { DebugSession } from '../debug-session'; import { DebugSessionManager } from '../debug-session-manager'; -import { DebugThread } from '../model/debug-thread'; import { DebugStackFrame } from '../model/debug-stack-frame'; -import { URI, IDisposable, DisposableCollection, Event, Emitter } from '@opensumi/ide-core-browser'; -import { Injectable, Autowired } from '@opensumi/di'; -import { DebugState, IDebugSessionManager } from '../../common/debug-session'; +import { DebugThread } from '../model/debug-thread'; + @Injectable() export class DebugViewModel implements IDisposable { diff --git a/packages/debug/src/browser/view/frames/debug-call-stack-frame.view.tsx b/packages/debug/src/browser/view/frames/debug-call-stack-frame.view.tsx index a1c6025cfd..cb155841c7 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack-frame.view.tsx +++ b/packages/debug/src/browser/view/frames/debug-call-stack-frame.view.tsx @@ -1,6 +1,8 @@ -import React from 'react'; import cls from 'classnames'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + +import { RecycleList } from '@opensumi/ide-components'; import { ViewState, isUndefined, @@ -9,14 +11,16 @@ import { DisposableCollection, getIcon, } from '@opensumi/ide-core-browser'; -import { DebugThread } from '../../model/debug-thread'; -import { RecycleList } from '@opensumi/ide-components'; -import { DebugStackFrame } from '../../model'; + import { IDebugSessionManager } from '../../../common'; +import { DebugSession } from '../../debug-session'; import { DebugSessionManager } from '../../debug-session-manager'; +import { DebugStackFrame } from '../../model'; +import { DebugThread } from '../../model/debug-thread'; + import styles from './debug-call-stack.module.less'; import { DebugCallStackService } from './debug-call-stack.service'; -import { DebugSession } from '../../debug-session'; + export interface DebugStackSessionViewProps { frames: DebugStackFrame[]; diff --git a/packages/debug/src/browser/view/frames/debug-call-stack-session.view.tsx b/packages/debug/src/browser/view/frames/debug-call-stack-session.view.tsx index c28ddd429e..1910a9124f 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack-session.view.tsx +++ b/packages/debug/src/browser/view/frames/debug-call-stack-session.view.tsx @@ -1,13 +1,16 @@ -import React from 'react'; import cls from 'classnames'; +import React from 'react'; + import { ViewState, getIcon, useInjectable, DisposableCollection } from '@opensumi/ide-core-browser'; + +import { DebugState, IDebugSessionManager } from '../../../common'; import { DebugSession } from '../../debug-session'; +import { DebugSessionManager } from '../../debug-session-manager'; import { DebugThread } from '../../model/debug-thread'; + import { DebugStackThreadView } from './debug-call-stack-thread.view'; -import { DebugStackOperationView } from './debug-call-stack.operation'; -import { DebugSessionManager } from '../../debug-session-manager'; -import { DebugState, IDebugSessionManager } from '../../../common'; import styles from './debug-call-stack.module.less'; +import { DebugStackOperationView } from './debug-call-stack.operation'; import { DebugCallStackService } from './debug-call-stack.service'; export interface DebugStackSessionViewProps { diff --git a/packages/debug/src/browser/view/frames/debug-call-stack-thread.view.tsx b/packages/debug/src/browser/view/frames/debug-call-stack-thread.view.tsx index 1af290348c..fc795fe76c 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack-thread.view.tsx +++ b/packages/debug/src/browser/view/frames/debug-call-stack-thread.view.tsx @@ -1,12 +1,15 @@ import React from 'react'; + import { ViewState, getIcon, useInjectable, localize, DisposableCollection } from '@opensumi/ide-core-browser'; + +import { IDebugSessionManager } from '../../../common'; +import { DebugSession } from '../../debug-session'; +import { DebugSessionManager } from '../../debug-session-manager'; import { DebugThread } from '../../model/debug-thread'; + import { DebugStackFramesView } from './debug-call-stack-frame.view'; -import { DebugStackOperationView } from './debug-call-stack.operation'; -import { DebugSessionManager } from '../../debug-session-manager'; -import { IDebugSessionManager } from '../../../common'; import styles from './debug-call-stack.module.less'; -import { DebugSession } from '../../debug-session'; +import { DebugStackOperationView } from './debug-call-stack.operation'; import { DebugCallStackService } from './debug-call-stack.service'; export interface DebugStackThreadViewProps { diff --git a/packages/debug/src/browser/view/frames/debug-call-stack.contribution.ts b/packages/debug/src/browser/view/frames/debug-call-stack.contribution.ts index ff864760f3..58389204c1 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack.contribution.ts +++ b/packages/debug/src/browser/view/frames/debug-call-stack.contribution.ts @@ -1,17 +1,19 @@ -import { DebugThread } from './../../model/debug-thread'; -import { DebugStackFrame } from './../../model/debug-stack-frame'; -import { IDebugSessionManager } from './../../../common/debug-session'; -import { DebugSessionManager } from './../../debug-session-manager'; -import { CallStackContext } from './../../../common/types'; +import { Autowired } from '@opensumi/di'; +import { Domain, CommandContribution, CommandRegistry, localize, IClipboardService } from '@opensumi/ide-core-browser'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; + +import { DEBUG_COMMANDS } from '../../debug-contribution'; + import { CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_RESTART_FRAME_SUPPORTED, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, } from './../../../common/constants'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { Autowired } from '@opensumi/di'; -import { Domain, CommandContribution, CommandRegistry, localize, IClipboardService } from '@opensumi/ide-core-browser'; -import { DEBUG_COMMANDS } from '../../debug-contribution'; +import { IDebugSessionManager } from './../../../common/debug-session'; +import { CallStackContext } from './../../../common/types'; +import { DebugSessionManager } from './../../debug-session-manager'; +import { DebugStackFrame } from './../../model/debug-stack-frame'; +import { DebugThread } from './../../model/debug-thread'; function isStackFrameContext(obj: any): obj is CallStackContext { return ( diff --git a/packages/debug/src/browser/view/frames/debug-call-stack.operation.tsx b/packages/debug/src/browser/view/frames/debug-call-stack.operation.tsx index a128a2c66d..757e7346de 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack.operation.tsx +++ b/packages/debug/src/browser/view/frames/debug-call-stack.operation.tsx @@ -1,10 +1,13 @@ import React from 'react'; + import { localize, useInjectable } from '@opensumi/ide-core-browser'; + import { DebugAction } from '../../components'; -import { DebugToolbarService } from '../configuration/debug-toolbar.service'; -import styles from './debug-call-stack.module.less'; import { DebugSession } from '../../debug-session'; import { DebugThread } from '../../model/debug-thread'; +import { DebugToolbarService } from '../configuration/debug-toolbar.service'; + +import styles from './debug-call-stack.module.less'; export interface DebugStackOperationViewProps { session?: DebugSession; diff --git a/packages/debug/src/browser/view/frames/debug-call-stack.service.ts b/packages/debug/src/browser/view/frames/debug-call-stack.service.ts index 44fb40a93d..5317bc7e50 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack.service.ts +++ b/packages/debug/src/browser/view/frames/debug-call-stack.service.ts @@ -1,11 +1,13 @@ -import { DebugSession } from './../../debug-session'; -import { CONTEXT_STACK_FRAME_SUPPORTS_RESTART, CONTEXT_CALLSTACK_ITEM_TYPE } from './../../../common/constants'; -import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; -import { IContextKey } from '@opensumi/ide-core-browser'; import { Injectable, Autowired } from '@opensumi/di'; +import { IContextKey } from '@opensumi/ide-core-browser'; import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; + import { DebugStackFrame, DebugThread } from '../../model'; +import { CONTEXT_STACK_FRAME_SUPPORTS_RESTART, CONTEXT_CALLSTACK_ITEM_TYPE } from './../../../common/constants'; +import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; +import { DebugSession } from './../../debug-session'; + @Injectable() export class DebugCallStackService { @Autowired(AbstractContextMenuService) diff --git a/packages/debug/src/browser/view/frames/debug-call-stack.view.tsx b/packages/debug/src/browser/view/frames/debug-call-stack.view.tsx index 15b197dd9b..40293ced65 100644 --- a/packages/debug/src/browser/view/frames/debug-call-stack.view.tsx +++ b/packages/debug/src/browser/view/frames/debug-call-stack.view.tsx @@ -1,10 +1,13 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { useInjectable, ViewState } from '@opensumi/ide-core-browser'; -import { DebugStackSessionView } from './debug-call-stack-session.view'; -import { DebugSessionManager } from '../../debug-session-manager'; + import { IDebugSessionManager, IDebugSession } from '../../../common'; import { DebugSession } from '../../debug-session'; +import { DebugSessionManager } from '../../debug-session-manager'; + +import { DebugStackSessionView } from './debug-call-stack-session.view'; export const DebugCallStackView = observer(({ viewState }: React.PropsWithChildren<{ viewState: ViewState }>) => { const manager = useInjectable(IDebugSessionManager); diff --git a/packages/debug/src/browser/view/variables/debug-variables-model.ts b/packages/debug/src/browser/view/variables/debug-variables-model.ts index 2f7777bcd7..9c034b2ec5 100644 --- a/packages/debug/src/browser/view/variables/debug-variables-model.ts +++ b/packages/debug/src/browser/view/variables/debug-variables-model.ts @@ -1,6 +1,7 @@ -import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { Injectable, Optional } from '@opensumi/di'; +import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; + import { ExpressionContainer } from '../../tree/debug-tree-node.define'; @Injectable({ multiple: true }) diff --git a/packages/debug/src/browser/view/variables/debug-variables-tree.model.service.ts b/packages/debug/src/browser/view/variables/debug-variables-tree.model.service.ts index 214905d7e7..c25ba79b18 100644 --- a/packages/debug/src/browser/view/variables/debug-variables-tree.model.service.ts +++ b/packages/debug/src/browser/view/variables/debug-variables-tree.model.service.ts @@ -1,6 +1,5 @@ -import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; import { isEqual } from 'lodash'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { TreeModel, @@ -19,7 +18,10 @@ import { IClipboardService, } from '@opensumi/ide-core-browser'; import { AbstractContextMenuService, MenuId, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; -import { DebugVariablesModel } from './debug-variables-model'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + + +import { DebugSession } from '../../debug-session'; import { ExpressionContainer, ExpressionNode, @@ -29,8 +31,9 @@ import { DebugScope, } from '../../tree/debug-tree-node.define'; import { DebugViewModel } from '../debug-view-model'; -import { DebugSession } from '../../debug-session'; +import { DebugContextKey } from './../../contextkeys/debug-contextkey.service'; +import { DebugVariablesModel } from './debug-variables-model'; import styles from './debug-variables.module.less'; export interface IDebugVariablesHandle extends IRecycleTreeHandle { diff --git a/packages/debug/src/browser/view/variables/debug-variables.contribution.ts b/packages/debug/src/browser/view/variables/debug-variables.contribution.ts index 4ac8737e31..652ba39d5f 100644 --- a/packages/debug/src/browser/view/variables/debug-variables.contribution.ts +++ b/packages/debug/src/browser/view/variables/debug-variables.contribution.ts @@ -1,13 +1,3 @@ -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { URI } from '@opensumi/ide-core-common'; -import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; -import { EditorContextKeys } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorContextKeys'; -import { - CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, - CONTEXT_IN_DEBUG_MODE, - CONTEXT_SET_VARIABLE_SUPPORTED, -} from './../../../common/constants'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { Autowired } from '@opensumi/di'; import { Domain, @@ -17,12 +7,26 @@ import { IQuickInputService, IReporterService, } from '@opensumi/ide-core-browser'; -import { DebugVariablesModelService } from './debug-variables-tree.model.service'; -import { DEBUG_COMMANDS } from '../../debug-contribution'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { URI } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; import { IMessageService } from '@opensumi/ide-overlay'; +import { EditorContextKeys } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorContextKeys'; +import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + import { DEBUG_REPORT_NAME } from '../../../common'; +import { DEBUG_COMMANDS } from '../../debug-contribution'; + +import { + CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, + CONTEXT_IN_DEBUG_MODE, + CONTEXT_SET_VARIABLE_SUPPORTED, +} from './../../../common/constants'; import { DebugWatchModelService } from './../watch/debug-watch-tree.model.service'; -import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; +import { DebugVariablesModelService } from './debug-variables-tree.model.service'; + + @Domain(MenuContribution, CommandContribution) export class VariablesPanelContribution implements MenuContribution, CommandContribution { @Autowired(IQuickInputService) diff --git a/packages/debug/src/browser/view/variables/debug-variables.view.tsx b/packages/debug/src/browser/view/variables/debug-variables.view.tsx index e3497852a2..a2dea96c4b 100644 --- a/packages/debug/src/browser/view/variables/debug-variables.view.tsx +++ b/packages/debug/src/browser/view/variables/debug-variables.view.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import { useInjectable, getIcon } from '@opensumi/ide-core-browser'; +import cls from 'classnames'; import { observer } from 'mobx-react-lite'; -import { ViewState } from '@opensumi/ide-core-browser'; +import React from 'react'; + import { INodeRendererProps, ClasslistComposite, @@ -12,6 +12,10 @@ import { TreeModel, CompositeTreeNode, } from '@opensumi/ide-components'; +import { Loading } from '@opensumi/ide-components'; +import { useInjectable, getIcon } from '@opensumi/ide-core-browser'; +import { ViewState } from '@opensumi/ide-core-browser'; + import { ExpressionContainer, ExpressionNode, @@ -19,10 +23,10 @@ import { DebugVariable, DebugScope, } from '../../tree/debug-tree-node.define'; + import { DebugVariablesModelService } from './debug-variables-tree.model.service'; -import { Loading } from '@opensumi/ide-components'; import styles from './debug-variables.module.less'; -import cls from 'classnames'; + export const DEBUG_VARIABLE_TREE_FIELD_NAME = 'DEBUG_VARIABLE_TREE_FIELD'; diff --git a/packages/debug/src/browser/view/watch/debug-watch-model.ts b/packages/debug/src/browser/view/watch/debug-watch-model.ts index a19b9b4279..da5c501de4 100644 --- a/packages/debug/src/browser/view/watch/debug-watch-model.ts +++ b/packages/debug/src/browser/view/watch/debug-watch-model.ts @@ -1,6 +1,7 @@ -import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { Injectable, Optional } from '@opensumi/di'; +import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; + import { ExpressionContainer } from '../../tree/debug-tree-node.define'; @Injectable({ multiple: true }) diff --git a/packages/debug/src/browser/view/watch/debug-watch-tree.model.service.ts b/packages/debug/src/browser/view/watch/debug-watch-tree.model.service.ts index d62a8dcac0..ef4e023fd7 100644 --- a/packages/debug/src/browser/view/watch/debug-watch-tree.model.service.ts +++ b/packages/debug/src/browser/view/watch/debug-watch-tree.model.service.ts @@ -1,6 +1,5 @@ -import { IDebugSessionManager } from './../../../common/debug-session'; -import { DebugVariableContainer, DebugVariable } from './../../tree/debug-tree-node.define'; -import { CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_WATCH_ITEM_TYPE } from './../../../common/constants'; +import pSeries from 'p-series'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { TreeModel, @@ -28,14 +27,19 @@ import { IReporterService, } from '@opensumi/ide-core-browser'; import { AbstractContextMenuService, MenuId, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; -import { DebugWatchModel } from './debug-watch-model'; import { Path } from '@opensumi/ide-core-common/lib/path'; + +import { DebugSessionManager } from '../../debug-session-manager'; +import { DebugWatch } from '../../model'; import { ExpressionContainer, ExpressionNode, DebugWatchNode, DebugWatchRoot } from '../../tree/debug-tree-node.define'; import { DebugViewModel } from '../debug-view-model'; -import { DebugWatch } from '../../model'; -import pSeries from 'p-series'; + +import { CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_WATCH_ITEM_TYPE } from './../../../common/constants'; +import { IDebugSessionManager } from './../../../common/debug-session'; +import { DebugVariableContainer, DebugVariable } from './../../tree/debug-tree-node.define'; +import { DebugWatchModel } from './debug-watch-model'; import styles from './debug-watch.module.less'; -import { DebugSessionManager } from '../../debug-session-manager'; + export interface IDebugWatchHandle extends IRecycleTreeHandle { hasDirectFocus: () => boolean; diff --git a/packages/debug/src/browser/view/watch/debug-watch.contribution.ts b/packages/debug/src/browser/view/watch/debug-watch.contribution.ts index c105026a3f..2648de4430 100644 --- a/packages/debug/src/browser/view/watch/debug-watch.contribution.ts +++ b/packages/debug/src/browser/view/watch/debug-watch.contribution.ts @@ -1,9 +1,3 @@ -import { - CONTEXT_IN_DEBUG_MODE, - CONTEXT_WATCH_EXPRESSIONS_FOCUSED, - CONTEXT_WATCH_ITEM_TYPE, -} from './../../../common/constants'; -import { MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next'; import { Autowired } from '@opensumi/di'; import { Domain, @@ -16,12 +10,20 @@ import { KeybindingContribution, KeybindingRegistry, } from '@opensumi/ide-core-browser'; -import { DEBUG_COMMANDS } from '../../debug-contribution'; -import { DEBUG_WATCH_ID } from '../../../common'; -import { DebugWatchModelService } from './debug-watch-tree.model.service'; +import { MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next'; import { MenuId, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; + +import { DEBUG_WATCH_ID } from '../../../common'; +import { DEBUG_COMMANDS } from '../../debug-contribution'; import { DebugWatchNode } from '../../tree/debug-tree-node.define'; +import { + CONTEXT_IN_DEBUG_MODE, + CONTEXT_WATCH_EXPRESSIONS_FOCUSED, + CONTEXT_WATCH_ITEM_TYPE, +} from './../../../common/constants'; +import { DebugWatchModelService } from './debug-watch-tree.model.service'; + @Domain(ClientAppContribution, MenuContribution, CommandContribution, TabBarToolbarContribution, KeybindingContribution) export class WatchPanelContribution implements diff --git a/packages/debug/src/browser/view/watch/debug-watch.view.tsx b/packages/debug/src/browser/view/watch/debug-watch.view.tsx index f36335f48e..f01b3f4366 100644 --- a/packages/debug/src/browser/view/watch/debug-watch.view.tsx +++ b/packages/debug/src/browser/view/watch/debug-watch.view.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import { useInjectable, getIcon, DisposableCollection, Disposable } from '@opensumi/ide-core-browser'; +import cls from 'classnames'; import { observer } from 'mobx-react-lite'; -import { ViewState } from '@opensumi/ide-core-browser'; +import React from 'react'; + import { INodeRendererProps, ClasslistComposite, @@ -12,6 +12,10 @@ import { TreeModel, PromptHandle, } from '@opensumi/ide-components'; +import { Loading } from '@opensumi/ide-components'; +import { useInjectable, getIcon, DisposableCollection, Disposable } from '@opensumi/ide-core-browser'; +import { ViewState } from '@opensumi/ide-core-browser'; + import { ExpressionContainer, ExpressionNode, @@ -19,10 +23,10 @@ import { DebugVariable, DebugWatchNode, } from '../../tree/debug-tree-node.define'; + import { DebugWatchModelService, IWatchNode } from './debug-watch-tree.model.service'; -import { Loading } from '@opensumi/ide-components'; import styles from './debug-watch.module.less'; -import cls from 'classnames'; + export const DEBUG_WATCH_TREE_FIELD_NAME = 'DEBUG_WATCH_TREE_FIELD'; diff --git a/packages/debug/src/common/constants.ts b/packages/debug/src/common/constants.ts index e944a40b73..465226a5f2 100644 --- a/packages/debug/src/common/constants.ts +++ b/packages/debug/src/common/constants.ts @@ -1,6 +1,7 @@ -import { DebugState } from './debug-session'; import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; +import { DebugState } from './debug-session'; + export const DEBUG_CONSOLE_CONTAINER_ID = 'debug-console-container'; export const DEBUG_CONTAINER_ID = 'debug'; export const DEBUG_WATCH_ID = 'debug-watch'; diff --git a/packages/debug/src/common/debug-model.ts b/packages/debug/src/common/debug-model.ts index 22ead4b1ea..dc9c4ffaf6 100644 --- a/packages/debug/src/common/debug-model.ts +++ b/packages/debug/src/common/debug-model.ts @@ -1,16 +1,18 @@ +import stream from 'stream'; + +import { IDisposable, MaybePromise, IJSONSchema, IJSONSchemaSnippet, URI } from '@opensumi/ide-core-common'; +import type { editor } from '@opensumi/monaco-editor-core'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IRuntimeBreakpoint, ISourceBreakpoint, DebugBreakpointWidgetContext, TSourceBrekpointProperties, } from './debug-breakpoint'; -import { IDebugHoverWidget } from './debug-hover'; -import stream from 'stream'; -import type { editor } from '@opensumi/monaco-editor-core'; import { DebugConfiguration } from './debug-configuration'; -import { IDisposable, MaybePromise, IJSONSchema, IJSONSchemaSnippet, URI } from '@opensumi/ide-core-common'; import { DebugEditor } from './debug-editor'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { IDebugHoverWidget } from './debug-hover'; export interface IDebugBreakpointWidget extends IDisposable { position: monaco.Position | undefined; diff --git a/packages/debug/src/common/debug-service.ts b/packages/debug/src/common/debug-service.ts index d2192c51dd..7d5fa09384 100644 --- a/packages/debug/src/common/debug-service.ts +++ b/packages/debug/src/common/debug-service.ts @@ -1,4 +1,5 @@ import { IDisposable, IJSONSchema, IJSONSchemaSnippet, ApplicationError, Event } from '@opensumi/ide-core-common'; + import { DebugConfiguration } from './debug-configuration'; import { IDebugSessionDTO } from './debug-session-options'; diff --git a/packages/debug/src/common/debug-session.ts b/packages/debug/src/common/debug-session.ts index c004d7a528..4e618f3bdc 100644 --- a/packages/debug/src/common/debug-session.ts +++ b/packages/debug/src/common/debug-session.ts @@ -1,7 +1,8 @@ +import { CancellationToken, IDisposable } from '@opensumi/ide-core-common'; import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { DebugSessionOptions, IDebugSessionDTO } from './debug-session-options'; + import { DebugConfiguration } from './debug-configuration'; -import { CancellationToken, IDisposable } from '@opensumi/ide-core-common'; +import { DebugSessionOptions, IDebugSessionDTO } from './debug-session-options'; export enum DebugState { Inactive, diff --git a/packages/debug/src/common/evaluatable-expression.ts b/packages/debug/src/common/evaluatable-expression.ts index c421c6a882..ef278a4520 100644 --- a/packages/debug/src/common/evaluatable-expression.ts +++ b/packages/debug/src/common/evaluatable-expression.ts @@ -1,6 +1,6 @@ -import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; -import { IRange, Position } from '@opensumi/ide-core-common/lib/types'; import { CancellationToken } from '@opensumi/ide-core-common'; +import { IRange, Position } from '@opensumi/ide-core-common/lib/types'; +import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; /** * An evaluatable expression represents additional information for an expression in a document. Evaluatable expressions are diff --git a/packages/debug/src/common/inline-values.ts b/packages/debug/src/common/inline-values.ts index e58c5c3f5d..d42c5ccc35 100644 --- a/packages/debug/src/common/inline-values.ts +++ b/packages/debug/src/common/inline-values.ts @@ -1,6 +1,6 @@ -import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; -import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; import { IRange, CancellationToken, Event } from '@opensumi/ide-core-common'; +import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; +import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; // Inline Values /** diff --git a/packages/decoration/__tests__/browser/index.test.ts b/packages/decoration/__tests__/browser/index.test.ts index 41ffb0ad8f..e0917d93af 100644 --- a/packages/decoration/__tests__/browser/index.test.ts +++ b/packages/decoration/__tests__/browser/index.test.ts @@ -2,9 +2,8 @@ import { Uri, DisposableCollection, Event, Emitter, CancellationToken } from '@o import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { DecorationModule } from '../../src/browser'; import { IDecorationsService, IDecorationsProvider, IDecorationData } from '../../src'; +import { DecorationModule } from '../../src/browser'; describe('DecorationsService', () => { let injector: MockInjector; diff --git a/packages/decoration/src/browser/decorationsService.ts b/packages/decoration/src/browser/decorationsService.ts index b02770ad9f..4fc4a59e52 100644 --- a/packages/decoration/src/browser/decorationsService.ts +++ b/packages/decoration/src/browser/decorationsService.ts @@ -11,10 +11,10 @@ import { toDisposable, dispose, } from '@opensumi/ide-core-common'; +import { getDebugLogger, isFalsyOrWhitespace, asArray } from '@opensumi/ide-core-common'; import { isPromiseCanceledError } from '@opensumi/ide-core-common/lib/errors'; -import { TernarySearchTree } from '@opensumi/ide-core-common/lib/map'; import { LinkedList } from '@opensumi/ide-core-common/lib/linked-list'; -import { getDebugLogger, isFalsyOrWhitespace, asArray } from '@opensumi/ide-core-common'; +import { TernarySearchTree } from '@opensumi/ide-core-common/lib/map'; import { IDecorationsService, diff --git a/packages/decoration/src/browser/index.ts b/packages/decoration/src/browser/index.ts index 38c07a2d61..1f2aaa64dd 100644 --- a/packages/decoration/src/browser/index.ts +++ b/packages/decoration/src/browser/index.ts @@ -2,6 +2,7 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; import { IDecorationsService } from '../common/decorations'; + import { FileDecorationsService } from './decorationsService'; @Injectable() diff --git a/packages/editor/__tests__/browser/breadcrumb.test.ts b/packages/editor/__tests__/browser/breadcrumb.test.ts index ea7fa46731..3796034080 100644 --- a/packages/editor/__tests__/browser/breadcrumb.test.ts +++ b/packages/editor/__tests__/browser/breadcrumb.test.ts @@ -1,16 +1,17 @@ -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { URI, IEventBus } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { IEditorDocumentModelService, WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; +import { BreadCrumbServiceImpl } from '@opensumi/ide-editor/lib/browser/breadcrumb'; import { DocumentSymbol, DocumentSymbolChangedEvent, } from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol'; -import { IEditorDocumentModelService, WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { IWorkspaceService } from '@opensumi/ide-workspace/lib/common'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { BreadCrumbServiceImpl } from '@opensumi/ide-editor/lib/browser/breadcrumb'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; describe('breadcrumb test', () => { let injector: MockInjector; diff --git a/packages/editor/__tests__/browser/decoration.test.ts b/packages/editor/__tests__/browser/decoration.test.ts index 8afb3821b4..3533c465ce 100644 --- a/packages/editor/__tests__/browser/decoration.test.ts +++ b/packages/editor/__tests__/browser/decoration.test.ts @@ -1,16 +1,17 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { URI, Emitter, IEventBus, Disposable } from '@opensumi/ide-core-browser'; import { IEditorDecorationCollectionService, EditorDecorationChangeEvent, EditorDecorationTypeRemovedEvent, } from '@opensumi/ide-editor/lib/browser'; import { EditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser/editor.decoration.service'; -import { URI, Emitter, IEventBus, Disposable } from '@opensumi/ide-core-browser'; import { createMockedMonaco } from '@opensumi/ide-monaco/__mocks__/monaco'; import { IThemeService } from '@opensumi/ide-theme'; -import { MonacoEditorDecorationApplier } from '../../src/browser/decoration-applier'; import { ICSSStyleService } from '@opensumi/ide-theme/lib/common/style'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MonacoEditorDecorationApplier } from '../../src/browser/decoration-applier'; + describe('editor decoration service test', () => { const injector = createBrowserInjector([]); diff --git a/packages/editor/__tests__/browser/doc-cache/empty-doc-cache.test.ts b/packages/editor/__tests__/browser/doc-cache/empty-doc-cache.test.ts index d9bb60e0ad..18753b554d 100644 --- a/packages/editor/__tests__/browser/doc-cache/empty-doc-cache.test.ts +++ b/packages/editor/__tests__/browser/doc-cache/empty-doc-cache.test.ts @@ -1,12 +1,14 @@ import { uniqueId } from 'lodash'; + import { URI } from '@opensumi/ide-core-browser'; +import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { EmptyDocCacheImpl } from '@opensumi/ide-editor/lib/browser/doc-cache'; -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; -import { IDocPersistentCacheProvider } from '../../../src/common'; +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { EditorDocumentModel } from '../../../src/browser/doc-model/main'; -import { EmptyDocCacheImpl } from '@opensumi/ide-editor/lib/browser/doc-cache'; -import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { IDocPersistentCacheProvider } from '../../../src/common'; + describe('EmptyDocCacheImpl', () => { let injector: MockInjector; diff --git a/packages/editor/__tests__/browser/doc-cache/local-storage-cache.test.ts b/packages/editor/__tests__/browser/doc-cache/local-storage-cache.test.ts index 46b9b2455a..db41fde3b6 100644 --- a/packages/editor/__tests__/browser/doc-cache/local-storage-cache.test.ts +++ b/packages/editor/__tests__/browser/doc-cache/local-storage-cache.test.ts @@ -1,14 +1,16 @@ -import { uniqueId } from 'lodash'; import { promisify } from 'util'; + +import { uniqueId } from 'lodash'; + import { ILoggerManagerClient, URI } from '@opensumi/ide-core-browser'; -import { LocalStorageDocCacheImpl } from '@opensumi/ide-editor/lib/browser/doc-cache'; import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { LocalStorageDocCacheImpl } from '@opensumi/ide-editor/lib/browser/doc-cache'; import { IWorkspaceStorageService } from '@opensumi/ide-workspace'; -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; -import { IDocPersistentCacheProvider } from '../../../src/common'; +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { EditorDocumentModel } from '../../../src/browser/doc-model/main'; +import { IDocPersistentCacheProvider } from '../../../src/common'; describe('LocalStorageDocCacheImpl', () => { let content: string; diff --git a/packages/editor/__tests__/browser/doc-model/editor-document-model-service.test.ts b/packages/editor/__tests__/browser/doc-model/editor-document-model-service.test.ts index eef4fe963c..8fb7131180 100644 --- a/packages/editor/__tests__/browser/doc-model/editor-document-model-service.test.ts +++ b/packages/editor/__tests__/browser/doc-model/editor-document-model-service.test.ts @@ -1,20 +1,22 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { URI, IEventBus } from '@opensumi/ide-core-browser'; -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; -import { - EditorDocumentModelServiceImpl, - EditorDocumentModelContentRegistryImpl, -} from '@opensumi/ide-editor/lib/browser/doc-model/main'; import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { IDocPersistentCacheProvider } from '@opensumi/ide-editor'; import { IEditorDocumentModelContentRegistry, IEditorDocumentModelService, EmptyDocCacheImpl, EditorDocumentModelCreationEvent, } from '@opensumi/ide-editor/lib/browser'; +import { + EditorDocumentModelServiceImpl, + EditorDocumentModelContentRegistryImpl, +} from '@opensumi/ide-editor/lib/browser/doc-model/main'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { TestEditorDocumentProvider } from '../test-providers'; -import { IDocPersistentCacheProvider } from '@opensumi/ide-editor'; + describe('EditorDocumentModelService', () => { let injector: MockInjector; diff --git a/packages/editor/__tests__/browser/doc-model/editor-document-model.test.ts b/packages/editor/__tests__/browser/doc-model/editor-document-model.test.ts index ddf28bc2a2..7f1ce3af83 100644 --- a/packages/editor/__tests__/browser/doc-model/editor-document-model.test.ts +++ b/packages/editor/__tests__/browser/doc-model/editor-document-model.test.ts @@ -1,20 +1,23 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { isMacintosh, isLinux } from '@opensumi/monaco-editor-core/esm/vs/base/common/platform'; import { uniqueId } from 'lodash'; + import { URI, IEventBus } from '@opensumi/ide-core-browser'; +import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { EmptyDocCacheImpl } from '@opensumi/ide-editor/lib/browser/doc-cache'; +import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { isMacintosh, isLinux } from '@opensumi/monaco-editor-core/esm/vs/base/common/platform'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; -import { IDocPersistentCacheProvider } from '../../../src/common'; +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; +import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; import { EditorDocumentModel, EditorDocumentModelConstructionOptions } from '../../../src/browser/doc-model/main'; import { EditorDocumentModelOptionChangedEvent, EditorDocumentModelContentChangedEvent, } from '../../../src/browser/doc-model/types'; -import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; -import { EmptyDocCacheImpl } from '@opensumi/ide-editor/lib/browser/doc-cache'; -import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { IDocPersistentCacheProvider } from '../../../src/common'; + describe('EditorDocumentModel', () => { let injector: MockInjector; diff --git a/packages/editor/__tests__/browser/editor-service.test.ts b/packages/editor/__tests__/browser/editor-service.test.ts index fb817195dd..c28f817681 100644 --- a/packages/editor/__tests__/browser/editor-service.test.ts +++ b/packages/editor/__tests__/browser/editor-service.test.ts @@ -1,14 +1,11 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { CorePreferences, IContextKeyService, PreferenceService } from '@opensumi/ide-core-browser'; import { - EditorCollectionService, - WorkbenchEditorService, - ResourceService, - ILanguageService, - EditorGroupSplitAction, -} from '@opensumi/ide-editor/lib/common'; -import { EditorCollectionServiceImpl } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; -import { WorkbenchEditorServiceImpl, EditorGroup } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; -import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; + URI, + Disposable, + createContributionProvider, + ILoggerManagerClient, + IEventBus, +} from '@opensumi/ide-core-common'; import { EditorComponentRegistry, IEditorDecorationCollectionService, @@ -20,24 +17,38 @@ import { EditorGroupChangeEvent, CodeEditorDidVisibleEvent, } from '@opensumi/ide-editor/lib/browser'; -import { IDocPersistentCacheProvider } from '@opensumi/ide-editor/lib/common'; import { EditorComponentRegistryImpl } from '@opensumi/ide-editor/lib/browser/component'; -import { EditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser/editor.decoration.service'; +import { isEditStack, isEOLStack } from '@opensumi/ide-editor/lib/browser/doc-model/editor-is-fn'; import { EditorDocumentModelContentRegistryImpl, EditorDocumentModelServiceImpl, SaveTask, } from '@opensumi/ide-editor/lib/browser/doc-model/main'; +import { EditorCollectionServiceImpl } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; +import { EditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser/editor.decoration.service'; +import { EditorFeatureRegistryImpl } from '@opensumi/ide-editor/lib/browser/feature'; import { LanguageService } from '@opensumi/ide-editor/lib/browser/language/language.service'; +import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; +import { WorkbenchEditorServiceImpl, EditorGroup } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { + EditorCollectionService, + WorkbenchEditorService, + ResourceService, + ILanguageService, + EditorGroupSplitAction, +} from '@opensumi/ide-editor/lib/common'; +import { IDocPersistentCacheProvider } from '@opensumi/ide-editor/lib/common'; import { MonacoService } from '@opensumi/ide-monaco'; +import { IMessageService } from '@opensumi/ide-overlay'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; +import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { useMockStorage } from '../../../core-browser/__mocks__/storage'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; import { MockedMonacoService } from '../../../monaco/__mocks__/monaco.service.mock'; -import { - URI, - Disposable, - createContributionProvider, - ILoggerManagerClient, - IEventBus, -} from '@opensumi/ide-core-common'; + import { TestResourceProvider, TestResourceResolver, @@ -46,15 +57,7 @@ import { TestResourceComponent, doNotClose, } from './test-providers'; -import { useMockStorage } from '../../../core-browser/__mocks__/storage'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { CorePreferences, IContextKeyService, PreferenceService } from '@opensumi/ide-core-browser'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { EditorFeatureRegistryImpl } from '@opensumi/ide-editor/lib/browser/feature'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { isEditStack, isEOLStack } from '@opensumi/ide-editor/lib/browser/doc-model/editor-is-fn'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; + const injector = createBrowserInjector([]); diff --git a/packages/editor/__tests__/browser/editor.collection.test.ts b/packages/editor/__tests__/browser/editor.collection.test.ts index 8cf5f1816c..acc8ba66f9 100644 --- a/packages/editor/__tests__/browser/editor.collection.test.ts +++ b/packages/editor/__tests__/browser/editor.collection.test.ts @@ -1,14 +1,12 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { monaco as monacoAPI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockedMonacoService } from '@opensumi/ide-monaco/__mocks__/monaco.service.mock'; +import { Injectable } from '@opensumi/di'; import { MonacoService, Emitter, URI } from '@opensumi/ide-core-browser'; -import { BrowserCodeEditor, BaseMonacoEditorWrapper } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; import { EditorCollectionService, EditorType } from '@opensumi/ide-editor'; -import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; -import { Injectable } from '@opensumi/di'; import { IEditorDecorationCollectionService, IEditorFeatureRegistry } from '@opensumi/ide-editor/lib/browser'; +import { BrowserCodeEditor, BaseMonacoEditorWrapper } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; import { EditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser/editor.decoration.service'; +import { MockedMonacoService } from '@opensumi/ide-monaco/__mocks__/monaco.service.mock'; +import { monaco as monacoAPI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { IConfigurationService, IConfigurationChangeEvent, @@ -16,6 +14,9 @@ import { ConfigurationTarget, } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; + describe('editor collection service test', () => { let injector: MockInjector; diff --git a/packages/editor/__tests__/browser/editor.contribution.test.ts b/packages/editor/__tests__/browser/editor.contribution.test.ts index 78fb272d4d..b640fd70af 100644 --- a/packages/editor/__tests__/browser/editor.contribution.test.ts +++ b/packages/editor/__tests__/browser/editor.contribution.test.ts @@ -1,8 +1,9 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { EditorModule } from '@opensumi/ide-editor/lib/browser'; import { EditorContribution } from '@opensumi/ide-editor/lib/browser/editor.contribution'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; + describe('Editor contribution should be work', () => { let mockInjector: MockInjector; diff --git a/packages/editor/__tests__/browser/editor.feature.test.ts b/packages/editor/__tests__/browser/editor.feature.test.ts index df203ec92e..dbe9ba6804 100644 --- a/packages/editor/__tests__/browser/editor.feature.test.ts +++ b/packages/editor/__tests__/browser/editor.feature.test.ts @@ -1,7 +1,6 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { QuickPickService, PreferenceService, IContextKeyService } from '@opensumi/ide-core-browser'; +import { AbstractContextMenuService, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; import { ILogger, Disposable, URI, Emitter, IEventBus, ISelection } from '@opensumi/ide-core-common'; -import { EditorFeatureRegistryImpl } from '@opensumi/ide-editor/lib/browser/feature'; import { IEditor } from '@opensumi/ide-editor'; import { IEditorFeatureRegistry, @@ -15,13 +14,15 @@ import { EditorGroupChangeEvent, EditorGroupCloseEvent, } from '@opensumi/ide-editor/lib/browser'; -import { EditorTopPaddingContribution } from '@opensumi/ide-editor/lib/browser/view/topPadding'; -import { QuickPickService, PreferenceService, IContextKeyService } from '@opensumi/ide-core-browser'; +import { EditorFeatureRegistryImpl } from '@opensumi/ide-editor/lib/browser/feature'; import { FormattingSelector } from '@opensumi/ide-editor/lib/browser/format/formatterSelect'; import { EditorHistoryService } from '@opensumi/ide-editor/lib/browser/history'; -import { AbstractContextMenuService, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; import { EditorContextMenuBrowserEditorContribution } from '@opensumi/ide-editor/lib/browser/menu/editor.context'; import { TabTitleMenuService } from '@opensumi/ide-editor/lib/browser/menu/title-context.menu'; +import { EditorTopPaddingContribution } from '@opensumi/ide-editor/lib/browser/view/topPadding'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; Error.stackTraceLimit = 100; diff --git a/packages/editor/__tests__/browser/editor.status-bar.test.ts b/packages/editor/__tests__/browser/editor.status-bar.test.ts index 5df9785cd0..a63a2c6edd 100644 --- a/packages/editor/__tests__/browser/editor.status-bar.test.ts +++ b/packages/editor/__tests__/browser/editor.status-bar.test.ts @@ -1,9 +1,10 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { Emitter } from '@opensumi/ide-core-common'; import { WorkbenchEditorService, ILanguageService, CursorStatus } from '@opensumi/ide-editor'; import { EditorStatusBarService } from '@opensumi/ide-editor/lib/browser/editor.status-bar.service'; -import { Emitter } from '@opensumi/ide-core-common'; import { IStatusBarService } from '@opensumi/ide-status-bar/lib/common'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; + describe('editor status bar item test', () => { const injector = createBrowserInjector([]); const _activeResourceChangeEvent: Emitter = new Emitter(); diff --git a/packages/editor/__tests__/browser/quick-open/workspace-symbol-quickopen.test.ts b/packages/editor/__tests__/browser/quick-open/workspace-symbol-quickopen.test.ts index b1844cdb46..a278357917 100644 --- a/packages/editor/__tests__/browser/quick-open/workspace-symbol-quickopen.test.ts +++ b/packages/editor/__tests__/browser/quick-open/workspace-symbol-quickopen.test.ts @@ -1,6 +1,10 @@ +import { SymbolInformation, Location } from 'vscode-languageserver-types'; + +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { SymbolKind as SymbolKindEnum } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { MockInjector, mockService } from '../../../../../tools/dev-tool/src/mock-injector'; + import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '../../../../../tools/dev-tool/src/mock-injector'; import { WorkspaceSymbolQuickOpenHandler } from '../../../src/browser/quick-open/workspace-symbol-quickopen'; import { ILanguageService, @@ -8,8 +12,6 @@ import { WorkspaceSymbolParams, WorkbenchEditorService, } from '../../../src/common'; -import { SymbolInformation, Location } from 'vscode-languageserver-types'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; class MockWorkspaceSymbolProvider implements WorkspaceSymbolProvider { provideWorkspaceSymbols(params: WorkspaceSymbolParams, token): Thenable { diff --git a/packages/editor/__tests__/browser/resource.test.ts b/packages/editor/__tests__/browser/resource.test.ts index df93976033..463dfe42b7 100644 --- a/packages/editor/__tests__/browser/resource.test.ts +++ b/packages/editor/__tests__/browser/resource.test.ts @@ -1,3 +1,11 @@ +import { AppConfig, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { URI, IEventBus, Schemas, ILoggerManagerClient } from '@opensumi/ide-core-common'; +import { IEditorDocumentModelService, ICompareService } from '@opensumi/ide-editor/lib/browser'; +import { DiffResourceProvider, DefaultDiffEditorContribution } from '@opensumi/ide-editor/lib/browser/diff'; +import { CompareService } from '@opensumi/ide-editor/lib/browser/diff/compare'; +import { UntitledSchemeDocumentProvider } from '@opensumi/ide-editor/lib/browser/untitled-resource'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { ResourceService, @@ -9,13 +17,6 @@ import { WorkbenchEditorService, } from '../../src'; import { ResourceServiceImpl } from '../../src/browser/resource.service'; -import { URI, IEventBus, Schemas, ILoggerManagerClient } from '@opensumi/ide-core-common'; -import { IEditorDocumentModelService, ICompareService } from '@opensumi/ide-editor/lib/browser'; -import { UntitledSchemeDocumentProvider } from '@opensumi/ide-editor/lib/browser/untitled-resource'; -import { AppConfig, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { DiffResourceProvider, DefaultDiffEditorContribution } from '@opensumi/ide-editor/lib/browser/diff'; -import { CompareService } from '@opensumi/ide-editor/lib/browser/diff/compare'; describe('resource service tests', () => { const injector = createBrowserInjector([]); diff --git a/packages/editor/__tests__/browser/test-providers.ts b/packages/editor/__tests__/browser/test-providers.ts index d4110290db..4fbf4c3f2b 100644 --- a/packages/editor/__tests__/browser/test-providers.ts +++ b/packages/editor/__tests__/browser/test-providers.ts @@ -1,5 +1,5 @@ -import { IResourceProvider, IResource } from '@opensumi/ide-editor'; import { URI, Emitter } from '@opensumi/ide-core-common'; +import { IResourceProvider, IResource } from '@opensumi/ide-editor'; import { IEditorDocumentModelContentProvider, IEditorComponentResolver, diff --git a/packages/editor/src/browser/breadcrumb/default.ts b/packages/editor/src/browser/breadcrumb/default.ts index 444550e832..329da9e55b 100644 --- a/packages/editor/src/browser/breadcrumb/default.ts +++ b/packages/editor/src/browser/breadcrumb/default.ts @@ -1,4 +1,5 @@ import debounce = require('lodash.debounce'); + import { Autowired, Injectable } from '@opensumi/di'; import { CommandService, @@ -22,6 +23,7 @@ import { IWorkspaceService } from '@opensumi/ide-workspace'; import { IEditor } from '../../common'; import { EditorSelectionChangeEvent, IBreadCrumbPart, IBreadCrumbProvider } from '../types'; + import { DocumentSymbolChangedEvent, DocumentSymbolStore, INormalizedDocumentSymbol } from './document-symbol'; @Injectable() diff --git a/packages/editor/src/browser/breadcrumb/document-symbol.ts b/packages/editor/src/browser/breadcrumb/document-symbol.ts index 734b2f187b..e40e66064f 100644 --- a/packages/editor/src/browser/breadcrumb/document-symbol.ts +++ b/packages/editor/src/browser/breadcrumb/document-symbol.ts @@ -1,4 +1,5 @@ -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import debounce = require('lodash.debounce'); + import { Injectable, Autowired } from '@opensumi/di'; import { WithEventBus, @@ -10,10 +11,11 @@ import { Deferred, CancellationToken, } from '@opensumi/ide-core-browser'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import { DocumentSymbol, SymbolTag } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + import { WorkbenchEditorService } from '../../common'; import { IEditorDocumentModelService, EditorDocumentModelContentChangedEvent } from '../doc-model/types'; -import debounce = require('lodash.debounce'); -import { DocumentSymbol, SymbolTag } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; @Injectable() export class DocumentSymbolStore extends WithEventBus { diff --git a/packages/editor/src/browser/breadcrumb/index.ts b/packages/editor/src/browser/breadcrumb/index.ts index 75fc54a099..5262139cd8 100644 --- a/packages/editor/src/browser/breadcrumb/index.ts +++ b/packages/editor/src/browser/breadcrumb/index.ts @@ -1,8 +1,11 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IBreadCrumbService, IBreadCrumbPart, IBreadCrumbProvider } from '../types'; import { IDisposable, URI, addElement, MaybeNull, Emitter } from '@opensumi/ide-core-browser'; -import { DefaultBreadCrumbProvider } from './default'; + import { IEditor } from '../../common'; +import { IBreadCrumbService, IBreadCrumbPart, IBreadCrumbProvider } from '../types'; + +import { DefaultBreadCrumbProvider } from './default'; + @Injectable() export class BreadCrumbServiceImpl implements IBreadCrumbService { diff --git a/packages/editor/src/browser/component.ts b/packages/editor/src/browser/component.ts index e7619ee245..ca9f1ee945 100644 --- a/packages/editor/src/browser/component.ts +++ b/packages/editor/src/browser/component.ts @@ -1,3 +1,10 @@ +import ReactDOM from 'react-dom'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { ExtensionActivateEvent, IDisposable, IEventBus } from '@opensumi/ide-core-common'; + +import { IResource, IEditorOpenType } from '../common'; + import { EditorComponentRegistry, IEditorComponent, @@ -9,10 +16,7 @@ import { RegisterEditorComponentEvent, RegisterEditorSideComponentEvent, } from './types'; -import { ExtensionActivateEvent, IDisposable, IEventBus } from '@opensumi/ide-core-common'; -import { IResource, IEditorOpenType } from '../common'; -import { Injectable, Autowired } from '@opensumi/di'; -import ReactDOM from 'react-dom'; + type SchemeKey = string; diff --git a/packages/editor/src/browser/component/scroll/scroll.tsx b/packages/editor/src/browser/component/scroll/scroll.tsx index 68a4074f9b..d52c8ab331 100644 --- a/packages/editor/src/browser/component/scroll/scroll.tsx +++ b/packages/editor/src/browser/component/scroll/scroll.tsx @@ -1,8 +1,9 @@ -import React from 'react'; -import styles from './scroll.module.less'; import classnames from 'classnames'; +import React from 'react'; import { MouseEvent, UIEvent } from 'react'; +import styles from './scroll.module.less'; + export interface ScrollAreaProps { className?: string; onScroll?: (position: ScrollPosition) => any; diff --git a/packages/editor/src/browser/decoration-applier.ts b/packages/editor/src/browser/decoration-applier.ts index 5e85596eaf..9e0ed8373c 100644 --- a/packages/editor/src/browser/decoration-applier.ts +++ b/packages/editor/src/browser/decoration-applier.ts @@ -1,6 +1,13 @@ +import clsx from 'classnames'; + +import { Autowired, Injectable } from '@opensumi/di'; +import { Disposable, URI, IEventBus } from '@opensumi/ide-core-common'; import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { IThemeService } from '@opensumi/ide-theme'; import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { Autowired, Injectable } from '@opensumi/di'; + +import { IDecorationRenderOptions, IDecorationApplyOptions, IMarkdownString } from '../common'; + import { IEditorDecorationCollectionService, IDynamicModelDecorationProperty, @@ -9,10 +16,7 @@ import { EditorDecorationTypeRemovedEvent, DidApplyEditorDecorationFromProvider, } from './types'; -import { IDecorationRenderOptions, IDecorationApplyOptions, IMarkdownString } from '../common'; -import { Disposable, URI, IEventBus } from '@opensumi/ide-core-common'; -import { IThemeService } from '@opensumi/ide-theme'; -import clsx from 'classnames'; + @Injectable({ multiple: true }) export class MonacoEditorDecorationApplier extends Disposable { diff --git a/packages/editor/src/browser/diff/compare.ts b/packages/editor/src/browser/diff/compare.ts index 1e5674ee64..435b0d35f5 100644 --- a/packages/editor/src/browser/diff/compare.ts +++ b/packages/editor/src/browser/diff/compare.ts @@ -1,5 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { ICompareService, CompareResult } from '../types'; import { URI, Domain, @@ -13,6 +12,8 @@ import { import { getIcon } from '@opensumi/ide-core-browser'; import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { ICompareService, CompareResult } from '../types'; + @Injectable() export class CompareService implements ICompareService { public readonly comparing = new Map>(); diff --git a/packages/editor/src/browser/diff/index.ts b/packages/editor/src/browser/diff/index.ts index a0c43379f5..ef8f2920ed 100644 --- a/packages/editor/src/browser/diff/index.ts +++ b/packages/editor/src/browser/diff/index.ts @@ -1,7 +1,8 @@ -import { IResourceProvider, IDiffResource, ResourceService, ResourceDecorationChangeEvent } from '../../common'; -import { URI, Domain, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; import { Injectable, Autowired } from '@opensumi/di'; +import { URI, Domain, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; + +import { IResourceProvider, IDiffResource, ResourceService, ResourceDecorationChangeEvent } from '../../common'; import { BrowserEditorContribution, EditorComponentRegistry } from '../types'; // diff URI: diff --git a/packages/editor/src/browser/doc-cache/empty-doc-cache.ts b/packages/editor/src/browser/doc-cache/empty-doc-cache.ts index 51b3164622..8ea0969cc3 100644 --- a/packages/editor/src/browser/doc-cache/empty-doc-cache.ts +++ b/packages/editor/src/browser/doc-cache/empty-doc-cache.ts @@ -1,5 +1,6 @@ import { Injectable } from '@opensumi/di'; import { URI } from '@opensumi/ide-core-browser'; + import { IDocPersistentCacheProvider, IDocStatus } from '../../common/doc-cache'; /** diff --git a/packages/editor/src/browser/doc-cache/local-storage-cache.ts b/packages/editor/src/browser/doc-cache/local-storage-cache.ts index 5cdb9271d9..c3e36c62dc 100644 --- a/packages/editor/src/browser/doc-cache/local-storage-cache.ts +++ b/packages/editor/src/browser/doc-cache/local-storage-cache.ts @@ -1,8 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; import { URI } from '@opensumi/ide-core-common'; -import { IDocPersistentCacheProvider, IDocStatus, IDocCache, parseCacheValueFrom } from '../../common/doc-cache'; import { IWorkspaceStorageService } from '@opensumi/ide-workspace'; +import { IDocPersistentCacheProvider, IDocStatus, IDocCache, parseCacheValueFrom } from '../../common/doc-cache'; + /** * 使用 LocalStorage 实现的文档缓存对象 */ diff --git a/packages/editor/src/browser/doc-model/editor-document-model-service.ts b/packages/editor/src/browser/doc-model/editor-document-model-service.ts index cb6b66518c..91b4a94609 100644 --- a/packages/editor/src/browser/doc-model/editor-document-model-service.ts +++ b/packages/editor/src/browser/doc-model/editor-document-model-service.ts @@ -1,3 +1,4 @@ +import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { URI, IRef, @@ -14,8 +15,11 @@ import { ReadyEvent, memoize, } from '@opensumi/ide-core-browser'; -import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { mapToSerializable, serializableToMap } from '@opensumi/ide-core-common/lib/map'; +import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { EditorDocumentModel } from './editor-document-model'; import { IEditorDocumentModel, IEditorDocumentModelContentRegistry, @@ -24,10 +28,6 @@ import { EditorDocumentModelCreationEvent, IPreferredModelOptions, } from './types'; -import { EditorDocumentModel } from './editor-document-model'; -import { mapToSerializable, serializableToMap } from '@opensumi/ide-core-common/lib/map'; -import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; export const EDITOR_DOCUMENT_MODEL_STORAGE: URI = new URI('editor-doc').withScheme(STORAGE_SCHEMA.SCOPE); diff --git a/packages/editor/src/browser/doc-model/editor-document-model.ts b/packages/editor/src/browser/doc-model/editor-document-model.ts index a5e2718659..86dc90c372 100644 --- a/packages/editor/src/browser/doc-model/editor-document-model.ts +++ b/packages/editor/src/browser/doc-model/editor-document-model.ts @@ -1,4 +1,5 @@ -import { monaco, URI as MonacoURI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; +import debounce = require('lodash.debounce'); + import { Autowired, Injectable } from '@opensumi/di'; import { CommandService, @@ -16,7 +17,11 @@ import { REPORT_NAME, URI, } from '@opensumi/ide-core-browser'; +import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { monaco, URI as MonacoURI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; +import { EOL, EndOfLineSequence, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { IMessageService } from '@opensumi/ide-overlay'; + import { IDocCache, IDocPersistentCacheProvider, @@ -25,7 +30,10 @@ import { SaveReason, IEditorDocumentModelContentChange, } from '../../common'; +import { EditorPreferences } from '../preference/schema'; +import { createEditorPreferenceProxy } from '../preference/util'; import { CompareResult, ICompareService } from '../types'; + import { EditorDocumentError } from './editor-document-error'; import { IEditorDocumentModelServiceImpl, SaveTask } from './save-task'; import { @@ -40,11 +48,6 @@ import { EditorDocumentModelWillSaveEvent, } from './types'; -import debounce = require('lodash.debounce'); -import { EditorPreferences } from '../preference/schema'; -import { createEditorPreferenceProxy } from '../preference/util'; -import { EOL, EndOfLineSequence, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; export interface EditorDocumentModelConstructionOptions { eol?: EOL; diff --git a/packages/editor/src/browser/doc-model/override.ts b/packages/editor/src/browser/doc-model/override.ts index bc9eba51d2..566b5bcf31 100644 --- a/packages/editor/src/browser/doc-model/override.ts +++ b/packages/editor/src/browser/doc-model/override.ts @@ -1,11 +1,12 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +/* istanbul ignore file */ +import { Autowired, Injectable } from '@opensumi/di'; +import { URI } from '@opensumi/ide-core-browser'; import { ITextModelService, ITextModelContentProvider, } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/resolverService'; -/* istanbul ignore file */ -import { Autowired, Injectable } from '@opensumi/di'; -import { URI } from '@opensumi/ide-core-browser'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IEditorDocumentModelService } from './types'; @Injectable() diff --git a/packages/editor/src/browser/doc-model/save-task.ts b/packages/editor/src/browser/doc-model/save-task.ts index ed7a25b82b..556550a415 100644 --- a/packages/editor/src/browser/doc-model/save-task.ts +++ b/packages/editor/src/browser/doc-model/save-task.ts @@ -1,5 +1,6 @@ import { URI, Deferred, IEditorDocumentChange, IEditorDocumentModelSaveResult } from '@opensumi/ide-core-browser'; import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; + import { IEditorDocumentModelService } from './types'; export interface IEditorDocumentModelServiceImpl extends IEditorDocumentModelService { diff --git a/packages/editor/src/browser/doc-model/saveParticipants.ts b/packages/editor/src/browser/doc-model/saveParticipants.ts index f27e7cdb72..24debdae4a 100644 --- a/packages/editor/src/browser/doc-model/saveParticipants.ts +++ b/packages/editor/src/browser/doc-model/saveParticipants.ts @@ -1,10 +1,4 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { CodeActionKind } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/types'; -import { - getCodeActions, - CodeActionItem, -} from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/codeAction'; +import { Injectable, Autowired } from '@opensumi/di'; import { ClientAppContribution, WithEventBus, @@ -18,10 +12,19 @@ import { MonacoOverrideServiceRegistry, Progress, } from '@opensumi/ide-core-browser'; -import { Injectable, Autowired } from '@opensumi/di'; -import { EditorDocumentModelWillSaveEvent, IEditorDocumentModelService } from './types'; -import { SaveReason } from '../types'; import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import { + getCodeActions, + CodeActionItem, +} from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/codeAction'; +import { CodeActionKind } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { SaveReason } from '../types'; + +import { EditorDocumentModelWillSaveEvent, IEditorDocumentModelService } from './types'; + @Injectable() export class CodeActionOnSaveParticipant extends WithEventBus { diff --git a/packages/editor/src/browser/doc-model/types.ts b/packages/editor/src/browser/doc-model/types.ts index 4003deec18..9de20f3fa9 100644 --- a/packages/editor/src/browser/doc-model/types.ts +++ b/packages/editor/src/browser/doc-model/types.ts @@ -1,5 +1,3 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; - import { URI, MaybePromise, @@ -12,8 +10,11 @@ import { IEditorDocumentChange, IEditorDocumentModelSaveResult, } from '@opensumi/ide-core-browser'; -import { IEditorDocumentModelContentChange, SaveReason } from '../../common'; import { EndOfLineSequence, EOL, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { IEditorDocumentModelContentChange, SaveReason } from '../../common'; + /** * editorDocumentModel is a wrapped concept for monaco's textModel */ diff --git a/packages/editor/src/browser/editor-collection.service.ts b/packages/editor/src/browser/editor-collection.service.ts index 66298676de..7cac3b9c82 100644 --- a/packages/editor/src/browser/editor-collection.service.ts +++ b/packages/editor/src/browser/editor-collection.service.ts @@ -1,9 +1,6 @@ -import type { - ICodeEditor as IMonacoCodeEditor, - IDiffEditor as IMonacoDiffEditor, -} from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { IRange, MonacoService, IContextKeyService } from '@opensumi/ide-core-browser'; +import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey'; import { ILineChange, URI, @@ -14,6 +11,14 @@ import { Disposable, removeUndefined, } from '@opensumi/ide-core-common'; +import { Emitter } from '@opensumi/ide-core-common'; +import type { + ICodeEditor as IMonacoCodeEditor, + IDiffEditor as IMonacoDiffEditor, +} from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; + import { ICodeEditor, IEditor, @@ -26,7 +31,8 @@ import { EditorType, IResourceOpenOptions, } from '../common'; -import { IRange, MonacoService, IContextKeyService } from '@opensumi/ide-core-browser'; + + import { MonacoEditorDecorationApplier } from './decoration-applier'; import { IEditorDocumentModelRef, @@ -34,12 +40,10 @@ import { IEditorDocumentModelService, IEditorDocumentModel, } from './doc-model/types'; -import { Emitter } from '@opensumi/ide-core-common'; -import { IEditorFeatureRegistry } from './types'; import { EditorFeatureRegistryImpl } from './feature'; import { getConvertedMonacoOptions, isEditorOption, isDiffEditorOption } from './preference/converter'; -import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey'; -import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; +import { IEditorFeatureRegistry } from './types'; + @Injectable() export class EditorCollectionServiceImpl extends WithEventBus implements EditorCollectionService { diff --git a/packages/editor/src/browser/editor-opener.ts b/packages/editor/src/browser/editor-opener.ts index a87eed7748..3b9bafcb44 100644 --- a/packages/editor/src/browser/editor-opener.ts +++ b/packages/editor/src/browser/editor-opener.ts @@ -1,5 +1,6 @@ import { Autowired, Injectable } from '@opensumi/di'; import { IOpener, URI, IRange } from '@opensumi/ide-core-browser'; + import { WorkbenchEditorService, ResourceService } from '../common'; @Injectable() diff --git a/packages/editor/src/browser/editor.contribution.ts b/packages/editor/src/browser/editor.contribution.ts index 965cca5a1a..0814fa53e7 100644 --- a/packages/editor/src/browser/editor.contribution.ts +++ b/packages/editor/src/browser/editor.contribution.ts @@ -1,4 +1,3 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IClientApp, @@ -34,9 +33,11 @@ import { AppConfig, } from '@opensumi/ide-core-browser'; import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; -import { isWindows, isOSX, PreferenceScope, ILogger } from '@opensumi/ide-core-common'; import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { isWindows, isOSX, PreferenceScope, ILogger } from '@opensumi/ide-core-common'; import { SUPPORTED_ENCODINGS } from '@opensumi/ide-core-common/lib/const'; +import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { WorkbenchEditorService, @@ -49,25 +50,24 @@ import { IEditor, SaveReason, } from '../common'; -import { EditorGroupsResetSizeEvent, BrowserEditorContribution, IEditorFeatureRegistry } from './types'; -import { WorkbenchEditorServiceImpl, EditorGroup } from './workbench-editor.service'; +import { AUTO_SAVE_MODE } from '../common/editor'; + +import { MonacoTextModelService } from './doc-model/override'; +import { IEditorDocumentModelService } from './doc-model/types'; +import { IEditorDocumentModelContentRegistry } from './doc-model/types'; +import { EditorOpener } from './editor-opener'; +import { MonacoCodeService, MonacoContextViewService } from './editor.override'; import { EditorStatusBarService } from './editor.status-bar.service'; import { EditorView } from './editor.view'; +import { FormattingSelector } from './format/formatterSelect'; import { EditorHistoryService } from './history'; import { NavigationMenuContainer } from './navigation.view'; -import { IEditorDocumentModelService } from './doc-model/types'; -import { FormattingSelector } from './format/formatterSelect'; -import { EditorTopPaddingContribution } from './view/topPadding'; -import { EditorSuggestWidgetContribution } from './view/suggest-widget'; -import { MonacoCodeService, MonacoContextViewService } from './editor.override'; -import { MonacoTextModelService } from './doc-model/override'; -import { EditorOpener } from './editor-opener'; -import { WorkspaceSymbolQuickOpenHandler } from './quick-open/workspace-symbol-quickopen'; - -import { AUTO_SAVE_MODE } from '../common/editor'; -import { IEditorDocumentModelContentRegistry } from './doc-model/types'; -import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { GoToLineQuickOpenHandler } from './quick-open/go-to-line'; +import { WorkspaceSymbolQuickOpenHandler } from './quick-open/workspace-symbol-quickopen'; +import { EditorGroupsResetSizeEvent, BrowserEditorContribution, IEditorFeatureRegistry } from './types'; +import { EditorSuggestWidgetContribution } from './view/suggest-widget'; +import { EditorTopPaddingContribution } from './view/topPadding'; +import { WorkbenchEditorServiceImpl, EditorGroup } from './workbench-editor.service'; interface ResourceArgs { group: EditorGroup; diff --git a/packages/editor/src/browser/editor.decoration.service.ts b/packages/editor/src/browser/editor.decoration.service.ts index 3249153988..cf1cf4d17e 100644 --- a/packages/editor/src/browser/editor.decoration.service.ts +++ b/packages/editor/src/browser/editor.decoration.service.ts @@ -1,8 +1,12 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Autowired, Injectable } from '@opensumi/di'; +import { URI, IDisposable, Disposable, IEventBus } from '@opensumi/ide-core-browser'; +import { IThemeService } from '@opensumi/ide-theme'; import { ICSSStyleService } from '@opensumi/ide-theme/lib/common/style'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IThemeDecorationRenderOptions, IDecorationRenderOptions, IContentDecorationRenderOptions } from '../common'; -import { URI, IDisposable, Disposable, IEventBus } from '@opensumi/ide-core-browser'; + + import { IEditorDecorationCollectionService, IBrowserTextEditorDecorationType, @@ -13,7 +17,7 @@ import { EditorDecorationChangeEvent, EditorDecorationTypeRemovedEvent, } from './types'; -import { IThemeService } from '@opensumi/ide-theme'; + @Injectable() export class EditorDecorationCollectionService implements IEditorDecorationCollectionService { decorations: Map = new Map(); diff --git a/packages/editor/src/browser/editor.override.ts b/packages/editor/src/browser/editor.override.ts index be392f3765..ee1ade618c 100644 --- a/packages/editor/src/browser/editor.override.ts +++ b/packages/editor/src/browser/editor.override.ts @@ -1,18 +1,20 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { Autowired, Injectable } from '@opensumi/di'; +import { PreferenceService } from '@opensumi/ide-core-browser'; +import { URI, IRange } from '@opensumi/ide-core-common'; import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/editorBrowser'; -import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; -import { CodeEditorServiceImpl } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/codeEditorServiceImpl'; import { ICodeEditorService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService'; +import { CodeEditorServiceImpl } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/codeEditorServiceImpl'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { SimpleLayoutService } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/simpleServices'; +import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; import { ContextViewService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextview/browser/contextViewService'; /* istanbul ignore file */ -import { WorkbenchEditorServiceImpl } from './workbench-editor.service'; import { WorkbenchEditorService } from '../common'; -import { URI, IRange } from '@opensumi/ide-core-common'; -import { Autowired, Injectable } from '@opensumi/di'; + import { BrowserCodeEditor } from './editor-collection.service'; -import { PreferenceService } from '@opensumi/ide-core-browser'; +import { WorkbenchEditorServiceImpl } from './workbench-editor.service'; + @Injectable() export class MonacoCodeService extends CodeEditorServiceImpl { diff --git a/packages/editor/src/browser/editor.status-bar.service.ts b/packages/editor/src/browser/editor.status-bar.service.ts index 2153ba5fcc..b9c98ace9c 100644 --- a/packages/editor/src/browser/editor.status-bar.service.ts +++ b/packages/editor/src/browser/editor.status-bar.service.ts @@ -1,8 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; - +import { localize, WithEventBus, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; import { StatusBarAlignment, IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; + import { WorkbenchEditorService, IEditor, CursorStatus, ILanguageService } from '../common'; -import { localize, WithEventBus, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; + + import { EditorDocumentModelOptionChangedEvent } from './doc-model/types'; @Injectable() diff --git a/packages/editor/src/browser/editor.view.tsx b/packages/editor/src/browser/editor.view.tsx index 5f9bdd571f..defaff025d 100644 --- a/packages/editor/src/browser/editor.view.tsx +++ b/packages/editor/src/browser/editor.view.tsx @@ -1,3 +1,9 @@ +import classnames from 'classnames'; +import { observer } from 'mobx-react-lite'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import ReactIs from 'react-is'; + import { AppConfig, ComponentRegistry, @@ -18,15 +24,13 @@ import { ResizeHandleVertical, } from '@opensumi/ide-core-browser/lib/components'; import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; -import classnames from 'classnames'; -import React from 'react'; -import ReactIs from 'react-is'; -import ReactDOM from 'react-dom'; -import { observer } from 'mobx-react-lite'; + import { IEditorOpenType, IResource, WorkbenchEditorService } from '../common'; + import { EditorComponentRegistryImpl } from './component'; import { Scroll } from './component/scroll/scroll'; +import styles from './editor.module.less'; import { EditorGrid, SplitDirection } from './grid/grid.service'; import { NavigationBar } from './navigation.view'; import { Tabs } from './tab.view'; @@ -42,7 +46,6 @@ import { CodeEditorDidVisibleEvent, } from './types'; import { EditorGroup, WorkbenchEditorServiceImpl } from './workbench-editor.service'; -import styles from './editor.module.less'; export const EditorView = () => { const ref = React.useRef(); diff --git a/packages/editor/src/browser/feature.ts b/packages/editor/src/browser/feature.ts index 97b4d73734..e942a6373a 100644 --- a/packages/editor/src/browser/feature.ts +++ b/packages/editor/src/browser/feature.ts @@ -1,8 +1,10 @@ -import { IEditorFeatureRegistry, IEditorFeatureContribution } from './types'; import { Injectable, Autowired } from '@opensumi/di'; import { IDisposable, addElement, ILogger, Emitter, Event, URI } from '@opensumi/ide-core-browser'; + import { IEditor } from '../common'; +import { IEditorFeatureRegistry, IEditorFeatureContribution } from './types'; + @Injectable() export class EditorFeatureRegistryImpl implements IEditorFeatureRegistry { private contributions: IEditorFeatureContribution[] = []; diff --git a/packages/editor/src/browser/format/formatterSelect.ts b/packages/editor/src/browser/format/formatterSelect.ts index 8d5e705def..64122a15ae 100644 --- a/packages/editor/src/browser/format/formatterSelect.ts +++ b/packages/editor/src/browser/format/formatterSelect.ts @@ -1,8 +1,9 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Injectable, Autowired } from '@opensumi/di'; import { QuickPickService, localize, PreferenceService, URI, PreferenceScope } from '@opensumi/ide-core-browser'; -import { IEditorDocumentModelService } from '../doc-model/types'; import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { IEditorDocumentModelService } from '../doc-model/types'; type IProvider = monaco.languages.DocumentFormattingEditProvider | monaco.languages.DocumentRangeFormattingEditProvider; diff --git a/packages/editor/src/browser/fs-resource/fs-editor-doc.ts b/packages/editor/src/browser/fs-resource/fs-editor-doc.ts index 45d0eed275..9e6920ed7b 100644 --- a/packages/editor/src/browser/fs-resource/fs-editor-doc.ts +++ b/packages/editor/src/browser/fs-resource/fs-editor-doc.ts @@ -1,4 +1,4 @@ -import { IEditorDocumentModelContentProvider } from '../doc-model/types'; +import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, URI, @@ -13,11 +13,12 @@ import { EncodingRegistry, } from '@opensumi/ide-core-browser'; import { UTF8_with_bom, UTF8, detectEncodingFromBuffer } from '@opensumi/ide-core-common/lib/encoding'; -import { Injectable, Autowired } from '@opensumi/di'; import { IFileServiceClient } from '@opensumi/ide-file-service'; -import { EditorPreferences } from '../preference/schema'; import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { IEditorDocumentModelContentProvider } from '../doc-model/types'; +import { EditorPreferences } from '../preference/schema'; + export interface ReadEncodingOptions { /** * The optional encoding parameter allows to specify the desired encoding when resolving diff --git a/packages/editor/src/browser/fs-resource/fs-resource.ts b/packages/editor/src/browser/fs-resource/fs-resource.ts index 7e7a15a9e1..14bb94e637 100644 --- a/packages/editor/src/browser/fs-resource/fs-resource.ts +++ b/packages/editor/src/browser/fs-resource/fs-resource.ts @@ -1,4 +1,4 @@ -import { IResourceProvider, IResource, ResourceNeedUpdateEvent } from '../../common'; +import { Autowired, Injectable } from '@opensumi/di'; import { OS, URI, @@ -9,15 +9,17 @@ import { LRUMap, IApplicationService, } from '@opensumi/ide-core-browser'; -import { Autowired, Injectable } from '@opensumi/di'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service/lib/common'; -import { Path } from '@opensumi/ide-core-common/lib/path'; import { FileChangeType } from '@opensumi/ide-core-common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; +import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service/lib/common'; import { IDialogService } from '@opensumi/ide-overlay'; -import { FileTreeSet } from './file-tree-set'; -import { IEditorDocumentModelService } from '../doc-model/types'; + +import { IResourceProvider, IResource, ResourceNeedUpdateEvent } from '../../common'; import { DIFF_SCHEME } from '../../common'; +import { IEditorDocumentModelService } from '../doc-model/types'; + +import { FileTreeSet } from './file-tree-set'; enum AskSaveResult { REVERT = 1, diff --git a/packages/editor/src/browser/fs-resource/index.ts b/packages/editor/src/browser/fs-resource/index.ts index cc365f4154..4d466ed92b 100644 --- a/packages/editor/src/browser/fs-resource/index.ts +++ b/packages/editor/src/browser/fs-resource/index.ts @@ -1,10 +1,13 @@ -import { Domain } from '@opensumi/ide-core-browser'; -import { BrowserEditorContribution } from '../types'; import { Autowired } from '@opensumi/di'; -import { FileSystemResourceProvider } from './fs-resource'; +import { Domain } from '@opensumi/ide-core-browser'; + + import { ResourceService } from '../../common'; import { IEditorDocumentModelContentRegistry } from '../doc-model/types'; +import { BrowserEditorContribution } from '../types'; + import { BaseFileSystemEditorDocumentProvider } from './fs-editor-doc'; +import { FileSystemResourceProvider } from './fs-resource'; @Domain(BrowserEditorContribution) export class FileSystemResourceContribution implements BrowserEditorContribution { diff --git a/packages/editor/src/browser/grid/grid.service.ts b/packages/editor/src/browser/grid/grid.service.ts index 97d93d3343..0c1fd5e18e 100644 --- a/packages/editor/src/browser/grid/grid.service.ts +++ b/packages/editor/src/browser/grid/grid.service.ts @@ -1,6 +1,7 @@ -import { IEditorGroup, IEditorGroupState, Direction } from '../../common'; import { IDisposable, IEventBus, MaybeNull, Emitter } from '@opensumi/ide-core-browser'; import { makeRandomHexString } from '@opensumi/ide-core-common/lib/functional'; + +import { IEditorGroup, IEditorGroupState, Direction } from '../../common'; import { GridResizeEvent } from '../types'; export const editorGridUid = new Set(); diff --git a/packages/editor/src/browser/history/index.ts b/packages/editor/src/browser/history/index.ts index 61d3911383..4fa33f94d4 100644 --- a/packages/editor/src/browser/history/index.ts +++ b/packages/editor/src/browser/history/index.ts @@ -1,7 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; import { IPosition, URI, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; -import { EditorSelectionChangeEvent, EditorGroupChangeEvent, EditorGroupCloseEvent } from '../types'; + import { WorkbenchEditorService } from '../../common'; +import { EditorSelectionChangeEvent, EditorGroupChangeEvent, EditorGroupCloseEvent } from '../types'; const HistoryPositionLineThreshold = 7; const HardMaxStateLength = 200; // 超过200个过后,会缩减至100个, 防止反复缩减 diff --git a/packages/editor/src/browser/index.ts b/packages/editor/src/browser/index.ts index 84082cace7..99f1fe7e8a 100644 --- a/packages/editor/src/browser/index.ts +++ b/packages/editor/src/browser/index.ts @@ -1,3 +1,4 @@ +import { Injectable, Provider, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { BrowserModule, Domain, @@ -6,12 +7,45 @@ import { PreferenceService, createPreferenceProxy, } from '@opensumi/ide-core-browser'; -import { EditorView } from './editor.view'; +import { ICallHierarchyService } from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy'; +import { + ICommandServiceToken, + IMonacoActionRegistry, + IMonacoCommandsRegistry, +} from '@opensumi/ide-monaco/lib/browser/contrib/command'; +import { ITextmateTokenizer } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; + import { EditorCollectionService, WorkbenchEditorService, ResourceService, ILanguageService } from '../common'; +import { IDocPersistentCacheProvider } from '../common/doc-cache'; + +import { BreadCrumbServiceImpl } from './breadcrumb'; +import { EditorComponentRegistryImpl } from './component'; +import { DefaultDiffEditorContribution } from './diff'; +import { CompareService, CompareEditorContribution } from './diff/compare'; +import { EmptyDocCacheImpl } from './doc-cache'; +import { EditorDocumentModelContentRegistryImpl, EditorDocumentModelServiceImpl } from './doc-model/main'; +import { SaveParticipantsContribution } from './doc-model/saveParticipants'; +import { IEditorDocumentModelContentRegistry, IEditorDocumentModelService } from './doc-model/types'; import { EditorCollectionServiceImpl } from './editor-collection.service'; -import { WorkbenchEditorServiceImpl } from './workbench-editor.service'; -import { Injectable, Provider, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { EditorContribution, EditorAutoSaveEditorContribution } from './editor.contribution'; +import { EditorDecorationCollectionService } from './editor.decoration.service'; +import { EditorView } from './editor.view'; +import { EditorFeatureRegistryImpl } from './feature'; +import { FileSystemResourceContribution } from './fs-resource'; +import { LanguageStatusContribution } from './language/language-status.contribution'; +import { LanguageStatusService } from './language/language-status.service'; +import { LanguageService } from './language/language.service'; +import { EditorContextMenuBrowserEditorContribution } from './menu/editor.context'; +import { EditorActionRegistryImpl } from './menu/editor.menu'; +import { CallHierarchyContribution, CallHierarchyService } from './monaco-contrib'; +import { + MonacoActionRegistry, + MonacoCommandRegistry, + MonacoCommandService, +} from './monaco-contrib/command/command.service'; +import { TextmateService } from './monaco-contrib/tokenizer/textmate.service'; +import { EditorPreferenceContribution } from './preference/contribution'; +import { EditorPreferences, editorPreferenceSchema } from './preference/schema'; import { ResourceServiceImpl } from './resource.service'; import { EditorComponentRegistry, @@ -23,39 +57,7 @@ import { IEditorFeatureRegistry, ILanguageStatusService, } from './types'; -import { EditorComponentRegistryImpl } from './component'; -import { DefaultDiffEditorContribution } from './diff'; -import { EditorDecorationCollectionService } from './editor.decoration.service'; -import { LanguageService } from './language/language.service'; -import { IEditorDocumentModelContentRegistry, IEditorDocumentModelService } from './doc-model/types'; -import { EditorDocumentModelContentRegistryImpl, EditorDocumentModelServiceImpl } from './doc-model/main'; -import { EditorActionRegistryImpl } from './menu/editor.menu'; -import { IDocPersistentCacheProvider } from '../common/doc-cache'; -import { EmptyDocCacheImpl } from './doc-cache'; -import { CompareService, CompareEditorContribution } from './diff/compare'; -import { BreadCrumbServiceImpl } from './breadcrumb'; -import { EditorContextMenuBrowserEditorContribution } from './menu/editor.context'; -import { EditorFeatureRegistryImpl } from './feature'; -import { EditorPreferenceContribution } from './preference/contribution'; -import { SaveParticipantsContribution } from './doc-model/saveParticipants'; -import { EditorPreferences, editorPreferenceSchema } from './preference/schema'; -import { FileSystemResourceContribution } from './fs-resource'; -import { ICallHierarchyService } from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy'; -import { CallHierarchyContribution, CallHierarchyService } from './monaco-contrib'; -import { - ICommandServiceToken, - IMonacoActionRegistry, - IMonacoCommandsRegistry, -} from '@opensumi/ide-monaco/lib/browser/contrib/command'; -import { - MonacoActionRegistry, - MonacoCommandRegistry, - MonacoCommandService, -} from './monaco-contrib/command/command.service'; -import { TextmateService } from './monaco-contrib/tokenizer/textmate.service'; -import { ITextmateTokenizer } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; -import { LanguageStatusService } from './language/language-status.service'; -import { LanguageStatusContribution } from './language/language-status.contribution'; +import { WorkbenchEditorServiceImpl } from './workbench-editor.service'; export * from './preference/schema'; export * from './types'; export * from './doc-model/types'; diff --git a/packages/editor/src/browser/language/diagnostic-collection.ts b/packages/editor/src/browser/language/diagnostic-collection.ts index f33a58de45..b7bc90c8b2 100644 --- a/packages/editor/src/browser/language/diagnostic-collection.ts +++ b/packages/editor/src/browser/language/diagnostic-collection.ts @@ -1,9 +1,14 @@ import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import IModel = monaco.editor.IModel; import IMarkerData = monaco.editor.IMarkerData; -import { DiagnosticCollection, Diagnostic, asDiagnostics } from '../../common'; + +// eslint-disable-next-line import/order import { DisposableCollection, Disposable, IDisposable } from '@opensumi/ide-core-common'; +// eslint-disable-next-line import/order +import { DiagnosticCollection, Diagnostic, asDiagnostics } from '../../common'; + export class MonacoDiagnosticCollection implements DiagnosticCollection { protected readonly diagnostics = new Map(); protected readonly toDispose = new DisposableCollection(); diff --git a/packages/editor/src/browser/language/language-status.contribution.ts b/packages/editor/src/browser/language/language-status.contribution.ts index ee657a2f59..fc54e65298 100644 --- a/packages/editor/src/browser/language/language-status.contribution.ts +++ b/packages/editor/src/browser/language/language-status.contribution.ts @@ -8,6 +8,7 @@ import { StatusBarAlignment, WithEventBus, } from '@opensumi/ide-core-browser'; + import { WorkbenchEditorService, IEditor, ILanguageStatusService, ILanguageStatus } from '../../common'; import { EditorDocumentModelOptionChangedEvent } from '../doc-model/types'; diff --git a/packages/editor/src/browser/language/language-status.service.ts b/packages/editor/src/browser/language/language-status.service.ts index 833cbe5894..f2278538d9 100644 --- a/packages/editor/src/browser/language/language-status.service.ts +++ b/packages/editor/src/browser/language/language-status.service.ts @@ -1,9 +1,11 @@ import { Injectable } from '@opensumi/di'; -import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { compare, Event, IDisposable } from '@opensumi/ide-core-common'; -import { ILanguageStatusService, ILanguageStatus } from '../../common'; +import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { LanguageFeatureRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/languageFeatureRegistry'; +import { ILanguageStatusService, ILanguageStatus } from '../../common'; + + @Injectable() export class LanguageStatusService implements ILanguageStatusService { private readonly _provider = new LanguageFeatureRegistry(); diff --git a/packages/editor/src/browser/language/language.service.ts b/packages/editor/src/browser/language/language.service.ts index 18a447dcdb..cdf8874d39 100644 --- a/packages/editor/src/browser/language/language.service.ts +++ b/packages/editor/src/browser/language/language.service.ts @@ -1,6 +1,4 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { Autowired, Injectable } from '@opensumi/di'; -import { MonacoDiagnosticCollection } from './diagnostic-collection'; import { URI, IDisposable, @@ -10,6 +8,8 @@ import { IRelatedInformation, MarkerSeverity, } from '@opensumi/ide-core-common'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { DiagnosticSeverity, DiagnosticRelatedInformation, @@ -19,6 +19,8 @@ import { ILanguageService, } from '../../common'; +import { MonacoDiagnosticCollection } from './diagnostic-collection'; + export type Mutable = { -readonly [P in keyof T]: T[P] }; function reviveSeverity(severity: MarkerSeverity): DiagnosticSeverity { diff --git a/packages/editor/src/browser/menu/editor.context.ts b/packages/editor/src/browser/menu/editor.context.ts index 23446b88da..11f281f904 100644 --- a/packages/editor/src/browser/menu/editor.context.ts +++ b/packages/editor/src/browser/menu/editor.context.ts @@ -1,11 +1,11 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { ContextMenuController } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/contextmenu/contextmenu'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { Disposable, Domain, IContextKeyService } from '@opensumi/ide-core-browser'; import { AbstractContextMenuService, MenuId, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; -import { EditorOption } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; -import { IAnchor } from '@opensumi/monaco-editor-core/esm/vs/base/browser/ui/contextview/contextview'; import * as dom from '@opensumi/monaco-editor-core/esm/vs/base/browser/dom'; +import { IAnchor } from '@opensumi/monaco-editor-core/esm/vs/base/browser/ui/contextview/contextview'; +import { EditorOption } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import { ContextMenuController } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/contextmenu/contextmenu'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { IEditor } from '../../common'; import { BrowserEditorContribution, IEditorFeatureRegistry } from '../types'; diff --git a/packages/editor/src/browser/menu/editor.menu.ts b/packages/editor/src/browser/menu/editor.menu.ts index 0c1102e72a..525813b224 100644 --- a/packages/editor/src/browser/menu/editor.menu.ts +++ b/packages/editor/src/browser/menu/editor.menu.ts @@ -1,8 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IEditorActionRegistry } from '../types'; import { IDisposable, Disposable, IContextKeyService, ILogger } from '@opensumi/ide-core-browser'; -import { IEditorGroup } from '../../common'; import { MenuId, IMenu, AbstractMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; + +import { IEditorGroup } from '../../common'; +import { IEditorActionRegistry } from '../types'; import { EditorGroup } from '../workbench-editor.service'; @Injectable() diff --git a/packages/editor/src/browser/menu/title-context.menu.ts b/packages/editor/src/browser/menu/title-context.menu.ts index 0db28f0af6..5848fe51d4 100644 --- a/packages/editor/src/browser/menu/title-context.menu.ts +++ b/packages/editor/src/browser/menu/title-context.menu.ts @@ -1,10 +1,11 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { URI } from '@opensumi/ide-core-common'; + import { IEditorGroup } from '../../common'; import { EditorGroup } from '../workbench-editor.service'; -import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; @Injectable() export class TabTitleMenuService { diff --git a/packages/editor/src/browser/monaco-contrib/callHierarchy/callHierarchy.contribution.ts b/packages/editor/src/browser/monaco-contrib/callHierarchy/callHierarchy.contribution.ts index 3a56b0add3..8cfd58cd64 100644 --- a/packages/editor/src/browser/monaco-contrib/callHierarchy/callHierarchy.contribution.ts +++ b/packages/editor/src/browser/monaco-contrib/callHierarchy/callHierarchy.contribution.ts @@ -8,13 +8,13 @@ import { IContextKey, Uri, } from '@opensumi/ide-core-browser'; -import { Position } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/position'; import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; import { CallHierarchyItem, CallHierarchyProviderRegistry, ICallHierarchyService, } from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy'; +import { Position } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/position'; import { BrowserEditorContribution, IEditor, IEditorFeatureRegistry } from '../../types'; diff --git a/packages/editor/src/browser/monaco-contrib/command/command.service.ts b/packages/editor/src/browser/monaco-contrib/command/command.service.ts index f3eaf82158..5dc99957fa 100644 --- a/packages/editor/src/browser/monaco-contrib/command/command.service.ts +++ b/packages/editor/src/browser/monaco-contrib/command/command.service.ts @@ -1,4 +1,3 @@ -import { URI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; import { Injectable, Autowired } from '@opensumi/di'; import { Command, @@ -16,7 +15,6 @@ import { Uri, MonacoOverrideServiceRegistry, } from '@opensumi/ide-core-browser'; - import { CommandsRegistry as MonacoCommandsRegistry, EditorExtensionsRegistry, @@ -27,8 +25,10 @@ import { IMonacoCommandsRegistry, MonacoEditorCommandHandler, } from '@opensumi/ide-monaco/lib/browser/contrib/command'; +import { URI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; import { StaticServices } from '@opensumi/ide-monaco/lib/browser/monaco-api/services'; import { Event, ICodeEditor, IEvent } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; + import { EditorCollectionService, WorkbenchEditorService } from '../../types'; /** diff --git a/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-registry.ts b/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-registry.ts index 8caed9ec91..2c25579212 100644 --- a/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-registry.ts +++ b/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-registry.ts @@ -16,8 +16,9 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/monaco/src/browser/textmate/textmate-registry.ts -import { Injectable } from '@opensumi/di'; import { IGrammarConfiguration } from 'vscode-textmate'; + +import { Injectable } from '@opensumi/di'; import { getDebugLogger, URI } from '@opensumi/ide-core-common'; import { TokenizerOption } from './textmate-tokenizer'; diff --git a/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-tokenizer.ts b/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-tokenizer.ts index 6d6b10e88e..5eccd0ba21 100644 --- a/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-tokenizer.ts +++ b/packages/editor/src/browser/monaco-contrib/tokenizer/textmate-tokenizer.ts @@ -1,3 +1,5 @@ +import { INITIAL, StackElement, IGrammar } from 'vscode-textmate'; + import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; /** ****************************************************************************** * Copyright (C) 2018 Ericsson and others. @@ -15,7 +17,6 @@ import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { INITIAL, StackElement, IGrammar } from 'vscode-textmate'; export class TokenizerState implements monaco.languages.IState { constructor(public readonly ruleStack: StackElement) {} diff --git a/packages/editor/src/browser/monaco-contrib/tokenizer/textmate.service.ts b/packages/editor/src/browser/monaco-contrib/tokenizer/textmate.service.ts index e45982f69f..9457d354e8 100644 --- a/packages/editor/src/browser/monaco-contrib/tokenizer/textmate.service.ts +++ b/packages/editor/src/browser/monaco-contrib/tokenizer/textmate.service.ts @@ -1,12 +1,4 @@ -import { IThemeData } from '@opensumi/ide-theme'; -import { Injectable, Autowired } from '@opensumi/di'; -import { monaco } from '@opensumi/ide-monaco/lib/browser/monaco-api'; -import { URI, Disposable } from '@opensumi/ide-core-common'; -import { ThemeChangedEvent } from '@opensumi/ide-theme/lib/common/event'; import { OnigScanner, loadWASM, OnigString } from 'vscode-oniguruma'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; -import { ModesRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/modesRegistry'; -import type { ILanguageExtensionPoint } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/modeService'; import { Registry, IRawGrammar, @@ -16,6 +8,21 @@ import { ITokenTypeMap, INITIAL, } from 'vscode-textmate'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { + WithEventBus, + parseWithComments, + PreferenceService, + ILogger, + ExtensionActivateEvent, + getDebugLogger, + MonacoService, + electronEnv, + AppConfig, +} from '@opensumi/ide-core-browser'; +import { URI, Disposable } from '@opensumi/ide-core-common'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { CommentRule, GrammarsContribution, @@ -23,6 +30,7 @@ import { LanguagesContribution, ScopeMap, } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; +import { monaco } from '@opensumi/ide-monaco/lib/browser/monaco-api'; import { FoldingRules, IAutoClosingPair, @@ -30,20 +38,14 @@ import { IndentationRule, LanguageConfiguration, } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { - WithEventBus, - parseWithComments, - PreferenceService, - ILogger, - ExtensionActivateEvent, - getDebugLogger, - MonacoService, - electronEnv, - AppConfig, -} from '@opensumi/ide-core-browser'; +import { IThemeData } from '@opensumi/ide-theme'; +import { ThemeChangedEvent } from '@opensumi/ide-theme/lib/common/event'; +import { ModesRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/modesRegistry'; +import type { ILanguageExtensionPoint } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/modeService'; -import { TextmateRegistry } from './textmate-registry'; import { IEditorDocumentModelService } from '../../doc-model/types'; + +import { TextmateRegistry } from './textmate-registry'; import { createTextmateTokenizer, TokenizerOption } from './textmate-tokenizer'; let wasmLoaded = false; diff --git a/packages/editor/src/browser/navigation.view.tsx b/packages/editor/src/browser/navigation.view.tsx index 87eb64c995..6394457384 100644 --- a/packages/editor/src/browser/navigation.view.tsx +++ b/packages/editor/src/browser/navigation.view.tsx @@ -1,17 +1,18 @@ +import classnames from 'classnames'; +import { observable } from 'mobx'; +import { observer } from 'mobx-react-lite'; import React from 'react'; -import { useInjectable, DomListener, Disposable, useUpdateOnEvent, URI } from '@opensumi/ide-core-browser'; + +import { Injectable } from '@opensumi/di'; import { Icon } from '@opensumi/ide-components'; +import { useInjectable, DomListener, Disposable, useUpdateOnEvent, URI } from '@opensumi/ide-core-browser'; import { getIcon } from '@opensumi/ide-core-browser'; +import { Scroll, IScrollDelegate } from './component/scroll/scroll'; import styles from './navigation.module.less'; import { IBreadCrumbService, IBreadCrumbPart } from './types'; -import { Injectable } from '@opensumi/di'; -import { observable } from 'mobx'; -import { observer } from 'mobx-react-lite'; -import { Scroll, IScrollDelegate } from './component/scroll/scroll'; -import classnames from 'classnames'; -import { EditorGroup } from './workbench-editor.service'; import { useUpdateOnGroupTabChange } from './view/react-hook'; +import { EditorGroup } from './workbench-editor.service'; export const NavigationBar = ({ editorGroup }: { editorGroup: EditorGroup }) => { const breadCrumbService = useInjectable(IBreadCrumbService) as IBreadCrumbService; diff --git a/packages/editor/src/browser/preference/contribution.ts b/packages/editor/src/browser/preference/contribution.ts index c9bca632a0..723a0a5a29 100644 --- a/packages/editor/src/browser/preference/contribution.ts +++ b/packages/editor/src/browser/preference/contribution.ts @@ -1,4 +1,5 @@ import { PreferenceContribution, Domain, ClientAppContribution } from '@opensumi/ide-core-browser'; + import { editorPreferenceSchema } from './schema'; @Domain(PreferenceContribution, ClientAppContribution) diff --git a/packages/editor/src/browser/preference/converter.ts b/packages/editor/src/browser/preference/converter.ts index 7c36d82fe5..431fab3cc6 100644 --- a/packages/editor/src/browser/preference/converter.ts +++ b/packages/editor/src/browser/preference/converter.ts @@ -1,8 +1,10 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { removeUndefined, Uri } from '@opensumi/ide-core-browser'; -import { IConvertedMonacoOptions } from '../types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; +import { IConvertedMonacoOptions } from '../types'; + + /** * 计算由ConfigurationService设置值带来的monaco编辑器的属性 * @param configurationService IConfigurationService diff --git a/packages/editor/src/browser/preference/util.ts b/packages/editor/src/browser/preference/util.ts index 4e11f72eb9..babe359ce5 100644 --- a/packages/editor/src/browser/preference/util.ts +++ b/packages/editor/src/browser/preference/util.ts @@ -1,4 +1,5 @@ import { PreferenceService, createPreferenceProxy } from '@opensumi/ide-core-browser'; + import { editorPreferenceSchema, EditorPreferences } from './schema'; export function createEditorPreferenceProxy( diff --git a/packages/editor/src/browser/quick-open/go-to-line.ts b/packages/editor/src/browser/quick-open/go-to-line.ts index f48a8e2df0..d271857173 100644 --- a/packages/editor/src/browser/quick-open/go-to-line.ts +++ b/packages/editor/src/browser/quick-open/go-to-line.ts @@ -1,5 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { QuickOpenItem, PrefixQuickOpenService, QuickOpenModel, Mode } from '@opensumi/ide-core-browser/lib/quick-open'; import { CommandService, EDITOR_COMMANDS, @@ -8,12 +7,14 @@ import { QuickOpenHandler, withNullAsUndefined, } from '@opensumi/ide-core-browser'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { AbstractGotoLineQuickAccessProvider } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/quickAccess/gotoLineQuickAccess'; -import { WorkbenchEditorService } from '../types'; +import { QuickOpenItem, PrefixQuickOpenService, QuickOpenModel, Mode } from '@opensumi/ide-core-browser/lib/quick-open'; import { Event as MonacoEvent } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { IRange as IMonacoRange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; import { IEditor as IMonacoCodeEditor } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon'; +import { AbstractGotoLineQuickAccessProvider } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/quickAccess/gotoLineQuickAccess'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { WorkbenchEditorService } from '../types'; class MonacoGoToLine extends AbstractGotoLineQuickAccessProvider { activeTextEditorControl: IMonacoCodeEditor | undefined; diff --git a/packages/editor/src/browser/quick-open/workspace-symbol-quickopen.ts b/packages/editor/src/browser/quick-open/workspace-symbol-quickopen.ts index 60c5e90357..bc3dcee583 100644 --- a/packages/editor/src/browser/quick-open/workspace-symbol-quickopen.ts +++ b/packages/editor/src/browser/quick-open/workspace-symbol-quickopen.ts @@ -1,4 +1,5 @@ -import { SymbolKind as SymbolKindEnum } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import type { SymbolInformation, Range } from 'vscode-languageserver-types'; + import { Injectable, Autowired } from '@opensumi/di'; import { QuickOpenHandler, @@ -11,6 +12,11 @@ import { getSymbolIcon, getIcon, } from '@opensumi/ide-core-browser'; +import { ILogger, localize, IReporterService, REPORT_NAME } from '@opensumi/ide-core-common'; +import { QuickOpenBaseAction, QuickOpenActionProvider } from '@opensumi/ide-quick-open'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { SymbolKind as SymbolKindEnum } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + import { WorkspaceSymbolProvider, ILanguageService, @@ -18,10 +24,6 @@ import { WorkbenchEditorService, EditorGroupSplitAction, } from '../../common'; -import type { SymbolInformation, Range } from 'vscode-languageserver-types'; -import { ILogger, localize, IReporterService, REPORT_NAME } from '@opensumi/ide-core-common'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { QuickOpenBaseAction, QuickOpenActionProvider } from '@opensumi/ide-quick-open'; @Injectable() class WorkspaceSymbolOpenSideAction extends QuickOpenBaseAction { diff --git a/packages/editor/src/browser/resource.service.ts b/packages/editor/src/browser/resource.service.ts index f1e487a9c8..c8c06b06d2 100644 --- a/packages/editor/src/browser/resource.service.ts +++ b/packages/editor/src/browser/resource.service.ts @@ -1,3 +1,9 @@ +import { observable } from 'mobx'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { URI, IDisposable, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; +import { Disposable, addElement, LRUMap, ILogger, Emitter } from '@opensumi/ide-core-common'; + import { ResourceService, IResource, @@ -8,10 +14,6 @@ import { ResourceDecorationNeedChangeEvent, ResourceDecorationChangeEvent, } from '../common'; -import { Injectable, Autowired } from '@opensumi/di'; -import { URI, IDisposable, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; -import { observable } from 'mobx'; -import { Disposable, addElement, LRUMap, ILogger, Emitter } from '@opensumi/ide-core-common'; @Injectable() export class ResourceServiceImpl extends WithEventBus implements ResourceService { diff --git a/packages/editor/src/browser/tab.view.tsx b/packages/editor/src/browser/tab.view.tsx index 1d18b8ef70..d9340a2efb 100644 --- a/packages/editor/src/browser/tab.view.tsx +++ b/packages/editor/src/browser/tab.view.tsx @@ -1,8 +1,6 @@ -import React, { useEffect, useState, useCallback, useRef, useContext, useMemo, forwardRef } from 'react'; -import { useInjectable, useUpdateOnEventBusEvent } from '@opensumi/ide-core-browser/lib/react-hooks'; -import { IResource, ResourceService, IEditorGroup, WorkbenchEditorService, ResourceDidUpdateEvent } from '../common'; -import styles from './editor.module.less'; import classnames from 'classnames'; +import React, { useEffect, useState, useCallback, useRef, useContext, useMemo, forwardRef } from 'react'; + import { getIcon, MaybeNull, @@ -17,13 +15,19 @@ import { DisposableCollection, Event, } from '@opensumi/ide-core-browser'; -import { Scroll } from './component/scroll/scroll'; -import { GridResizeEvent, IEditorActionRegistry, DragOverPosition, EditorGroupFileDropEvent } from './types'; import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { EditorGroup, WorkbenchEditorServiceImpl } from './workbench-editor.service'; +import { IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { useInjectable, useUpdateOnEventBusEvent } from '@opensumi/ide-core-browser/lib/react-hooks'; + +import { IResource, ResourceService, IEditorGroup, WorkbenchEditorService, ResourceDidUpdateEvent } from '../common'; + +import { Scroll } from './component/scroll/scroll'; +import styles from './editor.module.less'; import { TabTitleMenuService } from './menu/title-context.menu'; +import { GridResizeEvent, IEditorActionRegistry, DragOverPosition, EditorGroupFileDropEvent } from './types'; import { useUpdateOnGroupTabChange } from './view/react-hook'; -import { IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { EditorGroup, WorkbenchEditorServiceImpl } from './workbench-editor.service'; + const pkgName = require('../../package.json').name; diff --git a/packages/editor/src/browser/types.ts b/packages/editor/src/browser/types.ts index 59a17818c7..0a371496eb 100644 --- a/packages/editor/src/browser/types.ts +++ b/packages/editor/src/browser/types.ts @@ -1,4 +1,17 @@ +import { + MaybePromise, + IDisposable, + BasicEvent, + IRange, + MaybeNull, + ISelection, + URI, + Event, +} from '@opensumi/ide-core-browser'; +import { IMenu } from '@opensumi/ide-core-browser/lib/menu/next'; +import { IThemeColor } from '@opensumi/ide-core-common'; import { editor } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IResource, ResourceService, @@ -11,19 +24,9 @@ import { IEditor, DragOverPosition, } from '../common'; -import { - MaybePromise, - IDisposable, - BasicEvent, - IRange, - MaybeNull, - ISelection, - URI, - Event, -} from '@opensumi/ide-core-browser'; -import { IThemeColor } from '@opensumi/ide-core-common'; + import { IEditorDocumentModelContentRegistry } from './doc-model/types'; -import { IMenu } from '@opensumi/ide-core-browser/lib/menu/next'; + export * from '../common'; export type ReactEditorComponent = React.ComponentType<{ resource: IResource }>; diff --git a/packages/editor/src/browser/untitled-resource.ts b/packages/editor/src/browser/untitled-resource.ts index 5d377f9dd8..8a7ef8d6d5 100644 --- a/packages/editor/src/browser/untitled-resource.ts +++ b/packages/editor/src/browser/untitled-resource.ts @@ -18,6 +18,7 @@ import * as path from '@opensumi/ide-core-common/lib/path'; import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { IResourceProvider, WorkbenchEditorService } from '../common'; + import { IEditorDocumentModelService, IEditorDocumentModelContentProvider } from './doc-model/types'; @Injectable() diff --git a/packages/editor/src/browser/view/editor.react.tsx b/packages/editor/src/browser/view/editor.react.tsx index 63aa0c9d5f..897a14795c 100644 --- a/packages/editor/src/browser/view/editor.react.tsx +++ b/packages/editor/src/browser/view/editor.react.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { URI, useInjectable } from '@opensumi/ide-core-browser'; + import { EditorCollectionService, ICodeEditor } from '../../common'; import { IEditorDocumentModelService, IEditorDocumentModelRef } from '../doc-model/types'; diff --git a/packages/editor/src/browser/view/react-hook.tsx b/packages/editor/src/browser/view/react-hook.tsx index f57609493e..8af6a9c3df 100644 --- a/packages/editor/src/browser/view/react-hook.tsx +++ b/packages/editor/src/browser/view/react-hook.tsx @@ -1,6 +1,7 @@ -import { EditorGroup } from '../workbench-editor.service'; import { useUpdateOnEvent } from '@opensumi/ide-core-browser'; +import { EditorGroup } from '../workbench-editor.service'; + export function useUpdateOnGroupTabChange(editorGroup: EditorGroup) { return useUpdateOnEvent(editorGroup.onDidEditorGroupTabChanged, [editorGroup]); } diff --git a/packages/editor/src/browser/view/suggest-widget.ts b/packages/editor/src/browser/view/suggest-widget.ts index 714583e9d6..8fa5185d1c 100644 --- a/packages/editor/src/browser/view/suggest-widget.ts +++ b/packages/editor/src/browser/view/suggest-widget.ts @@ -1,10 +1,10 @@ -import { SuggestController } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/suggest/suggestController'; import { Autowired, Injectable } from '@opensumi/di'; -import { IEventBus } from '@opensumi/ide-core-common'; import { SuggestEvent, DisposableCollection } from '@opensumi/ide-core-browser'; +import { IEventBus } from '@opensumi/ide-core-common'; +import { SuggestController } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/suggest/suggestController'; -import { IEditorFeatureContribution } from '../types'; import { IEditor } from '../../common'; +import { IEditorFeatureContribution } from '../types'; @Injectable() export class EditorSuggestWidgetContribution implements IEditorFeatureContribution { diff --git a/packages/editor/src/browser/view/topPadding.ts b/packages/editor/src/browser/view/topPadding.ts index 513dc09196..02d00e3b11 100644 --- a/packages/editor/src/browser/view/topPadding.ts +++ b/packages/editor/src/browser/view/topPadding.ts @@ -1,6 +1,7 @@ import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { IEditorFeatureContribution } from '../types'; + import { IEditor } from '../../common'; +import { IEditorFeatureContribution } from '../types'; export class EditorTopPaddingContribution implements IEditorFeatureContribution { contribute(editor: IEditor) { diff --git a/packages/editor/src/browser/workbench-editor.service.ts b/packages/editor/src/browser/workbench-editor.service.ts index c6fa1a1d27..4988c6a3a4 100644 --- a/packages/editor/src/browser/workbench-editor.service.ts +++ b/packages/editor/src/browser/workbench-editor.service.ts @@ -1,27 +1,21 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { observable } from 'mobx'; -import { - WorkbenchEditorService, - EditorCollectionService, - ICodeEditor, - IResource, - ResourceService, - IResourceOpenOptions, - IDiffEditor, - IDiffResource, - IEditor, - CursorStatus, - IEditorOpenType, - EditorGroupSplitAction, - IEditorGroup, - IOpenResourceResult, - IEditorGroupState, - ResourceDecorationChangeEvent, - IUntitledOptions, - SaveReason, - getSplitActionFromDragDrop, -} from '../common'; + import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { + FILE_COMMANDS, + ResizeEvent, + getSlotLocation, + AppConfig, + IContextKeyService, + ServiceNames, + IScopedContextKeyService, + IContextKey, + RecentFilesManager, + PreferenceService, + IOpenerService, +} from '@opensumi/ide-core-browser'; +import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; +import { isUndefinedOrNull, Schemas, REPORT_NAME } from '@opensumi/ide-core-common'; import { CommandService, URI, @@ -44,6 +38,35 @@ import { IDisposable, Disposable, } from '@opensumi/ide-core-common'; +import { makeRandomHexString } from '@opensumi/ide-core-common/lib/functional'; +import { IMessageService } from '@opensumi/ide-overlay'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { + WorkbenchEditorService, + EditorCollectionService, + ICodeEditor, + IResource, + ResourceService, + IResourceOpenOptions, + IDiffEditor, + IDiffResource, + IEditor, + CursorStatus, + IEditorOpenType, + EditorGroupSplitAction, + IEditorGroup, + IOpenResourceResult, + IEditorGroupState, + ResourceDecorationChangeEvent, + IUntitledOptions, + SaveReason, + getSplitActionFromDragDrop, +} from '../common'; + +import { IEditorDocumentModelService, IEditorDocumentModelRef } from './doc-model/types'; +import { EditorTabChangedError, isEditorError } from './error'; +import { IGridEditorGroup, EditorGrid, SplitDirection, IEditorGridState } from './grid/grid.service'; import { EditorComponentRegistry, IEditorComponent, @@ -65,26 +88,6 @@ import { CodeEditorDidVisibleEvent, RegisterEditorComponentEvent, } from './types'; -import { IGridEditorGroup, EditorGrid, SplitDirection, IEditorGridState } from './grid/grid.service'; -import { makeRandomHexString } from '@opensumi/ide-core-common/lib/functional'; -import { - FILE_COMMANDS, - ResizeEvent, - getSlotLocation, - AppConfig, - IContextKeyService, - ServiceNames, - IScopedContextKeyService, - IContextKey, - RecentFilesManager, - PreferenceService, - IOpenerService, -} from '@opensumi/ide-core-browser'; -import { IEditorDocumentModelService, IEditorDocumentModelRef } from './doc-model/types'; -import { isUndefinedOrNull, Schemas, REPORT_NAME } from '@opensumi/ide-core-common'; -import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { EditorTabChangedError, isEditorError } from './error'; @Injectable() export class WorkbenchEditorServiceImpl extends WithEventBus implements WorkbenchEditorService { diff --git a/packages/editor/src/common/doc-cache.ts b/packages/editor/src/common/doc-cache.ts index 034838482e..2f281790b1 100644 --- a/packages/editor/src/common/doc-cache.ts +++ b/packages/editor/src/common/doc-cache.ts @@ -1,6 +1,6 @@ +import { URI, MaybePromise } from '@opensumi/ide-core-common'; import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; import type { IModelContentChange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model/textModelEvents'; -import { URI, MaybePromise } from '@opensumi/ide-core-common'; interface IDocBasicCacheData { path: string; diff --git a/packages/editor/src/common/editor.ts b/packages/editor/src/common/editor.ts index 60e462a959..d2e4a66f62 100644 --- a/packages/editor/src/common/editor.ts +++ b/packages/editor/src/common/editor.ts @@ -1,8 +1,5 @@ -// eslint-disable-next-line import/no-restricted-paths -import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import type { ITextModelUpdateOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; -import type { IEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; import { Injectable } from '@opensumi/di'; +import { IScopedContextKeyService } from '@opensumi/ide-core-browser'; import { URI, Event, @@ -15,10 +12,15 @@ import { IPosition, IThemeColor, } from '@opensumi/ide-core-common'; -import { IResource } from './resource'; +// eslint-disable-next-line import/no-restricted-paths +import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import type { IEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import type { ITextModelUpdateOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; + // eslint-disable-next-line import/no-restricted-paths import type { IEditorDocumentModel, IEditorDocumentModelRef } from '../browser'; -import { IScopedContextKeyService } from '@opensumi/ide-core-browser'; + +import { IResource } from './resource'; export interface CursorStatus { position: MaybeNull; diff --git a/packages/editor/src/common/language-status.ts b/packages/editor/src/common/language-status.ts index 5b411b47b1..ec1542a5b5 100644 --- a/packages/editor/src/common/language-status.ts +++ b/packages/editor/src/common/language-status.ts @@ -7,6 +7,7 @@ import { } from '@opensumi/ide-core-common'; // eslint-disable-next-line import/no-restricted-paths import type { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; + import { LanguageSelector } from './language'; export const ILanguageStatusService = Symbol('ILanguageStatusService'); diff --git a/packages/editor/src/common/language.ts b/packages/editor/src/common/language.ts index c779eae79c..c5af67ad97 100644 --- a/packages/editor/src/common/language.ts +++ b/packages/editor/src/common/language.ts @@ -1,10 +1,11 @@ -import { editor } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import type { IRelatedInformation } from '@opensumi/monaco-editor-core/esm/vs/platform/markers/common/markers'; +import LSTypes from 'vscode-languageserver-types'; + import { CancellationToken, Command, IAccessibilityInformation, Severity } from '@opensumi/ide-core-common'; -import { URI as Uri } from '@opensumi/monaco-editor-core/esm/vs/base/common/uri'; import { IDisposable, MarkerSeverity } from '@opensumi/ide-core-common'; -import LSTypes from 'vscode-languageserver-types'; import { IRelativePattern } from '@opensumi/ide-core-common/lib/utils/glob'; +import { URI as Uri } from '@opensumi/monaco-editor-core/esm/vs/base/common/uri'; +import { editor } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import type { IRelatedInformation } from '@opensumi/monaco-editor-core/esm/vs/platform/markers/common/markers'; export const ILanguageService = Symbol('ILanguageService'); diff --git a/packages/editor/src/common/mocks/workbench-editor.service.ts b/packages/editor/src/common/mocks/workbench-editor.service.ts index cf4cb77f0e..dd28b8dc96 100644 --- a/packages/editor/src/common/mocks/workbench-editor.service.ts +++ b/packages/editor/src/common/mocks/workbench-editor.service.ts @@ -1,9 +1,10 @@ -import { WorkbenchEditorService, IResourceOpenOptions, IUntitledOptions, IOpenResourceResult } from '../editor'; -import { URI, Emitter, MaybeNull, Event } from '@opensumi/ide-core-common'; import { Injectable } from '@opensumi/di'; -import { IResource } from '../resource'; +import { URI, Emitter, MaybeNull, Event } from '@opensumi/ide-core-common'; + // eslint-disable-next-line import/no-restricted-paths import type { IEditorGroup } from '../../browser'; +import { WorkbenchEditorService, IResourceOpenOptions, IUntitledOptions, IOpenResourceResult } from '../editor'; +import { IResource } from '../resource'; @Injectable() export class MockWorkbenchEditorService extends WorkbenchEditorService { diff --git a/packages/electron-basic/__tests__/index.test.ts b/packages/electron-basic/__tests__/index.test.ts index 46aef6f203..daaa520a2e 100644 --- a/packages/electron-basic/__tests__/index.test.ts +++ b/packages/electron-basic/__tests__/index.test.ts @@ -1,5 +1,3 @@ -import { createBrowserInjector } from '../../../tools/dev-tool/src/injector-helper'; -import { ElectronBasicContribution } from '../src/browser'; import { AppConfig, SlotLocation, @@ -10,15 +8,19 @@ import { addElement, electronEnv, } from '@opensumi/ide-core-browser'; +import { IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; import { IElectronMenuBarService } from '@opensumi/ide-core-browser/lib/menu/next/renderer/ctxmenu/electron'; -import { IMessageService } from '@opensumi/ide-overlay/lib/common'; import { IElectronMainLifeCycleService, IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; -import { ElectronNativeDialogService } from '../src/browser/dialog'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; import { WorkbenchEditorService, ResourceService } from '@opensumi/ide-editor'; -import { WelcomeContribution } from '../src/browser/welcome/contribution'; import { EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; +import { IMessageService } from '@opensumi/ide-overlay/lib/common'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { createBrowserInjector } from '../../../tools/dev-tool/src/injector-helper'; +import { ElectronBasicContribution } from '../src/browser'; +import { ElectronNativeDialogService } from '../src/browser/dialog'; +import { WelcomeContribution } from '../src/browser/welcome/contribution'; + function mockService(target) { return new Proxy(target, { diff --git a/packages/electron-basic/src/browser/dialog/index.ts b/packages/electron-basic/src/browser/dialog/index.ts index 3c4504ddfb..9bd78757ab 100644 --- a/packages/electron-basic/src/browser/dialog/index.ts +++ b/packages/electron-basic/src/browser/dialog/index.ts @@ -1,5 +1,5 @@ -import { IElectronNativeDialogService, electronEnv } from '@opensumi/ide-core-browser'; import { Injectable, Autowired } from '@opensumi/di'; +import { IElectronNativeDialogService, electronEnv } from '@opensumi/ide-core-browser'; import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; @Injectable() diff --git a/packages/electron-basic/src/browser/header/header.tsx b/packages/electron-basic/src/browser/header/header.tsx index c35c26ef1a..76e14be39d 100644 --- a/packages/electron-basic/src/browser/header/header.tsx +++ b/packages/electron-basic/src/browser/header/header.tsx @@ -1,7 +1,8 @@ +import cls from 'classnames'; import { observer } from 'mobx-react-lite'; import React, { useState, useEffect, useRef } from 'react'; -import cls from 'classnames'; -import styles from './header.module.less'; + + import { useInjectable, MaybeNull, @@ -15,11 +16,13 @@ import { isOSX, IWindowService, } from '@opensumi/ide-core-browser'; -import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { WorkbenchEditorService, IResource } from '@opensumi/ide-editor'; import { getIcon } from '@opensumi/ide-core-browser'; import { localize } from '@opensumi/ide-core-common'; +import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; import { basename } from '@opensumi/ide-core-common/lib/utils/paths'; +import { WorkbenchEditorService, IResource } from '@opensumi/ide-editor'; + +import styles from './header.module.less'; const useFullScreen = () => { const uiService: IElectronMainUIService = useInjectable(IElectronMainUIService); diff --git a/packages/electron-basic/src/browser/index.ts b/packages/electron-basic/src/browser/index.ts index c7c0102900..04e02af6d1 100644 --- a/packages/electron-basic/src/browser/index.ts +++ b/packages/electron-basic/src/browser/index.ts @@ -22,19 +22,20 @@ import { IEventBus, } from '@opensumi/ide-core-browser'; import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; -import { ElectronHeaderBar } from './header/header'; -import { WelcomeContribution } from './welcome/contribution'; -import { ElectronNativeDialogService } from './dialog'; import { IMenuRegistry, MenuContribution, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { IElectronMenuBarService } from '@opensumi/ide-core-browser/lib/menu/next/renderer/ctxmenu/electron'; import { IElectronMainLifeCycleService, IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { IMessageService } from '@opensumi/ide-overlay/lib/common'; +import { IResourceOpenOptions } from '@opensumi/ide-editor'; import { EditorGroupFileDropEvent, DragOverPosition, getSplitActionFromDragDrop, } from '@opensumi/ide-editor/lib/browser'; -import { IResourceOpenOptions } from '@opensumi/ide-editor'; +import { IMessageService } from '@opensumi/ide-overlay/lib/common'; + +import { ElectronNativeDialogService } from './dialog'; +import { ElectronHeaderBar } from './header/header'; +import { WelcomeContribution } from './welcome/contribution'; @Injectable() export class ElectronBasicModule extends BrowserModule { diff --git a/packages/electron-basic/src/browser/welcome/contribution.ts b/packages/electron-basic/src/browser/welcome/contribution.ts index 23d468b055..b43cf12df5 100644 --- a/packages/electron-basic/src/browser/welcome/contribution.ts +++ b/packages/electron-basic/src/browser/welcome/contribution.ts @@ -1,14 +1,15 @@ +import { Autowired } from '@opensumi/di'; import { Domain, URI, localize, ClientAppContribution, RecentFilesManager } from '@opensumi/ide-core-browser'; +import { ResourceService, IResource, WorkbenchEditorService } from '@opensumi/ide-editor'; import { BrowserEditorContribution, EditorComponentRegistry, EditorComponentRenderMode, } from '@opensumi/ide-editor/lib/browser'; -import { ResourceService, IResource, WorkbenchEditorService } from '@opensumi/ide-editor'; -import { EditorWelcomeComponent } from './welcome'; -import { Autowired } from '@opensumi/di'; import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { IWelcomeMetaData } from './common'; +import { EditorWelcomeComponent } from './welcome'; @Domain(BrowserEditorContribution, ClientAppContribution) export class WelcomeContribution implements BrowserEditorContribution, ClientAppContribution { diff --git a/packages/electron-basic/src/browser/welcome/welcome.tsx b/packages/electron-basic/src/browser/welcome/welcome.tsx index 2c56194a7c..d13f26be6d 100644 --- a/packages/electron-basic/src/browser/welcome/welcome.tsx +++ b/packages/electron-basic/src/browser/welcome/welcome.tsx @@ -1,6 +1,5 @@ import React from 'react'; -import { IWelcomeMetaData } from './common'; -import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; + import { useInjectable, localize, @@ -10,6 +9,9 @@ import { FILE_COMMANDS, IWindowService, } from '@opensumi/ide-core-browser'; +import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; + +import { IWelcomeMetaData } from './common'; import styles from './welcome.module.less'; export const EditorWelcomeComponent: ReactEditorComponent = ({ resource }) => { diff --git a/packages/explorer/__tests__/browser/explorer.contribution.test.ts b/packages/explorer/__tests__/browser/explorer.contribution.test.ts index 2d854d67e2..eb277e94fb 100644 --- a/packages/explorer/__tests__/browser/explorer.contribution.test.ts +++ b/packages/explorer/__tests__/browser/explorer.contribution.test.ts @@ -1,8 +1,9 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { ExplorerModule } from '@opensumi/ide-explorer'; import { ExplorerContribution } from '@opensumi/ide-explorer/lib/browser/explorer-contribution'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; + describe('Explorer contribution should be work', () => { let injector: MockInjector; diff --git a/packages/explorer/src/browser/explorer-contribution.ts b/packages/explorer/src/browser/explorer-contribution.ts index 149b33eb70..1824745c38 100644 --- a/packages/explorer/src/browser/explorer-contribution.ts +++ b/packages/explorer/src/browser/explorer-contribution.ts @@ -1,6 +1,6 @@ import { localize, Domain } from '@opensumi/ide-core-browser'; -import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; import { getIcon } from '@opensumi/ide-core-browser'; +import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; export const ExplorerContainerId = 'explorer'; diff --git a/packages/explorer/src/browser/index.ts b/packages/explorer/src/browser/index.ts index 26b8be36ba..2223fe5bf1 100644 --- a/packages/explorer/src/browser/index.ts +++ b/packages/explorer/src/browser/index.ts @@ -1,5 +1,6 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { ExplorerContribution } from './explorer-contribution'; @Injectable() diff --git a/packages/express-file-server/__tests__/browser/index.test.ts b/packages/express-file-server/__tests__/browser/index.test.ts index 673579d9ba..ed5810f7a5 100644 --- a/packages/express-file-server/__tests__/browser/index.test.ts +++ b/packages/express-file-server/__tests__/browser/index.test.ts @@ -1,3 +1,4 @@ +import { URI, createContributionProvider } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { StaticResourceModule, @@ -5,8 +6,8 @@ import { StaticResourceContribution, StaticResourceClientAppContribution, } from '@opensumi/ide-static-resource/lib/browser'; + import { ExpressFileServerModule } from '../../src/browser'; -import { URI, createContributionProvider } from '@opensumi/ide-core-common'; describe('packages/express-file-server/__tests__/browser/index.test.ts', () => { const injector = createBrowserInjector([ExpressFileServerModule, StaticResourceModule]); diff --git a/packages/express-file-server/__tests__/node/index.test.ts b/packages/express-file-server/__tests__/node/index.test.ts index 32c4c5f5dd..cfd07463be 100644 --- a/packages/express-file-server/__tests__/node/index.test.ts +++ b/packages/express-file-server/__tests__/node/index.test.ts @@ -1,11 +1,15 @@ +import http from 'http'; +import path from 'path'; + +import Koa from 'koa'; +import superagent from 'superagent'; + +import { IServerApp, AppConfig } from '@opensumi/ide-core-node'; import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { ExpressFileServerModule } from '../../src/node'; import { ExpressFileServerContribution } from '../../src/node/express-file-server.contribution'; -import { IServerApp, AppConfig } from '@opensumi/ide-core-node'; -import Koa from 'koa'; -import superagent from 'superagent'; -import http from 'http'; -import path from 'path'; + describe('template test', () => { let server: http.Server; diff --git a/packages/express-file-server/src/browser/file-server.contribution.ts b/packages/express-file-server/src/browser/file-server.contribution.ts index ec9155fa43..6beb4c5145 100644 --- a/packages/express-file-server/src/browser/file-server.contribution.ts +++ b/packages/express-file-server/src/browser/file-server.contribution.ts @@ -1,9 +1,10 @@ -import { Domain, URI, AppConfig } from '@opensumi/ide-core-browser'; import { Autowired } from '@opensumi/di'; +import { Domain, URI, AppConfig } from '@opensumi/ide-core-browser'; import { StaticResourceContribution, StaticResourceService, } from '@opensumi/ide-static-resource/lib/browser/static.definition'; + import { EXPRESS_SERVER_PATH } from '../common'; @Domain(StaticResourceContribution) diff --git a/packages/express-file-server/src/browser/index.ts b/packages/express-file-server/src/browser/index.ts index ebbaaabfa9..0a286b4919 100644 --- a/packages/express-file-server/src/browser/index.ts +++ b/packages/express-file-server/src/browser/index.ts @@ -1,7 +1,8 @@ import { Provider, Injectable } from '@opensumi/di'; -import { ExpressFileServerContribution } from './file-server.contribution'; import { BrowserModule } from '@opensumi/ide-core-browser'; +import { ExpressFileServerContribution } from './file-server.contribution'; + @Injectable() export class ExpressFileServerModule extends BrowserModule { providers: Provider[] = [ExpressFileServerContribution]; diff --git a/packages/express-file-server/src/node/express-file-server.contribution.ts b/packages/express-file-server/src/node/express-file-server.contribution.ts index 7b941e0c3f..adabacd4ba 100644 --- a/packages/express-file-server/src/node/express-file-server.contribution.ts +++ b/packages/express-file-server/src/node/express-file-server.contribution.ts @@ -1,10 +1,14 @@ -import { ServerAppContribution, Domain, IServerApp, AppConfig } from '@opensumi/ide-core-node'; -import { Autowired } from '@opensumi/di'; -import { ALLOW_MIME } from '../common'; -import mount from 'koa-mount'; import fs from 'fs'; import path from 'path'; +import mount from 'koa-mount'; + +import { Autowired } from '@opensumi/di'; +import { ServerAppContribution, Domain, IServerApp, AppConfig } from '@opensumi/ide-core-node'; + +import { ALLOW_MIME } from '../common'; + + @Domain(ServerAppContribution) export class ExpressFileServerContribution implements ServerAppContribution { @Autowired(AppConfig) diff --git a/packages/express-file-server/src/node/index.ts b/packages/express-file-server/src/node/index.ts index 59872f42c8..2cbd9625a8 100644 --- a/packages/express-file-server/src/node/index.ts +++ b/packages/express-file-server/src/node/index.ts @@ -1,5 +1,6 @@ import { Provider, Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; + import { ExpressFileServerContribution } from './express-file-server.contribution'; @Injectable() diff --git a/packages/extension-manager/src/browser/extension-overview/index.tsx b/packages/extension-manager/src/browser/extension-overview/index.tsx index 6ba1f41097..b1b3d2be7d 100644 --- a/packages/extension-manager/src/browser/extension-overview/index.tsx +++ b/packages/extension-manager/src/browser/extension-overview/index.tsx @@ -1,13 +1,15 @@ import React, { useCallback, useState } from 'react'; -import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; + import { Icon, getKaitianIcon, Button, Tabs } from '@opensumi/ide-components'; -import { localize, replaceLocalizePlaceholder } from '@opensumi/ide-core-common'; -import { Markdown } from '@opensumi/ide-markdown'; import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks/injectable-hooks'; +import { localize, replaceLocalizePlaceholder } from '@opensumi/ide-core-common'; +import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; +import { Markdown } from '@opensumi/ide-markdown'; -import { VSXExtensionRaw } from '../../common/vsx-registry-types'; import { InstallState, IVSXExtensionService, VSXExtension, VSXExtensionServiceToken } from '../../common'; +import { VSXExtensionRaw } from '../../common/vsx-registry-types'; + import styles from './overview.module.less'; enum TabActiveKey { diff --git a/packages/extension-manager/src/browser/extension/index.tsx b/packages/extension-manager/src/browser/extension/index.tsx index b0fec81843..0c3688ed26 100644 --- a/packages/extension-manager/src/browser/extension/index.tsx +++ b/packages/extension-manager/src/browser/extension/index.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useState } from 'react'; -import { localize, replaceLocalizePlaceholder } from '@opensumi/ide-core-common'; + import { Button, Icon, getKaitianIcon } from '@opensumi/ide-components'; +import { localize, replaceLocalizePlaceholder } from '@opensumi/ide-core-common'; import { InstallState, VSXExtension } from '../../common'; diff --git a/packages/extension-manager/src/browser/index.ts b/packages/extension-manager/src/browser/index.ts index f4832e01da..e7ae2e85e6 100644 --- a/packages/extension-manager/src/browser/index.ts +++ b/packages/extension-manager/src/browser/index.ts @@ -2,6 +2,7 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; import { VSXExtensionBackSerivceToken, VSXExtensionServicePath, VSXExtensionServiceToken } from '../common'; + import { VSXExtensionContribution } from './vsx-extension.contribution'; import { VSXExtensionService } from './vsx-extension.service'; diff --git a/packages/extension-manager/src/browser/vsx-extension.contribution.ts b/packages/extension-manager/src/browser/vsx-extension.contribution.ts index cc39674d74..1b8fc039d3 100644 --- a/packages/extension-manager/src/browser/vsx-extension.contribution.ts +++ b/packages/extension-manager/src/browser/vsx-extension.contribution.ts @@ -1,20 +1,21 @@ import { Autowired } from '@opensumi/di'; import { ClientAppContribution, ComponentContribution, ComponentRegistry, getIcon } from '@opensumi/ide-core-browser'; import { Domain, localize, replaceLocalizePlaceholder, URI } from '@opensumi/ide-core-common'; -import { IMainLayoutService, MainLayoutContribution } from '@opensumi/ide-main-layout'; import { BrowserEditorContribution, EditorComponentRegistry, IResource, ResourceService, } from '@opensumi/ide-editor/lib/browser'; +import { IMainLayoutService, MainLayoutContribution } from '@opensumi/ide-main-layout'; import { IIconService, IconType } from '@opensumi/ide-theme'; import { InstallState, IVSXExtensionService, VSXExtensionServiceToken } from '../common'; -import { VSXExtensionView } from './vsx-extension.view'; -import { ExtensionOverview } from './extension-overview'; import { VSXExtensionRaw } from '../common/vsx-registry-types'; + import { OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID, EXTENSION_SCHEME } from './const'; +import { ExtensionOverview } from './extension-overview'; +import { VSXExtensionView } from './vsx-extension.view'; @Domain(ClientAppContribution, MainLayoutContribution, ComponentContribution, BrowserEditorContribution) export class VSXExtensionContribution diff --git a/packages/extension-manager/src/browser/vsx-extension.service.ts b/packages/extension-manager/src/browser/vsx-extension.service.ts index 182ccdd094..dc171d801d 100644 --- a/packages/extension-manager/src/browser/vsx-extension.service.ts +++ b/packages/extension-manager/src/browser/vsx-extension.service.ts @@ -1,6 +1,6 @@ import { observable, computed } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; -import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; import { IStatusBarService, localize, @@ -8,7 +8,9 @@ import { StatusBarEntryAccessor, URI, } from '@opensumi/ide-core-browser'; +import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; import { ExtensionManagementService } from '@opensumi/ide-extension/lib/browser/extension-management.service'; +import { AbstractExtInstanceManagementService } from '@opensumi/ide-extension/lib/browser/types'; import { InstallState, @@ -18,7 +20,6 @@ import { VSXExtensionServicePath, } from '../common'; import { VSXExtensionRaw, VSXSearchParam, QueryParam } from '../common/vsx-registry-types'; -import { AbstractExtInstanceManagementService } from '@opensumi/ide-extension/lib/browser/types'; @Injectable() export class VSXExtensionService implements IVSXExtensionService { diff --git a/packages/extension-manager/src/browser/vsx-extension.view.tsx b/packages/extension-manager/src/browser/vsx-extension.view.tsx index cac0de96b2..67f5010d62 100644 --- a/packages/extension-manager/src/browser/vsx-extension.view.tsx +++ b/packages/extension-manager/src/browser/vsx-extension.view.tsx @@ -1,16 +1,19 @@ +import debounce from 'lodash/debounce'; +import { observer } from 'mobx-react-lite'; import * as React from 'react'; import { useState, useCallback } from 'react'; -import { observer } from 'mobx-react-lite'; -import { localize } from '@opensumi/ide-core-common'; -import { useInjectable } from '@opensumi/ide-core-browser'; + import { Tabs } from '@opensumi/ide-components'; -import { AutoFocusedInput } from '@opensumi/ide-main-layout/lib/browser/input'; +import { useInjectable } from '@opensumi/ide-core-browser'; import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; -import debounce from 'lodash/debounce'; +import { localize } from '@opensumi/ide-core-common'; +import { AutoFocusedInput } from '@opensumi/ide-main-layout/lib/browser/input'; + import { IVSXExtensionService, TabActiveKey, VSXExtension, VSXExtensionServiceToken } from '../common'; -import { Extension } from './extension'; + import { OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID } from './const'; +import { Extension } from './extension'; import styles from './vsx-extension.module.less'; const tabMap = [TabActiveKey.MARKETPLACE, TabActiveKey.INSTALLED]; diff --git a/packages/extension-manager/src/node/index.ts b/packages/extension-manager/src/node/index.ts index b56b0f9418..2f2f1c9bcc 100644 --- a/packages/extension-manager/src/node/index.ts +++ b/packages/extension-manager/src/node/index.ts @@ -2,6 +2,7 @@ import { Provider, Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; import { VSXExtensionBackSerivceToken, VSXExtensionServicePath } from '../common'; + import { VSXExtensionService } from './vsx-extension.service'; @Injectable() diff --git a/packages/extension-manager/src/node/vsx-extension.service.ts b/packages/extension-manager/src/node/vsx-extension.service.ts index 9b745237c6..c40e61c76c 100644 --- a/packages/extension-manager/src/node/vsx-extension.service.ts +++ b/packages/extension-manager/src/node/vsx-extension.service.ts @@ -1,11 +1,13 @@ +import os from 'os'; import path from 'path'; -import yauzl from 'yauzl'; import { Readable } from 'stream'; -import os from 'os'; + import fs from 'fs-extra'; import nodeFetch from 'node-fetch'; import requestretry from 'requestretry'; import { v4 as uuidv4 } from 'uuid'; +import yauzl from 'yauzl'; + import { Injectable, Autowired } from '@opensumi/di'; import { AppConfig } from '@opensumi/ide-core-node'; diff --git a/packages/extension-storage/__tests__/browser/storage.service.test.ts b/packages/extension-storage/__tests__/browser/storage.service.test.ts index 1eab4fec8a..e8c54628a9 100644 --- a/packages/extension-storage/__tests__/browser/storage.service.test.ts +++ b/packages/extension-storage/__tests__/browser/storage.service.test.ts @@ -1,10 +1,12 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { IExtensionStorageService, IExtensionStorageServer } from '../../src/common'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { AppConfig } from '@opensumi/ide-core-browser'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; import { ExtensionStorageService } from '@opensumi/ide-extension-storage/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { IExtensionStorageService, IExtensionStorageServer } from '../../src/common'; + describe('ExtensionStorage service should be work', () => { let injector: MockInjector; diff --git a/packages/extension-storage/__tests__/browser/storage.test.ts b/packages/extension-storage/__tests__/browser/storage.test.ts index 4da3683d30..ebba9a6f6a 100644 --- a/packages/extension-storage/__tests__/browser/storage.test.ts +++ b/packages/extension-storage/__tests__/browser/storage.test.ts @@ -1,17 +1,20 @@ -import { URI, StoragePaths, FileUri, IFileServiceClient, ILoggerManagerClient } from '@opensumi/ide-core-common'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IExtensionStorageServer, IExtensionStoragePathServer } from '@opensumi/ide-extension-storage'; -import { FileStat, IDiskFileProvider } from '@opensumi/ide-file-service'; +import path from 'path'; + import * as fs from 'fs-extra'; import temp from 'temp'; -import path from 'path'; + import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { URI, StoragePaths, FileUri, IFileServiceClient, ILoggerManagerClient } from '@opensumi/ide-core-common'; import { AppConfig } from '@opensumi/ide-core-node'; -import { ExtensionStorageModule } from '../../src/browser'; +import { IExtensionStorageServer, IExtensionStoragePathServer } from '@opensumi/ide-extension-storage'; +import { FileStat, IDiskFileProvider } from '@opensumi/ide-file-service'; import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { ExtensionStorageModule } from '../../src/browser'; + process.on('unhandledRejection', (reason) => { // eslint-disable-next-line no-console console.error(reason); diff --git a/packages/extension-storage/src/browser/index.ts b/packages/extension-storage/src/browser/index.ts index a61d4d1e07..7c406d1a90 100644 --- a/packages/extension-storage/src/browser/index.ts +++ b/packages/extension-storage/src/browser/index.ts @@ -1,9 +1,11 @@ -import { IExtensionStorageService, IExtensionStoragePathServer, IExtensionStorageServer } from '../common'; import { Provider, Autowired } from '@opensumi/di'; import { BrowserModule, EffectDomain, ClientAppContribution, Domain } from '@opensumi/ide-core-browser'; -import { ExtensionStorageService } from './storage.service'; -import { ExtensionStoragePathServer } from './storage-path'; + +import { IExtensionStorageService, IExtensionStoragePathServer, IExtensionStorageServer } from '../common'; + import { ExtensionStorageServer } from './storage'; +import { ExtensionStoragePathServer } from './storage-path'; +import { ExtensionStorageService } from './storage.service'; const pkgJson = require('../../package.json'); @EffectDomain(pkgJson.name) diff --git a/packages/extension-storage/src/browser/storage-path.ts b/packages/extension-storage/src/browser/storage-path.ts index 4a4f018607..a57d317cbc 100644 --- a/packages/extension-storage/src/browser/storage-path.ts +++ b/packages/extension-storage/src/browser/storage-path.ts @@ -1,16 +1,19 @@ import crypto from 'crypto'; + import { Injectable, Autowired } from '@opensumi/di'; +import { AppConfig } from '@opensumi/ide-core-browser'; import { isWindows, URI, Deferred, StoragePaths } from '@opensumi/ide-core-common'; -import { IExtensionStoragePathServer } from '../common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; +import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service'; +import { ILoggerManagerClient } from '@opensumi/ide-logs'; import { DEFAULT_WORKSPACE_SUFFIX_NAME, WORKSPACE_USER_STORAGE_FOLDER_NAME, UNTITLED_WORKSPACE, } from '@opensumi/ide-workspace'; -import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service'; -import { ILoggerManagerClient } from '@opensumi/ide-logs'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import { AppConfig } from '@opensumi/ide-core-browser'; + +import { IExtensionStoragePathServer } from '../common'; + @Injectable() export class ExtensionStoragePathServer implements IExtensionStoragePathServer { diff --git a/packages/extension-storage/src/browser/storage.service.ts b/packages/extension-storage/src/browser/storage.service.ts index 2b41e38982..94d10ae28d 100644 --- a/packages/extension-storage/src/browser/storage.service.ts +++ b/packages/extension-storage/src/browser/storage.service.ts @@ -1,8 +1,8 @@ -import { FileStat } from '@opensumi/ide-file-service'; -import { AppConfig } from '@opensumi/ide-core-browser'; import { Injectable, Autowired } from '@opensumi/di'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { AppConfig } from '@opensumi/ide-core-browser'; import { firstSessionDateStorageKey } from '@opensumi/ide-core-common'; +import { FileStat } from '@opensumi/ide-file-service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { ExtensionStorageUri, diff --git a/packages/extension-storage/src/browser/storage.ts b/packages/extension-storage/src/browser/storage.ts index 14f2e3d311..0968bbd517 100644 --- a/packages/extension-storage/src/browser/storage.ts +++ b/packages/extension-storage/src/browser/storage.ts @@ -1,6 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Deferred, URI, ILogger, StoragePaths, ThrottledDelayer, Throttler, Uri } from '@opensumi/ide-core-common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service'; + import { ExtensionStorageUri, IExtensionStoragePathServer, @@ -10,7 +12,6 @@ import { DEFAULT_EXTENSION_STORAGE_DIR_NAME, IExtensionStorageTask, } from '../common/'; -import { Path } from '@opensumi/ide-core-common/lib/path'; @Injectable() export class ExtensionStorageServer implements IExtensionStorageServer { diff --git a/packages/extension-storage/src/common/storage-path.ts b/packages/extension-storage/src/common/storage-path.ts index 59a2372539..277310bc6b 100644 --- a/packages/extension-storage/src/common/storage-path.ts +++ b/packages/extension-storage/src/common/storage-path.ts @@ -1,5 +1,5 @@ -import { FileStat } from '@opensumi/ide-file-service'; import { URI } from '@opensumi/ide-core-common'; +import { FileStat } from '@opensumi/ide-file-service'; // 用于为各个插件创建插件配置的存储目录 export const IExtensionStoragePathServer = Symbol('IExtensionStoragePathServer'); diff --git a/packages/extension-storage/src/common/storage.ts b/packages/extension-storage/src/common/storage.ts index d96a23b05d..18e9012464 100644 --- a/packages/extension-storage/src/common/storage.ts +++ b/packages/extension-storage/src/common/storage.ts @@ -1,6 +1,7 @@ -import { KeysToAnyValues, KeysToKeysToAnyValue } from './types'; -import { FileStat } from '@opensumi/ide-file-service'; import { Uri } from '@opensumi/ide-core-common'; +import { FileStat } from '@opensumi/ide-file-service'; + +import { KeysToAnyValues, KeysToKeysToAnyValue } from './types'; export const IExtensionStorageServer = Symbol('ExtensionStorageServer'); diff --git a/packages/extension/__mocks__/api/mainthread.extension.log.ts b/packages/extension/__mocks__/api/mainthread.extension.log.ts index 0b5e2927fa..3a5ee47b39 100644 --- a/packages/extension/__mocks__/api/mainthread.extension.log.ts +++ b/packages/extension/__mocks__/api/mainthread.extension.log.ts @@ -1,5 +1,5 @@ -import { IMainThreadExtensionLog } from '@opensumi/ide-extension/lib/common/extension-log'; import { LogLevel } from '@opensumi/ide-core-common'; +import { IMainThreadExtensionLog } from '@opensumi/ide-extension/lib/common/extension-log'; export class MainThreadExtensionLog implements IMainThreadExtensionLog { private level: LogLevel = LogLevel.Verbose; diff --git a/packages/extension/__mocks__/api/mainthread.extension.service.ts b/packages/extension/__mocks__/api/mainthread.extension.service.ts index 774d330628..a6362b00a0 100644 --- a/packages/extension/__mocks__/api/mainthread.extension.service.ts +++ b/packages/extension/__mocks__/api/mainthread.extension.service.ts @@ -1,5 +1,4 @@ import { VSCodeExtensionService } from '../../src/common/vscode'; - import { mockExtensionProps, mockExtensionProps2 } from '../extensions'; export class MainThreadExtensionService implements VSCodeExtensionService { diff --git a/packages/extension/__mocks__/extension.service.client.ts b/packages/extension/__mocks__/extension.service.client.ts index 3318b0b8f0..e6f0d22b95 100644 --- a/packages/extension/__mocks__/extension.service.client.ts +++ b/packages/extension/__mocks__/extension.service.client.ts @@ -1,6 +1,8 @@ +import { Injectable } from '@opensumi/di'; + import { IExtensionNodeClientService, IExtraMetaData, IExtensionMetaData, IExtension } from '../src/common'; + import { mockExtensionProps } from './extensions'; -import { Injectable } from '@opensumi/di'; const mockExtensions: IExtension[] = [ { diff --git a/packages/extension/__mocks__/extensions.ts b/packages/extension/__mocks__/extensions.ts index b0c3bf12c2..aab5433c1d 100644 --- a/packages/extension/__mocks__/extensions.ts +++ b/packages/extension/__mocks__/extensions.ts @@ -1,5 +1,7 @@ import path from 'path'; + import { Uri } from '@opensumi/ide-core-common'; + import { IExtension, IExtensionProps } from '../src/common'; import { IExtensionDescription, ExtensionIdentifier } from '../src/common/vscode'; diff --git a/packages/extension/__mocks__/initRPCProtocol.ts b/packages/extension/__mocks__/initRPCProtocol.ts index 91967ebe66..420e8a8b24 100644 --- a/packages/extension/__mocks__/initRPCProtocol.ts +++ b/packages/extension/__mocks__/initRPCProtocol.ts @@ -1,7 +1,9 @@ import net from 'net'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; + import { RPCServiceCenter, initRPCService } from '@opensumi/ide-connection'; +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { createSocketConnection } from '@opensumi/ide-connection/lib/node'; + import { KT_PROCESS_SOCK_OPTION_KEY } from '../src/common'; const argv = require('yargs').argv; diff --git a/packages/extension/__mocks__/mockExtNodClientService.ts b/packages/extension/__mocks__/mockExtNodClientService.ts index 12d180090f..eab0718482 100644 --- a/packages/extension/__mocks__/mockExtNodClientService.ts +++ b/packages/extension/__mocks__/mockExtNodClientService.ts @@ -1,5 +1,6 @@ import { Injectable } from '@opensumi/di'; import { IExtensionNodeClientService, IExtraMetaData, IExtensionMetaData } from '@opensumi/ide-extension'; + import { mockExtensions, mockExtensionProps } from './extensions'; @Injectable() diff --git a/packages/extension/__mocks__/worker.ts b/packages/extension/__mocks__/worker.ts index d7302ba395..63048c98f1 100644 --- a/packages/extension/__mocks__/worker.ts +++ b/packages/extension/__mocks__/worker.ts @@ -1,6 +1,8 @@ -import * as fs from 'fs-extra'; import path from 'path'; import vm from 'vm'; + +import * as fs from 'fs-extra'; + const { TextDecoder, TextEncoder } = require('util'); const workerScript = ` diff --git a/packages/extension/__tests__/browser/activation.service.test.ts b/packages/extension/__tests__/browser/activation.service.test.ts index 1a32fc2527..0a3f99a0af 100644 --- a/packages/extension/__tests__/browser/activation.service.test.ts +++ b/packages/extension/__tests__/browser/activation.service.test.ts @@ -1,6 +1,6 @@ import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { IActivationEventService } from '../../src/browser/types'; import { ExtensionModule } from '../../src/browser'; +import { IActivationEventService } from '../../src/browser/types'; describe('activation event test', () => { const injector = createBrowserInjector([ExtensionModule]); diff --git a/packages/extension/__tests__/browser/extension-service/extension-service-mock-helper.ts b/packages/extension/__tests__/browser/extension-service/extension-service-mock-helper.ts index cb1319da36..4ffc2e24e6 100644 --- a/packages/extension/__tests__/browser/extension-service/extension-service-mock-helper.ts +++ b/packages/extension/__tests__/browser/extension-service/extension-service-mock-helper.ts @@ -1,23 +1,11 @@ -import { Injectable, Provider } from '@opensumi/di'; -import path from 'path'; import fs from 'fs'; -import { - ExtensionService, - IExtensionNodeClientService, - IExtraMetaData, - IExtensionMetaData, - IExtension, - IExtensionProps, - ExtensionNodeServiceServerPath, - IExtCommandManagement, - AbstractExtensionManagementService, - IRequireInterceptorService, - RequireInterceptorService, - RequireInterceptorContribution, -} from '../../../src/common'; -import { MockInjector, mockService } from '../../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; -import { ExtensionServiceImpl } from '../../../src/browser/extension.service'; +import path from 'path'; + +import { Injectable, Provider } from '@opensumi/di'; +import { ICommentsService } from '@opensumi/ide-comments'; +import { CommentsService } from '@opensumi/ide-comments/lib/browser/comments.service'; +import { WSChannel } from '@opensumi/ide-connection'; +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; import { IContextKeyService, ILoggerManagerClient, @@ -42,57 +30,71 @@ import { ICredentialsService, Emitter, } from '@opensumi/ide-core-browser'; -import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; -import { IThemeService, IIconService } from '@opensumi/ide-theme/lib/common'; -import { IconService } from '@opensumi/ide-theme/lib/browser'; -import { DatabaseStorageContribution } from '@opensumi/ide-storage/lib/browser/storage.contribution'; -import { IWorkspaceStorageServer, IGlobalStorageServer } from '@opensumi/ide-storage'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; +import { MockPreferenceProvider } from '@opensumi/ide-core-browser/__mocks__/preference'; +import { IMenuRegistry, MenuRegistryImpl } from '@opensumi/ide-core-browser/src/menu/next'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { WSChannel } from '@opensumi/ide-connection'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; import { IEditorDocumentModelContentRegistry, IEditorDocumentModelService, IEditorActionRegistry, } from '@opensumi/ide-editor/lib/browser'; -import { MockPreferenceProvider } from '@opensumi/ide-core-browser/__mocks__/preference'; -import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common/file-search'; -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; -import { IMenuRegistry, MenuRegistryImpl } from '@opensumi/ide-core-browser/src/menu/next'; import { EditorActionRegistryImpl } from '@opensumi/ide-editor/lib/browser/menu/editor.menu'; -import { IMainLayoutService, MainLayoutContribution } from '@opensumi/ide-main-layout'; -import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; -import { PreferenceSettingsService } from '@opensumi/ide-preferences/lib/browser/preference-settings.service'; -import { WorkbenchThemeService } from '@opensumi/ide-theme/lib/browser/workbench.theme.service'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; -import { MonacoSnippetSuggestProvider } from '@opensumi/ide-monaco/lib/browser/monaco-snippet-suggest-provider'; +import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; +import { ActivationEventServiceImpl } from '@opensumi/ide-extension/lib/browser/activation.service'; +import { BrowserRequireInterceptorContribution } from '@opensumi/ide-extension/lib/browser/require-interceptor.contribution'; import { AbstractExtInstanceManagementService, IActivationEventService, } from '@opensumi/ide-extension/lib/browser/types'; -import { ActivationEventServiceImpl } from '@opensumi/ide-extension/lib/browser/activation.service'; +import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common/file-search'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; +import { IMainLayoutService, MainLayoutContribution } from '@opensumi/ide-main-layout'; +import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; +import { MonacoSnippetSuggestProvider } from '@opensumi/ide-monaco/lib/browser/monaco-snippet-suggest-provider'; import { SchemaRegistry, SchemaStore } from '@opensumi/ide-monaco/lib/browser/schema-registry'; +import { PreferenceSettingsService } from '@opensumi/ide-preferences/lib/browser/preference-settings.service'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { IWorkspaceStorageServer, IGlobalStorageServer } from '@opensumi/ide-storage'; +import { DatabaseStorageContribution } from '@opensumi/ide-storage/lib/browser/storage.contribution'; +import { IconService } from '@opensumi/ide-theme/lib/browser'; +import { SemanticTokenRegistryImpl } from '@opensumi/ide-theme/lib/browser/semantic-tokens-registry'; +import { WorkbenchThemeService } from '@opensumi/ide-theme/lib/browser/workbench.theme.service'; +import { IThemeService, IIconService } from '@opensumi/ide-theme/lib/common'; +import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; +import { IWebviewService } from '@opensumi/ide-webview'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '../../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../../../monaco/__mocks__/monaco.context-key.service'; +import { MockWorker, MessagePort } from '../../../__mocks__/worker'; import { ExtCommandManagementImpl } from '../../../src/browser/extension-command-management'; import { ExtInstanceManagementService } from '../../../src/browser/extension-instance-management'; import { ExtensionManagementService } from '../../../src/browser/extension-management.service'; +import { NodeExtProcessService } from '../../../src/browser/extension-node.service'; +import { ViewExtProcessService } from '../../../src/browser/extension-view.service'; +import { WorkerExtProcessService } from '../../../src/browser/extension-worker.service'; +import { ExtensionServiceImpl } from '../../../src/browser/extension.service'; +import { + ExtensionService, + IExtensionNodeClientService, + IExtraMetaData, + IExtensionMetaData, + IExtension, + IExtensionProps, + ExtensionNodeServiceServerPath, + IExtCommandManagement, + AbstractExtensionManagementService, + IRequireInterceptorService, + RequireInterceptorService, + RequireInterceptorContribution, +} from '../../../src/common'; import { AbstractNodeExtProcessService, AbstractViewExtProcessService, AbstractWorkerExtProcessService, } from '../../../src/common/extension.service'; -import { NodeExtProcessService } from '../../../src/browser/extension-node.service'; -import { WorkerExtProcessService } from '../../../src/browser/extension-worker.service'; -import { ViewExtProcessService } from '../../../src/browser/extension-view.service'; -import { MockWorker, MessagePort } from '../../../__mocks__/worker'; -import { IWebviewService } from '@opensumi/ide-webview'; -import { ICommentsService } from '@opensumi/ide-comments'; -import { CommentsService } from '@opensumi/ide-comments/lib/browser/comments.service'; -import { BrowserRequireInterceptorContribution } from '@opensumi/ide-extension/lib/browser/require-interceptor.contribution'; -import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; -import { SemanticTokenRegistryImpl } from '@opensumi/ide-theme/lib/browser/semantic-tokens-registry'; @Injectable() class MockLoggerManagerClient { diff --git a/packages/extension/__tests__/browser/extension-service/extension.contribution.test.ts b/packages/extension/__tests__/browser/extension-service/extension.contribution.test.ts index 9ff655373a..22d5166567 100644 --- a/packages/extension/__tests__/browser/extension-service/extension.contribution.test.ts +++ b/packages/extension/__tests__/browser/extension-service/extension.contribution.test.ts @@ -1,10 +1,11 @@ +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; +import { uuid } from '@opensumi/ide-core-common'; import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { setupExtensionServiceInjector } from './extension-service-mock-helper'; import { getClientId } from '../../../src/browser/extension.contribution'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; -import { uuid } from '@opensumi/ide-core-common'; + +import { setupExtensionServiceInjector } from './extension-service-mock-helper'; describe('Extension service', () => { let injector: MockInjector; diff --git a/packages/extension/__tests__/browser/extension-service/extension.service.test.ts b/packages/extension/__tests__/browser/extension-service/extension.service.test.ts index d49d82fee3..8b2aca01bc 100644 --- a/packages/extension/__tests__/browser/extension-service/extension.service.test.ts +++ b/packages/extension/__tests__/browser/extension-service/extension.service.test.ts @@ -1,12 +1,5 @@ import ReactDom from 'react-dom'; -import { - ExtensionService, - IExtCommandManagement, - AbstractExtensionManagementService, - IRequireInterceptorService, -} from '../../../src/common'; -import { AbstractExtInstanceManagementService } from '../../../src/browser/types'; -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; + import { CommandRegistryImpl, CommandRegistry, @@ -15,16 +8,26 @@ import { KeybindingRegistryImpl, KeybindingRegistry, } from '@opensumi/ide-core-browser'; -import { IThemeService, getColorRegistry } from '@opensumi/ide-theme/lib/common'; +import { IToolbarRegistry } from '@opensumi/ide-core-browser/lib/toolbar'; import { IMenuRegistry, MenuRegistryImpl, IMenuItem } from '@opensumi/ide-core-browser/src/menu/next'; +import { NextToolbarRegistryImpl } from '@opensumi/ide-core-browser/src/toolbar/toolbar.registry'; +import { IActivationEventService, ExtensionBeforeActivateEvent } from '@opensumi/ide-extension/lib/browser/types'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; +import { TabbarService } from '@opensumi/ide-main-layout/lib/browser/tabbar/tabbar.service'; import { PreferenceSettingsService } from '@opensumi/ide-preferences/lib/browser/preference-settings.service'; import { WorkbenchThemeService } from '@opensumi/ide-theme/lib/browser/workbench.theme.service'; -import { IToolbarRegistry } from '@opensumi/ide-core-browser/lib/toolbar'; -import { NextToolbarRegistryImpl } from '@opensumi/ide-core-browser/src/toolbar/toolbar.registry'; -import { IActivationEventService, ExtensionBeforeActivateEvent } from '@opensumi/ide-extension/lib/browser/types'; -import { TabbarService } from '@opensumi/ide-main-layout/lib/browser/tabbar/tabbar.service'; +import { IThemeService, getColorRegistry } from '@opensumi/ide-theme/lib/common'; + +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; +import { AbstractExtInstanceManagementService } from '../../../src/browser/types'; +import { + ExtensionService, + IExtCommandManagement, + AbstractExtensionManagementService, + IRequireInterceptorService, +} from '../../../src/common'; + import { MOCK_EXTENSIONS, setupExtensionServiceInjector } from './extension-service-mock-helper'; describe('Extension service', () => { diff --git a/packages/extension/__tests__/browser/extension-service/extension.worker.service.test.ts b/packages/extension/__tests__/browser/extension-service/extension.worker.service.test.ts index e03a2ce1b7..689dc1aae9 100644 --- a/packages/extension/__tests__/browser/extension-service/extension.worker.service.test.ts +++ b/packages/extension/__tests__/browser/extension-service/extension.worker.service.test.ts @@ -3,6 +3,7 @@ import { WorkerExtProcessService } from '@opensumi/ide-extension/lib/browser/ext import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { IExtensionWorkerHost, WorkerHostAPIIdentifier } from '../../../src/common'; + import { MOCK_EXTENSIONS, setupExtensionServiceInjector } from './extension-service-mock-helper'; describe('Extension service', () => { diff --git a/packages/extension/__tests__/browser/extension.test.ts b/packages/extension/__tests__/browser/extension.test.ts index fd8fb7dca7..2a2cea40d5 100644 --- a/packages/extension/__tests__/browser/extension.test.ts +++ b/packages/extension/__tests__/browser/extension.test.ts @@ -1,12 +1,15 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import paths from 'path'; + import { URI, Uri, setLanguageId } from '@opensumi/ide-core-browser'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IExtensionMetaData } from '../../src/common'; -import paths from 'path'; +import { Extension } from '../../src/browser/extension'; import { ExtensionServiceImpl } from '../../src/browser/extension.service'; +import { IExtensionMetaData } from '../../src/common'; import { ExtensionService } from '../../src/common'; -import { Extension } from '../../src/browser/extension'; -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; + import '@opensumi/ide-i18n'; const mockExtension: IExtensionMetaData = { diff --git a/packages/extension/__tests__/browser/index.test.ts b/packages/extension/__tests__/browser/index.test.ts index d929648533..7a7953ae91 100644 --- a/packages/extension/__tests__/browser/index.test.ts +++ b/packages/extension/__tests__/browser/index.test.ts @@ -19,6 +19,7 @@ import { IWorkspaceService } from '@opensumi/ide-workspace'; import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; import { ExtensionNodeServiceServerPath, IExtensionNodeClientService } from '../../src'; import { ExtensionClientAppContribution, ExtensionCommandContribution } from '../../src/browser/extension.contribution'; + import { setupExtensionServiceInjector } from './extension-service/extension-service-mock-helper'; describe(__filename, () => { diff --git a/packages/extension/__tests__/browser/main.language.test.ts b/packages/extension/__tests__/browser/main.language.test.ts index a7324bf72e..f083e22232 100644 --- a/packages/extension/__tests__/browser/main.language.test.ts +++ b/packages/extension/__tests__/browser/main.language.test.ts @@ -1,42 +1,44 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { createModel } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneEditor'; -import * as monacoModes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { ExtHostLanguages } from '../../src/hosted/api/vscode/ext.host.language'; -import { MainThreadLanguages } from '../../src/browser/vscode/api/main.thread.language'; -import { URI, Uri, Position } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; -import * as types from '../../src/common/vscode/ext-types'; -import * as modes from '../../src/common/vscode/model.api'; + import { RPCProtocol } from '@opensumi/ide-connection'; import { Emitter, CancellationToken, MonacoService, DisposableCollection } from '@opensumi/ide-core-browser'; -import { ExtensionDocumentDataManagerImpl } from '../../src/hosted/api/vscode/doc'; -import { ExtHostAPIIdentifier, IExtensionDescription, MainThreadAPIIdentifier } from '../../src/common/vscode'; -import { ExtHostCommands } from '../../src/hosted/api/vscode/ext.host.command'; -import { MainThreadCommands } from '../../src/browser/vscode/api/main.thread.commands'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockedMonacoService } from '../../../monaco/__mocks__/monaco.service.mock'; -import { ICallHierarchyService } from '@opensumi/ide-monaco/lib/browser/contrib'; -import { CallHierarchyService } from '@opensumi/ide-editor/lib/browser/monaco-contrib'; +import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { URI, Uri, Position } from '@opensumi/ide-core-common'; import { - IEditorDocumentModelService, - IEditorDocumentModelContentRegistry, - EmptyDocCacheImpl, -} from '@opensumi/ide-editor/src/browser'; + EvaluatableExpressionServiceImpl, + IEvaluatableExpressionService, +} from '@opensumi/ide-debug/lib/browser/editor/evaluatable-expression'; +import { IDocPersistentCacheProvider } from '@opensumi/ide-editor'; +import { TestEditorDocumentProvider } from '@opensumi/ide-editor/__tests__/browser/test-providers'; import { EditorDocumentModelServiceImpl, EditorDocumentModelContentRegistryImpl, } from '@opensumi/ide-editor/lib/browser/doc-model/main'; -import { IDocPersistentCacheProvider } from '@opensumi/ide-editor'; +import { CallHierarchyService } from '@opensumi/ide-editor/lib/browser/monaco-contrib'; import { - EvaluatableExpressionServiceImpl, - IEvaluatableExpressionService, -} from '@opensumi/ide-debug/lib/browser/editor/evaluatable-expression'; -import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; -import { TestEditorDocumentProvider } from '@opensumi/ide-editor/__tests__/browser/test-providers'; -import { mockService } from '../../../../tools/dev-tool/src/mock-injector'; + IEditorDocumentModelService, + IEditorDocumentModelContentRegistry, + EmptyDocCacheImpl, +} from '@opensumi/ide-editor/src/browser'; +import { ICallHierarchyService } from '@opensumi/ide-monaco/lib/browser/contrib'; import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monacoModes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { createModel } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneEditor'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { mockService } from '../../../../tools/dev-tool/src/mock-injector'; +import { MockedMonacoService } from '../../../monaco/__mocks__/monaco.service.mock'; +import { MainThreadCommands } from '../../src/browser/vscode/api/main.thread.commands'; +import { MainThreadLanguages } from '../../src/browser/vscode/api/main.thread.language'; +import { ExtHostAPIIdentifier, IExtensionDescription, MainThreadAPIIdentifier } from '../../src/common/vscode'; +import * as types from '../../src/common/vscode/ext-types'; +import * as modes from '../../src/common/vscode/model.api'; +import { ExtensionDocumentDataManagerImpl } from '../../src/hosted/api/vscode/doc'; +import { ExtHostCommands } from '../../src/hosted/api/vscode/ext.host.command'; +import { ExtHostLanguages } from '../../src/hosted/api/vscode/ext.host.language'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.command.test.ts b/packages/extension/__tests__/browser/main.thread.command.test.ts index 6c7077ca80..56abf03408 100644 --- a/packages/extension/__tests__/browser/main.thread.command.test.ts +++ b/packages/extension/__tests__/browser/main.thread.command.test.ts @@ -1,13 +1,15 @@ -import { Emitter, CommandRegistry, CommandRegistryImpl, ILoggerManagerClient } from '@opensumi/ide-core-common'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { Injector } from '@opensumi/di'; import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { Emitter, CommandRegistry, CommandRegistryImpl, ILoggerManagerClient } from '@opensumi/ide-core-common'; +import { MonacoCommandService } from '@opensumi/ide-editor/lib/browser/monaco-contrib/command/command.service'; +import { ICommandServiceToken } from '@opensumi/ide-monaco/lib/browser/contrib/command'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; import { MainThreadCommands } from '../../src/browser/vscode/api/main.thread.commands'; -import { ExtHostCommands } from '../../src/hosted/api/vscode/ext.host.command'; import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '../../src/common/vscode'; -import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; -import { ICommandServiceToken } from '@opensumi/ide-monaco/lib/browser/contrib/command'; -import { MonacoCommandService } from '@opensumi/ide-editor/lib/browser/monaco-contrib/command/command.service'; +import { ExtHostCommands } from '../../src/hosted/api/vscode/ext.host.command'; + describe('MainThreadCommandAPI Test Suites ', () => { let extHostCommands: ExtHostCommands; diff --git a/packages/extension/__tests__/browser/main.thread.custom-editor.test.ts b/packages/extension/__tests__/browser/main.thread.custom-editor.test.ts index de0f25c663..c483669320 100644 --- a/packages/extension/__tests__/browser/main.thread.custom-editor.test.ts +++ b/packages/extension/__tests__/browser/main.thread.custom-editor.test.ts @@ -1,8 +1,10 @@ +import { RPCProtocol } from '@opensumi/ide-connection'; import { Emitter, IEventBus, URI, CancellationTokenSource } from '@opensumi/ide-core-common'; +import { ResourceDecorationNeedChangeEvent } from '@opensumi/ide-editor/lib/browser/types'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; +import { MainThreadWebview } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.api.webview'; +import { MainThreadCustomEditor } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.custom-editor'; import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { RPCProtocol } from '@opensumi/ide-connection'; -import { mockService, MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { IExtHostCustomEditor, CustomEditorType, @@ -12,11 +14,10 @@ import { CustomEditorShouldSaveEvent, CustomEditorShouldRevertEvent, } from '@opensumi/ide-extension/lib/common/vscode/custom-editor'; -import { MainThreadWebview } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.api.webview'; -import { MainThreadCustomEditor } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.custom-editor'; import { IWebviewService } from '@opensumi/ide-webview/lib/browser/types'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; -import { ResourceDecorationNeedChangeEvent } from '@opensumi/ide-editor/lib/browser/types'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { mockService, MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.debug.test.ts b/packages/extension/__tests__/browser/main.thread.debug.test.ts index 07f690495d..12ae59d7f0 100644 --- a/packages/extension/__tests__/browser/main.thread.debug.test.ts +++ b/packages/extension/__tests__/browser/main.thread.debug.test.ts @@ -1,23 +1,24 @@ -import { Disposable, IFileServiceClient, ILoggerManagerClient, URI, Uri } from '@opensumi/ide-core-common'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { LabelService } from '@opensumi/ide-core-browser/src'; -import { MainThreadDebug } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.debug'; +import { Disposable, IFileServiceClient, ILoggerManagerClient, URI, Uri } from '@opensumi/ide-core-common'; +import { IDebugSessionManager, IDebugService, IDebugServer } from '@opensumi/ide-debug'; import { BreakpointManager, DebugPreferences, DebugSessionContributionRegistry, DebugModelManager, } from '@opensumi/ide-debug/lib/browser'; -import { IDebugSessionManager, IDebugService, IDebugServer } from '@opensumi/ide-debug'; +import { DebugConfigurationManager } from '@opensumi/ide-debug/lib/browser'; import { DebugConsoleModelService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; import { WorkbenchEditorService } from '@opensumi/ide-editor/src'; +import { MainThreadConnection } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.connection'; +import { MainThreadDebug } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.debug'; +import { ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; import { IMessageService } from '@opensumi/ide-overlay'; -import { DebugConfigurationManager } from '@opensumi/ide-debug/lib/browser'; import { ITerminalApiService } from '@opensumi/ide-terminal-next'; -import { ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { MainThreadConnection } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.connection'; -import { IRPCProtocol } from '@opensumi/ide-connection'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; const map = new Map(); diff --git a/packages/extension/__tests__/browser/main.thread.decoration.test.ts b/packages/extension/__tests__/browser/main.thread.decoration.test.ts index 2dacece9a3..14175871d6 100644 --- a/packages/extension/__tests__/browser/main.thread.decoration.test.ts +++ b/packages/extension/__tests__/browser/main.thread.decoration.test.ts @@ -1,22 +1,22 @@ +import type vscode from 'vscode'; + import { Injector } from '@opensumi/di'; import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { createWindowApiFactory } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.window.api.impl'; +import { Event, Uri, Emitter, DisposableCollection, CancellationToken } from '@opensumi/ide-core-common'; +import { IDecorationsService } from '@opensumi/ide-decoration'; +import { FileDecorationsService } from '@opensumi/ide-decoration/lib/browser/decorationsService'; import { MainThreadDecorations } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.decoration'; import { IMainThreadEnv, MainThreadAPIIdentifier, ExtHostAPIIdentifier, } from '@opensumi/ide-extension/lib/common/vscode'; -import { FileDecorationsService } from '@opensumi/ide-decoration/lib/browser/decorationsService'; -import { IDecorationsService } from '@opensumi/ide-decoration'; -import type vscode from 'vscode'; -import { Event, Uri, Emitter, DisposableCollection, CancellationToken } from '@opensumi/ide-core-common'; +import { createWindowApiFactory } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.window.api.impl'; import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; - -import ExtensionHostextWindowAPIImpl from '../../src/hosted/ext.host'; -import { ExtHostDecorations } from '../../src/hosted/api/vscode/ext.host.decoration'; import { mockExtensions } from '../../__mocks__/extensions'; +import { ExtHostDecorations } from '../../src/hosted/api/vscode/ext.host.decoration'; +import ExtensionHostextWindowAPIImpl from '../../src/hosted/ext.host'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.editor.test.ts b/packages/extension/__tests__/browser/main.thread.editor.test.ts index b56f4e4f74..fde0a4e5e0 100644 --- a/packages/extension/__tests__/browser/main.thread.editor.test.ts +++ b/packages/extension/__tests__/browser/main.thread.editor.test.ts @@ -1,4 +1,12 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import path from 'path'; + +import { isEqual } from 'lodash'; + +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { URI, IContextKeyService } from '@opensumi/ide-core-browser'; +import { CorePreferences, MonacoOverrideServiceRegistry } from '@opensumi/ide-core-browser'; +import { injectMockPreferences } from '@opensumi/ide-core-browser/__mocks__/preference'; +import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; import { Emitter, IFileServiceClient, @@ -7,26 +15,7 @@ import { OS, IApplicationService, } from '@opensumi/ide-core-common'; -import { URI, IContextKeyService } from '@opensumi/ide-core-browser'; -import { injectMockPreferences } from '@opensumi/ide-core-browser/__mocks__/preference'; -import path from 'path'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import * as types from '../../src/common/vscode/ext-types'; -import { IDialogService } from '@opensumi/ide-overlay'; -import { isEqual } from 'lodash'; - -import { ExtensionHostEditorService } from '../../src/hosted/api/vscode/editor/editor.host'; -import { MainThreadEditorService } from '../../src/browser/vscode/api/main.thread.editor'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { - WorkbenchEditorService, - EditorCollectionService, - ResourceService, - ILanguageService, - IDocPersistentCacheProvider, -} from '@opensumi/ide-editor/lib/common'; -import { WorkbenchEditorServiceImpl, EditorGroup } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { IResource, IEditorOpenType } from '@opensumi/ide-editor'; import { IEditorDecorationCollectionService, IEditorDocumentModelContentRegistry, @@ -36,47 +25,60 @@ import { EmptyDocCacheImpl, EditorPreferences, } from '@opensumi/ide-editor/lib/browser'; -import { EditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser/editor.decoration.service'; -import { EditorCollectionServiceImpl } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; -import { ExtensionService } from '@opensumi/ide-extension/lib/common'; -import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service'; -import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; -import { MainThreadExtensionDocumentData } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.doc'; +import { EditorComponentRegistryImpl } from '@opensumi/ide-editor/lib/browser/component'; import { EditorDocumentModelContentRegistryImpl, EditorDocumentModelServiceImpl, } from '@opensumi/ide-editor/lib/browser/doc-model/main'; +import { EditorCollectionServiceImpl } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; +import { EditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser/editor.decoration.service'; import { EditorFeatureRegistryImpl } from '@opensumi/ide-editor/lib/browser/feature'; +import { BaseFileSystemEditorDocumentProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-editor-doc'; +import { FileSystemResourceProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-resource'; +import { LanguageService } from '@opensumi/ide-editor/lib/browser/language/language.service'; +import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; +import { EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser/types'; import { EditorGroupChangeEvent, EditorVisibleChangeEvent, EditorGroupIndexChangedEvent, EditorSelectionChangeEvent, } from '@opensumi/ide-editor/lib/browser/types'; +import { WorkbenchEditorServiceImpl, EditorGroup } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { + WorkbenchEditorService, + EditorCollectionService, + ResourceService, + ILanguageService, + IDocPersistentCacheProvider, +} from '@opensumi/ide-editor/lib/common'; +import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service'; +import { MainThreadExtensionDocumentData } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.doc'; +import { ExtensionService } from '@opensumi/ide-extension/lib/common'; +import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; +import * as TypeConverts from '@opensumi/ide-extension/lib/common/vscode/converter'; +import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; +import { FileServiceContribution } from '@opensumi/ide-file-service/lib/browser/file-service-contribution'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; import { MonacoService } from '@opensumi/ide-monaco'; import MonacoServiceImpl from '@opensumi/ide-monaco/lib/browser/monaco.service'; -import { CorePreferences, MonacoOverrideServiceRegistry } from '@opensumi/ide-core-browser'; -import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; -import { LanguageService } from '@opensumi/ide-editor/lib/browser/language/language.service'; -import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { MonacoOverrideServiceRegistryImpl } from '@opensumi/ide-monaco/lib/browser/override.service.registry'; +import { IDialogService } from '@opensumi/ide-overlay'; import { IWorkspaceService } from '@opensumi/ide-workspace'; import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { BaseFileSystemEditorDocumentProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-editor-doc'; -import { FileSystemResourceProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-resource'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; -import { FileServiceContribution } from '@opensumi/ide-file-service/lib/browser/file-service-contribution'; -import { TestEditorDocumentProvider, TestResourceResolver } from '../../../editor/__tests__/browser/test-providers'; -import { EditorComponentRegistryImpl } from '@opensumi/ide-editor/lib/browser/component'; -import { EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser/types'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { IResource, IEditorOpenType } from '@opensumi/ide-editor'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { IConfigurationService, IConfigurationChangeEvent, ConfigurationTarget, } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration'; -import * as TypeConverts from '@opensumi/ide-extension/lib/common/vscode/converter'; -import { MonacoOverrideServiceRegistryImpl } from '@opensumi/ide-monaco/lib/browser/override.service.registry'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { TestEditorDocumentProvider, TestResourceResolver } from '../../../editor/__tests__/browser/test-providers'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; +import { MainThreadEditorService } from '../../src/browser/vscode/api/main.thread.editor'; +import * as types from '../../src/common/vscode/ext-types'; +import { ExtensionHostEditorService } from '../../src/hosted/api/vscode/editor/editor.host'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.env.test.ts b/packages/extension/__tests__/browser/main.thread.env.test.ts index 55085f97dc..15952984dc 100644 --- a/packages/extension/__tests__/browser/main.thread.env.test.ts +++ b/packages/extension/__tests__/browser/main.thread.env.test.ts @@ -1,5 +1,7 @@ // @ts-nocheck import { Injector, Injectable } from '@opensumi/di'; +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { AppConfig } from '@opensumi/ide-core-browser'; import { Emitter, ILoggerManagerClient, @@ -7,11 +9,7 @@ import { LogLevel, getLanguageId, } from '@opensumi/ide-core-common'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { createEnvApiFactory, ExtHostEnv, envValue } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.env'; -import { ExtHostTerminal } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.terminal'; -import { ExtHostStorage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.storage'; +import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; import { MainThreadEnv } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.env'; import { MainThreadStorage } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.storage'; import { @@ -20,10 +18,13 @@ import { ExtHostAPIIdentifier, IMainThreadStorage, } from '@opensumi/ide-extension/lib/common/vscode'; +import { createEnvApiFactory, ExtHostEnv, envValue } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.env'; +import { ExtHostStorage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.storage'; +import { ExtHostTerminal } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.terminal'; import ExtensionHostServiceImpl from '@opensumi/ide-extension/lib/hosted/ext.host'; import { LoggerManagerClient } from '@opensumi/ide-logs/lib/browser/log-manage'; -import { AppConfig } from '@opensumi/ide-core-browser'; -import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.extensions.test.ts b/packages/extension/__tests__/browser/main.thread.extensions.test.ts index c5c6f82908..9f5b3196b5 100644 --- a/packages/extension/__tests__/browser/main.thread.extensions.test.ts +++ b/packages/extension/__tests__/browser/main.thread.extensions.test.ts @@ -1,40 +1,43 @@ -import * as ideCoreCommon from '@opensumi/ide-core-common'; import { Injectable, Injector } from '@opensumi/di'; import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; -import * as types from '../../src/common/vscode/ext-types'; -import { createExtensionsApiFactory } from '../../src/hosted/api/vscode/ext.host.extensions'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import ExtensionHostServiceImpl from '../../src/hosted/ext.host'; -import { ExtensionNodeServiceServerPath } from '../../src/common'; -import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../src/common/vscode'; -import { MainThreadStorage } from '../../src/browser/vscode/api/main.thread.storage'; -import { MainThreadExtensionLogIdentifier } from '../../src/common/extension-log'; -import { MainThreadExtensionLog } from '../../src/browser/vscode/api/main.thread.log'; -import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; import { IContextKeyService, AppConfig } from '@opensumi/ide-core-browser'; +import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; +import * as ideCoreCommon from '@opensumi/ide-core-common'; +import { IReporter, DefaultReporter } from '@opensumi/ide-core-common'; import { AppConfig as NodeAppConfig } from '@opensumi/ide-core-node'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; -import { IGlobalStorageServer } from '@opensumi/ide-storage'; -import { MainThreadWebview } from '../../src/browser/vscode/api/main.thread.api.webview'; - -import { MockExtNodeClientService } from '../../__mocks__/extension.service.client'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { MockWorkbenchEditorService } from '../../../editor/src/common/mocks/workbench-editor.service'; -import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; -import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; import { FileSearchServicePath } from '@opensumi/ide-file-search'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { WorkspaceService } from '@opensumi/ide-workspace/lib/browser/workspace-service'; -import { IThemeService, IIconService } from '@opensumi/ide-theme'; -import { IconService } from '@opensumi/ide-theme/lib/browser'; import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; -import { WorkspacePreferences } from '@opensumi/ide-workspace/lib/browser/workspace-preferences'; +import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { IGlobalStorageServer } from '@opensumi/ide-storage'; +import { IThemeService, IIconService } from '@opensumi/ide-theme'; +import { IconService } from '@opensumi/ide-theme/lib/browser'; import { IWebviewService } from '@opensumi/ide-webview'; -import { mockKaitianExtensionProviders } from './extension-service/extension-service-mock-helper'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkspacePreferences } from '@opensumi/ide-workspace/lib/browser/workspace-preferences'; +import { WorkspaceService } from '@opensumi/ide-workspace/lib/browser/workspace-service'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; +import { MockWorkbenchEditorService } from '../../../editor/src/common/mocks/workbench-editor.service'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; import { MainThreadExtensionService } from '../../__mocks__/api/mainthread.extension.service'; -import { IReporter, DefaultReporter } from '@opensumi/ide-core-common'; +import { MockExtNodeClientService } from '../../__mocks__/extension.service.client'; +import { MainThreadWebview } from '../../src/browser/vscode/api/main.thread.api.webview'; +import { MainThreadExtensionLog } from '../../src/browser/vscode/api/main.thread.log'; +import { MainThreadStorage } from '../../src/browser/vscode/api/main.thread.storage'; +import { ExtensionNodeServiceServerPath } from '../../src/common'; +import { MainThreadExtensionLogIdentifier } from '../../src/common/extension-log'; +import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../src/common/vscode'; +import * as types from '../../src/common/vscode/ext-types'; +import { createExtensionsApiFactory } from '../../src/hosted/api/vscode/ext.host.extensions'; +import ExtensionHostServiceImpl from '../../src/hosted/ext.host'; + + +import { mockKaitianExtensionProviders } from './extension-service/extension-service-mock-helper'; + @Injectable() class MockLoggerManagerClient { diff --git a/packages/extension/__tests__/browser/main.thread.output.test.ts b/packages/extension/__tests__/browser/main.thread.output.test.ts index 28dec020f5..6d6d56b219 100644 --- a/packages/extension/__tests__/browser/main.thread.output.test.ts +++ b/packages/extension/__tests__/browser/main.thread.output.test.ts @@ -1,14 +1,14 @@ -import { Emitter } from '@opensumi/ide-core-common'; import { Injector } from '@opensumi/di'; import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { Emitter } from '@opensumi/ide-core-common'; import { ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; -import * as types from '../../src/common/vscode/ext-types'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; -import { ExtHostOutput } from '../../src/hosted/api/vscode/ext.host.output'; import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; import { MockOutputService } from '../../__mocks__/api/output.service'; +import * as types from '../../src/common/vscode/ext-types'; +import { ExtHostOutput } from '../../src/hosted/api/vscode/ext.host.output'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.secret.test.ts b/packages/extension/__tests__/browser/main.thread.secret.test.ts index 85f76397aa..a19f9ade9d 100644 --- a/packages/extension/__tests__/browser/main.thread.secret.test.ts +++ b/packages/extension/__tests__/browser/main.thread.secret.test.ts @@ -1,9 +1,10 @@ -import { Emitter } from '@opensumi/ide-core-common'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { AppConfig, ICredentialsService, ICryptrService } from '@opensumi/ide-core-browser/src'; +import { Emitter } from '@opensumi/ide-core-common'; import { MainThreadSecret } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.secret'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; + const onDidChangePasswordEmitter = new Emitter(); const mockExtThreadSecretProxy = { $onDidChangePassword: onDidChangePasswordEmitter.event, diff --git a/packages/extension/__tests__/browser/main.thread.statusbar.test.ts b/packages/extension/__tests__/browser/main.thread.statusbar.test.ts index 762ec944d1..8937fecbc7 100644 --- a/packages/extension/__tests__/browser/main.thread.statusbar.test.ts +++ b/packages/extension/__tests__/browser/main.thread.statusbar.test.ts @@ -1,15 +1,16 @@ import { Injector } from '@opensumi/di'; -import { Emitter, CommandRegistry, CommandRegistryImpl, ILoggerManagerClient } from '@opensumi/ide-core-common'; import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { ExtHostStatusBar } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.statusbar'; +import { Emitter, CommandRegistry, CommandRegistryImpl, ILoggerManagerClient } from '@opensumi/ide-core-common'; import { MainThreadStatusBar } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.statusbar'; +import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; import { StatusBarAlignment } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; +import { ExtHostStatusBar } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.statusbar'; import { IStatusBarService } from '@opensumi/ide-status-bar'; import { StatusBarService } from '@opensumi/ide-status-bar/lib/browser/status-bar.service'; -import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { mockExtensionDescription } from '../../__mocks__/extensions'; +import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.task.test.ts b/packages/extension/__tests__/browser/main.thread.task.test.ts index 54db25bf50..b554ee9c1a 100644 --- a/packages/extension/__tests__/browser/main.thread.task.test.ts +++ b/packages/extension/__tests__/browser/main.thread.task.test.ts @@ -1,4 +1,7 @@ import path from 'path'; + +import { Injectable } from '@opensumi/di'; +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { Emitter, FileUri, @@ -8,40 +11,40 @@ import { ITaskDefinitionRegistry, TaskDefinitionRegistryImpl, } from '@opensumi/ide-core-common'; -import { Injectable } from '@opensumi/di'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { ExtHostTasks, createTaskApiFactory } from '@opensumi/ide-extension/lib/hosted/api/vscode/tasks/ext.host.tasks'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; +import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/src/browser/doc-model/main'; +import { ExtensionService } from '@opensumi/ide-extension'; +import { IExtensionStorageService } from '@opensumi/ide-extension-storage/lib/common'; +import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service'; import { MainthreadTasks } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.tasks'; -import { TaskService } from '@opensumi/ide-task/lib/browser/task.service'; -import { ExtHostTerminal } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.terminal'; -import { ExtHostWorkspace } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.workspace'; +import { MainThreadWorkspace } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.workspace'; import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { ExtHostMessage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.message'; +import { Task, ShellExecution } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; -import { ExtensionService } from '@opensumi/ide-extension'; -import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service'; -import { mockExtensions } from '../../__mocks__/extensions'; -import { ITaskService, ITaskSystem } from '@opensumi/ide-task/lib/common'; +import { ExtHostMessage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.message'; +import { ExtHostStorage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.storage'; +import { ExtHostTerminal } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.terminal'; +import { ExtHostWorkspace } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.workspace'; +import { ExtHostTasks, createTaskApiFactory } from '@opensumi/ide-extension/lib/hosted/api/vscode/tasks/ext.host.tasks'; +import { LoggerManagerClient } from '@opensumi/ide-logs/lib/browser/log-manage'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; +import { MonacoService } from '@opensumi/ide-monaco'; import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; +import { TaskService } from '@opensumi/ide-task/lib/browser/task.service'; import { TerminalTaskSystem } from '@opensumi/ide-task/lib/browser/terminal-task-system'; -import { Task, ShellExecution } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { LoggerManagerClient } from '@opensumi/ide-logs/lib/browser/log-manage'; -import { MainThreadWorkspace } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.workspace'; -import { IExtensionStorageService } from '@opensumi/ide-extension-storage/lib/common'; -import { ExtHostStorage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.storage'; -import { VariableModule } from '@opensumi/ide-variable/lib/browser'; +import { ITaskService, ITaskSystem } from '@opensumi/ide-task/lib/common'; import { ITerminalInternalService, ITerminalController } from '@opensumi/ide-terminal-next'; -import { TerminalInternalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.internal.service'; import { TerminalController } from '@opensumi/ide-terminal-next/lib/browser/terminal.controller'; -import { MonacoService } from '@opensumi/ide-monaco'; +import { TerminalInternalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.internal.service'; +import { VariableModule } from '@opensumi/ide-variable/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockedMonacoService } from '../../../monaco/__mocks__/monaco.service.mock'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; -import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/src/browser/doc-model/main'; +import { mockExtensions } from '../../__mocks__/extensions'; + const extension = Object.assign({}, mockExtensions[0], { packageJSON: { diff --git a/packages/extension/__tests__/browser/main.thread.treeview.test.ts b/packages/extension/__tests__/browser/main.thread.treeview.test.ts index 1db5f47dcc..bd015eb2dd 100644 --- a/packages/extension/__tests__/browser/main.thread.treeview.test.ts +++ b/packages/extension/__tests__/browser/main.thread.treeview.test.ts @@ -1,13 +1,14 @@ +import { IContextKeyService, PreferenceService } from '@opensumi/ide-core-browser/src'; +import { IMenuRegistry } from '@opensumi/ide-core-browser/src/menu/next'; import { Emitter, Disposable } from '@opensumi/ide-core-common'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MainThreadTreeView } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.treeview'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { IMenuRegistry } from '@opensumi/ide-core-browser/src/menu/next'; -import { IContextKeyService, PreferenceService } from '@opensumi/ide-core-browser/src'; -import { IIconService, IThemeService } from '@opensumi/ide-theme'; import { IFileServiceClient } from '@opensumi/ide-file-service'; import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { IIconService, IThemeService } from '@opensumi/ide-theme'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; const mockExtThreadTreeViewProxy = { $postMessage: jest.fn(), diff --git a/packages/extension/__tests__/browser/main.thread.webview.test.ts b/packages/extension/__tests__/browser/main.thread.webview.test.ts index be023d404b..baedd6a661 100644 --- a/packages/extension/__tests__/browser/main.thread.webview.test.ts +++ b/packages/extension/__tests__/browser/main.thread.webview.test.ts @@ -1,14 +1,5 @@ -import { - ExtHostWebviewViews, - ExtHostWebviewService, -} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.api.webview'; -import { - MainThreadWebview, - MainThreadWebviewView, -} from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.api.webview'; -import { mockService } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { ILoggerManagerClient } from '@opensumi/ide-logs'; +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { IOpenerService } from '@opensumi/ide-core-browser/lib/opener'; import { Emitter, makeRandomHexString, @@ -17,18 +8,28 @@ import { CancellationTokenSource, CommandRegistry, } from '@opensumi/ide-core-common'; -import { IWebviewService, IWebview } from '@opensumi/ide-webview'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { IExtHostWebview, ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '../../lib/common/vscode'; +import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/common'; import { WebviewViewShouldShowEvent } from '@opensumi/ide-extension/lib/browser/components/extension-webview-view'; -import { WebviewViewProvider, WebviewView } from '@opensumi/ide-extension/lib/common/vscode/webview'; +import { + MainThreadWebview, + MainThreadWebviewView, +} from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.api.webview'; import { IExtensionDescription, ExtensionIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/common'; -import { IIconService } from '@opensumi/ide-theme'; -import { StaticResourceService } from '@opensumi/ide-static-resource'; -import { IOpenerService } from '@opensumi/ide-core-browser/lib/opener'; +import { WebviewViewProvider, WebviewView } from '@opensumi/ide-extension/lib/common/vscode/webview'; +import { + ExtHostWebviewViews, + ExtHostWebviewService, +} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.api.webview'; +import { ILoggerManagerClient } from '@opensumi/ide-logs'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { StaticResourceService } from '@opensumi/ide-static-resource'; +import { IIconService } from '@opensumi/ide-theme'; +import { IWebviewService, IWebview } from '@opensumi/ide-webview'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { mockService } from '../../../../tools/dev-tool/src/mock-injector'; import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; +import { IExtHostWebview, ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '../../lib/common/vscode'; async function delay(ms: number) { return new Promise((resolve) => { diff --git a/packages/extension/__tests__/browser/main.thread.window.test.ts b/packages/extension/__tests__/browser/main.thread.window.test.ts index 1e2aa0905a..6f36ffbfd3 100644 --- a/packages/extension/__tests__/browser/main.thread.window.test.ts +++ b/packages/extension/__tests__/browser/main.thread.window.test.ts @@ -1,8 +1,10 @@ import { Emitter } from '@opensumi/ide-core-common'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { IWebviewService, IPlainWebviewWindow } from '@opensumi/ide-webview'; import { MainThreadIDEWindow } from '@opensumi/ide-extension/lib/browser/sumi/main.thread.window'; +import { IWebviewService, IPlainWebviewWindow } from '@opensumi/ide-webview'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; + const onMessageEmitter = new Emitter(); const onClosedEmitter = new Emitter(); diff --git a/packages/extension/__tests__/browser/main.thread.workspace.test.ts b/packages/extension/__tests__/browser/main.thread.workspace.test.ts index e8a96b8757..dd474a1e02 100644 --- a/packages/extension/__tests__/browser/main.thread.workspace.test.ts +++ b/packages/extension/__tests__/browser/main.thread.workspace.test.ts @@ -1,4 +1,20 @@ -import { ExtHostFileSystemInfo } from '../../src/hosted/api/vscode/ext.host.file-system-info'; +import fs from 'fs'; +import os from 'os'; +import path from 'path'; +import util from 'util'; + +import temp = require('temp'); +import vscode from 'vscode'; + +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { + PreferenceProviderProvider, + PreferenceProvider, + PreferenceService, + PreferenceServiceImpl, +} from '@opensumi/ide-core-browser'; +import { injectMockPreferences } from '@opensumi/ide-core-browser/__mocks__/preference'; +import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; import { Uri as vscodeUri, Emitter, @@ -14,48 +30,8 @@ import { IApplicationService, DisposableCollection, } from '@opensumi/ide-core-common'; -import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; -import path from 'path'; -import fs from 'fs'; -import os from 'os'; -import util from 'util'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MainThreadWorkspace } from '../../src/browser/vscode/api/main.thread.workspace'; -import { ExtHostWorkspace, createWorkspaceApiFactory } from '../../src/hosted/api/vscode/ext.host.workspace'; -import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { ExtHostMessage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.message'; -import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; -import { ExtHostPreference } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.preference'; -import { ExtHostFileSystem } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.file-system'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { IDocPersistentCacheProvider, ResourceService } from '@opensumi/ide-editor/lib/common'; -import { - FileServiceClient, - BrowserFileSystemRegistryImpl, -} from '@opensumi/ide-file-service/lib/browser/file-service-client'; -import { - FileServicePath, - FileStat, - FileType, - IBrowserFileSystemRegistry, - IDiskFileProvider, -} from '@opensumi/ide-file-service'; -import { FileService, FileSystemNodeOptions } from '@opensumi/ide-file-service/lib/node'; -import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; -import { ExtensionService } from '@opensumi/ide-extension'; -import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; -import { MonacoService } from '@opensumi/ide-monaco'; -import MonacoServiceImpl from '@opensumi/ide-monaco/lib/browser/monaco.service'; -import { MainThreadWebview } from '../../src/browser/vscode/api/main.thread.api.webview'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; -import { StaticResourceServiceImpl } from '@opensumi/ide-static-resource/lib/browser/static.service'; import { AppConfig } from '@opensumi/ide-core-node'; -import { MainThreadExtensionDocumentData } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.doc'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IEditorDocumentModelContentRegistry, IEditorDocumentModelService, @@ -64,37 +40,64 @@ import { EditorComponentRegistry, EditorPreferences, } from '@opensumi/ide-editor/lib/browser'; +import { EditorComponentRegistryImpl } from '@opensumi/ide-editor/lib/browser/component'; import { EditorDocumentModelContentRegistryImpl, EditorDocumentModelServiceImpl, } from '@opensumi/ide-editor/lib/browser/doc-model/main'; -import { FileSchemeDocumentProvider } from '@opensumi/ide-file-scheme/lib/browser/file-doc'; -import { MainThreadPreference } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.preference'; -import { - PreferenceProviderProvider, - PreferenceProvider, - PreferenceService, - PreferenceServiceImpl, -} from '@opensumi/ide-core-browser'; -import { injectMockPreferences } from '@opensumi/ide-core-browser/__mocks__/preference'; import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service'; -import { EditorComponentRegistryImpl } from '@opensumi/ide-editor/lib/browser/component'; +import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { IDocPersistentCacheProvider, ResourceService } from '@opensumi/ide-editor/lib/common'; +import { ExtensionService } from '@opensumi/ide-extension'; +import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; +import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service'; +import { MainThreadExtensionDocumentData } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.doc'; +import { MainThreadFileSystem } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.file-system'; +import { MainThreadPreference } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.preference'; +import { ExtHostAPIIdentifier, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; +import { Position, WorkspaceEdit } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; +import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; +import { ExtHostFileSystem } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.file-system'; +import { ExtHostFileSystemEvent } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.file-system-event'; +import { ExtHostMessage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.message'; +import { ExtHostPreference } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.preference'; import { ExtHostStorage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.storage'; -import { ExtHostTasks } from '@opensumi/ide-extension/lib/hosted/api/vscode/tasks/ext.host.tasks'; import { ExtHostTerminal } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.terminal'; -import { mockExtensions } from '../../__mocks__/extensions'; +import { ExtHostTasks } from '@opensumi/ide-extension/lib/hosted/api/vscode/tasks/ext.host.tasks'; +import { FileSchemeDocumentProvider } from '@opensumi/ide-file-scheme/lib/browser/file-doc'; +import { + FileServicePath, + FileStat, + FileType, + IBrowserFileSystemRegistry, + IDiskFileProvider, +} from '@opensumi/ide-file-service'; +import { + FileServiceClient, + BrowserFileSystemRegistryImpl, +} from '@opensumi/ide-file-service/lib/browser/file-service-client'; +import { FileService, FileSystemNodeOptions } from '@opensumi/ide-file-service/lib/node'; import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; -import { MainThreadFileSystem } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.file-system'; -import { ExtHostFileSystemEvent } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.file-system-event'; -import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; -import temp = require('temp'); +import { MonacoService } from '@opensumi/ide-monaco'; +import MonacoServiceImpl from '@opensumi/ide-monaco/lib/browser/monaco.service'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { StaticResourceServiceImpl } from '@opensumi/ide-static-resource/lib/browser/static.service'; import { IWebviewService } from '@opensumi/ide-webview'; -import vscode from 'vscode'; -import { Position, WorkspaceEdit } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { IWorkspaceEditService, IWorkspaceFileService } from '@opensumi/ide-workspace-edit'; import { WorkspaceEditServiceImpl } from '@opensumi/ide-workspace-edit/lib/browser/workspace-edit.service'; import { WorkspaceFileService } from '@opensumi/ide-workspace-edit/lib/browser/workspace-file.service'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector'; +import { mockExtensions } from '../../__mocks__/extensions'; +import { MockLoggerManagerClient } from '../../__mocks__/loggermanager'; import { MainThreadFileSystemEvent } from '../../lib/browser/vscode/api/main.thread.file-system-event'; +import { MainThreadWebview } from '../../src/browser/vscode/api/main.thread.api.webview'; +import { MainThreadWorkspace } from '../../src/browser/vscode/api/main.thread.workspace'; +import { ExtHostFileSystemInfo } from '../../src/hosted/api/vscode/ext.host.file-system-info'; +import { ExtHostWorkspace, createWorkspaceApiFactory } from '../../src/hosted/api/vscode/ext.host.workspace'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/browser/sumi-browser/index.test.ts b/packages/extension/__tests__/browser/sumi-browser/index.test.ts index 125555bb4e..1827edf72c 100644 --- a/packages/extension/__tests__/browser/sumi-browser/index.test.ts +++ b/packages/extension/__tests__/browser/sumi-browser/index.test.ts @@ -1,8 +1,9 @@ import { registerLocalizationBundle } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { MockInjector } from '@opensumi/ide-dev-tool/src/mock-injector'; -import { createBrowserApi } from '../../../src/browser/sumi-browser'; + import { mockExtension } from '../../../__mocks__/extensions'; +import { createBrowserApi } from '../../../src/browser/sumi-browser'; describe('activation event test', () => { let injector: MockInjector; diff --git a/packages/extension/__tests__/browser/vscode.contributes.test.ts b/packages/extension/__tests__/browser/vscode.contributes.test.ts index a4eba34e8c..22ffdcd69d 100644 --- a/packages/extension/__tests__/browser/vscode.contributes.test.ts +++ b/packages/extension/__tests__/browser/vscode.contributes.test.ts @@ -1,9 +1,9 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import os from 'os'; + import { Injector } from '@opensumi/di'; -import { VSCodeContributeRunner } from '../../src/browser/vscode/contributes'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; -import { mockExtensionProps } from '../../__mocks__/extensions'; +import { ISchemaStore, PreferenceService } from '@opensumi/ide-core-browser'; +import { MockLogger, MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { MonacoService } from '@opensumi/ide-core-browser/lib/monaco'; import { CommandRegistry, CommandService, @@ -14,22 +14,25 @@ import { ILoggerManagerClient, Uri, } from '@opensumi/ide-core-common'; +import { TextmateService } from '@opensumi/ide-editor/lib/browser/monaco-contrib/tokenizer/textmate.service'; +import { IExtensionStoragePathServer } from '@opensumi/ide-extension-storage'; import { ExtensionWillContributeEvent } from '@opensumi/ide-extension/lib/browser/types'; +import { ExtensionNodeServiceServerPath } from '@opensumi/ide-extension/lib/common'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { IJSONSchemaRegistry } from '@opensumi/ide-monaco'; +import { ITextmateTokenizer } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; import { SchemaRegistry, SchemaStore } from '@opensumi/ide-monaco/lib/browser/schema-registry'; -import { IExtensionStoragePathServer } from '@opensumi/ide-extension-storage'; -import { ISchemaStore, PreferenceService } from '@opensumi/ide-core-browser'; -import { MockPreferenceService } from '../../../terminal-next/__tests__/browser/mock.service'; -import { MockLogger, MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { ExtensionNodeServiceServerPath } from '@opensumi/ide-extension/lib/common'; -import { MockExtNodeClientService } from '../../__mocks__/extension.service.client'; import { IIconService, IThemeService } from '@opensumi/ide-theme'; import { IconService } from '@opensumi/ide-theme/lib/browser'; import { WorkbenchThemeService } from '@opensumi/ide-theme/lib/browser/workbench.theme.service'; -import { ITextmateTokenizer } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; -import { MonacoService } from '@opensumi/ide-core-browser/lib/monaco'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { MockPreferenceService } from '../../../terminal-next/__tests__/browser/mock.service'; +import { MockExtNodeClientService } from '../../__mocks__/extension.service.client'; +import { mockExtensionProps } from '../../__mocks__/extensions'; +import { VSCodeContributeRunner } from '../../src/browser/vscode/contributes'; + import { setupExtensionServiceInjector } from './extension-service/extension-service-mock-helper'; -import { TextmateService } from '@opensumi/ide-editor/lib/browser/monaco-contrib/tokenizer/textmate.service'; const extension = { ...mockExtensionProps, diff --git a/packages/extension/__tests__/common/activator.test.ts b/packages/extension/__tests__/common/activator.test.ts index e8acce7ab9..229fd99831 100644 --- a/packages/extension/__tests__/common/activator.test.ts +++ b/packages/extension/__tests__/common/activator.test.ts @@ -1,5 +1,5 @@ -import { ExtensionsActivator, ActivatedExtension } from '../../src/common/activator'; import { mockService } from '../../../../tools/dev-tool/src/mock-injector'; +import { ExtensionsActivator, ActivatedExtension } from '../../src/common/activator'; describe(__filename, () => { let extensionsActivator: ExtensionsActivator; diff --git a/packages/extension/__tests__/common/require-interceptor.test.ts b/packages/extension/__tests__/common/require-interceptor.test.ts index 91a23b871f..4e64cb8469 100644 --- a/packages/extension/__tests__/common/require-interceptor.test.ts +++ b/packages/extension/__tests__/common/require-interceptor.test.ts @@ -1,4 +1,5 @@ import React from 'react'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { IRequireInterceptorService, RequireInterceptorService } from '../../src/common/require-interceptor'; diff --git a/packages/extension/__tests__/hosted/api/sumi/ext.host.command.test.ts b/packages/extension/__tests__/hosted/api/sumi/ext.host.command.test.ts index 7cee09f33f..9f972bad51 100644 --- a/packages/extension/__tests__/hosted/api/sumi/ext.host.command.test.ts +++ b/packages/extension/__tests__/hosted/api/sumi/ext.host.command.test.ts @@ -1,7 +1,8 @@ -import { ExtHostCommands } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.command'; -import { createCommandsApiFactory } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.command'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { MainThreadAPIIdentifier, IMainThreadCommands } from '@opensumi/ide-extension/lib/common/vscode'; +import { createCommandsApiFactory } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.command'; +import { ExtHostCommands } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.command'; + import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; describe('extension/__tests__/hosted/api/sumi/ext.host.command.test.ts', () => { diff --git a/packages/extension/__tests__/hosted/api/sumi/ext.host.layout.test.ts b/packages/extension/__tests__/hosted/api/sumi/ext.host.layout.test.ts index a45b9d3f8e..ae21b33f26 100644 --- a/packages/extension/__tests__/hosted/api/sumi/ext.host.layout.test.ts +++ b/packages/extension/__tests__/hosted/api/sumi/ext.host.layout.test.ts @@ -1,11 +1,12 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { MainThreadSumiAPIIdentifier } from '../../../../src/common/sumi'; -import { createLayoutAPIFactory, ExtHostLayout } from '../../../../src/hosted/api/sumi/ext.host.layout'; + import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { mockExtensions } from '../../../../__mocks__/extensions'; import { MainThreadLayout } from '../../../../src/browser/sumi/main.thread.layout'; +import { MainThreadSumiAPIIdentifier } from '../../../../src/common/sumi'; import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; +import { createLayoutAPIFactory, ExtHostLayout } from '../../../../src/hosted/api/sumi/ext.host.layout'; import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; -import { mockExtensions } from '../../../../__mocks__/extensions'; const extension = mockExtensions[0]; diff --git a/packages/extension/__tests__/hosted/api/sumi/ext.host.toolbar.test.ts b/packages/extension/__tests__/hosted/api/sumi/ext.host.toolbar.test.ts index 22cd99bd79..51999dcce5 100644 --- a/packages/extension/__tests__/hosted/api/sumi/ext.host.toolbar.test.ts +++ b/packages/extension/__tests__/hosted/api/sumi/ext.host.toolbar.test.ts @@ -1,16 +1,17 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { Emitter } from '@opensumi/ide-core-common'; -import { ExtHostSumiAPIIdentifier, MainThreadSumiAPIIdentifier } from '../../../../src/common/sumi'; -import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; -import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; - +import { ExtHostCommon } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.common'; import { createToolbarAPIFactory, ExtHostToolbarActionService, } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.toolbar'; -import { ExtHostCommon } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.common'; + +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { mockExtensions } from '../../../../__mocks__/extensions'; +import { ExtHostSumiAPIIdentifier, MainThreadSumiAPIIdentifier } from '../../../../src/common/sumi'; +import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; +import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; + const actionMaps: Map = new Map(); diff --git a/packages/extension/__tests__/hosted/api/sumi/ext.host.window.test.ts b/packages/extension/__tests__/hosted/api/sumi/ext.host.window.test.ts index 4e9a7cdb4c..3beba0dad2 100644 --- a/packages/extension/__tests__/hosted/api/sumi/ext.host.window.test.ts +++ b/packages/extension/__tests__/hosted/api/sumi/ext.host.window.test.ts @@ -1,11 +1,13 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { IWindowInfo } from '@opensumi/ide-extension/lib/common/sumi/window'; +import { ExtHostIDEWindow, ExtIDEWebviewWindow } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.window'; +import { createWindowApiFactory } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.window'; + +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { MainThreadSumiAPIIdentifier } from '../../../../src/common/sumi'; import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; -import { ExtHostIDEWindow, ExtIDEWebviewWindow } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.window'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; -import { createWindowApiFactory } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.window'; -import { IWindowInfo } from '@opensumi/ide-extension/lib/common/sumi/window'; + const mockMainThreadIDEWindowProxy = { $createWebviewWindow: jest.fn(async () => { diff --git a/packages/extension/__tests__/hosted/api/vscode/__mock__/taskProvider.ts b/packages/extension/__tests__/hosted/api/vscode/__mock__/taskProvider.ts index 4bdeb3fccc..4e7efa1bea 100644 --- a/packages/extension/__tests__/hosted/api/vscode/__mock__/taskProvider.ts +++ b/packages/extension/__tests__/hosted/api/vscode/__mock__/taskProvider.ts @@ -1,5 +1,7 @@ import type { TaskProvider } from 'vscode'; + import { Emitter as EventEmitter, Event } from '@opensumi/ide-core-common'; + import * as extTypes from '../../../../../src/common/vscode/ext-types'; // Test case diff --git a/packages/extension/__tests__/hosted/api/vscode/editor/editor.host.test.ts b/packages/extension/__tests__/hosted/api/vscode/editor/editor.host.test.ts index 1e8e7cff0e..39d4ca2a6b 100644 --- a/packages/extension/__tests__/hosted/api/vscode/editor/editor.host.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/editor/editor.host.test.ts @@ -1,5 +1,6 @@ -import { TextEditorData } from '@opensumi/ide-extension/lib/hosted/api/vscode/editor/editor.host'; import { SnippetString, Position, Range } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; +import { TextEditorData } from '@opensumi/ide-extension/lib/hosted/api/vscode/editor/editor.host'; + import { mockService } from '../../../../../../../tools/dev-tool/src/mock-injector'; describe(__filename, () => { diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.authentication.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.authentication.test.ts index 3b88f26711..54ed0ad147 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.authentication.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.authentication.test.ts @@ -1,14 +1,9 @@ -import { - ExtHostAuthentication, - createAuthenticationApiFactory, -} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.authentication'; +import type vscode from 'vscode'; + +import { Injector } from '@opensumi/di'; import { RPCProtocol } from '@opensumi/ide-connection'; -import { - MainThreadAPIIdentifier, - IMainThreadAuthentication, - ExtHostAPIIdentifier, -} from '@opensumi/ide-extension/lib/common/vscode'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { IMenuRegistry, MenuId, IMenuItem } from '@opensumi/ide-core-browser/src/menu/next'; import { Emitter, ILoggerManagerClient, @@ -16,18 +11,25 @@ import { IAuthenticationService, CommandRegistry, } from '@opensumi/ide-core-common'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; -import type vscode from 'vscode'; -import { MainThreadAuthentication } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.authentication'; -import { Injector } from '@opensumi/di'; import { ActivationEventServiceImpl } from '@opensumi/ide-extension/lib/browser/activation.service'; import { IActivationEventService } from '@opensumi/ide-extension/lib/browser/types'; -import { MockLoggerManagerClient } from '../../../../__mocks__/loggermanager'; -import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; -import { IMenuRegistry, MenuId, IMenuItem } from '@opensumi/ide-core-browser/src/menu/next'; +import { MainThreadAuthentication } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.authentication'; +import { + MainThreadAPIIdentifier, + IMainThreadAuthentication, + ExtHostAPIIdentifier, +} from '@opensumi/ide-extension/lib/common/vscode'; +import { + ExtHostAuthentication, + createAuthenticationApiFactory, +} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.authentication'; import { IMessageService } from '@opensumi/ide-overlay'; import { QuickPickService } from '@opensumi/ide-quick-open'; +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { MockLoggerManagerClient } from '../../../../__mocks__/loggermanager'; + describe('extension/__tests__/hosted/api/vscode/ext.host.authentication.test.ts', () => { let injector: Injector; let authenticationAPI: typeof vscode.authentication; diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.command.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.command.test.ts index 7b84f02a8b..b39293d2b0 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.command.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.command.test.ts @@ -1,20 +1,23 @@ -import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; -import { - ExtHostCommands, - createCommandsApiFactory, -} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.command'; +import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IExtensionInfo, Uri } from '@opensumi/ide-core-common'; import { MainThreadAPIIdentifier, IMainThreadCommands, CommandHandler, } from '@opensumi/ide-extension/lib/common/vscode'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; -import { IExtensionInfo, Uri } from '@opensumi/ide-core-common'; -import * as modes from '@opensumi/ide-extension/lib/common/vscode/model.api'; import * as types from '@opensumi/ide-extension/lib/common/vscode/ext-types'; import { SymbolKind } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; -import type vscode from 'vscode'; +import * as modes from '@opensumi/ide-extension/lib/common/vscode/model.api'; +import { + ExtHostCommands, + createCommandsApiFactory, +} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.command'; +import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; + +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; + describe('extension/__tests__/hosted/api/vscode/ext.host.command.test.ts', () => { let vscodeCommand: typeof vscode.commands; diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.comments.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.comments.test.ts index bcc16759d7..357b11a92d 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.comments.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.comments.test.ts @@ -1,30 +1,32 @@ +import type vscode from 'vscode'; + import { Injector } from '@opensumi/di'; -import { - ExtHostComments, - createCommentsApiFactory, - ExtHostCommentThread, -} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.comments'; +import { ICommentsService, ICommentsFeatureRegistry, CommentReactionClick } from '@opensumi/ide-comments'; +import { CommentsFeatureRegistry } from '@opensumi/ide-comments/lib/browser/comments-feature.registry'; +import { CommentsService } from '@opensumi/ide-comments/lib/browser/comments.service'; import { RPCProtocol } from '@opensumi/ide-connection'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { Uri, Emitter, Disposable, IEventBus, URI } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { MainthreadComments } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.comments'; import { MainThreadAPIIdentifier, IMainThreadComments, ExtHostAPIIdentifier, } from '@opensumi/ide-extension/lib/common/vscode'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; -import { Uri, Emitter, Disposable, IEventBus, URI } from '@opensumi/ide-core-common'; import * as types from '@opensumi/ide-extension/lib/common/vscode/ext-types'; -import type vscode from 'vscode'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; -import { MainthreadComments } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.comments'; -import { ICommentsService, ICommentsFeatureRegistry, CommentReactionClick } from '@opensumi/ide-comments'; -import { CommentsService } from '@opensumi/ide-comments/lib/browser/comments.service'; -import { CommentsFeatureRegistry } from '@opensumi/ide-comments/lib/browser/comments-feature.registry'; +import { + ExtHostComments, + createCommentsApiFactory, + ExtHostCommentThread, +} from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.comments'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; + +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; import { MockContextKeyService } from '../../../../../monaco/__mocks__/monaco.context-key.service'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.custom-editor.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.custom-editor.test.ts index 11878d55a4..32df29fa22 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.custom-editor.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.custom-editor.test.ts @@ -1,12 +1,11 @@ +import { RPCProtocol } from '@opensumi/ide-connection'; import { Emitter, CancellationTokenSource, Uri } from '@opensumi/ide-core-common'; +import { URI } from '@opensumi/ide-core-common'; import { MainThreadAPIIdentifier, ExtHostAPIIdentifier, ExtensionDocumentDataManager, } from '@opensumi/ide-extension/lib/common/vscode'; -import { RPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostCustomEditorImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.custom-editor'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; import { IMainThreadCustomEditor, CustomTextEditorProvider, @@ -16,8 +15,11 @@ import { CustomDocumentEditEvent, CustomDocumentContentChangeEvent, } from '@opensumi/ide-extension/lib/common/vscode/custom-editor'; -import { URI } from '@opensumi/ide-core-common'; import { ExtHostWebviewService } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.api.webview'; +import { ExtHostCustomEditorImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.custom-editor'; + +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; + const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.debug.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.debug.test.ts index 8b8543b3c6..004b6ab57b 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.debug.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.debug.test.ts @@ -1,16 +1,19 @@ -import { ExtHostDebug, createDebugApiFactory } from '../../../../src/hosted/api/vscode/debug/ext.host.debug'; -import { ExtHostConnection } from '../../../../src/hosted/api/vscode/ext.host.connection'; +import path from 'path'; + import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; -import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { URI } from '@opensumi/ide-core-common'; -import path from 'path'; + +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; import { DebugAdapterServer, DebugAdapterExecutable, DebugAdapterInlineImplementation, } from '../../../../src/common/vscode/ext-types'; +import { ExtHostDebug, createDebugApiFactory } from '../../../../src/hosted/api/vscode/debug/ext.host.debug'; +import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; +import { ExtHostConnection } from '../../../../src/hosted/api/vscode/ext.host.connection'; + const mockMainThreadCommandProxy = { $executeCommand: jest.fn(() => new Promise(() => ({}))), diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.decoration.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.decoration.test.ts index ee1e20e969..d331f0b23a 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.decoration.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.decoration.test.ts @@ -1,3 +1,5 @@ +import type vscode from 'vscode'; + import { Event, Uri, @@ -7,7 +9,6 @@ import { CancellationTokenSource, CancellationToken, } from '@opensumi/ide-core-common'; -import type vscode from 'vscode'; import { ExtHostDecorations } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.decoration'; function URI2UriComponents(uri: URI): UriComponents { diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.env.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.env.test.ts index 8fe0c916c8..80b70bc61d 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.env.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.env.test.ts @@ -1,15 +1,17 @@ -import { ExtHostEnv, createEnvApiFactory } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.env'; -import { Emitter, ILoggerManagerClient, Uri, uuid } from '@opensumi/ide-core-common'; -import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; +import type vscode from 'vscode'; + import { RPCProtocol } from '@opensumi/ide-connection'; import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; +import { Emitter, ILoggerManagerClient, Uri, uuid } from '@opensumi/ide-core-common'; import { MainThreadEnv } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.env'; +import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; +import { UIKind } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; +import { ExtHostEnv, createEnvApiFactory } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.env'; + import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; import { MockLoggerManagerClient } from '../../../../__mocks__/loggermanager'; -import { UIKind } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; -import type vscode from 'vscode'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.extensions.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.extensions.test.ts index 333f5d6b63..f9954fcf26 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.extensions.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.extensions.test.ts @@ -1,13 +1,15 @@ import path from 'path'; + import { Injector } from '@opensumi/di'; import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { IExtensionProps, URI } from '@opensumi/ide-core-common'; + import { initMockRPCProtocol } from '../../../../__mocks__/initRPCProtocol'; +import { ExtensionMode } from '../../../../src/common/vscode/ext-types'; import { ExtensionContext } from '../../../../src/hosted/api/vscode/ext.host.extensions'; +import { ExtHostSecret } from '../../../../src/hosted/api/vscode/ext.host.secrets'; import { ExtHostStorage } from '../../../../src/hosted/api/vscode/ext.host.storage'; import { ExtensionWorkerHost } from '../../../../src/hosted/worker.host'; -import { ExtensionMode } from '../../../../src/common/vscode/ext-types'; -import { ExtHostSecret } from '../../../../src/hosted/api/vscode/ext.host.secrets'; const staticServicePath = 'http://localhost:9999'; diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.file-system.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.file-system.test.ts index 4774a59b5e..9e1da77ac2 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.file-system.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.file-system.test.ts @@ -1,9 +1,9 @@ import { URI } from '@opensumi/ide-core-common'; -import { FileChangeType, FileType, FileStat } from '@opensumi/ide-file-service/lib/common'; import { convertToVSCFileStat, ExtHostFileSystem, } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.file-system'; +import { FileChangeType, FileType, FileStat } from '@opensumi/ide-file-service/lib/common'; describe('convertToVSCFileStat', () => { it('Should return normal conversion to VSCode format results.', () => { diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.quickopen.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.quickopen.test.ts index 938e0090c8..4b3e47b502 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.quickopen.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.quickopen.test.ts @@ -1,13 +1,15 @@ -import { Emitter, Disposable } from '@opensumi/ide-core-common'; -import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; import { RPCProtocol } from '@opensumi/ide-connection'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; -import { ExtHostQuickOpen } from '../../../../src/hosted/api/vscode/ext.host.quickopen'; -import { MainThreadQuickOpen } from '../../../../src/browser/vscode/api/main.thread.quickopen'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { Emitter, Disposable } from '@opensumi/ide-core-common'; import { QuickPickService } from '@opensumi/ide-quick-open'; import { QuickTitleBar } from '@opensumi/ide-quick-open/lib/browser/quick-title-bar'; +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { MainThreadQuickOpen } from '../../../../src/browser/vscode/api/main.thread.quickopen'; +import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; +import { ExtHostQuickOpen } from '../../../../src/hosted/api/vscode/ext.host.quickopen'; + + const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.secret.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.secret.test.ts index 9f54a02317..dbdac44dfd 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.secret.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.secret.test.ts @@ -1,6 +1,7 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; + import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; import { ExtHostSecret } from '../../../../src/hosted/api/vscode/ext.host.secrets'; const moackMainThreadSecret = { diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.statusbar.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.statusbar.test.ts index 2c9cbf79f2..333a63e20f 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.statusbar.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.statusbar.test.ts @@ -1,17 +1,18 @@ -import { ExtHostStatusBar } from '../../../../src/hosted/api/vscode/ext.host.statusbar'; -import { Emitter, ILoggerManagerClient, uuid } from '@opensumi/ide-core-common'; -import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; import { RPCProtocol } from '@opensumi/ide-connection'; import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; -import { MainThreadStatusBar } from '../../../../src/browser/vscode/api/main.thread.statusbar'; +import { IContextKeyService, IStatusBarService } from '@opensumi/ide-core-browser'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { Emitter, ILoggerManagerClient, uuid } from '@opensumi/ide-core-common'; +import { StatusBarService } from '@opensumi/ide-status-bar/lib/browser/status-bar.service'; + import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { mockExtensionDescription } from '../../../../__mocks__/extensions'; import { MockLoggerManagerClient } from '../../../../__mocks__/loggermanager'; -import { IContextKeyService, IStatusBarService } from '@opensumi/ide-core-browser'; -import { StatusBarService } from '@opensumi/ide-status-bar/lib/browser/status-bar.service'; +import { MainThreadStatusBar } from '../../../../src/browser/vscode/api/main.thread.statusbar'; +import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; import { ThemeColor } from '../../../../src/common/vscode/ext-types'; -import { mockExtensionDescription } from '../../../../__mocks__/extensions'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { ExtHostStatusBar } from '../../../../src/hosted/api/vscode/ext.host.statusbar'; const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.storage.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.storage.test.ts index bc6360e2fe..f046a46b45 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.storage.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.storage.test.ts @@ -1,12 +1,14 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; -import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; +import { URI, StoragePaths } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { MainThreadAPIIdentifier } from '../../../../src/common/vscode'; import { ExtensionGlobalMemento, ExtensionMemento, ExtHostStorage, } from '../../../../src/hosted/api/vscode/ext.host.storage'; -import { URI, StoragePaths } from '@opensumi/ide-core-common'; + const cache = { shared: {}, diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.task.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.task.test.ts index 7d030d8053..a93c56ded2 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.task.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.task.test.ts @@ -1,4 +1,8 @@ import path from 'path'; + +import { RPCProtocol } from '@opensumi/ide-connection'; +import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; import { Emitter as EventEmitter, Disposable, @@ -7,7 +11,17 @@ import { Uri, IFileServiceClient, } from '@opensumi/ide-core-common'; -import { RPCProtocol } from '@opensumi/ide-connection'; +import { ITaskDefinitionRegistry, TaskDefinitionRegistryImpl } from '@opensumi/ide-core-common/lib/task-definition'; +import { IEditorDocumentModelService, WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; +import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; +import { ExtHostMessage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.message'; +import { ExtHostWorkspace } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.workspace'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; +import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common/main-layout.defination'; +import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; +import { TaskService } from '@opensumi/ide-task/lib/browser/task.service'; +import { TerminalTaskSystem } from '@opensumi/ide-task/lib/browser/terminal-task-system'; +import { ITaskService, ITaskSystem } from '@opensumi/ide-task/lib/common'; import { ITerminalApiService, ITerminalClientFactory, @@ -18,43 +32,34 @@ import { ITerminalService, ITerminalTheme, } from '@opensumi/ide-terminal-next'; +import { TerminalClientFactory } from '@opensumi/ide-terminal-next/lib/browser/terminal.client'; +import { TerminalController } from '@opensumi/ide-terminal-next/lib/browser/terminal.controller'; +import { TerminalInternalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.internal.service'; +import { TerminalPreference } from '@opensumi/ide-terminal-next/lib/browser/terminal.preference'; +import { TerminalProfileService } from '@opensumi/ide-terminal-next/lib/browser/terminal.profile'; +import { TerminalGroupViewService } from '@opensumi/ide-terminal-next/lib/browser/terminal.view'; +import { ITerminalPreference } from '@opensumi/ide-terminal-next/lib/common/preference'; +import { IVariableResolverService } from '@opensumi/ide-variable'; +import { VariableResolverService } from '@opensumi/ide-variable/lib/browser/variable-resolver.service'; +import { IWorkspaceService } from '@opensumi/ide-workspace/lib/common/workspace-defination'; + import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; -import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; -import { ExtHostTerminal } from '../../../../src/hosted/api/vscode/ext.host.terminal'; -import { MainThreadTerminal } from '../../../../src/browser/vscode/api/main.thread.terminal'; import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; -import { ExtHostTasks } from '../../../../src/hosted/api/vscode/tasks/ext.host.tasks'; -import { MainthreadTasks } from '../../../../src/browser/vscode/api/main.thread.tasks'; -import { ExtensionDocumentDataManagerImpl } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc'; -import { ExtHostMessage } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.message'; -import { ExtHostWorkspace } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.workspace'; -import { mockExtensionProps } from '../../../../__mocks__/extensions'; -import { ITaskService, ITaskSystem } from '@opensumi/ide-task/lib/common'; -import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { IWorkspaceService } from '@opensumi/ide-workspace/lib/common/workspace-defination'; -import { TaskService } from '@opensumi/ide-task/lib/browser/task.service'; -import { IEditorDocumentModelService, WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser'; -import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common/main-layout.defination'; import { MockMainLayoutService, MockSocketService, MockTerminalThemeService, } from '../../../../../terminal-next/__tests__/browser/mock.service'; -import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; -import { TerminalTaskSystem } from '@opensumi/ide-task/lib/browser/terminal-task-system'; -import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; -import { ITaskDefinitionRegistry, TaskDefinitionRegistryImpl } from '@opensumi/ide-core-common/lib/task-definition'; -import { IVariableResolverService } from '@opensumi/ide-variable'; -import { VariableResolverService } from '@opensumi/ide-variable/lib/browser/variable-resolver.service'; -import { TerminalGroupViewService } from '@opensumi/ide-terminal-next/lib/browser/terminal.view'; -import { TerminalClientFactory } from '@opensumi/ide-terminal-next/lib/browser/terminal.client'; -import { TerminalController } from '@opensumi/ide-terminal-next/lib/browser/terminal.controller'; -import { TerminalInternalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.internal.service'; -import { TerminalPreference } from '@opensumi/ide-terminal-next/lib/browser/terminal.preference'; -import { ITerminalPreference } from '@opensumi/ide-terminal-next/lib/common/preference'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks'; +import { mockExtensionProps } from '../../../../__mocks__/extensions'; +import { MainthreadTasks } from '../../../../src/browser/vscode/api/main.thread.tasks'; +import { MainThreadTerminal } from '../../../../src/browser/vscode/api/main.thread.terminal'; +import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; +import { ExtHostTerminal } from '../../../../src/hosted/api/vscode/ext.host.terminal'; +import { ExtHostTasks } from '../../../../src/hosted/api/vscode/tasks/ext.host.tasks'; + + import { CustomBuildTaskProvider } from './__mock__/taskProvider'; -import { TerminalProfileService } from '@opensumi/ide-terminal-next/lib/browser/terminal.profile'; + const extension = mockExtensionProps; diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.terminal.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.terminal.test.ts index 71ca3aceb8..92755d25b1 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.terminal.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.terminal.test.ts @@ -1,5 +1,8 @@ -import { Emitter, Disposable, ILogger } from '@opensumi/ide-core-common'; import { RPCProtocol } from '@opensumi/ide-connection'; +import { PreferenceService } from '@opensumi/ide-core-browser'; +import { Emitter, Disposable, ILogger } from '@opensumi/ide-core-common'; +import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; +import { IExtension } from '@opensumi/ide-extension'; import { ITerminalApiService, ITerminalController, @@ -8,26 +11,25 @@ import { ITerminalService, ITerminalServicePath, } from '@opensumi/ide-terminal-next'; +import { TerminalProfileService } from '@opensumi/ide-terminal-next/lib/browser/terminal.profile'; +import { TerminalProfileInternalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.profile.internal'; +import { NodePtyTerminalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.service'; +import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; + import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; +import { + MockProfileService, + MockTerminalProfileInternalService, +} from '../../../../../terminal-next/__tests__/browser/mock.service'; +import { MainThreadTerminal } from '../../../../src/browser/vscode/api/main.thread.terminal'; import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '../../../../src/common/vscode'; import { EnvironmentVariableCollection, ExtHostTerminal, Terminal, } from '../../../../src/hosted/api/vscode/ext.host.terminal'; -import { MainThreadTerminal } from '../../../../src/browser/vscode/api/main.thread.terminal'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; -import { IExtension } from '@opensumi/ide-extension'; -import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; -import { TerminalProfileService } from '@opensumi/ide-terminal-next/lib/browser/terminal.profile'; -import { NodePtyTerminalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.service'; -import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; -import { PreferenceService } from '@opensumi/ide-core-browser'; -import { TerminalProfileInternalService } from '@opensumi/ide-terminal-next/lib/browser/terminal.profile.internal'; -import { - MockProfileService, - MockTerminalProfileInternalService, -} from '../../../../../terminal-next/__tests__/browser/mock.service'; + const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.test.ts index 0bc5191d0f..39ea936843 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.test.ts @@ -1,15 +1,16 @@ -import { Deferred, IReporter } from '@opensumi/ide-core-common'; import { Injector } from '@opensumi/di'; -import ExtensionHostServiceImpl from '../../../../src/hosted/ext.host'; +import { Deferred, IReporter } from '@opensumi/ide-core-common'; +import { REPORT_NAME } from '@opensumi/ide-core-common'; +import { AppConfig, DefaultReporter } from '@opensumi/ide-core-node'; -import { mockExtensionProps, mockExtensionProps2 } from '../../../../__mocks__/extensions'; -import { initMockRPCProtocol } from '../../../../__mocks__/initRPCProtocol'; +import { MainThreadExtensionLog } from '../../../../__mocks__/api/mainthread.extension.log'; import { MainThreadExtensionService } from '../../../../__mocks__/api/mainthread.extension.service'; import { MainThreadStorage } from '../../../../__mocks__/api/mathread.storage'; -import { MainThreadExtensionLog } from '../../../../__mocks__/api/mainthread.extension.log'; +import { mockExtensionProps, mockExtensionProps2 } from '../../../../__mocks__/extensions'; +import { initMockRPCProtocol } from '../../../../__mocks__/initRPCProtocol'; import { MockLoggerManagerClient } from '../../../../__mocks__/loggermanager'; -import { AppConfig, DefaultReporter } from '@opensumi/ide-core-node'; -import { REPORT_NAME } from '@opensumi/ide-core-common'; +import ExtensionHostServiceImpl from '../../../../src/hosted/ext.host'; + const enum MessageType { Request = 1, diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.theming.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.theming.test.ts index 0222835486..c49cef68d1 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.theming.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.theming.test.ts @@ -1,11 +1,13 @@ +import { RPCProtocol } from '@opensumi/ide-connection'; import { Emitter } from '@opensumi/ide-core-common'; +import { MainThreadTheming } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.theming'; import { MainThreadAPIIdentifier, ExtHostAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; -import { RPCProtocol } from '@opensumi/ide-connection'; +import { ColorThemeKind } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; import { ExtHostTheming } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.theming'; -import { MainThreadTheming } from '@opensumi/ide-extension/lib/browser/vscode/api/main.thread.theming'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { IThemeService, ThemeType } from '@opensumi/ide-theme'; -import { ColorThemeKind } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; + +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; + const emitterA = new Emitter(); const emitterB = new Emitter(); diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.treeview.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.treeview.test.ts index 89a0bec796..82b32a02c7 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.treeview.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.treeview.test.ts @@ -1,9 +1,11 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { Emitter, Disposable, CancellationTokenSource } from '@opensumi/ide-core-common'; +import { ExtHostTreeViews } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.treeview'; + +import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; import { MainThreadAPIIdentifier, TreeView } from '../../../../src/common/vscode'; import { ExtHostCommands } from '../../../../src/hosted/api/vscode/ext.host.command'; -import { createBrowserInjector } from '../../../../../../tools/dev-tool/src/injector-helper'; -import { ExtHostTreeViews } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.treeview'; -import { Emitter, Disposable, CancellationTokenSource } from '@opensumi/ide-core-common'; + const moackManThreadTreeView = { $registerTreeDataProvider: jest.fn(), diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.urls.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.urls.test.ts index 408e11b6f6..d5b1aa803e 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.urls.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.urls.test.ts @@ -1,7 +1,8 @@ -import { Uri } from '@opensumi/ide-core-common'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Uri } from '@opensumi/ide-core-common'; import { IMainThreadUrls, MainThreadAPIIdentifier } from '@opensumi/ide-extension/lib/common/vscode'; + +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; import { ExtHostUrls } from '../../../../src/hosted/api/vscode/ext.host.urls'; describe('extension/__tests__/hosted/api/vscode/ext.host.urls.test.ts', () => { diff --git a/packages/extension/__tests__/hosted/api/vscode/ext.host.webview.test.ts b/packages/extension/__tests__/hosted/api/vscode/ext.host.webview.test.ts index e82ebd1f1b..bcbbab1681 100644 --- a/packages/extension/__tests__/hosted/api/vscode/ext.host.webview.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/ext.host.webview.test.ts @@ -1,8 +1,9 @@ import { Uri, IExtensionInfo } from '@opensumi/ide-core-common'; -import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; import { MainThreadAPIIdentifier, IMainThreadWebview } from '@opensumi/ide-extension/lib/common/vscode'; -import { ExtHostWebviewService } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.api.webview'; import { ExtHostWebview } from '@opensumi/ide-extension/lib/hosted/api/sumi/ext.host.webview'; +import { ExtHostWebviewService } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.api.webview'; + +import { mockService } from '../../../../../../tools/dev-tool/src/mock-injector'; describe('vscode extHostWebview Test', () => { const map = new Map(); const rpcProtocol = { diff --git a/packages/extension/__tests__/hosted/api/vscode/language/rang-formatting.test.ts b/packages/extension/__tests__/hosted/api/vscode/language/rang-formatting.test.ts index d2d80b2e0e..3ebdfa64c6 100644 --- a/packages/extension/__tests__/hosted/api/vscode/language/rang-formatting.test.ts +++ b/packages/extension/__tests__/hosted/api/vscode/language/rang-formatting.test.ts @@ -1,6 +1,7 @@ +import { join } from 'path'; + import { createPatch, applyPatch } from 'diff'; import { readFile } from 'fs-extra'; -import { join } from 'path'; describe('range-formatting', () => { it('applyPatch', async () => { diff --git a/packages/extension/__tests__/hosted/ext.host.proxy.test.ts b/packages/extension/__tests__/hosted/ext.host.proxy.test.ts index aa4804d8d1..dd8d3eb4a6 100644 --- a/packages/extension/__tests__/hosted/ext.host.proxy.test.ts +++ b/packages/extension/__tests__/hosted/ext.host.proxy.test.ts @@ -1,12 +1,15 @@ +import path from 'path'; + +import { INodeLogger, Event, getDebugLogger } from '@opensumi/ide-core-node'; + +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; import { IExtHostProxy, IExtensionHostManager } from '../../src/common'; import { ExtHostProxy } from '../../src/hosted/ext.host.proxy-base'; import { ExtensionHostProxyManager } from '../../src/node/extension.host.proxy.manager'; -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { INodeLogger, Event, getDebugLogger } from '@opensumi/ide-core-node'; + // re-install RAL in `@opensumi/vscode-jsonrpc` import '@opensumi/vscode-jsonrpc/lib/node/main'; -import path from 'path'; const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/extension/__tests__/hosted/vscode.extension.test.ts b/packages/extension/__tests__/hosted/vscode.extension.test.ts index 8ae072fe7b..36643bf3ea 100644 --- a/packages/extension/__tests__/hosted/vscode.extension.test.ts +++ b/packages/extension/__tests__/hosted/vscode.extension.test.ts @@ -1,4 +1,5 @@ import { KTExtension } from '@opensumi/ide-extension/lib/hosted/vscode.extension'; + import { mockService } from '../../../../tools/dev-tool/src/mock-injector'; describe('extension/__tests__/hosted/vscode.extension.test.ts', () => { diff --git a/packages/extension/__tests__/hosted/worker.host.test.ts b/packages/extension/__tests__/hosted/worker.host.test.ts index dfe4b02ae2..fc6bd0fbc2 100644 --- a/packages/extension/__tests__/hosted/worker.host.test.ts +++ b/packages/extension/__tests__/hosted/worker.host.test.ts @@ -1,14 +1,15 @@ import { Injector } from '@opensumi/di'; -import { Deferred, DefaultReporter, IReporter } from '@opensumi/ide-core-common'; -import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { ProxyIdentifier } from '@opensumi/ide-connection'; -import { ExtensionWorkerHost } from '../../src/hosted/worker.host'; -import { mockExtensionProps, mockExtensionProps2 } from '../../__mocks__/extensions'; -import { initMockRPCProtocol } from '../../__mocks__/initRPCProtocol'; +import { RPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; +import { Deferred, DefaultReporter, IReporter } from '@opensumi/ide-core-common'; + +import { MainThreadExtensionLog } from '../../__mocks__/api/mainthread.extension.log'; import { MainThreadExtensionService } from '../../__mocks__/api/mainthread.extension.service'; import { MainThreadStorage } from '../../__mocks__/api/mathread.storage'; -import { MainThreadExtensionLog } from '../../__mocks__/api/mainthread.extension.log'; +import { mockExtensionProps, mockExtensionProps2 } from '../../__mocks__/extensions'; +import { initMockRPCProtocol } from '../../__mocks__/initRPCProtocol'; import { MockWorker, MessagePort, MessageChannel, mockFetch } from '../../__mocks__/worker'; +import { ExtensionWorkerHost } from '../../src/hosted/worker.host'; const enum MessageType { Request = 1, diff --git a/packages/extension/__tests__/node/extension.host.manager.common-tester.ts b/packages/extension/__tests__/node/extension.host.manager.common-tester.ts index 95eee1a351..66ea4aeb02 100644 --- a/packages/extension/__tests__/node/extension.host.manager.common-tester.ts +++ b/packages/extension/__tests__/node/extension.host.manager.common-tester.ts @@ -1,9 +1,12 @@ +import path from 'path'; + import { Provider } from '@opensumi/di'; -import { IExtensionHostManager } from '../../src'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { INodeLogger, MaybePromise, getDebugLogger } from '@opensumi/ide-core-node'; -import path from 'path'; + +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { IExtensionHostManager } from '../../src'; + const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/extension/__tests__/node/extension.host.manager.test.ts b/packages/extension/__tests__/node/extension.host.manager.test.ts index 7db5394df3..da871a8170 100644 --- a/packages/extension/__tests__/node/extension.host.manager.test.ts +++ b/packages/extension/__tests__/node/extension.host.manager.test.ts @@ -1,7 +1,8 @@ -import { extensionHostManagerTester } from './extension.host.manager.common-tester'; import { IExtensionHostManager } from '../../src'; import { ExtensionHostManager } from '../../src/node/extension.host.manager'; +import { extensionHostManagerTester } from './extension.host.manager.common-tester'; + extensionHostManagerTester({ providers: [ { diff --git a/packages/extension/__tests__/node/extension.host.proxy.manager.test.ts b/packages/extension/__tests__/node/extension.host.proxy.manager.test.ts index 79b76639f3..249fcbbd68 100644 --- a/packages/extension/__tests__/node/extension.host.proxy.manager.test.ts +++ b/packages/extension/__tests__/node/extension.host.proxy.manager.test.ts @@ -1,8 +1,10 @@ +import { Event } from '@opensumi/ide-core-common'; + import { IExtensionHostManager } from '../../src'; -import { ExtensionHostProxyManager } from '../../src/node/extension.host.proxy.manager'; import { ExtHostProxy } from '../../src/hosted/ext.host.proxy-base'; +import { ExtensionHostProxyManager } from '../../src/node/extension.host.proxy.manager'; + import { extensionHostManagerTester } from './extension.host.manager.common-tester'; -import { Event } from '@opensumi/ide-core-common'; const PROXY_PORT = 10297; let extHostProxy: ExtHostProxy; diff --git a/packages/extension/__tests__/node/extension.service.client.test.ts b/packages/extension/__tests__/node/extension.service.client.test.ts index 5c08c023f9..ccec4e3d19 100644 --- a/packages/extension/__tests__/node/extension.service.client.test.ts +++ b/packages/extension/__tests__/node/extension.service.client.test.ts @@ -1,18 +1,20 @@ +import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; -import os from 'os'; + import { Injector } from '@opensumi/di'; import { AppConfig, INodeLogger, getDebugLogger } from '@opensumi/ide-core-node'; - -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { IExtensionNodeClientService, IExtensionNodeService } from '../../src/common'; -import { ExtensionServiceClientImpl } from '../../src/node/extension.service.client'; -import { ExtensionNodeServiceImpl } from '../../src/node/extension.service'; import { IExtensionStoragePathServer } from '@opensumi/ide-extension-storage/lib/common'; import { IFileService, IDiskFileProvider } from '@opensumi/ide-file-service/lib/common'; import { FileSystemNodeOptions, FileService } from '@opensumi/ide-file-service/lib/node'; import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { IExtensionNodeClientService, IExtensionNodeService } from '../../src/common'; +import { ExtensionNodeServiceImpl } from '../../src/node/extension.service'; +import { ExtensionServiceClientImpl } from '../../src/node/extension.service.client'; + describe('Extension Client Serivce', () => { let injector: Injector; let extensionNodeClient: IExtensionNodeClientService; diff --git a/packages/extension/__tests__/node/extension.service.test.ts b/packages/extension/__tests__/node/extension.service.test.ts index e83682baad..28482b7934 100644 --- a/packages/extension/__tests__/node/extension.service.test.ts +++ b/packages/extension/__tests__/node/extension.service.test.ts @@ -1,16 +1,19 @@ +import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; -import os from 'os'; + import { Injector } from '@opensumi/di'; import { AppConfig, INodeLogger, IReporterService, getDebugLogger } from '@opensumi/ide-core-node'; +import { ActivationEventServiceImpl } from '@opensumi/ide-extension/lib/browser/activation.service'; +import { IActivationEventService } from '@opensumi/ide-extension/lib/browser/types'; -import { ExtensionNodeServiceImpl } from '../../src/node/extension.service'; import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { IExtensionNodeService, IExtensionNodeClientService, IExtensionHostManager } from '../../src/common'; -import { ExtensionServiceClientImpl } from '../../src/node/extension.service.client'; import { ExtensionHostManager } from '../../src/node/extension.host.manager'; -import { IActivationEventService } from '@opensumi/ide-extension/lib/browser/types'; -import { ActivationEventServiceImpl } from '@opensumi/ide-extension/lib/browser/activation.service'; +import { ExtensionNodeServiceImpl } from '../../src/node/extension.service'; +import { ExtensionServiceClientImpl } from '../../src/node/extension.service.client'; + describe('Extension Serivce', () => { let injector: Injector; diff --git a/packages/extension/src/browser/activation.service.ts b/packages/extension/src/browser/activation.service.ts index 67aa056459..a547ec9463 100644 --- a/packages/extension/src/browser/activation.service.ts +++ b/packages/extension/src/browser/activation.service.ts @@ -1,7 +1,8 @@ +import pm from 'picomatch'; + import { Injectable } from '@opensumi/di'; -import { IDisposable } from '@opensumi/ide-core-common/lib/disposable'; import { MaybePromise } from '@opensumi/ide-core-common'; -import pm from 'picomatch'; +import { IDisposable } from '@opensumi/ide-core-common/lib/disposable'; import { IActivationEventService } from './types'; diff --git a/packages/extension/src/browser/components/extension-loading-view.tsx b/packages/extension/src/browser/components/extension-loading-view.tsx index a5b7a99339..a16f75bf7e 100644 --- a/packages/extension/src/browser/components/extension-loading-view.tsx +++ b/packages/extension/src/browser/components/extension-loading-view.tsx @@ -1,6 +1,8 @@ import React from 'react'; -import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; + import { formatLocalize } from '@opensumi/ide-core-browser'; +import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; + import styles from './extension-tree-view.module.less'; export const ExtensionLoadingView = ({ style }: { style?: React.CSSProperties }) => ( diff --git a/packages/extension/src/browser/components/extension-portal-root.tsx b/packages/extension/src/browser/components/extension-portal-root.tsx index ec94fc2a0c..e7a46fd440 100644 --- a/packages/extension/src/browser/components/extension-portal-root.tsx +++ b/packages/extension/src/browser/components/extension-portal-root.tsx @@ -1,8 +1,10 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; + +import { DisposableCollection } from '@opensumi/ide-components/lib/utils/disposable'; import { useInjectable } from '@opensumi/ide-core-browser'; import { getThemeTypeSelector, IThemeService, ThemeType } from '@opensumi/ide-theme/lib/common'; -import { DisposableCollection } from '@opensumi/ide-components/lib/utils/disposable'; + import { AbstractViewExtProcessService } from '../../common/extension.service'; interface IPortalRootProps { diff --git a/packages/extension/src/browser/components/extension-tree-view-node.tsx b/packages/extension/src/browser/components/extension-tree-view-node.tsx index 46423be7d0..945f49e953 100644 --- a/packages/extension/src/browser/components/extension-tree-view-node.tsx +++ b/packages/extension/src/browser/components/extension-tree-view-node.tsx @@ -1,13 +1,16 @@ -import React from 'react'; import cls from 'classnames'; -import styles from '../vscode/api/tree-view/tree-view-node.module.less'; +import React from 'react'; + + import { INodeRendererProps, ClasslistComposite, PromptHandle, TreeNodeType } from '@opensumi/ide-components'; -import { getIcon } from '@opensumi/ide-core-browser'; import { Loading } from '@opensumi/ide-components'; -import { ExtensionTreeNode, ExtensionCompositeTreeNode } from '../vscode/api/tree-view/tree-view.node.defined'; +import { getIcon } from '@opensumi/ide-core-browser'; import { TitleActionList } from '@opensumi/ide-core-browser/lib/components/actions'; import { MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import styles from '../vscode/api/tree-view/tree-view-node.module.less'; +import { ExtensionTreeNode, ExtensionCompositeTreeNode } from '../vscode/api/tree-view/tree-view.node.defined'; + export interface ITreeViewNodeProps { item: ExtensionTreeNode | ExtensionCompositeTreeNode; treeViewId: string; diff --git a/packages/extension/src/browser/components/extension-tree-view.tsx b/packages/extension/src/browser/components/extension-tree-view.tsx index 74a2f7d9c4..a736905bce 100644 --- a/packages/extension/src/browser/components/extension-tree-view.tsx +++ b/packages/extension/src/browser/components/extension-tree-view.tsx @@ -1,18 +1,20 @@ +import { observer } from 'mobx-react-lite'; import React from 'react'; -import styles from './extension-tree-view.module.less'; -import { isOSX, useInjectable } from '@opensumi/ide-core-browser'; + import { Injector } from '@opensumi/di'; -import { observer } from 'mobx-react-lite'; +import { RecycleTree, INodeRendererProps, IRecycleTreeHandle, TreeNodeType } from '@opensumi/ide-components'; import { ViewState } from '@opensumi/ide-core-browser'; +import { isOSX, useInjectable } from '@opensumi/ide-core-browser'; +import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; +import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common/main-layout.defination'; +import { TreeViewDataProvider } from '../vscode/api/main.thread.treeview'; import { ExtensionTreeViewModel } from '../vscode/api/tree-view/tree-view.model.service'; -import { RecycleTree, INodeRendererProps, IRecycleTreeHandle, TreeNodeType } from '@opensumi/ide-components'; -import { TREE_VIEW_NODE_HEIGHT, TreeViewNode } from './extension-tree-view-node'; import { ExtensionCompositeTreeNode, ExtensionTreeNode } from '../vscode/api/tree-view/tree-view.node.defined'; -import { TreeViewDataProvider } from '../vscode/api/main.thread.treeview'; -import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; -import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common/main-layout.defination'; + +import { TREE_VIEW_NODE_HEIGHT, TreeViewNode } from './extension-tree-view-node'; +import styles from './extension-tree-view.module.less'; export interface ExtensionTabBarTreeViewProps { injector: Injector; diff --git a/packages/extension/src/browser/components/extension-webview-view.tsx b/packages/extension/src/browser/components/extension-webview-view.tsx index 8b0954cb1f..1963e4b5ba 100644 --- a/packages/extension/src/browser/components/extension-webview-view.tsx +++ b/packages/extension/src/browser/components/extension-webview-view.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { BasicEvent, CancellationToken, @@ -6,7 +8,7 @@ import { CancellationTokenSource, Disposable, } from '@opensumi/ide-core-browser'; -import React from 'react'; + import { ExtensionService } from '../../common'; export class WebviewViewShouldShowEvent extends BasicEvent<{ diff --git a/packages/extension/src/browser/extension-instance-management.ts b/packages/extension/src/browser/extension-instance-management.ts index 1766323080..73a99e4826 100644 --- a/packages/extension/src/browser/extension-instance-management.ts +++ b/packages/extension/src/browser/extension-instance-management.ts @@ -14,6 +14,7 @@ import { IExtensionMetaData, IExtensionNodeClientService, } from '../common'; + import { Extension } from './extension'; import { AbstractExtInstanceManagementService } from './types'; diff --git a/packages/extension/src/browser/extension-management.service.ts b/packages/extension/src/browser/extension-management.service.ts index f7b3d56503..c5fde57cfb 100644 --- a/packages/extension/src/browser/extension-management.service.ts +++ b/packages/extension/src/browser/extension-management.service.ts @@ -10,6 +10,7 @@ import { IExtensionProps, IExtraMetaData, } from '../common'; + import { Extension } from './extension'; import { AbstractExtInstanceManagementService, ExtensionDidEnabledEvent, ExtensionDidUninstalledEvent } from './types'; diff --git a/packages/extension/src/browser/extension-node.service.ts b/packages/extension/src/browser/extension-node.service.ts index c9139142f8..cff7c45e4a 100644 --- a/packages/extension/src/browser/extension-node.service.ts +++ b/packages/extension/src/browser/extension-node.service.ts @@ -27,6 +27,7 @@ import { import { ActivatedExtensionJSON } from '../common/activator'; import { AbstractNodeExtProcessService } from '../common/extension.service'; import { ExtHostAPIIdentifier } from '../common/vscode'; + import { createSumiApiFactory } from './sumi/main.thread.api.impl'; import { createApiFactory as createVSCodeAPIFactory } from './vscode/api/main.thread.api.impl'; diff --git a/packages/extension/src/browser/extension-view.service.ts b/packages/extension/src/browser/extension-view.service.ts index 7e5942d577..40b4c4beb0 100644 --- a/packages/extension/src/browser/extension-view.service.ts +++ b/packages/extension/src/browser/extension-view.service.ts @@ -1,14 +1,7 @@ -import { warning } from '@opensumi/ide-components/lib/utils/warning'; import { Autowired, Injectable, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { warning } from '@opensumi/ide-components/lib/utils/warning'; import { IRPCProtocol, ProxyIdentifier } from '@opensumi/ide-connection'; -import { - EXTENSION_EXTEND_SERVICE_PREFIX, - IBrowserRequireInterceptorArgs, - IExtension, - IRequireInterceptorService, - MOCK_EXTENSION_EXTEND_PROXY_IDENTIFIER, - RequireInterceptorContribution, -} from '../common'; +import { AppConfig, IToolbarPopoverRegistry } from '@opensumi/ide-core-browser'; import { ContributionProvider, IExtensionProps, @@ -19,24 +12,32 @@ import { REPORT_NAME, getDebugLogger, } from '@opensumi/ide-core-common'; -import { AppConfig, IToolbarPopoverRegistry } from '@opensumi/ide-core-browser'; -import { getShadowRoot } from './shadowRoot'; import { Path, posix } from '@opensumi/ide-core-common/lib/path'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; -import { createProxiedWindow, createProxiedDocument } from './proxies'; -import { retargetEvents } from './retargetEvents'; -import { KtViewLocation } from './sumi/contributes/browser-views'; -import { ExtensionNoExportsView } from './components'; -import { ISumiBrowserContributions } from './sumi-browser/types'; -import { Extension } from './extension'; -import { SumiBrowserContributionRunner } from './sumi-browser/contribution'; +import { + EXTENSION_EXTEND_SERVICE_PREFIX, + IBrowserRequireInterceptorArgs, + IExtension, + IRequireInterceptorService, + MOCK_EXTENSION_EXTEND_PROXY_IDENTIFIER, + RequireInterceptorContribution, +} from '../common'; +import { ActivatedExtensionJSON } from '../common/activator'; import { AbstractNodeExtProcessService, AbstractViewExtProcessService, AbstractWorkerExtProcessService, } from '../common/extension.service'; -import { ActivatedExtensionJSON } from '../common/activator'; + +import { ExtensionNoExportsView } from './components'; +import { Extension } from './extension'; +import { createProxiedWindow, createProxiedDocument } from './proxies'; +import { retargetEvents } from './retargetEvents'; +import { getShadowRoot } from './shadowRoot'; +import { SumiBrowserContributionRunner } from './sumi-browser/contribution'; +import { ISumiBrowserContributions } from './sumi-browser/types'; +import { KtViewLocation } from './sumi/contributes/browser-views'; const LOAD_FAILED_CODE = 'load'; diff --git a/packages/extension/src/browser/extension-worker.service.ts b/packages/extension/src/browser/extension-worker.service.ts index 89b576a423..cfdd0dc554 100644 --- a/packages/extension/src/browser/extension-worker.service.ts +++ b/packages/extension/src/browser/extension-worker.service.ts @@ -8,6 +8,7 @@ import { posix } from '@opensumi/ide-core-common/lib/path'; import { IExtension, IExtensionWorkerHost, WorkerHostAPIIdentifier } from '../common'; import { ActivatedExtensionJSON } from '../common/activator'; import { AbstractWorkerExtProcessService } from '../common/extension.service'; + import { getWorkerBootstrapUrl } from './loader'; import { initWorkerThreadAPIProxy } from './vscode/api/main.thread.api.impl'; import { startInsideIframe } from './workerHostIframe'; diff --git a/packages/extension/src/browser/extension.contribution.ts b/packages/extension/src/browser/extension.contribution.ts index 198c2f5a64..2b5634a1b3 100644 --- a/packages/extension/src/browser/extension.contribution.ts +++ b/packages/extension/src/browser/extension.contribution.ts @@ -1,3 +1,5 @@ +import type vscode from 'vscode'; + import { Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; import { @@ -30,13 +32,11 @@ import { StatusBarAlignment, StatusBarEntryAccessor, } from '@opensumi/ide-core-browser/lib/services/status-bar-service'; +import { IResourceOpenOptions, WorkbenchEditorService, EditorGroupColumn } from '@opensumi/ide-editor'; import { IWindowDialogService } from '@opensumi/ide-overlay'; import { IWebviewService } from '@opensumi/ide-webview'; -import { IResourceOpenOptions, WorkbenchEditorService, EditorGroupColumn } from '@opensumi/ide-editor'; -import type vscode from 'vscode'; import type { ITextEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/platform/editor/common/editor'; -import { TextDocumentShowOptions, ViewColumn, CUSTOM_EDITOR_SCHEME } from '../common/vscode'; import { ExtensionNodeServiceServerPath, IExtensionNodeClientService, @@ -47,7 +47,9 @@ import { ExtensionHostTypeUpperCase, } from '../common'; import { ActivatedExtension } from '../common/activator'; -import * as VSCodeBuiltinCommands from './vscode/builtin-commands'; +import { TextDocumentShowOptions, ViewColumn, CUSTOM_EDITOR_SCHEME } from '../common/vscode'; +import { fromRange, isLikelyVscodeRange, viewColumnToResourceOpenOptions } from '../common/vscode/converter'; + import { AbstractExtInstanceManagementService, ExtensionApiReadyEvent, @@ -55,7 +57,7 @@ import { IActivationEventService, Serializable, } from './types'; -import { fromRange, isLikelyVscodeRange, viewColumnToResourceOpenOptions } from '../common/vscode/converter'; +import * as VSCodeBuiltinCommands from './vscode/builtin-commands'; export const getClientId = (injector: Injector) => { let clientId: string; diff --git a/packages/extension/src/browser/extension.service.ts b/packages/extension/src/browser/extension.service.ts index a13eb100b8..d5b4d69a1b 100644 --- a/packages/extension/src/browser/extension.service.ts +++ b/packages/extension/src/browser/extension.service.ts @@ -1,10 +1,4 @@ import { Autowired, Injectable } from '@opensumi/di'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; -import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; -import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; -import { localize, OnEvent, WithEventBus, ProgressLocation, ExtensionDidContributes } from '@opensumi/ide-core-common'; -import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common'; import { AppConfig, CommandRegistry, @@ -15,15 +9,31 @@ import { IClientApp, ILogger, } from '@opensumi/ide-core-browser'; +import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { localize, OnEvent, WithEventBus, ProgressLocation, ExtensionDidContributes } from '@opensumi/ide-core-common'; +import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; +import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common'; +import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { Extension } from './extension'; +import { + ExtensionHostType, + ExtensionNodeServiceServerPath, + ExtensionService, + IExtensionNodeClientService, + IExtCommandManagement, + IExtensionMetaData, + LANGUAGE_BUNDLE_FIELD, +} from '../common'; import { ActivatedExtension } from '../common/activator'; -import { isLanguagePackExtension, MainThreadAPIIdentifier } from '../common/vscode'; import { AbstractNodeExtProcessService, AbstractViewExtProcessService, AbstractWorkerExtProcessService, } from '../common/extension.service'; +import { isLanguagePackExtension, MainThreadAPIIdentifier } from '../common/vscode'; + +import { Extension } from './extension'; import { ExtensionApiReadyEvent, ExtensionDidEnabledEvent, @@ -32,15 +42,7 @@ import { IActivationEventService, AbstractExtInstanceManagementService, } from './types'; -import { - ExtensionHostType, - ExtensionNodeServiceServerPath, - ExtensionService, - IExtensionNodeClientService, - IExtCommandManagement, - IExtensionMetaData, - LANGUAGE_BUNDLE_FIELD, -} from '../common'; + @Injectable() export class ExtensionServiceImpl extends WithEventBus implements ExtensionService { diff --git a/packages/extension/src/browser/extension.ts b/packages/extension/src/browser/extension.ts index 5982a123c3..db516fe27c 100644 --- a/packages/extension/src/browser/extension.ts +++ b/packages/extension/src/browser/extension.ts @@ -1,5 +1,4 @@ import { Injectable, Optional, Autowired } from '@opensumi/di'; -import { JSONType, ExtensionService, IExtension, IExtensionProps, IExtensionMetaData } from '../common'; import { getDebugLogger, registerLocalizationBundle, @@ -11,6 +10,9 @@ import { replaceNlsField, } from '@opensumi/ide-core-common'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; + +import { JSONType, ExtensionService, IExtension, IExtensionProps, IExtensionMetaData } from '../common'; + import { ExtensionMetadataService } from './metadata.service'; import { AbstractExtInstanceManagementService, ExtensionDidActivatedEvent, ExtensionWillActivateEvent } from './types'; diff --git a/packages/extension/src/browser/index.ts b/packages/extension/src/browser/index.ts index 17f48ba9a7..781ee7dfdd 100644 --- a/packages/extension/src/browser/index.ts +++ b/packages/extension/src/browser/index.ts @@ -19,6 +19,7 @@ import { AbstractWorkerExtProcessService, AbstractViewExtProcessService, } from '../common/extension.service'; + import { ActivationEventServiceImpl } from './activation.service'; import { ExtCommandManagementImpl as ExtCommandManagementImpl } from './extension-command-management'; import { ExtInstanceManagementService } from './extension-instance-management'; @@ -28,9 +29,9 @@ import { ViewExtProcessService } from './extension-view.service'; import { WorkerExtProcessService } from './extension-worker.service'; import { ExtensionClientAppContribution, ExtensionCommandContribution } from './extension.contribution'; import { ExtensionServiceImpl } from './extension.service'; +import { BrowserRequireInterceptorContribution } from './require-interceptor.contribution'; import { AbstractExtInstanceManagementService, IActivationEventService } from './types'; import { ExtensionDebugService, ExtensionDebugSessionContributionRegistry } from './vscode/api/debug'; -import { BrowserRequireInterceptorContribution } from './require-interceptor.contribution'; @Injectable() export class ExtensionModule extends BrowserModule { diff --git a/packages/extension/src/browser/metadata.service.ts b/packages/extension/src/browser/metadata.service.ts index 7af7736aba..8cca1b516a 100644 --- a/packages/extension/src/browser/metadata.service.ts +++ b/packages/extension/src/browser/metadata.service.ts @@ -1,10 +1,12 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { IExtension } from '../common'; import { Disposable, ILogger } from '@opensumi/ide-core-browser'; -import { IActivationEventService } from './types'; import { IEventBus, ExtensionEnabledEvent } from '@opensumi/ide-core-common'; -import { VSCodeContributeRunner } from './vscode/contributes'; + +import { IExtension } from '../common'; + import { SumiContributesRunner } from './sumi/contributes'; +import { IActivationEventService } from './types'; +import { VSCodeContributeRunner } from './vscode/contributes'; @Injectable({ multiple: true }) export class ExtensionMetadataService extends Disposable { diff --git a/packages/extension/src/browser/require-interceptor.contribution.ts b/packages/extension/src/browser/require-interceptor.contribution.ts index c1b49cb715..d4bc5472c7 100644 --- a/packages/extension/src/browser/require-interceptor.contribution.ts +++ b/packages/extension/src/browser/require-interceptor.contribution.ts @@ -1,11 +1,14 @@ import React from 'react'; import ReactDOM from 'react-dom'; + import { Domain } from '@opensumi/ide-core-browser'; + import { IBrowserRequireInterceptorArgs, IRequireInterceptorService, RequireInterceptorContribution, } from '../common/require-interceptor'; + import { createBrowserApi } from './sumi-browser'; @Domain(RequireInterceptorContribution) diff --git a/packages/extension/src/browser/shadowRoot.tsx b/packages/extension/src/browser/shadowRoot.tsx index 261b1212bc..993414c0d9 100644 --- a/packages/extension/src/browser/shadowRoot.tsx +++ b/packages/extension/src/browser/shadowRoot.tsx @@ -1,12 +1,13 @@ -import { ComponentContextProvider, IconContext, IIconResourceOptions } from '@opensumi/ide-components'; -import { DisposableCollection, LabelService, useInjectable } from '@opensumi/ide-core-browser'; -import { localize, URI } from '@opensumi/ide-core-common'; -import { getThemeTypeSelector, IIconService, IThemeService, ThemeType } from '@opensumi/ide-theme'; import clx from 'classnames'; import React, { useCallback } from 'react'; import { useEffect, useRef, useState } from 'react'; import ReactDOM from 'react-dom'; +import { ComponentContextProvider, IconContext, IIconResourceOptions } from '@opensumi/ide-components'; +import { DisposableCollection, LabelService, useInjectable } from '@opensumi/ide-core-browser'; +import { localize, URI } from '@opensumi/ide-core-common'; +import { getThemeTypeSelector, IIconService, IThemeService, ThemeType } from '@opensumi/ide-theme'; + import { IExtension } from '../common'; import { AbstractViewExtProcessService } from '../common/extension.service'; diff --git a/packages/extension/src/browser/sumi-browser/commands.ts b/packages/extension/src/browser/sumi-browser/commands.ts index 1bbbe8b933..eed158e568 100644 --- a/packages/extension/src/browser/sumi-browser/commands.ts +++ b/packages/extension/src/browser/sumi-browser/commands.ts @@ -1,10 +1,11 @@ import { Injectable, Autowired, Injector, Optional } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { ILogger, CommandRegistry, IExtensionInfo } from '@opensumi/ide-core-common'; import { ICommandServiceToken, IMonacoCommandService } from '@opensumi/ide-monaco/lib/browser/contrib/command'; + import { IExtension } from '../../common'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IExtHostCommands } from '../../common/vscode/command'; import { ExtHostAPIIdentifier } from '../../common/vscode'; +import { IExtHostCommands } from '../../common/vscode/command'; @Injectable() export class KaitianBrowserCommand { diff --git a/packages/extension/src/browser/sumi-browser/components.ts b/packages/extension/src/browser/sumi-browser/components.ts index 33ab928f51..b0558776ce 100644 --- a/packages/extension/src/browser/sumi-browser/components.ts +++ b/packages/extension/src/browser/sumi-browser/components.ts @@ -1,8 +1,10 @@ import React from 'react'; + import { Injector } from '@opensumi/di'; +import { AppConfig } from '@opensumi/ide-core-browser'; import * as Components from '@opensumi/ide-core-browser/lib/components'; + import { IExtension } from '../../common'; -import { AppConfig } from '@opensumi/ide-core-browser'; import { PortalRoot } from '../components/extension-portal-root'; export function createBrowserComponents(injector: Injector, extension: IExtension) { diff --git a/packages/extension/src/browser/sumi-browser/contribution/editor.ts b/packages/extension/src/browser/sumi-browser/contribution/editor.ts index 60526e307b..8b593abf32 100644 --- a/packages/extension/src/browser/sumi-browser/contribution/editor.ts +++ b/packages/extension/src/browser/sumi-browser/contribution/editor.ts @@ -1,10 +1,11 @@ -import { IRunTimeParams, AbstractSumiBrowserContributionRunner, IEditorViewContribution } from '../types'; -import { IDisposable, Disposable, URI } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { IIconService, IconType } from '@opensumi/ide-theme'; +import { IDisposable, Disposable, URI } from '@opensumi/ide-core-common'; import { ResourceService } from '@opensumi/ide-editor'; import { EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { IIconService, IconType } from '@opensumi/ide-theme'; + +import { IRunTimeParams, AbstractSumiBrowserContributionRunner, IEditorViewContribution } from '../types'; @Injectable({ multiple: true }) export class EditorBrowserContributionRunner extends AbstractSumiBrowserContributionRunner { diff --git a/packages/extension/src/browser/sumi-browser/contribution/editorSide.ts b/packages/extension/src/browser/sumi-browser/contribution/editorSide.ts index e357935c5f..6524cbafae 100644 --- a/packages/extension/src/browser/sumi-browser/contribution/editorSide.ts +++ b/packages/extension/src/browser/sumi-browser/contribution/editorSide.ts @@ -1,10 +1,11 @@ -import { IRunTimeParams, AbstractSumiBrowserContributionRunner, IEditorSideViewContribution } from '../types'; -import { IDisposable, Disposable } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; +import { IDisposable, Disposable } from '@opensumi/ide-core-common'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { IRunTimeParams, AbstractSumiBrowserContributionRunner, IEditorSideViewContribution } from '../types'; + @Injectable({ multiple: true }) export class EditorSideBrowserContributionRunner extends AbstractSumiBrowserContributionRunner { @Autowired(EditorComponentRegistry) diff --git a/packages/extension/src/browser/sumi-browser/contribution/index.ts b/packages/extension/src/browser/sumi-browser/contribution/index.ts index 10a9ece759..40b9d3384d 100644 --- a/packages/extension/src/browser/sumi-browser/contribution/index.ts +++ b/packages/extension/src/browser/sumi-browser/contribution/index.ts @@ -1,10 +1,12 @@ -import { AbstractSumiBrowserContributionRunner, IRunTimeParams } from '../types'; -import { IDisposable, Disposable } from '@opensumi/ide-core-common'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { TabbarBrowserContributionRunner } from './tabbar'; +import { IDisposable, Disposable } from '@opensumi/ide-core-common'; + +import { AbstractSumiBrowserContributionRunner, IRunTimeParams } from '../types'; + import { EditorBrowserContributionRunner } from './editor'; -import { ToolBarBrowserContributionRunner } from './toolbar'; import { EditorSideBrowserContributionRunner } from './editorSide'; +import { TabbarBrowserContributionRunner } from './tabbar'; +import { ToolBarBrowserContributionRunner } from './toolbar'; @Injectable({ multiple: true }) export class SumiBrowserContributionRunner extends AbstractSumiBrowserContributionRunner { diff --git a/packages/extension/src/browser/sumi-browser/contribution/tabbar.ts b/packages/extension/src/browser/sumi-browser/contribution/tabbar.ts index 7861e81a8c..421f6d94f3 100644 --- a/packages/extension/src/browser/sumi-browser/contribution/tabbar.ts +++ b/packages/extension/src/browser/sumi-browser/contribution/tabbar.ts @@ -1,10 +1,11 @@ -import { IRunTimeParams, AbstractSumiBrowserContributionRunner, ITabBarViewContribution } from '../types'; -import { IDisposable, Disposable } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { getIcon } from '@opensumi/ide-core-browser'; +import { IDisposable, Disposable } from '@opensumi/ide-core-common'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { IIconService } from '@opensumi/ide-theme'; +import { IRunTimeParams, AbstractSumiBrowserContributionRunner, ITabBarViewContribution } from '../types'; + const SUPPORT_LOCATION = ['left', 'right', 'bottom', 'editor', 'toolBar']; @Injectable({ multiple: true }) diff --git a/packages/extension/src/browser/sumi-browser/contribution/toolbar.ts b/packages/extension/src/browser/sumi-browser/contribution/toolbar.ts index 3c4242f57c..d5da68769e 100644 --- a/packages/extension/src/browser/sumi-browser/contribution/toolbar.ts +++ b/packages/extension/src/browser/sumi-browser/contribution/toolbar.ts @@ -1,10 +1,11 @@ -import { IRunTimeParams, AbstractSumiBrowserContributionRunner } from '../types'; -import { IDisposable, Disposable, ILogger } from '@opensumi/ide-core-common'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { IDisposable, Disposable, ILogger } from '@opensumi/ide-core-common'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { IIconService } from '@opensumi/ide-theme'; import { IToolBarViewService, ToolBarPosition } from '@opensumi/ide-toolbar/lib/browser'; +import { IRunTimeParams, AbstractSumiBrowserContributionRunner } from '../types'; + @Injectable({ multiple: true }) export class ToolBarBrowserContributionRunner extends AbstractSumiBrowserContributionRunner { @Autowired(IMainLayoutService) diff --git a/packages/extension/src/browser/sumi-browser/index.ts b/packages/extension/src/browser/sumi-browser/index.ts index 35748e883c..dc1355fd8d 100644 --- a/packages/extension/src/browser/sumi-browser/index.ts +++ b/packages/extension/src/browser/sumi-browser/index.ts @@ -1,16 +1,17 @@ +import { Injector } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { URI, localize, getIcon, IReporterService, format } from '@opensumi/ide-core-browser'; -import { Scroll } from '@opensumi/ide-editor/lib/browser/component/scroll/scroll'; import { ResizeHandleHorizontal, ResizeHandleVertical } from '@opensumi/ide-core-browser/lib/components'; -import { PlainWebview } from '@opensumi/ide-webview'; -import { ToolBarPosition } from '@opensumi/ide-toolbar'; import { EditorComponentRenderMode } from '@opensumi/ide-editor/lib/browser'; -import { Injector } from '@opensumi/di'; +import { Scroll } from '@opensumi/ide-editor/lib/browser/component/scroll/scroll'; import { IThemeService, getColorRegistry } from '@opensumi/ide-theme'; -import { IRPCProtocol } from '@opensumi/ide-connection'; +import { ToolBarPosition } from '@opensumi/ide-toolbar'; +import { PlainWebview } from '@opensumi/ide-webview'; + +import { IExtension } from '../../common'; import { createBrowserCommandsApiFactory } from './commands'; import { createBrowserComponents } from './components'; -import { IExtension } from '../../common'; /** * Browser 尽量只export视图相关的少量API diff --git a/packages/extension/src/browser/sumi-browser/types.ts b/packages/extension/src/browser/sumi-browser/types.ts index e079590f87..68598b9125 100644 --- a/packages/extension/src/browser/sumi-browser/types.ts +++ b/packages/extension/src/browser/sumi-browser/types.ts @@ -1,11 +1,12 @@ -import { IExtension } from '../..'; import { ProxyIdentifier } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { IDisposable, Uri } from '@opensumi/ide-core-common'; -import { EditorComponentRenderMode } from '@opensumi/ide-editor/lib/browser'; import { Path } from '@opensumi/ide-core-common/lib/path'; +import { EditorComponentRenderMode } from '@opensumi/ide-editor/lib/browser'; import { ToolBarPosition } from '@opensumi/ide-toolbar/lib/browser'; import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; +import { IExtension } from '../..'; + export interface ISumiBrowserContributions { [containerId: string]: | { diff --git a/packages/extension/src/browser/sumi/contributes/browser-views.ts b/packages/extension/src/browser/sumi/contributes/browser-views.ts index 648758c606..c2f98a53d2 100644 --- a/packages/extension/src/browser/sumi/contributes/browser-views.ts +++ b/packages/extension/src/browser/sumi/contributes/browser-views.ts @@ -1,11 +1,12 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { VSCodeContributePoint, Contributes } from '../../../common'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { getIcon } from '@opensumi/ide-core-browser'; import { DisposableCollection, getDebugLogger } from '@opensumi/ide-core-common'; -import { ExtensionLoadingView } from '../../components'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { IIconService } from '@opensumi/ide-theme'; +import { VSCodeContributePoint, Contributes } from '../../../common'; +import { ExtensionLoadingView } from '../../components'; + export type KtViewLocation = 'left' | 'right' | 'bottom' | 'editor' | 'toolBar'; export type KtViewsContribution = { diff --git a/packages/extension/src/browser/sumi/contributes/index.ts b/packages/extension/src/browser/sumi/contributes/index.ts index cab9b9ba6c..b3de7fafe0 100644 --- a/packages/extension/src/browser/sumi/contributes/index.ts +++ b/packages/extension/src/browser/sumi/contributes/index.ts @@ -1,13 +1,14 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector, Optional } from '@opensumi/di'; import { IJSONSchemaRegistry, localize, ILogger, WithEventBus, IEventBus } from '@opensumi/ide-core-browser'; + import { IExtensionMetaData, CONTRIBUTE_NAME_KEY } from '../../../common'; import { ExtensionWillContributeEvent } from '../../types'; import { BrowserViewContributionPoint, KtViewsSchema } from './browser-views'; +import { MenuExtendContributionPoint } from './menu-extend'; import { MenubarsContributionPoint } from './menubar'; import { SubmenusContributionPoint } from './submenu'; import { ToolbarContributionPoint } from './toolbar'; -import { MenuExtendContributionPoint } from './menu-extend'; const CONTRIBUTES_SYMBOL = Symbol(); diff --git a/packages/extension/src/browser/sumi/contributes/toolbar.ts b/packages/extension/src/browser/sumi/contributes/toolbar.ts index 1999dd9cc6..db9aab57b6 100644 --- a/packages/extension/src/browser/sumi/contributes/toolbar.ts +++ b/packages/extension/src/browser/sumi/contributes/toolbar.ts @@ -1,9 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { IToolbarRegistry } from '@opensumi/ide-core-browser'; import { VSCodeContributePoint, Contributes } from '../../../common'; -import { IToolbarButtonContribution, IToolbarSelectContribution, IToolbarActionBasicContribution } from '../types'; import { KaitianExtensionToolbarService } from '../main.thread.toolbar'; -import { IToolbarRegistry } from '@opensumi/ide-core-browser'; +import { IToolbarButtonContribution, IToolbarSelectContribution, IToolbarActionBasicContribution } from '../types'; export interface KtToolbarSchema { actions?: Array; diff --git a/packages/extension/src/browser/sumi/main.thread.api.impl.ts b/packages/extension/src/browser/sumi/main.thread.api.impl.ts index 2167330872..775002594f 100644 --- a/packages/extension/src/browser/sumi/main.thread.api.impl.ts +++ b/packages/extension/src/browser/sumi/main.thread.api.impl.ts @@ -1,11 +1,13 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; import { Injector } from '@opensumi/di'; -import { MainThreadLifeCycle } from './main.thread.lifecycle'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Disposable } from '@opensumi/ide-core-common'; + import { MainThreadSumiAPIIdentifier } from '../../common/sumi'; + +import { MainThreadCommon } from './main.thread.common'; import { MainThreadLayout } from './main.thread.layout'; -import { Disposable } from '@opensumi/ide-core-common'; +import { MainThreadLifeCycle } from './main.thread.lifecycle'; import { MainThreadTheme } from './main.thread.theme'; -import { MainThreadCommon } from './main.thread.common'; import { MainThreadToolbar } from './main.thread.toolbar'; import { MainThreadIDEWindow } from './main.thread.window'; diff --git a/packages/extension/src/browser/sumi/main.thread.common.ts b/packages/extension/src/browser/sumi/main.thread.common.ts index fb47d76875..604ac6df58 100644 --- a/packages/extension/src/browser/sumi/main.thread.common.ts +++ b/packages/extension/src/browser/sumi/main.thread.common.ts @@ -1,8 +1,9 @@ import { Injectable, Injector, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IEventBus, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; import { Disposable } from '@opensumi/ide-core-common'; + import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; -import { IEventBus, WithEventBus, OnEvent } from '@opensumi/ide-core-browser'; import { IExtHostCommon, IMainThreadCommon } from '../../common/sumi/common'; import { ExtHostEvent } from '../types'; diff --git a/packages/extension/src/browser/sumi/main.thread.layout.ts b/packages/extension/src/browser/sumi/main.thread.layout.ts index abc1d4d9b9..10eb8d734f 100644 --- a/packages/extension/src/browser/sumi/main.thread.layout.ts +++ b/packages/extension/src/browser/sumi/main.thread.layout.ts @@ -1,12 +1,13 @@ import { Injectable, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IMainThreadLayout, IExtHostLayout } from '../../common/sumi/layout'; +import { IEventBus, Disposable, ILogger } from '@opensumi/ide-core-browser'; import { IMainLayoutService, TabBarRegistrationEvent } from '@opensumi/ide-main-layout'; import { TabBarHandler } from '@opensumi/ide-main-layout/lib/browser/tabbar-handler'; -import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; -import { IEventBus, Disposable, ILogger } from '@opensumi/ide-core-browser'; import { IconType, IconShape, IIconService } from '@opensumi/ide-theme'; +import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; +import { IMainThreadLayout, IExtHostLayout } from '../../common/sumi/layout'; + @Injectable({ multiple: true }) export class MainThreadLayout extends Disposable implements IMainThreadLayout { @Autowired(IMainLayoutService) diff --git a/packages/extension/src/browser/sumi/main.thread.lifecycle.ts b/packages/extension/src/browser/sumi/main.thread.lifecycle.ts index 721d1b4807..1716fb902e 100644 --- a/packages/extension/src/browser/sumi/main.thread.lifecycle.ts +++ b/packages/extension/src/browser/sumi/main.thread.lifecycle.ts @@ -1,7 +1,7 @@ import { Autowired, Injectable, Injector } from '@opensumi/di'; -import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron'; -import { ExtensionCandidate } from '@opensumi/ide-core-common'; import { AppConfig, electronEnv } from '@opensumi/ide-core-browser'; +import { ExtensionCandidate } from '@opensumi/ide-core-common'; +import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron'; import { IMainThreadLifeCycle } from '../../common/sumi/lifecycle'; diff --git a/packages/extension/src/browser/sumi/main.thread.theme.ts b/packages/extension/src/browser/sumi/main.thread.theme.ts index e491c4940a..7869c38231 100644 --- a/packages/extension/src/browser/sumi/main.thread.theme.ts +++ b/packages/extension/src/browser/sumi/main.thread.theme.ts @@ -1,10 +1,12 @@ import { Injectable, Injector, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Disposable } from '@opensumi/ide-core-browser'; +import { IThemeService, getColorRegistry } from '@opensumi/ide-theme'; + +import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; import { IMainThreadTheme } from '../../common/sumi/theme'; import { IExtHostTheme } from '../../common/sumi/theme'; -import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; -import { IThemeService, getColorRegistry } from '@opensumi/ide-theme'; -import { Disposable } from '@opensumi/ide-core-browser'; + @Injectable({ multiple: true }) export class MainThreadTheme extends Disposable implements IMainThreadTheme { diff --git a/packages/extension/src/browser/sumi/main.thread.toolbar.ts b/packages/extension/src/browser/sumi/main.thread.toolbar.ts index eb9d0264d7..a489f8d2ce 100644 --- a/packages/extension/src/browser/sumi/main.thread.toolbar.ts +++ b/packages/extension/src/browser/sumi/main.thread.toolbar.ts @@ -13,13 +13,15 @@ import { ExtensionActivateEvent, IToolbarPopoverRegistry, } from '@opensumi/ide-core-browser'; -import { IToolbarButtonContribution, IToolbarSelectContribution } from './types'; +import { Disposable } from '@opensumi/ide-core-browser'; import { IIconService, IconType } from '@opensumi/ide-theme'; + import { EMIT_EXT_HOST_EVENT } from '../../common'; -import { Disposable } from '@opensumi/ide-core-browser'; import { IMainThreadToolbar } from '../../common/sumi/toolbar'; import { ExtensionLoadingView } from '../components'; +import { IToolbarButtonContribution, IToolbarSelectContribution } from './types'; + @Injectable() export class KaitianExtensionToolbarService { private btnDelegates = new Map(); diff --git a/packages/extension/src/browser/sumi/main.thread.window.ts b/packages/extension/src/browser/sumi/main.thread.window.ts index e1acb0d1da..3b46acc4be 100644 --- a/packages/extension/src/browser/sumi/main.thread.window.ts +++ b/packages/extension/src/browser/sumi/main.thread.window.ts @@ -1,7 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; import { Disposable } from '@opensumi/ide-core-browser'; +import { IPlainWebviewWindow, IWebviewService } from '@opensumi/ide-webview'; + +import { ExtHostSumiAPIIdentifier } from '../../common/sumi'; import { IMainThreadIDEWindow, IIDEWindowWebviewOptions, @@ -9,7 +11,7 @@ import { IExtHostIDEWindow, IWindowInfo, } from '../../common/sumi/window'; -import { IPlainWebviewWindow, IWebviewService } from '@opensumi/ide-webview'; + // 与 MainThreadWindow 做一下区分,用于拓展 sumi 下的ideWindow API @Injectable({ multiple: true }) diff --git a/packages/extension/src/browser/types.ts b/packages/extension/src/browser/types.ts index 5f274d2156..47b3214dc1 100644 --- a/packages/extension/src/browser/types.ts +++ b/packages/extension/src/browser/types.ts @@ -1,6 +1,8 @@ import { Injectable } from '@opensumi/di'; import { BasicEvent, IDisposable, IExtensionProps } from '@opensumi/ide-core-browser'; + import { IExtension, IExtensionMetaData } from '../common'; + import { Extension } from './extension'; export type Serializable = any; diff --git a/packages/extension/src/browser/vscode/api/debug/extension-debug-adapter-contribution.ts b/packages/extension/src/browser/vscode/api/debug/extension-debug-adapter-contribution.ts index 0dc259e01b..dcb144fcd8 100644 --- a/packages/extension/src/browser/vscode/api/debug/extension-debug-adapter-contribution.ts +++ b/packages/extension/src/browser/vscode/api/debug/extension-debug-adapter-contribution.ts @@ -1,5 +1,6 @@ -import { DebuggerDescription, DebugConfiguration, IDebugSessionDTO } from '@opensumi/ide-debug'; import { MaybePromise, IJSONSchema, IJSONSchemaSnippet } from '@opensumi/ide-core-browser'; +import { DebuggerDescription, DebugConfiguration, IDebugSessionDTO } from '@opensumi/ide-debug'; + import { IExtHostDebug } from '../../../../common/vscode'; import { IActivationEventService } from '../../../types'; diff --git a/packages/extension/src/browser/vscode/api/debug/extension-debug-service.ts b/packages/extension/src/browser/vscode/api/debug/extension-debug-service.ts index e27005b608..2fc3d455c6 100644 --- a/packages/extension/src/browser/vscode/api/debug/extension-debug-service.ts +++ b/packages/extension/src/browser/vscode/api/debug/extension-debug-service.ts @@ -1,6 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { DebugServer, DebuggerDescription, IDebugSessionManager, IDebugSessionDTO } from '@opensumi/ide-debug'; -import { ExtensionDebugAdapterContribution } from './extension-debug-adapter-contribution'; import { Disposable, IDisposable, @@ -9,13 +7,17 @@ import { IJSONSchemaSnippet, WaitUntilEvent, } from '@opensumi/ide-core-browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { ILoggerManagerClient, SupportLogNamespace, ILogServiceClient } from '@opensumi/ide-logs/lib/browser'; -import { DebugConfiguration } from '@opensumi/ide-debug/lib/common/debug-configuration'; +import { DebugServer, DebuggerDescription, IDebugSessionManager, IDebugSessionDTO } from '@opensumi/ide-debug'; import { DebugConfigurationManager } from '@opensumi/ide-debug/lib/browser'; +import { DebugConfiguration } from '@opensumi/ide-debug/lib/common/debug-configuration'; +import { ILoggerManagerClient, SupportLogNamespace, ILogServiceClient } from '@opensumi/ide-logs/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { DebugActivationEvent } from '../../../../common/vscode'; import { IActivationEventService } from '../../../types'; +import { ExtensionDebugAdapterContribution } from './extension-debug-adapter-contribution'; + export interface ExtensionDebugAdapterContributionRegistrator { /** * 注册插件Debug Adapter贡献点 diff --git a/packages/extension/src/browser/vscode/api/debug/extension-debug-session-contribution-registry.ts b/packages/extension/src/browser/vscode/api/debug/extension-debug-session-contribution-registry.ts index 35f166531e..d21c05f3dc 100644 --- a/packages/extension/src/browser/vscode/api/debug/extension-debug-session-contribution-registry.ts +++ b/packages/extension/src/browser/vscode/api/debug/extension-debug-session-contribution-registry.ts @@ -1,6 +1,6 @@ -import { DebugSessionContribution, DebugSessionContributionRegistry } from '@opensumi/ide-debug/lib/browser'; -import { IDisposable, ContributionProvider, Disposable, getDebugLogger } from '@opensumi/ide-core-browser'; import { Injectable, Autowired } from '@opensumi/di'; +import { IDisposable, ContributionProvider, Disposable, getDebugLogger } from '@opensumi/ide-core-browser'; +import { DebugSessionContribution, DebugSessionContributionRegistry } from '@opensumi/ide-debug/lib/browser'; export interface ExtensionDebugSessionContributionRegistrator { /** diff --git a/packages/extension/src/browser/vscode/api/debug/extension-debug-session-factory.ts b/packages/extension/src/browser/vscode/api/debug/extension-debug-session-factory.ts index aff21e92ef..7b89d3544e 100644 --- a/packages/extension/src/browser/vscode/api/debug/extension-debug-session-factory.ts +++ b/packages/extension/src/browser/vscode/api/debug/extension-debug-session-factory.ts @@ -1,4 +1,8 @@ import { Injector } from '@opensumi/di'; +import { IWebSocket } from '@opensumi/ide-connection'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { IDebugSessionManager } from '@opensumi/ide-debug'; +import { DebugSessionOptions } from '@opensumi/ide-debug'; import { DebugSession, DebugSessionConnection, @@ -7,17 +11,13 @@ import { DebugPreferences, DebugModelManager, } from '@opensumi/ide-debug/lib/browser'; -import { IDebugSessionManager } from '@opensumi/ide-debug'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; import { IMessageService } from '@opensumi/ide-overlay'; -import { IWebSocket } from '@opensumi/ide-connection'; -import { DebugSessionOptions } from '@opensumi/ide-debug'; import { ITerminalApiService, TerminalOptions } from '@opensumi/ide-terminal-next'; import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; export class ExtensionDebugSession extends DebugSession { constructor( diff --git a/packages/extension/src/browser/vscode/api/main.thread.api.impl.ts b/packages/extension/src/browser/vscode/api/main.thread.api.impl.ts index acdda658ab..c0395c76ff 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.api.impl.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.api.impl.ts @@ -1,3 +1,7 @@ +import { Injector } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; + +import { IMainThreadExtensionLog, MainThreadExtensionLogIdentifier } from '../../../common/extension-log'; import { MainThreadAPIIdentifier, IMainThreadCommands, @@ -23,44 +27,42 @@ import { IMainThreadTesting, IMainThreadEditorTabsShape, } from '../../../common/vscode'; // '../../common'; +import { VSCodeExtensionService } from '../../../common/vscode'; + +import { MainThreadProgress } from './main.thread.api.progress'; +import { MainThreadWebview, MainThreadWebviewView } from './main.thread.api.webview'; +import { MainThreadAuthentication } from './main.thread.authentication'; import { MainThreadCommands } from './main.thread.commands'; +import { MainthreadComments } from './main.thread.comments'; +import { MainThreadConnection } from './main.thread.connection'; +import { MainThreadCustomEditor } from './main.thread.custom-editor'; +import { MainThreadDebug } from './main.thread.debug'; +import { MainThreadDecorations } from './main.thread.decoration'; import { MainThreadExtensionDocumentData } from './main.thread.doc'; -import { Injector } from '@opensumi/di'; -import { VSCodeExtensionService } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { MainThreadLanguages } from './main.thread.language'; -import { MainThreadStatusBar } from './main.thread.statusbar'; -import { MainThreadMessage } from './main.thread.message'; import { MainThreadEditorService } from './main.thread.editor'; -import { MainThreadPreference } from './main.thread.preference'; -import { MainThreadWorkspace } from './main.thread.workspace'; +import { MainThreadEditorTabsService } from './main.thread.editor-tabs'; import { MainThreadEnv } from './main.thread.env'; -import { MainThreadQuickOpen } from './main.thread.quickopen'; -import { MainThreadStorage } from './main.thread.storage'; -import { MainThreadOutput } from './main.thread.output'; import { MainThreadFileSystem } from './main.thread.file-system'; -import { MainThreadWebview, MainThreadWebviewView } from './main.thread.api.webview'; -import { MainThreadSCM } from './main.thread.scm'; -import { MainThreadTreeView } from './main.thread.treeview'; -import { MainThreadDecorations } from './main.thread.decoration'; -import { MainThreadWindowState } from './main.thread.window-state'; -import { MainThreadDebug } from './main.thread.debug'; -import { MainThreadConnection } from './main.thread.connection'; -import { MainThreadTerminal } from './main.thread.terminal'; -import { MainThreadWindow } from './main.thread.window'; -import { MainThreadProgress } from './main.thread.api.progress'; -import { MainthreadTasks } from './main.thread.tasks'; -import { MainthreadComments } from './main.thread.comments'; import { MainThreadFileSystemEvent } from './main.thread.file-system-event'; -import { MainThreadUrls } from './main.thread.urls'; -import { IMainThreadExtensionLog, MainThreadExtensionLogIdentifier } from '../../../common/extension-log'; +import { MainThreadLanguages } from './main.thread.language'; import { MainThreadExtensionLog } from './main.thread.log'; -import { MainThreadTheming } from './main.thread.theming'; -import { MainThreadCustomEditor } from './main.thread.custom-editor'; -import { MainThreadAuthentication } from './main.thread.authentication'; +import { MainThreadMessage } from './main.thread.message'; +import { MainThreadOutput } from './main.thread.output'; +import { MainThreadPreference } from './main.thread.preference'; +import { MainThreadQuickOpen } from './main.thread.quickopen'; +import { MainThreadSCM } from './main.thread.scm'; import { MainThreadSecret } from './main.thread.secret'; +import { MainThreadStatusBar } from './main.thread.statusbar'; +import { MainThreadStorage } from './main.thread.storage'; +import { MainthreadTasks } from './main.thread.tasks'; +import { MainThreadTerminal } from './main.thread.terminal'; import { MainThreadTestsImpl } from './main.thread.tests'; -import { MainThreadEditorTabsService } from './main.thread.editor-tabs'; +import { MainThreadTheming } from './main.thread.theming'; +import { MainThreadTreeView } from './main.thread.treeview'; +import { MainThreadUrls } from './main.thread.urls'; +import { MainThreadWindow } from './main.thread.window'; +import { MainThreadWindowState } from './main.thread.window-state'; +import { MainThreadWorkspace } from './main.thread.workspace'; export async function createApiFactory( rpcProtocol: IRPCProtocol, diff --git a/packages/extension/src/browser/vscode/api/main.thread.api.progress.ts b/packages/extension/src/browser/vscode/api/main.thread.api.progress.ts index d947666a2a..e4c6df8e0f 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.api.progress.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.api.progress.ts @@ -1,7 +1,6 @@ -import { IMainThreadProgress, IExtHostProgress } from '../../../common/vscode/progress'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { Autowired, Injectable, Optional } from '@opensumi/di'; -import { ExtHostAPIIdentifier } from '../../../common/vscode'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; import { IProgressOptions, IProgressStep, @@ -9,8 +8,10 @@ import { ProgressLocation, IProgressNotificationOptions, } from '@opensumi/ide-core-common'; -import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; + import { IExtension } from '../../../common'; +import { ExtHostAPIIdentifier } from '../../../common/vscode'; +import { IMainThreadProgress, IExtHostProgress } from '../../../common/vscode/progress'; @Injectable({ multiple: true }) export class MainThreadProgress implements IMainThreadProgress { diff --git a/packages/extension/src/browser/vscode/api/main.thread.api.webview.ts b/packages/extension/src/browser/vscode/api/main.thread.api.webview.ts index a766080a45..5cbc1bc5ce 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.api.webview.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.api.webview.ts @@ -1,28 +1,7 @@ -import { - IMainThreadWebview, - WebviewPanelShowOptions, - IWebviewPanelOptions, - IWebviewOptions, - ExtHostAPIIdentifier, - IExtHostWebview, - IWebviewPanelViewState, - IMainThreadWebviewView, - IWebviewExtensionDescription, - IExtHostWebviewView, - WebviewViewResolverRegistrationEvent, - WebviewViewResolverRegistrationRemovalEvent, - WebviewViewOptions, -} from '../../../common/vscode'; +import throttle = require('lodash.throttle'); + import { Injectable, Autowired, Optional } from '@opensumi/di'; -import { - IWebviewService, - IEditorWebviewComponent, - IWebview, - IPlainWebview, - IPlainWebviewComponentHandle, -} from '@opensumi/ide-webview'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { WorkbenchEditorService, IResource } from '@opensumi/ide-editor'; import { Disposable, URI, @@ -38,19 +17,42 @@ import { IDisposable, addMapElement, } from '@opensumi/ide-core-browser'; -import { EditorGroupChangeEvent, IEditorOpenType } from '@opensumi/ide-editor/lib/browser'; -import { ISumiExtHostWebviews } from '../../../common/sumi/webview'; -import { IIconService, IconType } from '@opensumi/ide-theme'; -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; -import { viewColumnToResourceOpenOptions } from '../../../common/vscode/converter'; import { IOpenerService } from '@opensumi/ide-core-browser'; -import { HttpOpener } from '@opensumi/ide-core-browser/lib/opener/http-opener'; import { CommandOpener } from '@opensumi/ide-core-browser/lib/opener/command-opener'; -import throttle = require('lodash.throttle'); -import { IActivationEventService } from '../../types'; +import { HttpOpener } from '@opensumi/ide-core-browser/lib/opener/http-opener'; import { CancellationToken, WithEventBus, OnEvent } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService, IResource } from '@opensumi/ide-editor'; +import { EditorGroupChangeEvent, IEditorOpenType } from '@opensumi/ide-editor/lib/browser'; import { IMainLayoutService, ViewCollapseChangedEvent } from '@opensumi/ide-main-layout'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { IIconService, IconType } from '@opensumi/ide-theme'; +import { + IWebviewService, + IEditorWebviewComponent, + IWebview, + IPlainWebview, + IPlainWebviewComponentHandle, +} from '@opensumi/ide-webview'; + +import { ISumiExtHostWebviews } from '../../../common/sumi/webview'; +import { + IMainThreadWebview, + WebviewPanelShowOptions, + IWebviewPanelOptions, + IWebviewOptions, + ExtHostAPIIdentifier, + IExtHostWebview, + IWebviewPanelViewState, + IMainThreadWebviewView, + IWebviewExtensionDescription, + IExtHostWebviewView, + WebviewViewResolverRegistrationEvent, + WebviewViewResolverRegistrationRemovalEvent, + WebviewViewOptions, +} from '../../../common/vscode'; +import { viewColumnToResourceOpenOptions } from '../../../common/vscode/converter'; import { WebviewViewShouldShowEvent } from '../../components/extension-webview-view'; +import { IActivationEventService } from '../../types'; @Injectable({ multiple: true }) export class MainThreadWebview extends Disposable implements IMainThreadWebview { diff --git a/packages/extension/src/browser/vscode/api/main.thread.authentication.ts b/packages/extension/src/browser/vscode/api/main.thread.authentication.ts index 2c4d44a71b..a5ee044ca2 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.authentication.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.authentication.ts @@ -1,14 +1,15 @@ -import { IMainThreadAuthentication, ExtHostAPIIdentifier, IExtHostAuthentication } from '../../../common/vscode'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { Disposable, QuickPickService, localize, formatLocalize, ILogger } from '@opensumi/ide-core-browser'; -import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; import { IAuthenticationService, IAuthenticationProvider, AuthenticationSessionsChangeEvent, AuthenticationSession, } from '@opensumi/ide-core-common'; +import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; + +import { IMainThreadAuthentication, ExtHostAPIIdentifier, IExtHostAuthentication } from '../../../common/vscode'; import { IActivationEventService } from '../../types'; @Injectable({ multiple: true }) diff --git a/packages/extension/src/browser/vscode/api/main.thread.commands.ts b/packages/extension/src/browser/vscode/api/main.thread.commands.ts index 57d5f57d22..d0f973bc5a 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.commands.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.commands.ts @@ -1,10 +1,11 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostAPIIdentifier, IMainThreadCommands, IExtHostCommands, ArgumentProcessor } from '../../../common/vscode'; import { Injectable, Autowired, Optional } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { CommandRegistry, ILogger, IContextKeyService, IDisposable } from '@opensumi/ide-core-browser'; import { URI, isNonEmptyArray, Disposable, IExtensionInfo } from '@opensumi/ide-core-common'; import { ICommandServiceToken, IMonacoCommandService } from '@opensumi/ide-monaco/lib/browser/contrib/command'; +import { ExtHostAPIIdentifier, IMainThreadCommands, IExtHostCommands, ArgumentProcessor } from '../../../common/vscode'; + export interface IExtCommandHandler extends IDisposable { execute: (...args: any[]) => Promise; } diff --git a/packages/extension/src/browser/vscode/api/main.thread.comments.ts b/packages/extension/src/browser/vscode/api/main.thread.comments.ts index da50519bf8..06d75a0cae 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.comments.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.comments.ts @@ -1,16 +1,15 @@ -import { - CommentThread, - CommentInput, - CommentReaction as CoreCommentReaction, - CommentMode as CoreCommentMode, -} from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { - UriComponents, - CommentThreadCollapsibleState, - Comment as CoreComment, - CommentThreadChanges, -} from '../../../common/vscode/models'; + ICommentsService, + ICommentsThread, + ICommentsFeatureRegistry, + CommentMode, + CommentReactionClick, + IThreadComment, + CommentReaction, +} from '@opensumi/ide-comments'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { IRange, Emitter, @@ -24,24 +23,26 @@ import { WithEventBus, OnEvent, } from '@opensumi/ide-core-common'; +import { + CommentThread, + CommentInput, + CommentReaction as CoreCommentReaction, + CommentMode as CoreCommentMode, +} from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + import { IMainThreadComments, CommentProviderFeatures, IExtHostComments, IMainThreadCommands, } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { ExtHostAPIIdentifier } from '../../../common/vscode'; import { - ICommentsService, - ICommentsThread, - ICommentsFeatureRegistry, - CommentMode, - CommentReactionClick, - IThreadComment, - CommentReaction, -} from '@opensumi/ide-comments'; -import { MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; + UriComponents, + CommentThreadCollapsibleState, + Comment as CoreComment, + CommentThreadChanges, +} from '../../../common/vscode/models'; @Injectable({ multiple: true }) export class MainthreadComments implements IDisposable, IMainThreadComments { diff --git a/packages/extension/src/browser/vscode/api/main.thread.connection.ts b/packages/extension/src/browser/vscode/api/main.thread.connection.ts index 954b59b6ff..2e1a9b5887 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.connection.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.connection.ts @@ -1,7 +1,7 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { Disposable, DisposableCollection } from '@opensumi/ide-core-common'; import { Injectable, Optional, Autowired } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { ILoggerManagerClient, ILogServiceClient, SupportLogNamespace, Deferred } from '@opensumi/ide-core-browser'; +import { Disposable, DisposableCollection } from '@opensumi/ide-core-common'; import { IMainThreadConnectionService, diff --git a/packages/extension/src/browser/vscode/api/main.thread.custom-editor.ts b/packages/extension/src/browser/vscode/api/main.thread.custom-editor.ts index 2dea7556f4..74af1b0846 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.custom-editor.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.custom-editor.ts @@ -1,4 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { WithEventBus, OnEvent, IExtensionInfo, URI } from '@opensumi/ide-core-common'; +import { IEditorDocumentModelService, ResourceDecorationNeedChangeEvent } from '@opensumi/ide-editor/lib/browser'; +import { IWebviewService } from '@opensumi/ide-webview'; + import { IMainThreadCustomEditor, IExtHostCustomEditor, @@ -6,8 +11,6 @@ import { ICustomEditorOptions, ExtHostAPIIdentifier, } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { WithEventBus, OnEvent, IExtensionInfo, URI } from '@opensumi/ide-core-common'; import { CustomEditorShouldDisplayEvent, CustomEditorOptionChangeEvent, @@ -16,11 +19,10 @@ import { CustomEditorShouldRevertEvent, CustomEditorShouldEditEvent, } from '../../../common/vscode/custom-editor'; -import { IEditorDocumentModelService, ResourceDecorationNeedChangeEvent } from '@opensumi/ide-editor/lib/browser'; -import { MainThreadWebview } from './main.thread.api.webview'; -import { IWebviewService } from '@opensumi/ide-webview'; import { UriComponents } from '../../../common/vscode/models'; +import { MainThreadWebview } from './main.thread.api.webview'; + @Injectable({ multiple: true }) export class MainThreadCustomEditor extends WithEventBus implements IMainThreadCustomEditor { private proxy: IExtHostCustomEditor; diff --git a/packages/extension/src/browser/vscode/api/main.thread.debug.ts b/packages/extension/src/browser/vscode/api/main.thread.debug.ts index a79d223bb6..aa60544522 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.debug.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.debug.ts @@ -1,12 +1,5 @@ import { Injectable, Optional, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; -import { - IMainThreadDebug, - ExtHostAPIIdentifier, - IExtHostDebug, - ExtensionWSChannel, - IMainThreadConnectionService, - IStartDebuggingOptions, -} from '../../../common/vscode'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { DisposableCollection, Uri, @@ -15,6 +8,7 @@ import { SupportLogNamespace, URI, } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; import { DebuggerDescription, IDebugService, @@ -33,21 +27,30 @@ import { DebugModelManager, DebugBreakpoint, } from '@opensumi/ide-debug/lib/browser'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { DebugConsoleModelService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; +import { IDebugSessionManager, IDebugSessionOptions } from '@opensumi/ide-debug/lib/common/debug-session'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; import { IMessageService } from '@opensumi/ide-overlay'; +import { ITerminalApiService } from '@opensumi/ide-terminal-next'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + +import { + IMainThreadDebug, + ExtHostAPIIdentifier, + IExtHostDebug, + ExtensionWSChannel, + IMainThreadConnectionService, + IStartDebuggingOptions, +} from '../../../common/vscode'; +import { Breakpoint, WorkspaceFolder } from '../../../common/vscode/models'; +import { IActivationEventService } from '../../types'; + import { ExtensionDebugSessionFactory, ExtensionDebugSessionContributionRegistry } from './debug'; -import { ExtensionDebugService } from './debug/extension-debug-service'; import { ExtensionDebugAdapterContribution } from './debug/extension-debug-adapter-contribution'; -import { IActivationEventService } from '../../types'; -import { Breakpoint, WorkspaceFolder } from '../../../common/vscode/models'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; -import { IDebugSessionManager, IDebugSessionOptions } from '@opensumi/ide-debug/lib/common/debug-session'; -import { ITerminalApiService } from '@opensumi/ide-terminal-next'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; -import { DebugConsoleModelService } from '@opensumi/ide-debug/lib/browser/view/console/debug-console-tree.model.service'; +import { ExtensionDebugService } from './debug/extension-debug-service'; + @Injectable({ multiple: true }) export class MainThreadDebug implements IMainThreadDebug { diff --git a/packages/extension/src/browser/vscode/api/main.thread.decoration.ts b/packages/extension/src/browser/vscode/api/main.thread.decoration.ts index e3af744f93..7a5f59f903 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.decoration.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.decoration.ts @@ -1,7 +1,7 @@ -import { UriComponents, Uri as URI, Emitter, CancellationToken } from '@opensumi/ide-core-common'; -import { IDisposable, dispose } from '@opensumi/ide-core-common/lib/disposable'; import { Injectable, Optional, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { UriComponents, Uri as URI, Emitter, CancellationToken } from '@opensumi/ide-core-common'; +import { IDisposable, dispose } from '@opensumi/ide-core-common/lib/disposable'; import { IDecorationsService, IDecorationData } from '@opensumi/ide-decoration'; import { ExtHostAPIIdentifier } from '../../../common/vscode'; diff --git a/packages/extension/src/browser/vscode/api/main.thread.doc.ts b/packages/extension/src/browser/vscode/api/main.thread.doc.ts index ea7645cae7..794ba67a60 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.doc.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.doc.ts @@ -1,3 +1,7 @@ +import { Injectable, Optional, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { PreferenceService } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; import { WithEventBus, OnEvent, @@ -9,10 +13,6 @@ import { Emitter, LRUMap, } from '@opensumi/ide-core-common'; -import { ExtHostAPIIdentifier, IMainThreadDocumentsShape, IExtensionHostDocService } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { Injectable, Optional, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { Schemas } from '../../../common/vscode/ext-types'; import { ResourceService } from '@opensumi/ide-editor'; import { EditorComponentRegistry, @@ -27,10 +27,11 @@ import { EditorDocumentModelOptionChangedEvent, EditorDocumentModelWillSaveEvent, } from '@opensumi/ide-editor/lib/browser'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { PreferenceService } from '@opensumi/ide-core-browser'; import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { ExtHostAPIIdentifier, IMainThreadDocumentsShape, IExtensionHostDocService } from '../../../common/vscode'; +import { Schemas } from '../../../common/vscode/ext-types'; + const DEFAULT_EXT_HOLD_DOC_REF_MAX_AGE = 1000 * 60 * 3; // 插件进程openDocument持有的最长时间 const DEFAULT_EXT_HOLD_DOC_REF_MIN_AGE = 1000 * 20; // 插件进程openDocument持有的最短时间,防止bounce const DEFAULT_EXT_HOLD_DOC_REF_LENGTH = 1024 * 1024 * 80; // 插件进程openDocument持有的最长长度 diff --git a/packages/extension/src/browser/vscode/api/main.thread.editor-tabs.ts b/packages/extension/src/browser/vscode/api/main.thread.editor-tabs.ts index e49d5655d0..4bba49a441 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.editor-tabs.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.editor-tabs.ts @@ -1,14 +1,15 @@ -import { ExtHostAPIIdentifier } from './../../../common/vscode/index'; +import { Injectable, Autowired, Optional } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { URI, Disposable } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; + import { IExtHostEditorTabsShape, IMainThreadEditorTabsShape, IEditorTabDto, } from './../../../common/vscode/editor-tabs'; -import { URI, Disposable } from '@opensumi/ide-core-common'; -import { Injectable, Autowired, Optional } from '@opensumi/di'; -import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { ExtHostAPIIdentifier } from './../../../common/vscode/index'; export interface ITabInfo { name: string; diff --git a/packages/extension/src/browser/vscode/api/main.thread.editor.ts b/packages/extension/src/browser/vscode/api/main.thread.editor.ts index 02bc8ea666..992c2add99 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.editor.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.editor.ts @@ -1,18 +1,8 @@ -import type { ICodeEditor as IMonacoCodeEditor, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { RenderLineNumbersType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; -import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import debounce = require('lodash.debounce'); + import { Injectable, Autowired, Optional } from '@opensumi/di'; -import { - IMainThreadEditorsService, - IExtensionHostEditorService, - ExtHostAPIIdentifier, - IEditorChangeDTO, - IResolvedTextEditorConfiguration, - TextEditorRevealType, - ITextEditorUpdateConfiguration, - TextEditorCursorStyle, -} from '../../../common/vscode'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { WithEventBus, MaybeNull, IRange, ILineChange, URI, ISelection } from '@opensumi/ide-core-common'; import { WorkbenchEditorService, IEditorGroup, @@ -26,8 +16,6 @@ import { IDecorationRenderOptions, IThemeDecorationRenderOptions, } from '@opensumi/ide-editor'; -import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; -import { WithEventBus, MaybeNull, IRange, ILineChange, URI, ISelection } from '@opensumi/ide-core-common'; import { EditorGroupChangeEvent, IEditorDecorationCollectionService, @@ -37,17 +25,33 @@ import { EditorGroupIndexChangedEvent, IDiffResource, } from '@opensumi/ide-editor/lib/browser'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { IMonacoImplEditor, EditorCollectionServiceImpl, BrowserDiffEditor, } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; -import debounce = require('lodash.debounce'); -import { MainThreadExtensionDocumentData } from './main.thread.doc'; +import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import type { ICodeEditor as IMonacoCodeEditor, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { EndOfLineSequence } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { RenderLineNumbersType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; + +import { + IMainThreadEditorsService, + IExtensionHostEditorService, + ExtHostAPIIdentifier, + IEditorChangeDTO, + IResolvedTextEditorConfiguration, + TextEditorRevealType, + ITextEditorUpdateConfiguration, + TextEditorCursorStyle, +} from '../../../common/vscode'; import { viewColumnToResourceOpenOptions } from '../../../common/vscode/converter'; -import { EndOfLineSequence } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; + +import { MainThreadExtensionDocumentData } from './main.thread.doc'; + @Injectable({ multiple: true }) export class MainThreadEditorService extends WithEventBus implements IMainThreadEditorsService { diff --git a/packages/extension/src/browser/vscode/api/main.thread.env.ts b/packages/extension/src/browser/vscode/api/main.thread.env.ts index 699c2a6476..daf4c07409 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.env.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.env.ts @@ -1,10 +1,8 @@ import type vscode from 'vscode'; + import { Injectable, Optional, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; -import { ILoggerManagerClient } from '@opensumi/ide-logs/lib/browser'; -import { IMainThreadEnv, IExtHostEnv, ExtHostAPIIdentifier } from '../../../common/vscode'; -import { UIKind, UriComponents } from '../../../common/vscode/ext-types'; import { IOpenerService, IClipboardService, @@ -12,8 +10,13 @@ import { IExternalUriService, AppConfig, } from '@opensumi/ide-core-browser'; -import { getLanguageId, URI, firstSessionDateStorageKey } from '@opensumi/ide-core-common'; import { HttpOpener } from '@opensumi/ide-core-browser/lib/opener/http-opener'; +import { getLanguageId, URI, firstSessionDateStorageKey } from '@opensumi/ide-core-common'; +import { ILoggerManagerClient } from '@opensumi/ide-logs/lib/browser'; + +import { IMainThreadEnv, IExtHostEnv, ExtHostAPIIdentifier } from '../../../common/vscode'; +import { UIKind, UriComponents } from '../../../common/vscode/ext-types'; + import { MainThreadStorage } from './main.thread.storage'; @Injectable({ multiple: true }) diff --git a/packages/extension/src/browser/vscode/api/main.thread.file-system-event.ts b/packages/extension/src/browser/vscode/api/main.thread.file-system-event.ts index 72d4e35482..e00b9ea03d 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.file-system-event.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.file-system-event.ts @@ -1,4 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { MessageType } from '@opensumi/ide-components'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { PreferenceService } from '@opensumi/ide-core-browser'; +import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; import { Disposable, URI, @@ -10,21 +14,18 @@ import { formatLocalize, } from '@opensumi/ide-core-common'; import { IFileServiceClient, FileChangeType } from '@opensumi/ide-file-service'; +import { ResourceEdit } from '@opensumi/ide-monaco/lib/browser/monaco-api'; +import { IDialogService } from '@opensumi/ide-overlay'; import { IBulkEditServiceShape, FileOperation, IWorkspaceFileOperationParticipant, IWorkspaceFileService, } from '@opensumi/ide-workspace-edit'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; -import { PreferenceService } from '@opensumi/ide-core-browser'; -import { IDialogService } from '@opensumi/ide-overlay'; -import { MessageType } from '@opensumi/ide-components'; -import { IExtHostFileSystemEvent, FileSystemEvents } from '../../../common/vscode/file-system'; import { ExtHostAPIIdentifier } from '../../../common/vscode'; -import { ResourceEdit } from '@opensumi/ide-monaco/lib/browser/monaco-api'; +import { IExtHostFileSystemEvent, FileSystemEvents } from '../../../common/vscode/file-system'; + @Injectable({ multiple: true }) export class MainThreadFileSystemEvent extends Disposable { diff --git a/packages/extension/src/browser/vscode/api/main.thread.file-system.ts b/packages/extension/src/browser/vscode/api/main.thread.file-system.ts index a6ed28dc1e..2c94702b95 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.file-system.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.file-system.ts @@ -1,7 +1,8 @@ -import { URI, IDisposable, Emitter, Event, Uri, dispose, Disposable } from '@opensumi/ide-core-common'; -import { ensureDir } from '@opensumi/ide-core-common/lib/browser-fs/ensure-dir'; import { Injectable, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { URI, IDisposable, Emitter, Event, Uri, dispose, Disposable } from '@opensumi/ide-core-common'; +import { ensureDir } from '@opensumi/ide-core-common/lib/browser-fs/ensure-dir'; +import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; import { FileChange, FileSystemProviderCapabilities, FileStat as IFileStat } from '@opensumi/ide-file-service'; import { IFileServiceClient, @@ -11,7 +12,9 @@ import { FileSystemProvider, IBrowserFileSystemRegistry, } from '@opensumi/ide-file-service/lib/common'; + import { ExtHostAPIIdentifier } from '../../../common/vscode'; +import { toFileStat, fromFileStat } from '../../../common/vscode/converter'; import { UriComponents } from '../../../common/vscode/ext-types'; import { IExtHostFileSystemShape, @@ -23,8 +26,6 @@ import { IExtHostFileSystemInfoShape, FilePermission, } from '../../../common/vscode/file-system'; -import { toFileStat, fromFileStat } from '../../../common/vscode/converter'; -import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; @Injectable({ multiple: true }) export class MainThreadFileSystem implements IMainThreadFileSystemShape { diff --git a/packages/extension/src/browser/vscode/api/main.thread.language.ts b/packages/extension/src/browser/vscode/api/main.thread.language.ts index 8f2dc5df7b..7f1b209a68 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.language.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.language.ts @@ -1,7 +1,6 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; -import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import { CancellationToken } from 'vscode'; +import { DocumentFilter } from 'vscode-languageserver-protocol'; + import { Autowired, Injectable, Optional } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { IReporterService, PreferenceService } from '@opensumi/ide-core-browser'; @@ -17,9 +16,23 @@ import { URI, } from '@opensumi/ide-core-common'; import { extname } from '@opensumi/ide-core-common/lib/path'; -import { ICallHierarchyService } from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy'; import { IEvaluatableExpressionService } from '@opensumi/ide-debug/lib/browser/editor/evaluatable-expression'; -import { DocumentFilter } from 'vscode-languageserver-protocol'; +import { InlineValuesProviderRegistry } from '@opensumi/ide-debug/lib/browser/editor/inline-values'; +import { InlineValueContext, InlineValuesProvider, InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; +import { ILanguageService } from '@opensumi/ide-editor'; +import { + IEditorDocumentModelService, + ILanguageStatus, + ILanguageStatusService, + LanguageSelector, +} from '@opensumi/ide-editor/lib/browser'; +import { ICallHierarchyService } from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy'; +import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; + + import { ExtHostAPIIdentifier, ICodeActionDto, @@ -34,6 +47,7 @@ import { testGlob, } from '../../../common/vscode'; import { fromLanguageSelector } from '../../../common/vscode/converter'; +import { UriComponents } from '../../../common/vscode/ext-types'; import { IExtensionDescription } from '../../../common/vscode/extension'; import { ILink, @@ -49,23 +63,15 @@ import { ResourceFileEditDto, ILinkDto, } from '../../../common/vscode/model.api'; -import { mixin, reviveIndentationRule, reviveOnEnterRules, reviveRegExp } from '../../../common/vscode/utils'; -import { UriComponents } from '../../../common/vscode/ext-types'; import { FoldingRangeProvider } from '../../../common/vscode/model.api'; -import { ILanguageService } from '@opensumi/ide-editor'; -import { - IEditorDocumentModelService, - ILanguageStatus, - ILanguageStatusService, - LanguageSelector, -} from '@opensumi/ide-editor/lib/browser'; +import { mixin, reviveIndentationRule, reviveOnEnterRules, reviveRegExp } from '../../../common/vscode/utils'; + + import { DocumentRangeSemanticTokensProviderImpl, DocumentSemanticTokensProvider, } from './semantic-tokens/semantic-token-provider'; -import { CancellationToken } from 'vscode'; -import { InlineValueContext, InlineValuesProvider, InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; -import { InlineValuesProviderRegistry } from '@opensumi/ide-debug/lib/browser/editor/inline-values'; + @Injectable({ multiple: true }) export class MainThreadLanguages implements IMainThreadLanguages { diff --git a/packages/extension/src/browser/vscode/api/main.thread.log.ts b/packages/extension/src/browser/vscode/api/main.thread.log.ts index 41d8f5c8bb..b0b5eee1a2 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.log.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.log.ts @@ -1,9 +1,11 @@ import { Injectable, Injector, Autowired } from '@opensumi/di'; -import { LogLevel } from '@opensumi/ide-core-common'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IMainThreadExtensionLog, MainThreadExtensionLogIdentifier } from '../../../common/extension-log'; +import { LogLevel } from '@opensumi/ide-core-common'; import { ILoggerManagerClient, SupportLogNamespace, ILogServiceClient } from '@opensumi/ide-logs/lib/browser'; +import { IMainThreadExtensionLog, MainThreadExtensionLogIdentifier } from '../../../common/extension-log'; + + @Injectable() export class MainThreadExtensionLog implements IMainThreadExtensionLog { @Autowired(ILoggerManagerClient) diff --git a/packages/extension/src/browser/vscode/api/main.thread.message.ts b/packages/extension/src/browser/vscode/api/main.thread.message.ts index bcff5725cd..fd2d3fd754 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.message.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.message.ts @@ -1,9 +1,11 @@ import type vscode from 'vscode'; -import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; -import { IMainThreadMessage, IExtHostMessage, ExtHostAPIIdentifier } from '../../../common/vscode'; + import { Injectable, Optional, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { MessageType } from '@opensumi/ide-core-common'; +import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; + +import { IMainThreadMessage, IExtHostMessage, ExtHostAPIIdentifier } from '../../../common/vscode'; @Injectable({ multiple: true }) export class MainThreadMessage implements IMainThreadMessage { diff --git a/packages/extension/src/browser/vscode/api/main.thread.output.ts b/packages/extension/src/browser/vscode/api/main.thread.output.ts index d0deccf036..adb2cb9478 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.output.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.output.ts @@ -1,8 +1,9 @@ -import { IMainThreadOutput } from '../../../common/vscode'; import { Injectable, Autowired } from '@opensumi/di'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; -import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; + +import { IMainThreadOutput } from '../../../common/vscode'; @Injectable({ multiple: true }) export class MainThreadOutput implements IMainThreadOutput { diff --git a/packages/extension/src/browser/vscode/api/main.thread.preference.ts b/packages/extension/src/browser/vscode/api/main.thread.preference.ts index 096c36ec8c..0e2f54fc2c 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.preference.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.preference.ts @@ -1,12 +1,5 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { - ExtHostAPIIdentifier, - IMainThreadPreference, - PreferenceData, - PreferenceChangeExt, -} from '../../../common/vscode'; import { Injectable, Optional, Autowired } from '@opensumi/di'; -import { ConfigurationTarget } from '../../../common/vscode'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { PreferenceService, PreferenceProviderProvider, @@ -14,8 +7,17 @@ import { DisposableCollection, PreferenceSchemaProvider, } from '@opensumi/ide-core-browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; import { FileStat } from '@opensumi/ide-file-service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { + ExtHostAPIIdentifier, + IMainThreadPreference, + PreferenceData, + PreferenceChangeExt, +} from '../../../common/vscode'; +import { ConfigurationTarget } from '../../../common/vscode'; + export function getPreferences( preferenceProviderProvider: PreferenceProviderProvider, diff --git a/packages/extension/src/browser/vscode/api/main.thread.quickopen.ts b/packages/extension/src/browser/vscode/api/main.thread.quickopen.ts index a5b93523fa..db790da826 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.quickopen.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.quickopen.ts @@ -1,10 +1,11 @@ -import { IMainThreadQuickOpen, IExtHostQuickOpen, ExtHostAPIIdentifier } from '../../../common/vscode'; import { Injectable, Optional, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Disposable } from '@opensumi/ide-core-browser'; +import { IQuickInputService } from '@opensumi/ide-core-browser/lib/quick-open'; import { QuickPickService, QuickPickItem, QuickPickOptions, QuickInputOptions } from '@opensumi/ide-quick-open'; import { QuickTitleBar } from '@opensumi/ide-quick-open/lib/browser/quick-title-bar'; -import { IQuickInputService } from '@opensumi/ide-core-browser/lib/quick-open'; -import { Disposable } from '@opensumi/ide-core-browser'; + +import { IMainThreadQuickOpen, IExtHostQuickOpen, ExtHostAPIIdentifier } from '../../../common/vscode'; @Injectable({ multiple: true }) export class MainThreadQuickOpen extends Disposable implements IMainThreadQuickOpen { diff --git a/packages/extension/src/browser/vscode/api/main.thread.scm.ts b/packages/extension/src/browser/vscode/api/main.thread.scm.ts index e1b25a50fb..f6ad6e047d 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.scm.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.scm.ts @@ -1,4 +1,6 @@ import { Injectable, Optional, Autowired } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { ILogger } from '@opensumi/ide-core-browser'; import { UriComponents, Uri as URI, @@ -9,7 +11,6 @@ import { CancellationToken, } from '@opensumi/ide-core-common'; import { Sequence, ISplice } from '@opensumi/ide-core-common/lib/sequence'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { ISCMRepository, ISCMProvider, @@ -19,9 +20,9 @@ import { IInputValidation, SCMService, } from '@opensumi/ide-scm/lib/common'; -import { ILogger } from '@opensumi/ide-core-browser'; import { ExtHostAPIIdentifier } from '../../../common/vscode'; +import { VSCommand } from '../../../common/vscode/model.api'; import { IExtHostSCMShape, SCMProviderFeatures, @@ -30,7 +31,6 @@ import { IMainThreadSCMShape, } from '../../../common/vscode/scm'; -import { VSCommand } from '../../../common/vscode/model.api'; class MainThreadSCMResourceGroup implements ISCMResourceGroup { readonly elements: ISCMResource[] = []; diff --git a/packages/extension/src/browser/vscode/api/main.thread.secret.ts b/packages/extension/src/browser/vscode/api/main.thread.secret.ts index 23e037de31..d1b865d8ef 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.secret.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.secret.ts @@ -1,9 +1,10 @@ import { Injectable, Autowired, Optional } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostAPIIdentifier, IMainThreadSecret, IExtHostSecret } from '../../../common/vscode'; import { AppConfig, ICredentialsService, Disposable } from '@opensumi/ide-core-browser'; import { ICryptrService } from '@opensumi/ide-core-browser/lib/services'; +import { ExtHostAPIIdentifier, IMainThreadSecret, IExtHostSecret } from '../../../common/vscode'; + @Injectable({ multiple: true }) export class MainThreadSecret extends Disposable implements IMainThreadSecret { private readonly _proxy: IExtHostSecret; diff --git a/packages/extension/src/browser/vscode/api/main.thread.statusbar.ts b/packages/extension/src/browser/vscode/api/main.thread.statusbar.ts index 25aff7ed81..115e8deb7d 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.statusbar.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.statusbar.ts @@ -1,12 +1,13 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IThemeColor } from '@opensumi/ide-core-common'; import { Injectable, Autowired, Optional } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { CommandService, Disposable, IAccessibilityInformation } from '@opensumi/ide-core-browser'; import { IStatusBarService, StatusBarAlignment, StatusBarEntry } from '@opensumi/ide-core-browser/lib/services'; -import * as types from '../../../common/vscode/ext-types'; -import { ExtHostAPIIdentifier, IMainThreadStatusBar, IExtHostStatusBar } from '../../../common/vscode'; +import { IThemeColor } from '@opensumi/ide-core-common'; import { getCodiconAriaLabel } from '@opensumi/monaco-editor-core/esm/vs/base/common/codicons'; +import { ExtHostAPIIdentifier, IMainThreadStatusBar, IExtHostStatusBar } from '../../../common/vscode'; +import * as types from '../../../common/vscode/ext-types'; + @Injectable({ multiple: true }) export class MainThreadStatusBar implements IMainThreadStatusBar { private disposable = new Disposable(); diff --git a/packages/extension/src/browser/vscode/api/main.thread.storage.ts b/packages/extension/src/browser/vscode/api/main.thread.storage.ts index 1a650eed0c..b402dff298 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.storage.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.storage.ts @@ -1,8 +1,9 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostAPIIdentifier, IMainThreadStorage, KeysToAnyValues, IExtHostStorage } from '../../../common/vscode'; import { Injectable, Autowired, Optional } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; +import { ExtHostAPIIdentifier, IMainThreadStorage, KeysToAnyValues, IExtHostStorage } from '../../../common/vscode'; + @Injectable({ multiple: true }) export class MainThreadStorage implements IMainThreadStorage { private readonly proxy: IExtHostStorage; diff --git a/packages/extension/src/browser/vscode/api/main.thread.tasks.ts b/packages/extension/src/browser/vscode/api/main.thread.tasks.ts index 0b8ac32a10..f2a2e757b9 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.tasks.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.tasks.ts @@ -1,26 +1,5 @@ import { Autowired, Injectable } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { - IMainThreadTasks, - IExtHostTasks, - RunOptionsDTO, - TaskPresentationOptionsDTO, - TaskDefinitionDTO, - ProcessExecutionOptionsDTO, - ShellExecutionDTO, - ProcessExecutionDTO, - CustomExecution2DTO, - CustomExecutionDTO, - TaskDTO, - ShellExecutionOptionsDTO, - TaskSourceDTO, - TaskFilterDTO, - TaskExecutionDTO, - TaskHandleDTO, - TaskProcessStartedDTO, - TaskProcessEndedDTO, -} from '../../../common/vscode/tasks'; -import { ExtHostAPIIdentifier } from '../../../common/vscode'; import { ILogger, IDisposable, @@ -35,7 +14,6 @@ import { } from '@opensumi/ide-core-common'; import { ITaskService, ITaskProvider, IWorkspaceFolder } from '@opensumi/ide-task/lib/common'; import { KeyedTaskIdentifier, TaskEventKind, TaskExecution } from '@opensumi/ide-task/lib/common/task'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; import { PresentationOptions, RunOptions, @@ -51,6 +29,29 @@ import { CustomTask, ContributedTask, } from '@opensumi/ide-task/lib/common/task'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { ExtHostAPIIdentifier } from '../../../common/vscode'; +import { + IMainThreadTasks, + IExtHostTasks, + RunOptionsDTO, + TaskPresentationOptionsDTO, + TaskDefinitionDTO, + ProcessExecutionOptionsDTO, + ShellExecutionDTO, + ProcessExecutionDTO, + CustomExecution2DTO, + CustomExecutionDTO, + TaskDTO, + ShellExecutionOptionsDTO, + TaskSourceDTO, + TaskFilterDTO, + TaskExecutionDTO, + TaskHandleDTO, + TaskProcessStartedDTO, + TaskProcessEndedDTO, +} from '../../../common/vscode/tasks'; namespace TaskHandleDTO { export function is(value: any): value is TaskHandleDTO { diff --git a/packages/extension/src/browser/vscode/api/main.thread.terminal.ts b/packages/extension/src/browser/vscode/api/main.thread.terminal.ts index 459a4568bc..2596230b73 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.terminal.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.terminal.ts @@ -1,4 +1,5 @@ import type vscode from 'vscode'; + import { Injectable, Optional, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { ILogger, Disposable, PreferenceService, IDisposable } from '@opensumi/ide-core-browser'; @@ -22,9 +23,10 @@ import { EnvironmentVariableServiceToken, } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; import { deserializeEnvironmentVariableCollection } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; -import { IMainThreadTerminal, IExtHostTerminal, ExtHostAPIIdentifier } from '../../../common/vscode'; import { ITerminalProfileService } from '@opensumi/ide-terminal-next/lib/common/profile'; +import { IMainThreadTerminal, IExtHostTerminal, ExtHostAPIIdentifier } from '../../../common/vscode'; + @Injectable({ multiple: true }) export class MainThreadTerminal implements IMainThreadTerminal { private readonly proxy: IExtHostTerminal; diff --git a/packages/extension/src/browser/vscode/api/main.thread.tests.ts b/packages/extension/src/browser/vscode/api/main.thread.tests.ts index cd23d46662..9eac8bcaa8 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.tests.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.tests.ts @@ -1,7 +1,7 @@ // eslint-disable no-console import { Injectable, Optional, Autowired } from '@opensumi/di'; -import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Logger } from '@opensumi/ide-core-browser'; import { CancellationToken, Disposable, @@ -10,6 +10,13 @@ import { URI, } from '@opensumi/ide-core-common'; import { ITestController, ITestService, TestServiceToken } from '@opensumi/ide-testing'; +import { ITestProfileService, TestProfileServiceToken } from '@opensumi/ide-testing/lib/common/test-profile'; +import { + ITestResult, + ITestResultService, + TestResultImpl, + TestResultServiceToken, +} from '@opensumi/ide-testing/lib/common/test-result'; import { ITestRunProfile, ResolvedTestRunRequest, @@ -22,16 +29,9 @@ import { ITestItem, TestDiffOpType, } from '@opensumi/ide-testing/lib/common/testCollection'; -import { ITestProfileService, TestProfileServiceToken } from '@opensumi/ide-testing/lib/common/test-profile'; +import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; import { ExtHostAPIIdentifier, IExtHostTests, IMainThreadTesting } from '../../../common/vscode'; -import { - ITestResult, - ITestResultService, - TestResultImpl, - TestResultServiceToken, -} from '@opensumi/ide-testing/lib/common/test-result'; -import { Logger } from '@opensumi/ide-core-browser'; const reviveDiff = (diff: TestsDiff) => { for (const entry of diff) { diff --git a/packages/extension/src/browser/vscode/api/main.thread.theming.ts b/packages/extension/src/browser/vscode/api/main.thread.theming.ts index 822c011923..e5b46424eb 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.theming.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.theming.ts @@ -1,9 +1,11 @@ -import { IMainThreadTheming, IExtHostTheming } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { Autowired, Injectable, Optional } from '@opensumi/di'; -import { ExtHostAPIIdentifier } from '../../../common/vscode'; -import { IThemeService } from '@opensumi/ide-theme'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { IDisposable } from '@opensumi/ide-core-common'; +import { IThemeService } from '@opensumi/ide-theme'; + +import { IMainThreadTheming, IExtHostTheming } from '../../../common/vscode'; +import { ExtHostAPIIdentifier } from '../../../common/vscode'; + @Injectable({ multiple: true }) export class MainThreadTheming implements IMainThreadTheming { diff --git a/packages/extension/src/browser/vscode/api/main.thread.treeview.ts b/packages/extension/src/browser/vscode/api/main.thread.treeview.ts index d7cbcb50de..65efd044de 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.treeview.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.treeview.ts @@ -1,8 +1,6 @@ -import { IRPCProtocol } from '@opensumi/ide-connection'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector, Optional } from '@opensumi/di'; -import { TreeViewItem, TreeViewBaseOptions, ITreeViewRevealOptions } from '../../../common/vscode'; -import { TreeItemCollapsibleState } from '../../../common/vscode/ext-types'; -import { IMainThreadTreeView, IExtHostTreeView, ExtHostAPIIdentifier } from '../../../common/vscode'; +import { Tree, ITreeNodeOrCompositeTreeNode } from '@opensumi/ide-components'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, Event, @@ -19,12 +17,6 @@ import { CancellationTokenSource, WithEventBus, } from '@opensumi/ide-core-browser'; -import { IMainLayoutService, ViewCollapseChangedEvent } from '@opensumi/ide-main-layout'; -import { ExtensionTabBarTreeView } from '../../components'; -import { IIconService, IconType, IThemeService } from '@opensumi/ide-theme'; -import { ExtensionTreeViewModel } from './tree-view/tree-view.model.service'; -import { ExtensionCompositeTreeNode, ExtensionTreeRoot, ExtensionTreeNode } from './tree-view/tree-view.node.defined'; -import { Tree, ITreeNodeOrCompositeTreeNode } from '@opensumi/ide-components'; import { AbstractMenuService, generateCtxMenu, @@ -32,8 +24,20 @@ import { MenuId, MenuNode, } from '@opensumi/ide-core-browser/lib/menu/next'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { IMainLayoutService, ViewCollapseChangedEvent } from '@opensumi/ide-main-layout'; +import { IIconService, IconType, IThemeService } from '@opensumi/ide-theme'; + +import { TreeViewItem, TreeViewBaseOptions, ITreeViewRevealOptions } from '../../../common/vscode'; +import { IMainThreadTreeView, IExtHostTreeView, ExtHostAPIIdentifier } from '../../../common/vscode'; +import { TreeItemCollapsibleState } from '../../../common/vscode/ext-types'; +import { ExtensionTabBarTreeView } from '../../components'; + + +import { ExtensionTreeViewModel } from './tree-view/tree-view.model.service'; +import { ExtensionCompositeTreeNode, ExtensionTreeRoot, ExtensionTreeNode } from './tree-view/tree-view.node.defined'; + @Injectable({ multiple: true }) export class MainThreadTreeView extends WithEventBus implements IMainThreadTreeView { diff --git a/packages/extension/src/browser/vscode/api/main.thread.urls.ts b/packages/extension/src/browser/vscode/api/main.thread.urls.ts index 68ce93c3cc..c0e272bcf7 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.urls.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.urls.ts @@ -1,6 +1,5 @@ import { Injectable, Optional, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IMainThreadUrls, IExtHostUrls, ExtHostAPIIdentifier } from '../../../common/vscode'; import { IOpenerService, IDisposable, @@ -10,6 +9,8 @@ import { ILogger, AppConfig, } from '@opensumi/ide-core-browser'; + +import { IMainThreadUrls, IExtHostUrls, ExtHostAPIIdentifier } from '../../../common/vscode'; import { IActivationEventService } from '../../types'; class ExtennsionUrlHandler { diff --git a/packages/extension/src/browser/vscode/api/main.thread.window-state.ts b/packages/extension/src/browser/vscode/api/main.thread.window-state.ts index 9af8b8821c..300a6183c4 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.window-state.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.window-state.ts @@ -1,6 +1,7 @@ +import { Optional, Injectable } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; + import { ExtHostAPIIdentifier, IExtHostWindowState } from '../../../common/vscode'; -import { Optional, Injectable } from '@opensumi/di'; @Injectable({ multiple: true }) export class MainThreadWindowState { diff --git a/packages/extension/src/browser/vscode/api/main.thread.window.ts b/packages/extension/src/browser/vscode/api/main.thread.window.ts index a6da63e35e..2933148778 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.window.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.window.ts @@ -1,4 +1,8 @@ +import { Optional, Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { URI } from '@opensumi/ide-core-browser'; +import { IDialogService, IWindowDialogService, IOpenDialogOptions, ISaveDialogOptions } from '@opensumi/ide-overlay'; + import { ExtHostAPIIdentifier, IMainThreadWindow, @@ -6,9 +10,6 @@ import { IExtOpenDialogOptions, IExtSaveDialogOptions, } from '../../../common/vscode'; -import { Optional, Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { URI } from '@opensumi/ide-core-browser'; -import { IDialogService, IWindowDialogService, IOpenDialogOptions, ISaveDialogOptions } from '@opensumi/ide-overlay'; @Injectable({ multiple: true }) export class MainThreadWindow implements IMainThreadWindow { diff --git a/packages/extension/src/browser/vscode/api/main.thread.workspace.ts b/packages/extension/src/browser/vscode/api/main.thread.workspace.ts index fb12b5474b..3a44d64e31 100644 --- a/packages/extension/src/browser/vscode/api/main.thread.workspace.ts +++ b/packages/extension/src/browser/vscode/api/main.thread.workspace.ts @@ -1,4 +1,13 @@ +import { Injectable, Optional, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { URI, ILogger, WithEventBus, OnEvent, CancellationToken } from '@opensumi/ide-core-browser'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; +import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common'; +import { FileStat } from '@opensumi/ide-file-service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { IWorkspaceEditService, WorkspaceEditDidRenameFileEvent } from '@opensumi/ide-workspace-edit'; + import { ExtHostAPIIdentifier, IMainThreadWorkspace, @@ -6,14 +15,6 @@ import { IExtHostWorkspace, reviveWorkspaceEditDto, } from '../../../common/vscode'; -import { Injectable, Optional, Autowired } from '@opensumi/di'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { FileStat } from '@opensumi/ide-file-service'; -import { URI, ILogger, WithEventBus, OnEvent, CancellationToken } from '@opensumi/ide-core-browser'; -import { IExtensionStorageService } from '@opensumi/ide-extension-storage'; -import { IWorkspaceEditService, WorkspaceEditDidRenameFileEvent } from '@opensumi/ide-workspace-edit'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common'; import type * as model from '../../../common/vscode/model.api'; @Injectable({ multiple: true }) diff --git a/packages/extension/src/browser/vscode/api/semantic-tokens/semantic-token-provider.ts b/packages/extension/src/browser/vscode/api/semantic-tokens/semantic-token-provider.ts index 1f8dfe0fc3..d4f87b6552 100644 --- a/packages/extension/src/browser/vscode/api/semantic-tokens/semantic-token-provider.ts +++ b/packages/extension/src/browser/vscode/api/semantic-tokens/semantic-token-provider.ts @@ -1,6 +1,6 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import * as model from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { IExtHostLanguages } from '../../../../common/vscode/languages'; import { decodeSemanticTokensDto } from '../../../../common/vscode/semantic-tokens'; diff --git a/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.service.ts b/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.service.ts index 7a93a35453..8ca95a6b80 100644 --- a/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.service.ts +++ b/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.service.ts @@ -19,11 +19,6 @@ import { ThrottledDelayer, CommandService, } from '@opensumi/ide-core-browser'; -import { ExtensionCompositeTreeNode, ExtensionTreeNode, ExtensionTreeRoot } from './tree-view.node.defined'; -import styles from './tree-view-node.module.less'; -import { ExtensionTreeModel } from './tree-view.model'; -import { ITreeViewRevealOptions, TreeViewBaseOptions, TreeViewItem } from '../../../../common/vscode'; -import { TreeViewDataProvider } from '../main.thread.treeview'; import { AbstractMenuService, ICtxMenuRenderer, @@ -32,6 +27,13 @@ import { } from '@opensumi/ide-core-browser/lib/menu/next'; import { isUndefinedOrNull, isNumber } from '@opensumi/ide-core-common'; +import { ITreeViewRevealOptions, TreeViewBaseOptions, TreeViewItem } from '../../../../common/vscode'; +import { TreeViewDataProvider } from '../main.thread.treeview'; + +import styles from './tree-view-node.module.less'; +import { ExtensionTreeModel } from './tree-view.model'; +import { ExtensionCompositeTreeNode, ExtensionTreeNode, ExtensionTreeRoot } from './tree-view.node.defined'; + export const IExtensionTreeViewModel = Symbol('IExtensionTreeViewModel'); export const ITreeViewId = Symbol('ITreeViewId'); diff --git a/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.ts b/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.ts index 658db18953..3511f11c8b 100644 --- a/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.ts +++ b/packages/extension/src/browser/vscode/api/tree-view/tree-view.model.ts @@ -1,6 +1,7 @@ import { Injectable, Optional } from '@opensumi/di'; import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; + import { ExtensionTreeRoot } from './tree-view.node.defined'; @Injectable({ multiple: true }) diff --git a/packages/extension/src/browser/vscode/api/tree-view/tree-view.node.defined.ts b/packages/extension/src/browser/vscode/api/tree-view/tree-view.node.defined.ts index 9c9f38e072..b056c1b1d8 100644 --- a/packages/extension/src/browser/vscode/api/tree-view/tree-view.node.defined.ts +++ b/packages/extension/src/browser/vscode/api/tree-view/tree-view.node.defined.ts @@ -1,9 +1,10 @@ import { TreeNode, CompositeTreeNode, ITree } from '@opensumi/ide-components'; -import { TreeViewDataProvider } from '../main.thread.treeview'; -import { ICommand } from '../../../../common/vscode/models'; import { MenuNode } from '@opensumi/ide-core-browser/lib/menu/next'; import { IAccessibilityInformation } from '@opensumi/ide-core-common'; + import { ITreeItemLabel } from '../../../../common/vscode'; +import { ICommand } from '../../../../common/vscode/models'; +import { TreeViewDataProvider } from '../main.thread.treeview'; export class ExtensionTreeRoot extends CompositeTreeNode { public static is(node: any): node is ExtensionTreeRoot { diff --git a/packages/extension/src/browser/vscode/builtin-commands.ts b/packages/extension/src/browser/vscode/builtin-commands.ts index 66ea33fa99..ebba8586cc 100644 --- a/packages/extension/src/browser/vscode/builtin-commands.ts +++ b/packages/extension/src/browser/vscode/builtin-commands.ts @@ -1,6 +1,6 @@ -import { TERMINAL_COMMANDS } from '@opensumi/ide-terminal-next'; import { FILE_COMMANDS, Command, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; import { DEBUG_COMMANDS } from '@opensumi/ide-debug/lib/browser/debug-contribution'; +import { TERMINAL_COMMANDS } from '@opensumi/ide-terminal-next'; /** * 插件进程内置 command 的命名空间 diff --git a/packages/extension/src/browser/vscode/contributes/actions.ts b/packages/extension/src/browser/vscode/contributes/actions.ts index abc37f4846..ba8cb33881 100644 --- a/packages/extension/src/browser/vscode/contributes/actions.ts +++ b/packages/extension/src/browser/vscode/contributes/actions.ts @@ -1,11 +1,12 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; -import { IToolBarViewService } from '@opensumi/ide-toolbar/lib/browser'; import { getIcon, CommandService } from '@opensumi/ide-core-browser'; import { IToolbarActionService, IToolbarActionGroup, } from '@opensumi/ide-core-browser/lib/menu/next/toolbar-action.service'; +import { IToolBarViewService } from '@opensumi/ide-toolbar/lib/browser'; + +import { VSCodeContributePoint, Contributes } from '../../../common'; export interface ActionContribution { type: 'action'; diff --git a/packages/extension/src/browser/vscode/contributes/breakpoints.ts b/packages/extension/src/browser/vscode/contributes/breakpoints.ts index f1cadfcb37..55667cff43 100644 --- a/packages/extension/src/browser/vscode/contributes/breakpoints.ts +++ b/packages/extension/src/browser/vscode/contributes/breakpoints.ts @@ -1,7 +1,8 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { DebugConfigurationManager } from '@opensumi/ide-debug/lib/browser'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + export interface BreakpointsContributionScheme { language: string; } diff --git a/packages/extension/src/browser/vscode/contributes/color.ts b/packages/extension/src/browser/vscode/contributes/color.ts index 18e645991c..3da6cc68e9 100644 --- a/packages/extension/src/browser/vscode/contributes/color.ts +++ b/packages/extension/src/browser/vscode/contributes/color.ts @@ -1,8 +1,9 @@ // import { VscodeContributionPoint, Contributes } from './common'; -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; -import { ExtColorContribution, IThemeService } from '@opensumi/ide-theme'; import { replaceLocalizePlaceholder, localize } from '@opensumi/ide-core-browser'; +import { ExtColorContribution, IThemeService } from '@opensumi/ide-theme'; + +import { VSCodeContributePoint, Contributes } from '../../../common'; export type ColorsSchema = Array; const colorIdPattern = '^\\w+[.\\w+]*$'; diff --git a/packages/extension/src/browser/vscode/contributes/commands.ts b/packages/extension/src/browser/vscode/contributes/commands.ts index 4d08dbba75..ad33bf6576 100644 --- a/packages/extension/src/browser/vscode/contributes/commands.ts +++ b/packages/extension/src/browser/vscode/contributes/commands.ts @@ -1,8 +1,9 @@ -import { VSCodeContributePoint, Contributes, ExtensionService, IExtCommandManagement } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { CommandRegistry, AppConfig } from '@opensumi/ide-core-browser'; import { ThemeType, IIconService, IconType } from '@opensumi/ide-theme'; +import { VSCodeContributePoint, Contributes, ExtensionService, IExtCommandManagement } from '../../../common'; + export interface CommandFormat { command: string; diff --git a/packages/extension/src/browser/vscode/contributes/common.ts b/packages/extension/src/browser/vscode/contributes/common.ts index 2730bd07c5..bdfde8491d 100644 --- a/packages/extension/src/browser/vscode/contributes/common.ts +++ b/packages/extension/src/browser/vscode/contributes/common.ts @@ -1,6 +1,7 @@ -import { IExtension, JSONType } from '../../../common'; import { Disposable } from '@opensumi/ide-core-common'; +import { IExtension, JSONType } from '../../../common'; + export const CONTRIBUTE_NAME_KEY = 'contribute_name'; export abstract class VscodeContributionPoint extends Disposable { constructor(protected json: T, protected contributes: any, protected extension: IExtension) { diff --git a/packages/extension/src/browser/vscode/contributes/configuration.ts b/packages/extension/src/browser/vscode/contributes/configuration.ts index bf7246aaf3..c3441fc44d 100644 --- a/packages/extension/src/browser/vscode/contributes/configuration.ts +++ b/packages/extension/src/browser/vscode/contributes/configuration.ts @@ -1,4 +1,3 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { replaceLocalizePlaceholder, @@ -9,6 +8,8 @@ import { PreferenceService, } from '@opensumi/ide-core-browser'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + export interface ConfigurationSnippets { body: { title: string; diff --git a/packages/extension/src/browser/vscode/contributes/configurationDefaults.ts b/packages/extension/src/browser/vscode/contributes/configurationDefaults.ts index 26b4b283f5..feffcdbbc1 100644 --- a/packages/extension/src/browser/vscode/contributes/configurationDefaults.ts +++ b/packages/extension/src/browser/vscode/contributes/configurationDefaults.ts @@ -1,4 +1,3 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { PreferenceSchemaProperties, @@ -7,6 +6,8 @@ import { PreferenceScope, } from '@opensumi/ide-core-browser'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + export interface ConfigurationSnippets { body: { title: string; diff --git a/packages/extension/src/browser/vscode/contributes/customEditors.tsx b/packages/extension/src/browser/vscode/contributes/customEditors.tsx index 4e8b418096..0d06bfa921 100644 --- a/packages/extension/src/browser/vscode/contributes/customEditors.tsx +++ b/packages/extension/src/browser/vscode/contributes/customEditors.tsx @@ -1,12 +1,14 @@ -import { VSCodeContributePoint, Contributes, ExtensionService } from '../../../common'; -import { Injectable, Autowired } from '@opensumi/di'; -import { EditorComponentRegistry, ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; -import { ICustomEditorOptions, CUSTOM_EDITOR_SCHEME } from '../../../common/vscode'; import React = require('react'); + +import { Injectable, Autowired } from '@opensumi/di'; import { useInjectable, IEventBus } from '@opensumi/ide-core-browser'; -import { IActivationEventService } from '../../types'; import { CancellationTokenSource, Disposable, ILogger } from '@opensumi/ide-core-common'; +import { EditorComponentRegistry, ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; import { IWebviewService } from '@opensumi/ide-webview'; +import { WebviewMounter } from '@opensumi/ide-webview/lib/browser/editor-webview'; + +import { VSCodeContributePoint, Contributes, ExtensionService } from '../../../common'; +import { ICustomEditorOptions, CUSTOM_EDITOR_SCHEME } from '../../../common/vscode'; import { CustomEditorScheme, CustomEditorShouldDisplayEvent, @@ -16,8 +18,8 @@ import { CustomEditorShouldRevertEvent, CustomEditorShouldEditEvent, } from '../../../common/vscode/custom-editor'; -import { WebviewMounter } from '@opensumi/ide-webview/lib/browser/editor-webview'; import { match } from '../../../common/vscode/glob'; +import { IActivationEventService } from '../../types'; @Injectable() @Contributes('customEditors') diff --git a/packages/extension/src/browser/vscode/contributes/debuggers.ts b/packages/extension/src/browser/vscode/contributes/debuggers.ts index 26a80fd042..bfd6aeea06 100644 --- a/packages/extension/src/browser/vscode/contributes/debuggers.ts +++ b/packages/extension/src/browser/vscode/contributes/debuggers.ts @@ -1,10 +1,11 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { replaceLocalizePlaceholder } from '@opensumi/ide-core-browser'; import { IJSONSchema, IJSONSchemaSnippet, deepClone, localize, IJSONSchemaMap } from '@opensumi/ide-core-common'; import { IDebugService, IDebuggerContribution } from '@opensumi/ide-debug'; import { DebugConfigurationManager, DebugSchemaUpdater } from '@opensumi/ide-debug/lib/browser'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + const INTERNAL_CONSOLE_OPTIONS_SCHEMA = { enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'], default: 'openOnFirstSessionStart', diff --git a/packages/extension/src/browser/vscode/contributes/grammar.ts b/packages/extension/src/browser/vscode/contributes/grammar.ts index 13d0e98b8e..344e0e1a31 100644 --- a/packages/extension/src/browser/vscode/contributes/grammar.ts +++ b/packages/extension/src/browser/vscode/contributes/grammar.ts @@ -1,9 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { GrammarsContribution } from '@opensumi/ide-monaco'; import { localize, URI, Disposable } from '@opensumi/ide-core-common'; +import { GrammarsContribution } from '@opensumi/ide-monaco'; +import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; import { VSCodeContributePoint, Contributes } from '../../../common'; -import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; export type GrammarSchema = Array; diff --git a/packages/extension/src/browser/vscode/contributes/icon.ts b/packages/extension/src/browser/vscode/contributes/icon.ts index 653be5f1e8..76b31bf7ea 100644 --- a/packages/extension/src/browser/vscode/contributes/icon.ts +++ b/packages/extension/src/browser/vscode/contributes/icon.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { ThemeContribution, IIconService } from '@opensumi/ide-theme'; import { URI } from '@opensumi/ide-core-common'; +import { ThemeContribution, IIconService } from '@opensumi/ide-theme'; + import { VSCodeContributePoint, Contributes } from '../../../common'; export type ThemesSchema = Array; diff --git a/packages/extension/src/browser/vscode/contributes/index.ts b/packages/extension/src/browser/vscode/contributes/index.ts index a9cbf906bd..89940df364 100644 --- a/packages/extension/src/browser/vscode/contributes/index.ts +++ b/packages/extension/src/browser/vscode/contributes/index.ts @@ -9,36 +9,37 @@ import { WithEventBus, IEventBus, } from '@opensumi/ide-core-browser'; + import { IExtensionMetaData, VSCodeContributePoint, CONTRIBUTE_NAME_KEY } from '../../../common'; +import { CustomEditorScheme } from '../../../common/vscode/custom-editor'; import { ExtensionWillContributeEvent } from '../../types'; +import { ActionContributionSchema, ActionsContributionPoint } from './actions'; +import { BreakpointsContributionScheme, BreakpointsContributionPoint } from './breakpoints'; +import { ColorsSchema, ColorsContributionPoint } from './color'; import { CommandsSchema, CommandsContributionPoint } from './commands'; -import { ThemesSchema, ThemesContributionPoint } from './theme'; -import { LanguagesSchema, LanguagesContributionPoint } from './language'; -import { GrammarsContributionPoint, GrammarSchema } from './grammar'; import { ConfigurationContributionPoint } from './configuration'; import { ConfigurationDefaultsContributionPoint } from './configurationDefaults'; -import { ColorsSchema, ColorsContributionPoint } from './color'; -import { LocalizationsContributionPoint } from './localization'; -import { KeybindingSchema, KeybindingContributionPoint } from './keybindings'; -import { MenusContributionPoint, SubmenusContributionPoint } from './menu'; -import { SnippetSchema, SnippetsContributionPoint } from './snippets'; -import { ViewContainersSchema, ViewContainersContributionPoint } from './view-containers'; -import { ViewsSchema, ViewsContributionPoint } from './views'; +import { CustomEditorContributionPoint } from './customEditors'; import { DebuggersContributionScheme, DebuggersContributionPoint } from './debuggers'; -import { BreakpointsContributionScheme, BreakpointsContributionPoint } from './breakpoints'; +import { GrammarsContributionPoint, GrammarSchema } from './grammar'; import { IconThemesContributionPoint } from './icon'; -import { ActionContributionSchema, ActionsContributionPoint } from './actions'; -import { ITaskDefinitionSchema, TaskDefinitionContributionPoint } from './taskDefinition'; -import { ProblemPatterns, ProblemPatternsContributionPoint } from './problemPatterns'; +import { KeybindingSchema, KeybindingContributionPoint } from './keybindings'; +import { LanguagesSchema, LanguagesContributionPoint } from './language'; +import { LocalizationsContributionPoint } from './localization'; +import { MenusContributionPoint, SubmenusContributionPoint } from './menu'; import { ProblemMatchersContributions, ProblemMatchersContributionPoint } from './problemMatchers'; -import { CustomEditorContributionPoint } from './customEditors'; -import { CustomEditorScheme } from '../../../common/vscode/custom-editor'; -import { ViewsWelcomeContributionPoint } from './views-welcome'; +import { ProblemPatterns, ProblemPatternsContributionPoint } from './problemPatterns'; import { SemanticTokenModifiersContributionPoint } from './semanticTokenModifiers'; import { SemanticTokenScopesContributionPoint } from './semanticTokenScopes'; import { SemanticTokenTypesContributionPoint } from './semanticTokenTypes'; +import { SnippetSchema, SnippetsContributionPoint } from './snippets'; +import { ITaskDefinitionSchema, TaskDefinitionContributionPoint } from './taskDefinition'; import { TerminalContributionPoint } from './terminal'; +import { ThemesSchema, ThemesContributionPoint } from './theme'; +import { ViewContainersSchema, ViewContainersContributionPoint } from './view-containers'; +import { ViewsSchema, ViewsContributionPoint } from './views'; +import { ViewsWelcomeContributionPoint } from './views-welcome'; export const EXTENSION_IDENTIFIER_PATTERN = '^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$'; diff --git a/packages/extension/src/browser/vscode/contributes/keybindings.ts b/packages/extension/src/browser/vscode/contributes/keybindings.ts index 54b007e77b..28d7d4f03a 100644 --- a/packages/extension/src/browser/vscode/contributes/keybindings.ts +++ b/packages/extension/src/browser/vscode/contributes/keybindings.ts @@ -1,8 +1,9 @@ -import { Injectable, Autowired } from '@opensumi/di'; // import { VscodeContributionPoint, Contributes } from './common'; -import { VSCodeContributePoint, Contributes } from '../../../common'; +import { Injectable, Autowired } from '@opensumi/di'; import { KeybindingRegistry, OS, Keybinding, KeybindingWeight } from '@opensumi/ide-core-browser'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + export interface ContributedKeyBinding { command: string; args?: any; diff --git a/packages/extension/src/browser/vscode/contributes/language.ts b/packages/extension/src/browser/vscode/contributes/language.ts index 6ca009bb71..15f4e9a4b4 100644 --- a/packages/extension/src/browser/vscode/contributes/language.ts +++ b/packages/extension/src/browser/vscode/contributes/language.ts @@ -1,9 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { LanguagesContribution } from '@opensumi/ide-monaco'; import { localize, URI } from '@opensumi/ide-core-common'; +import { LanguagesContribution } from '@opensumi/ide-monaco'; +import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; import { VSCodeContributePoint, Contributes } from '../../../common'; -import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; export type LanguagesSchema = Array; diff --git a/packages/extension/src/browser/vscode/contributes/localization.ts b/packages/extension/src/browser/vscode/contributes/localization.ts index d917bc83e8..4a5d004b7d 100644 --- a/packages/extension/src/browser/vscode/contributes/localization.ts +++ b/packages/extension/src/browser/vscode/contributes/localization.ts @@ -8,8 +8,8 @@ import { getLanguageId, } from '@opensumi/ide-core-browser'; import { Path } from '@opensumi/ide-core-common/lib/path'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { IExtensionStoragePathServer } from '@opensumi/ide-extension-storage'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { VSCodeContributePoint, diff --git a/packages/extension/src/browser/vscode/contributes/menu.ts b/packages/extension/src/browser/vscode/contributes/menu.ts index b931eec569..95a47ff15c 100644 --- a/packages/extension/src/browser/vscode/contributes/menu.ts +++ b/packages/extension/src/browser/vscode/contributes/menu.ts @@ -10,11 +10,11 @@ import { localize, } from '@opensumi/ide-core-browser'; import { ToolbarRegistry } from '@opensumi/ide-core-browser/lib/layout'; -import { ThemeType } from '@opensumi/ide-theme'; -import { IconType, IIconService } from '@opensumi/ide-theme/lib/common/theme.service'; import { IMenuRegistry, MenuId, IMenuItem, ISubmenuItem } from '@opensumi/ide-core-browser/lib/menu/next'; -import { IEditorActionRegistry } from '@opensumi/ide-editor/lib/browser'; import { IEditorGroup } from '@opensumi/ide-editor'; +import { IEditorActionRegistry } from '@opensumi/ide-editor/lib/browser'; +import { ThemeType } from '@opensumi/ide-theme'; +import { IconType, IIconService } from '@opensumi/ide-theme/lib/common/theme.service'; import { VSCodeContributePoint, Contributes } from '../../../common'; diff --git a/packages/extension/src/browser/vscode/contributes/problemMatchers.ts b/packages/extension/src/browser/vscode/contributes/problemMatchers.ts index 062116a7be..15f16de5b4 100644 --- a/packages/extension/src/browser/vscode/contributes/problemMatchers.ts +++ b/packages/extension/src/browser/vscode/contributes/problemMatchers.ts @@ -6,7 +6,9 @@ import { localize, deepClone, } from '@opensumi/ide-core-common'; + import { VSCodeContributePoint } from '../../../common'; + import { Contributes } from './common'; import { PatternSchemas } from './problemPatterns'; diff --git a/packages/extension/src/browser/vscode/contributes/problemPatterns.ts b/packages/extension/src/browser/vscode/contributes/problemPatterns.ts index 834c8bb3ae..0afa983c33 100644 --- a/packages/extension/src/browser/vscode/contributes/problemPatterns.ts +++ b/packages/extension/src/browser/vscode/contributes/problemPatterns.ts @@ -6,6 +6,7 @@ import { deepClone, localize, } from '@opensumi/ide-core-common'; + import { VSCodeContributePoint, Contributes } from '../../../common'; export namespace PatternSchemas { diff --git a/packages/extension/src/browser/vscode/contributes/semanticTokenModifiers.ts b/packages/extension/src/browser/vscode/contributes/semanticTokenModifiers.ts index 1fef0439c1..042da59823 100644 --- a/packages/extension/src/browser/vscode/contributes/semanticTokenModifiers.ts +++ b/packages/extension/src/browser/vscode/contributes/semanticTokenModifiers.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { ILogger } from '@opensumi/ide-core-common'; import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; + import { VSCodeContributePoint, Contributes, diff --git a/packages/extension/src/browser/vscode/contributes/semanticTokenScopes.ts b/packages/extension/src/browser/vscode/contributes/semanticTokenScopes.ts index 72e3305f20..0759038ec1 100644 --- a/packages/extension/src/browser/vscode/contributes/semanticTokenScopes.ts +++ b/packages/extension/src/browser/vscode/contributes/semanticTokenScopes.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { ILogger } from '@opensumi/ide-core-common/lib/log'; import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; + import { VSCodeContributePoint, Contributes, SemanticTokenScopesSchema } from '../../../common'; @Injectable() diff --git a/packages/extension/src/browser/vscode/contributes/semanticTokenTypes.ts b/packages/extension/src/browser/vscode/contributes/semanticTokenTypes.ts index 54e797387d..b73c9873ea 100644 --- a/packages/extension/src/browser/vscode/contributes/semanticTokenTypes.ts +++ b/packages/extension/src/browser/vscode/contributes/semanticTokenTypes.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { ILogger } from '@opensumi/ide-core-browser/lib/logger'; import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; + import { VSCodeContributePoint, Contributes, SemanticTokenTypeSchema, validateTypeOrModifier } from '../../../common'; @Injectable() diff --git a/packages/extension/src/browser/vscode/contributes/snippets.ts b/packages/extension/src/browser/vscode/contributes/snippets.ts index 1ace03f1b4..8642ca1794 100644 --- a/packages/extension/src/browser/vscode/contributes/snippets.ts +++ b/packages/extension/src/browser/vscode/contributes/snippets.ts @@ -1,7 +1,8 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { MonacoSnippetSuggestProvider } from '@opensumi/ide-monaco/lib/browser/monaco-snippet-suggest-provider'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + export interface SnippetContribution { path: string; source: string; diff --git a/packages/extension/src/browser/vscode/contributes/taskDefinition.ts b/packages/extension/src/browser/vscode/contributes/taskDefinition.ts index 705a1635ac..009c29c2fa 100644 --- a/packages/extension/src/browser/vscode/contributes/taskDefinition.ts +++ b/packages/extension/src/browser/vscode/contributes/taskDefinition.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { ITaskDefinitionRegistry } from '@opensumi/ide-core-common'; import { IJSONSchema, IJSONSchemaMap, localize, ILogger } from '@opensumi/ide-core-browser'; +import { ITaskDefinitionRegistry } from '@opensumi/ide-core-common'; + import { VSCodeContributePoint, Contributes } from '../../../common'; export const taskDefinitionSchema: IJSONSchema = { diff --git a/packages/extension/src/browser/vscode/contributes/terminal.ts b/packages/extension/src/browser/vscode/contributes/terminal.ts index 4e6c2cd39d..f820886cd4 100644 --- a/packages/extension/src/browser/vscode/contributes/terminal.ts +++ b/packages/extension/src/browser/vscode/contributes/terminal.ts @@ -1,8 +1,9 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; import { localize } from '@opensumi/ide-core-common'; import { ITerminalContributions, ITerminalContributionService } from '@opensumi/ide-terminal-next/lib/common'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + @Injectable() @Contributes('terminal') export class TerminalContributionPoint extends VSCodeContributePoint { diff --git a/packages/extension/src/browser/vscode/contributes/theme.ts b/packages/extension/src/browser/vscode/contributes/theme.ts index d693b0562d..256dd73642 100644 --- a/packages/extension/src/browser/vscode/contributes/theme.ts +++ b/packages/extension/src/browser/vscode/contributes/theme.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { ThemeContribution, IThemeService } from '@opensumi/ide-theme'; import { URI } from '@opensumi/ide-core-common'; +import { ThemeContribution, IThemeService } from '@opensumi/ide-theme'; + import { VSCodeContributePoint, Contributes } from '../../../common'; export type ThemesSchema = Array; diff --git a/packages/extension/src/browser/vscode/contributes/view-containers.ts b/packages/extension/src/browser/vscode/contributes/view-containers.ts index d4cac934d5..064cd5a021 100644 --- a/packages/extension/src/browser/vscode/contributes/view-containers.ts +++ b/packages/extension/src/browser/vscode/contributes/view-containers.ts @@ -1,9 +1,10 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { DisposableCollection } from '@opensumi/ide-core-common'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { IIconService } from '@opensumi/ide-theme'; +import { VSCodeContributePoint, Contributes } from '../../../common'; + export interface ViewContainersContribution { [key: string]: ViewContainerItem; } diff --git a/packages/extension/src/browser/vscode/contributes/views-welcome.ts b/packages/extension/src/browser/vscode/contributes/views-welcome.ts index 27200aefac..4060f13d7a 100644 --- a/packages/extension/src/browser/vscode/contributes/views-welcome.ts +++ b/packages/extension/src/browser/vscode/contributes/views-welcome.ts @@ -1,9 +1,10 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; +import { DisposableCollection, localize } from '@opensumi/ide-core-browser'; import { DEBUG_WELCOME_ID } from '@opensumi/ide-debug'; -import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; import { IMainLayoutService, IViewContentDescriptor, IViewsRegistry } from '@opensumi/ide-main-layout'; -import { DisposableCollection, localize } from '@opensumi/ide-core-browser'; +import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; + +import { VSCodeContributePoint, Contributes } from '../../../common'; export enum ViewsWelcomeExtensionPointFields { view = 'view', diff --git a/packages/extension/src/browser/vscode/contributes/views.ts b/packages/extension/src/browser/vscode/contributes/views.ts index 2c6ac43cce..cc354c9654 100644 --- a/packages/extension/src/browser/vscode/contributes/views.ts +++ b/packages/extension/src/browser/vscode/contributes/views.ts @@ -1,8 +1,9 @@ -import { VSCodeContributePoint, Contributes } from '../../../common'; import { Injectable, Autowired } from '@opensumi/di'; +import { DisposableCollection } from '@opensumi/ide-core-browser'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; -import { DisposableCollection } from '@opensumi/ide-core-browser'; + +import { VSCodeContributePoint, Contributes } from '../../../common'; import { ExtensionWebviewView } from '../../components/extension-webview-view'; export interface ViewsContribution { diff --git a/packages/extension/src/common/activator.ts b/packages/extension/src/common/activator.ts index 3c32095309..c0af1288e4 100644 --- a/packages/extension/src/common/activator.ts +++ b/packages/extension/src/common/activator.ts @@ -1,5 +1,7 @@ import type vscode from 'vscode'; + import { IDisposable } from '@opensumi/ide-core-common'; + import { ExtensionHostType } from '.'; export class ExtensionActivationTimes { diff --git a/packages/extension/src/common/ext.host.proxy.ts b/packages/extension/src/common/ext.host.proxy.ts index 0516d9d581..511149b2d4 100644 --- a/packages/extension/src/common/ext.host.proxy.ts +++ b/packages/extension/src/common/ext.host.proxy.ts @@ -1,4 +1,5 @@ import type * as net from 'net'; + import { ProxyIdentifier } from '@opensumi/ide-connection'; import { Event } from '@opensumi/ide-core-common'; diff --git a/packages/extension/src/common/extension.service.ts b/packages/extension/src/common/extension.service.ts index 11e20fb9ed..fdaeb7c008 100644 --- a/packages/extension/src/common/extension.service.ts +++ b/packages/extension/src/common/extension.service.ts @@ -1,9 +1,10 @@ import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { Deferred } from '@opensumi/ide-core-common'; + import { ActivatedExtensionJSON } from './activator'; +import type { SumiWorkerExtensionService, VSCodeExtensionService } from './vscode'; import { IExtension } from './index'; -import type { SumiWorkerExtensionService, VSCodeExtensionService } from './vscode'; type ExtensionChangeKind = 'install' | 'uninstall' | 'upgrade' | 'enable' | 'disable'; diff --git a/packages/extension/src/common/index.ts b/packages/extension/src/common/index.ts index f858389752..56058955cb 100644 --- a/packages/extension/src/common/index.ts +++ b/packages/extension/src/common/index.ts @@ -1,3 +1,4 @@ +import { createExtHostContextProxyIdentifier } from '@opensumi/ide-connection'; import { Disposable, IJSONSchema, @@ -10,14 +11,17 @@ import { replaceNlsField, ILogger, } from '@opensumi/ide-core-common'; -import { createExtHostContextProxyIdentifier } from '@opensumi/ide-connection'; +import { Emitter, IExtensionProps } from '@opensumi/ide-core-common'; +import { typeAndModifierIdPattern } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; + import { ExtHostStorage } from '../hosted/api/vscode/ext.host.storage'; import { Extension } from '../hosted/vscode.extension'; -import { Emitter, IExtensionProps } from '@opensumi/ide-core-common'; -import { IExtensionContributions, IMainThreadCommands } from './vscode'; -import { ISumiExtensionContributions } from './sumi/extension'; + + import { ActivatedExtension, ExtensionsActivator, ActivatedExtensionJSON } from './activator'; -import { typeAndModifierIdPattern } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; +import { ISumiExtensionContributions } from './sumi/extension'; +import { IExtensionContributions, IMainThreadCommands } from './vscode'; + export { IExtensionProps } from '@opensumi/ide-core-common'; diff --git a/packages/extension/src/common/require-interceptor.ts b/packages/extension/src/common/require-interceptor.ts index a492befb72..dfc2af4227 100644 --- a/packages/extension/src/common/require-interceptor.ts +++ b/packages/extension/src/common/require-interceptor.ts @@ -1,6 +1,7 @@ import { Injectable, Injector, Autowired } from '@opensumi/di'; import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { Disposable, IDisposable, ILogger } from '@opensumi/ide-core-common'; + import { IExtension } from '..'; export interface IBrowserRequireInterceptorArgs { diff --git a/packages/extension/src/common/sumi/extension.ts b/packages/extension/src/common/sumi/extension.ts index 251c55281d..c370e47c6a 100644 --- a/packages/extension/src/common/sumi/extension.ts +++ b/packages/extension/src/common/sumi/extension.ts @@ -1,12 +1,12 @@ import { IMenubarItem, ISubmenuItem } from '@opensumi/ide-core-browser/lib/menu/next'; -import { ThemeType } from '@opensumi/ide-theme'; import { ISumiMenuExtendInfo } from '@opensumi/ide-core-common'; +import { ThemeType } from '@opensumi/ide-theme'; -import { IExtensionContributions } from '../vscode/extension'; // eslint-disable-next-line import/no-restricted-paths import type { ITabBarViewContribution } from '../../browser/sumi-browser/types'; // eslint-disable-next-line import/no-restricted-paths import type { IToolbarButtonContribution, IToolbarSelectContribution } from '../../browser/sumi/types'; +import { IExtensionContributions } from '../vscode/extension'; export interface IContributeMenubarItem extends Omit { title: IMenubarItem['label']; diff --git a/packages/extension/src/common/sumi/index.ts b/packages/extension/src/common/sumi/index.ts index 423c2727ef..62542038e2 100644 --- a/packages/extension/src/common/sumi/index.ts +++ b/packages/extension/src/common/sumi/index.ts @@ -1,8 +1,9 @@ import { createMainContextProxyIdentifier, createExtHostContextProxyIdentifier } from '@opensumi/ide-connection'; + +import { IMainThreadCommon, IExtHostCommon } from './common'; +import { IMainThreadLayout, IExtHostLayout } from './layout'; import { IMainThreadLifeCycle, IExtHostLifeCycle } from './lifecycle'; import { IExtHostTheme, IMainThreadTheme } from './theme'; -import { IMainThreadLayout, IExtHostLayout } from './layout'; -import { IMainThreadCommon, IExtHostCommon } from './common'; import { IExtHostToolbar, IMainThreadToolbar } from './toolbar'; import { IExtHostIDEWindow, IMainThreadIDEWindow } from './window'; diff --git a/packages/extension/src/common/sumi/toolbar.ts b/packages/extension/src/common/sumi/toolbar.ts index 66e0c26596..02083608ce 100644 --- a/packages/extension/src/common/sumi/toolbar.ts +++ b/packages/extension/src/common/sumi/toolbar.ts @@ -1,4 +1,5 @@ import { Event } from '@opensumi/ide-core-common'; + // eslint-disable-next-line import/no-restricted-paths import type { IToolbarButtonContribution, IToolbarSelectContribution } from '../../browser/sumi/types'; diff --git a/packages/extension/src/common/vscode/command.ts b/packages/extension/src/common/vscode/command.ts index 3dfc1b9b7a..441e4c716a 100644 --- a/packages/extension/src/common/vscode/command.ts +++ b/packages/extension/src/common/vscode/command.ts @@ -1,6 +1,7 @@ -import { Disposable } from './ext-types'; import { IExtensionInfo, IDisposable } from '@opensumi/ide-core-common'; +import { Disposable } from './ext-types'; + export interface IMainThreadCommands { $registerCommand(id: string): void; $unregisterCommand(id: string): void; diff --git a/packages/extension/src/common/vscode/comments.ts b/packages/extension/src/common/vscode/comments.ts index 88263cb61c..802468fab6 100644 --- a/packages/extension/src/common/vscode/comments.ts +++ b/packages/extension/src/common/vscode/comments.ts @@ -1,6 +1,7 @@ +import { IRange, CancellationToken } from '@opensumi/ide-core-common'; + import * as modes from './models'; import { UriComponents, CommentThreadChanges } from './models'; -import { IRange, CancellationToken } from '@opensumi/ide-core-common'; export interface CommentProviderFeatures { reactionGroup?: modes.CommentReaction[]; diff --git a/packages/extension/src/common/vscode/connection.ts b/packages/extension/src/common/vscode/connection.ts index 7bce9c852a..c0ee16353f 100644 --- a/packages/extension/src/common/vscode/connection.ts +++ b/packages/extension/src/common/vscode/connection.ts @@ -1,10 +1,12 @@ -import { Message } from '@opensumi/vscode-jsonrpc/lib/common/messages'; +import { IWebSocket } from '@opensumi/ide-connection'; +import { IDisposable } from '@opensumi/ide-core-common'; import { MessageReader } from '@opensumi/vscode-jsonrpc/lib/common/messageReader'; +import { Message } from '@opensumi/vscode-jsonrpc/lib/common/messages'; import { MessageWriter } from '@opensumi/vscode-jsonrpc/lib/common/messageWriter'; -import { IDisposable } from '@opensumi/ide-core-common'; + import { ExtensionMessageReader } from './extension-message-reader'; import { ExtensionMessageWriter } from './extension-message-writer'; -import { IWebSocket } from '@opensumi/ide-connection'; + export interface IMainThreadConnection { $createConnection(id: string): Promise; diff --git a/packages/extension/src/common/vscode/converter.ts b/packages/extension/src/common/vscode/converter.ts index 1645f412a4..cd8892037a 100644 --- a/packages/extension/src/common/vscode/converter.ts +++ b/packages/extension/src/common/vscode/converter.ts @@ -1,9 +1,7 @@ -import { RenderLineNumbersType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; - +import { marked } from 'marked'; import type vscode from 'vscode'; -import * as types from './ext-types'; -import * as model from './model.api'; -import * as debugModel from '@opensumi/ide-debug'; +import { SymbolInformation, Range as R, Position as P, SymbolKind as S } from 'vscode-languageserver-types'; + import { URI, Uri, @@ -21,6 +19,8 @@ import { coalesce, asArray, } from '@opensumi/ide-core-common'; +import * as debugModel from '@opensumi/ide-debug'; +import { IEvaluatableExpression } from '@opensumi/ide-debug/lib/common/evaluatable-expression'; import { IDecorationRenderOptions, IThemeDecorationRenderOptions, @@ -30,19 +30,10 @@ import { LanguageSelector, LanguageFilter, } from '@opensumi/ide-editor/lib/common'; -import { IEvaluatableExpression } from '@opensumi/ide-debug/lib/common/evaluatable-expression'; -import { SymbolInformation, Range as R, Position as P, SymbolKind as S } from 'vscode-languageserver-types'; -import { ExtensionDocumentDataManager } from './doc'; -import { ViewColumn as ViewColumnEnums } from './enums'; import { FileStat, FileType } from '@opensumi/ide-file-service'; -import { isMarkdownString, IMarkdownString, parseHrefAndDimensions } from './models'; -import { marked } from 'marked'; -import { CommandsConverter } from '../../hosted/api/vscode/ext.host.command'; -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; // eslint-disable-next-line import/no-restricted-paths import { EndOfLineSequence, CodeActionTriggerType } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; - -import { IInlineValueContextDto } from './languages'; +import { TestId } from '@opensumi/ide-testing/lib/common'; import { CoverageDetails, DetailType, @@ -57,9 +48,19 @@ import { SerializedTestResultItem, TestMessageType, } from '@opensumi/ide-testing/lib/common/testCollection'; -import { getPrivateApiFor, TestItemImpl } from './testing/testApi'; -import { TestId } from '@opensumi/ide-testing/lib/common'; +import { RenderLineNumbersType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + +import { CommandsConverter } from '../../hosted/api/vscode/ext.host.command'; + +import { ExtensionDocumentDataManager } from './doc'; +import { ViewColumn as ViewColumnEnums } from './enums'; +import * as types from './ext-types'; import { IRelativePattern } from './glob'; +import { IInlineValueContextDto } from './languages'; +import * as model from './model.api'; +import { isMarkdownString, IMarkdownString, parseHrefAndDimensions } from './models'; +import { getPrivateApiFor, TestItemImpl } from './testing/testApi'; export interface TextEditorOpenOptions extends vscode.TextDocumentShowOptions { background?: boolean; diff --git a/packages/extension/src/common/vscode/custom-editor.ts b/packages/extension/src/common/vscode/custom-editor.ts index 2877d19fdf..39eb1cf677 100644 --- a/packages/extension/src/common/vscode/custom-editor.ts +++ b/packages/extension/src/common/vscode/custom-editor.ts @@ -1,8 +1,11 @@ import type { TextDocument } from 'vscode'; -import type { WebviewPanel, IWebviewPanelOptions } from './webview'; + +import { Event, BasicEvent, URI, IExtensionInfo } from '@opensumi/ide-core-common'; import type { CancellationToken } from '@opensumi/ide-core-common/lib/cancellation'; + import { Uri, UriComponents } from './ext-types'; -import { Event, BasicEvent, URI, IExtensionInfo } from '@opensumi/ide-core-common'; +import type { WebviewPanel, IWebviewPanelOptions } from './webview'; + /** * Provider for text based custom editors. diff --git a/packages/extension/src/common/vscode/debug.ts b/packages/extension/src/common/vscode/debug.ts index a4b7772af6..570ee7cdbb 100644 --- a/packages/extension/src/common/vscode/debug.ts +++ b/packages/extension/src/common/vscode/debug.ts @@ -1,8 +1,10 @@ -import { IJSONSchema, IJSONSchemaSnippet, Event } from '@opensumi/ide-core-common'; -import { Breakpoint } from './models'; import type vscode from 'vscode'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + +import { IJSONSchema, IJSONSchemaSnippet, Event } from '@opensumi/ide-core-common'; import { DebuggerDescription, DebugConfiguration, IDebuggerContribution, IDebugSessionDTO } from '@opensumi/ide-debug'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + +import { Breakpoint } from './models'; import { WorkspaceFolder } from './models'; export type DebugSessionUUID = string; diff --git a/packages/extension/src/common/vscode/decoration.ts b/packages/extension/src/common/vscode/decoration.ts index ce9624e2ba..c3e706b3c5 100644 --- a/packages/extension/src/common/vscode/decoration.ts +++ b/packages/extension/src/common/vscode/decoration.ts @@ -1,6 +1,7 @@ -import { CancellationToken, IDisposable, UriComponents, IThemeColor } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; +import { CancellationToken, IDisposable, UriComponents, IThemeColor } from '@opensumi/ide-core-common'; + export interface DecorationRequest { readonly id: number; readonly handle: number; diff --git a/packages/extension/src/common/vscode/doc.ts b/packages/extension/src/common/vscode/doc.ts index 57c5c2fe17..9c3a1f1c30 100644 --- a/packages/extension/src/common/vscode/doc.ts +++ b/packages/extension/src/common/vscode/doc.ts @@ -1,8 +1,11 @@ import type vscode from 'vscode'; + import { IDisposable, Event } from '@opensumi/ide-core-common'; -import { Uri } from './ext-types'; import { SaveReason, IEditorDocumentModelContentChange } from '@opensumi/ide-editor'; + import { ExtHostDocumentData } from '../../hosted/api/vscode/doc/ext-data.host'; + +import { Uri } from './ext-types'; export interface IModelChangedEvent { /** * The actual changes. diff --git a/packages/extension/src/common/vscode/editor-tabs.ts b/packages/extension/src/common/vscode/editor-tabs.ts index 8a62e9354b..ebb7cf7ddf 100644 --- a/packages/extension/src/common/vscode/editor-tabs.ts +++ b/packages/extension/src/common/vscode/editor-tabs.ts @@ -1,6 +1,7 @@ -import { Event, IDisposable, URI } from '@opensumi/ide-core-common'; import type * as vscode from 'vscode'; +import { Event, IDisposable, URI } from '@opensumi/ide-core-common'; + export interface IEditorTabDto { group: number; name: string; diff --git a/packages/extension/src/common/vscode/editor.ts b/packages/extension/src/common/vscode/editor.ts index 4566363852..72f3af9be6 100644 --- a/packages/extension/src/common/vscode/editor.ts +++ b/packages/extension/src/common/vscode/editor.ts @@ -1,4 +1,3 @@ -import type { RenderLineNumbersType as MonacoRenderLineNumbersType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; import { ISelection, IRange, ILineChange } from '@opensumi/ide-core-common'; import { IUndoStopOptions, @@ -7,9 +6,11 @@ import { IDecorationApplyOptions, IResourceOpenOptions, } from '@opensumi/ide-editor'; -import { ViewColumn } from './enums'; // eslint-disable-next-line import/no-restricted-paths import type { EndOfLineSequence } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import type { RenderLineNumbersType as MonacoRenderLineNumbersType } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; + +import { ViewColumn } from './enums'; export * from './custom-editor'; export * from './enums'; export interface IExtensionHostEditorService { diff --git a/packages/extension/src/common/vscode/env.ts b/packages/extension/src/common/vscode/env.ts index 5ecb084e50..ed1656ed24 100644 --- a/packages/extension/src/common/vscode/env.ts +++ b/packages/extension/src/common/vscode/env.ts @@ -1,5 +1,7 @@ -import { LogLevel as KTLogLevel, Emitter } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { LogLevel as KTLogLevel, Emitter } from '@opensumi/ide-core-common'; + import { LogLevel, UIKind, UriComponents } from './ext-types'; export interface IMainThreadEnv { diff --git a/packages/extension/src/common/vscode/ext-types.ts b/packages/extension/src/common/vscode/ext-types.ts index d445d66d20..1ba3f63b3a 100644 --- a/packages/extension/src/common/vscode/ext-types.ts +++ b/packages/extension/src/common/vscode/ext-types.ts @@ -1,9 +1,11 @@ import type vscode from 'vscode'; + import { Uri, UriUtils } from '@opensumi/ide-core-common'; -import { illegalArgument } from './utils'; -import { FileOperationOptions } from './model.api'; import { startsWithIgnoreCase, uuid, es5ClassCompat, isStringArray } from '@opensumi/ide-core-common'; + +import { FileOperationOptions } from './model.api'; import { escapeCodicons } from './models/html-content'; +import { illegalArgument } from './utils'; export { UriComponents } from './models/uri'; diff --git a/packages/extension/src/common/vscode/extension-message-writer.ts b/packages/extension/src/common/vscode/extension-message-writer.ts index 0e7561dc5a..0b3cebadb7 100644 --- a/packages/extension/src/common/vscode/extension-message-writer.ts +++ b/packages/extension/src/common/vscode/extension-message-writer.ts @@ -1,5 +1,6 @@ -import { AbstractMessageWriter, MessageWriter } from '@opensumi/vscode-jsonrpc/lib/common/messageWriter'; import { Message } from '@opensumi/vscode-jsonrpc/lib/common/messages'; +import { AbstractMessageWriter, MessageWriter } from '@opensumi/vscode-jsonrpc/lib/common/messageWriter'; + import { IExtHostConnection } from './connection'; /** diff --git a/packages/extension/src/common/vscode/file-system.ts b/packages/extension/src/common/vscode/file-system.ts index fcce3909da..c455fb4e8f 100644 --- a/packages/extension/src/common/vscode/file-system.ts +++ b/packages/extension/src/common/vscode/file-system.ts @@ -3,8 +3,8 @@ import { FileSystemProviderCapabilities, FileChange } from '@opensumi/ide-file-s import { FileOperation } from '@opensumi/ide-workspace-edit'; import { Disposable } from './ext-types'; -import { UriComponents } from './models'; import { IWorkspaceEditDto } from './model.api'; +import { UriComponents } from './models'; /** * Enumeration of file change types. diff --git a/packages/extension/src/common/vscode/index.ts b/packages/extension/src/common/vscode/index.ts index 30159349a1..964ebbb450 100644 --- a/packages/extension/src/common/vscode/index.ts +++ b/packages/extension/src/common/vscode/index.ts @@ -1,9 +1,47 @@ import type vscode from 'vscode'; -import { Emitter, IExtensionProps } from '@opensumi/ide-core-common'; import { createMainContextProxyIdentifier, createExtHostContextProxyIdentifier } from '@opensumi/ide-connection'; -import { IMainThreadDocumentsShape, ExtensionDocumentDataManager } from './doc'; +import { Emitter, IExtensionProps } from '@opensumi/ide-core-common'; + +import { IExtension, IExtensionHostService } from '..'; +// eslint-disable-next-line import/no-restricted-paths +import type { MainThreadWindowState } from '../../browser/vscode/api/main.thread.window-state'; +import { ExtHostFileSystem } from '../../hosted/api/vscode/ext.host.file-system'; +import { ExtHostFileSystemEvent } from '../../hosted/api/vscode/ext.host.file-system-event'; +import { ExtHostFileSystemInfo } from '../../hosted/api/vscode/ext.host.file-system-info'; +import { ExtHostLanguages } from '../../hosted/api/vscode/ext.host.language'; +import { ExtHostStorage } from '../../hosted/api/vscode/ext.host.storage'; +import { ISumiExtHostWebviews } from '../sumi/webview'; + +import { IExtHostAuthentication, IMainThreadAuthentication } from './authentication'; import { IMainThreadCommands, IExtHostCommands } from './command'; +import { IExtHostComments, IMainThreadComments } from './comments'; +import { IExtHostConnection, IMainThreadConnection } from './connection'; +import { IExtHostDebug, IMainThreadDebug } from './debug'; +import { IExtHostDecorationsShape, IMainThreadDecorationsShape } from './decoration'; +import { IMainThreadDocumentsShape, ExtensionDocumentDataManager } from './doc'; +import { + IMainThreadEditorsService, + IExtensionHostEditorService, + IMainThreadCustomEditor, + IExtHostCustomEditor, +} from './editor'; +import { IExtHostEditorTabs, IMainThreadEditorTabsShape } from './editor-tabs'; +import { IMainThreadEnv, IExtHostEnv } from './env'; +import { IMainThreadFileSystemShape } from './file-system'; +import { IMainThreadLanguages } from './languages'; +import { IMainThreadPreference, IExtHostPreference } from './preference'; +import { IExtHostProgress, IMainThreadProgress } from './progress'; +import { IMainThreadSCMShape, IExtHostSCMShape } from './scm'; +import { IExtHostSecret, IMainThreadSecret } from './secret'; +import { IMainThreadStorage, IExtHostStorage } from './storage'; +import { IExtHostTasks, IMainThreadTasks } from './tasks'; +import { IExtHostTerminal, IMainThreadTerminal } from './terminal'; +import { IExtHostTests, IMainThreadTesting } from './tests'; +import { IExtHostTheming, IMainThreadTheming } from './theming'; +import { IExtHostTreeView, IMainThreadTreeView } from './treeview'; +import { IMainThreadUrls, IExtHostUrls } from './urls'; +import { IMainThreadWebview, IExtHostWebview, IMainThreadWebviewView, IExtHostWebviewView } from './webview'; import { IMainThreadMessage, IExtHostMessage, @@ -18,42 +56,6 @@ import { IMainThreadWindow, } from './window'; import { IMainThreadWorkspace, IExtHostWorkspace } from './workspace'; -import { - IMainThreadEditorsService, - IExtensionHostEditorService, - IMainThreadCustomEditor, - IExtHostCustomEditor, -} from './editor'; -import { ExtHostLanguages } from '../../hosted/api/vscode/ext.host.language'; -import { IExtension, IExtensionHostService } from '..'; -import { IMainThreadPreference, IExtHostPreference } from './preference'; -import { IMainThreadEnv, IExtHostEnv } from './env'; -import { IMainThreadStorage, IExtHostStorage } from './storage'; -import { ExtHostStorage } from '../../hosted/api/vscode/ext.host.storage'; -import { IMainThreadLanguages } from './languages'; -import { IMainThreadWebview, IExtHostWebview, IMainThreadWebviewView, IExtHostWebviewView } from './webview'; -import { IExtHostTreeView, IMainThreadTreeView } from './treeview'; -import { IMainThreadSCMShape, IExtHostSCMShape } from './scm'; -import { IExtHostDecorationsShape, IMainThreadDecorationsShape } from './decoration'; -// eslint-disable-next-line import/no-restricted-paths -import type { MainThreadWindowState } from '../../browser/vscode/api/main.thread.window-state'; -import { IExtHostDebug, IMainThreadDebug } from './debug'; -import { IExtHostConnection, IMainThreadConnection } from './connection'; -import { IExtHostTerminal, IMainThreadTerminal } from './terminal'; -import { IMainThreadFileSystemShape } from './file-system'; -import { ISumiExtHostWebviews } from '../sumi/webview'; -import { IExtHostProgress, IMainThreadProgress } from './progress'; -import { IExtHostTheming, IMainThreadTheming } from './theming'; -import { IExtHostTasks, IMainThreadTasks } from './tasks'; -import { IExtHostComments, IMainThreadComments } from './comments'; -import { ExtHostFileSystem } from '../../hosted/api/vscode/ext.host.file-system'; -import { ExtHostFileSystemInfo } from '../../hosted/api/vscode/ext.host.file-system-info'; -import { ExtHostFileSystemEvent } from '../../hosted/api/vscode/ext.host.file-system-event'; -import { IMainThreadUrls, IExtHostUrls } from './urls'; -import { IExtHostAuthentication, IMainThreadAuthentication } from './authentication'; -import { IExtHostSecret, IMainThreadSecret } from './secret'; -import { IExtHostTests, IMainThreadTesting } from './tests'; -import { IExtHostEditorTabs, IMainThreadEditorTabsShape } from './editor-tabs'; export const VSCodeExtensionService = Symbol('VSCodeExtensionService'); export interface VSCodeExtensionService { diff --git a/packages/extension/src/common/vscode/languages.ts b/packages/extension/src/common/vscode/languages.ts index 88e8fc742d..0e4e624e4b 100644 --- a/packages/extension/src/common/vscode/languages.ts +++ b/packages/extension/src/common/vscode/languages.ts @@ -1,3 +1,4 @@ +import globToRegExp = require('glob-to-regexp'); import { DocumentSelector, CompletionItemProvider, @@ -12,6 +13,25 @@ import { CallHierarchyProvider, InlayHintsProvider, } from 'vscode'; +import { SymbolInformation } from 'vscode-languageserver-types'; + +import { IMarkerData, IRange, Uri, UriComponents } from '@opensumi/ide-core-common'; +import { IEvaluatableExpression } from '@opensumi/ide-debug/lib/common/evaluatable-expression'; +import { InlineValueContext, InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; +import { ILanguageStatus, ISingleEditOperation } from '@opensumi/ide-editor'; +// eslint-disable-next-line import/no-restricted-paths +import type { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { Range as MonacoRange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; +import type { + CodeActionContext, + SignatureHelpContext, + Command, + CompletionItemLabel, +} from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + +import { Disposable } from './ext-types'; +import { IExtensionDescription } from './extension'; import { SerializedDocumentFilter, Hover, @@ -53,25 +73,7 @@ import { ILinksListDto, SerializedRegExp, } from './model.api'; -import type { - CodeActionContext, - SignatureHelpContext, - Command, - CompletionItemLabel, -} from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { Disposable } from './ext-types'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import globToRegExp = require('glob-to-regexp'); -import { IMarkerData, IRange, Uri, UriComponents } from '@opensumi/ide-core-common'; import { CompletionContext } from './model.api'; -import { IEvaluatableExpression } from '@opensumi/ide-debug/lib/common/evaluatable-expression'; -import { InlineValueContext, InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; -import { ILanguageStatus, ISingleEditOperation } from '@opensumi/ide-editor'; -import { IExtensionDescription } from './extension'; -// eslint-disable-next-line import/no-restricted-paths -import type { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { Range as MonacoRange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; -import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; export interface IMainThreadLanguages { $unregister(handle: number): void; diff --git a/packages/extension/src/common/vscode/model.api.ts b/packages/extension/src/common/vscode/model.api.ts index fd36efbba1..d224eec57d 100644 --- a/packages/extension/src/common/vscode/model.api.ts +++ b/packages/extension/src/common/vscode/model.api.ts @@ -1,7 +1,6 @@ -import { LanguageFeatureRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/languageFeatureRegistry'; -import type { languages, editor } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import type vscode from 'vscode'; +import { SymbolInformation } from 'vscode-languageserver-types'; -// 内置的api类型声明 import { Uri as URI, IRange, @@ -12,13 +11,17 @@ import { Event, } from '@opensumi/ide-core-common'; import { ISingleEditOperation } from '@opensumi/ide-editor'; -import type vscode from 'vscode'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { IndentAction, SymbolKind } from './ext-types'; -import { IMarkdownString } from './models/html-content'; // eslint-disable-next-line import/no-restricted-paths import type { CallHierarchyItem } from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy'; import type { CompletionItemLabel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; +import { LanguageFeatureRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/languageFeatureRegistry'; +import type { languages, editor } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +// 内置的api类型声明 + +import { IndentAction, SymbolKind } from './ext-types'; +import { IMarkdownString } from './models/html-content'; + export { IMarkdownString, SymbolTag, CallHierarchyItem }; export interface IRawColorInfo { diff --git a/packages/extension/src/common/vscode/models/html-content.ts b/packages/extension/src/common/vscode/models/html-content.ts index ec91e75dc3..a705ed401e 100644 --- a/packages/extension/src/common/vscode/models/html-content.ts +++ b/packages/extension/src/common/vscode/models/html-content.ts @@ -1,6 +1,7 @@ -import { UriComponents } from './uri'; import { illegalArgument } from '../utils'; +import { UriComponents } from './uri'; + // TODO: edtior 中有相同interface,待统一 export interface IMarkdownString { value: string; diff --git a/packages/extension/src/common/vscode/scm.ts b/packages/extension/src/common/vscode/scm.ts index 20a5b63778..33963adff1 100644 --- a/packages/extension/src/common/vscode/scm.ts +++ b/packages/extension/src/common/vscode/scm.ts @@ -1,5 +1,5 @@ -import { CancellationToken } from '@opensumi/vscode-jsonrpc/lib/common/cancellation'; import type { IDisposable, UriComponents, IThemeColor } from '@opensumi/ide-core-common'; +import { CancellationToken } from '@opensumi/vscode-jsonrpc/lib/common/cancellation'; import { VSCommand } from './model.api'; diff --git a/packages/extension/src/common/vscode/tasks.ts b/packages/extension/src/common/vscode/tasks.ts index 95e2199751..0217b10107 100644 --- a/packages/extension/src/common/vscode/tasks.ts +++ b/packages/extension/src/common/vscode/tasks.ts @@ -1,8 +1,11 @@ -import { IDisposable } from '@opensumi/ide-core-node'; import type vscode from 'vscode'; -import { IExtensionProps } from '../index'; + +import { IDisposable } from '@opensumi/ide-core-node'; import { UriComponents } from '@opensumi/ide-editor/lib/common'; +import { IExtensionProps } from '../index'; + + export interface TaskHandlerData { type: string; provider: vscode.TaskProvider; diff --git a/packages/extension/src/common/vscode/terminal.ts b/packages/extension/src/common/vscode/terminal.ts index 6627f14270..36e02bb1c1 100644 --- a/packages/extension/src/common/vscode/terminal.ts +++ b/packages/extension/src/common/vscode/terminal.ts @@ -1,3 +1,5 @@ +import type vscode from 'vscode'; + import { Event, IDisposable, IExtensionProps } from '@opensumi/ide-core-common'; import { ITerminalInfo, @@ -10,7 +12,7 @@ import { ICreateContributedTerminalProfileOptions, } from '@opensumi/ide-terminal-next'; import { SerializableEnvironmentVariableCollection } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; -import type vscode from 'vscode'; + import { IExtensionDescription } from './extension'; export interface IMainThreadTerminal { diff --git a/packages/extension/src/common/vscode/testing/testApi.ts b/packages/extension/src/common/vscode/testing/testApi.ts index 5aa8d08219..d251460130 100644 --- a/packages/extension/src/common/vscode/testing/testApi.ts +++ b/packages/extension/src/common/vscode/testing/testApi.ts @@ -3,9 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TestIdPathParts } from '@opensumi/ide-testing/lib/common'; import * as vscode from 'vscode'; +import { TestIdPathParts } from '@opensumi/ide-testing/lib/common'; + export const enum ExtHostTestItemEventOp { Upsert, RemoveChild, diff --git a/packages/extension/src/common/vscode/testing/testCollection.ts b/packages/extension/src/common/vscode/testing/testCollection.ts index 9ec89a3edc..1d8f60763c 100644 --- a/packages/extension/src/common/vscode/testing/testCollection.ts +++ b/packages/extension/src/common/vscode/testing/testCollection.ts @@ -8,6 +8,9 @@ import { ITestTag, } from '@opensumi/ide-testing/lib/common/testCollection'; import { TestId } from '@opensumi/ide-testing/lib/common/testId'; + +import * as Convert from '../converter'; + import { TestItemImpl, TestItemRootImpl, @@ -16,7 +19,6 @@ import { ExtHostTestItemEventOp, diffTestItems, } from './testApi'; -import * as Convert from '../converter'; type TestItemRaw = Convert.TestItem.Raw; diff --git a/packages/extension/src/common/vscode/tests.ts b/packages/extension/src/common/vscode/tests.ts index ba367f0139..39baa3bfe9 100644 --- a/packages/extension/src/common/vscode/tests.ts +++ b/packages/extension/src/common/vscode/tests.ts @@ -5,8 +5,8 @@ // Some code copied and modified from https://github.com/microsoft/vscode/tree/main/src/vs/workbench/contrib/testing/common import type vscode from 'vscode'; -import { CancellationToken } from '@opensumi/ide-core-common'; +import { CancellationToken } from '@opensumi/ide-core-common'; import { CoverageDetails, ExtensionRunTestsRequest, diff --git a/packages/extension/src/common/vscode/treeview.ts b/packages/extension/src/common/vscode/treeview.ts index 66bc50444e..dff61adbc7 100644 --- a/packages/extension/src/common/vscode/treeview.ts +++ b/packages/extension/src/common/vscode/treeview.ts @@ -1,9 +1,11 @@ import type vscode from 'vscode'; -import { UriComponents, ICommand } from './models'; + import { Event, IDisposable, IAccessibilityInformation } from '@opensumi/ide-core-common'; -import { TreeItemCollapsibleState, ThemeIcon } from './ext-types'; -import { ThemeType } from '@opensumi/ide-theme'; import type { CancellationToken } from '@opensumi/ide-core-common/lib/cancellation'; +import { ThemeType } from '@opensumi/ide-theme'; + +import { TreeItemCollapsibleState, ThemeIcon } from './ext-types'; +import { UriComponents, ICommand } from './models'; export interface ITreeViewRevealOptions { select?: boolean; diff --git a/packages/extension/src/common/vscode/urls.ts b/packages/extension/src/common/vscode/urls.ts index 68f7ea2fea..b8e381797b 100644 --- a/packages/extension/src/common/vscode/urls.ts +++ b/packages/extension/src/common/vscode/urls.ts @@ -1,5 +1,7 @@ import type vscode from 'vscode'; + import { IDisposable } from '@opensumi/ide-core-common'; + import { UriComponents } from './ext-types'; export interface IMainThreadUrls extends IDisposable { diff --git a/packages/extension/src/common/vscode/utils.ts b/packages/extension/src/common/vscode/utils.ts index 2937363c19..d96bb4d91c 100644 --- a/packages/extension/src/common/vscode/utils.ts +++ b/packages/extension/src/common/vscode/utils.ts @@ -1,9 +1,10 @@ +import vscode from 'vscode'; + import type { OnEnterRule, IndentationRule, } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes/languageConfiguration'; -import vscode from 'vscode'; import * as types from './ext-types'; import { SerializedIndentationRule, SerializedRegExp, SerializedOnEnterRule } from './model.api'; diff --git a/packages/extension/src/common/vscode/webview.ts b/packages/extension/src/common/vscode/webview.ts index 8f90307f03..e14fc410cb 100644 --- a/packages/extension/src/common/vscode/webview.ts +++ b/packages/extension/src/common/vscode/webview.ts @@ -1,6 +1,8 @@ +import type vscode from 'vscode'; + import { Event, IExtensionInfo, Uri, CancellationToken, BasicEvent } from '@opensumi/ide-core-common'; + import { ViewColumn } from './editor'; -import type vscode from 'vscode'; export interface WebviewPanelShowOptions { readonly viewColumn?: number; diff --git a/packages/extension/src/common/vscode/window.ts b/packages/extension/src/common/vscode/window.ts index 6f277ba7cd..89d2ef941e 100644 --- a/packages/extension/src/common/vscode/window.ts +++ b/packages/extension/src/common/vscode/window.ts @@ -1,9 +1,11 @@ import type vscode from 'vscode'; -import * as types from './ext-types'; + +import { QuickTitleButton } from '@opensumi/ide-core-browser/lib/quick-open'; import { CancellationToken, MessageType, MaybePromise } from '@opensumi/ide-core-common'; -import { QuickPickItem, QuickPickOptions, QuickInputOptions } from '@opensumi/ide-quick-open'; import { Event, IThemeColor } from '@opensumi/ide-core-common'; -import { QuickTitleButton } from '@opensumi/ide-core-browser/lib/quick-open'; +import { QuickPickItem, QuickPickOptions, QuickInputOptions } from '@opensumi/ide-quick-open'; + +import * as types from './ext-types'; import { UriComponents, QuickInputButton } from './ext-types'; import { IExtensionDescription } from './extension'; diff --git a/packages/extension/src/common/vscode/workspace.ts b/packages/extension/src/common/vscode/workspace.ts index 0d69824af7..abbde69e71 100644 --- a/packages/extension/src/common/vscode/workspace.ts +++ b/packages/extension/src/common/vscode/workspace.ts @@ -1,11 +1,13 @@ import type vscode from 'vscode'; + import { URI, IDisposable, IRange, CancellationToken } from '@opensumi/ide-core-common'; -import { Uri, UriComponents } from './ext-types'; import { FileStat } from '@opensumi/ide-file-service'; -import type * as model from './model.api'; -import { IWorkspaceEdit, IResourceTextEdit, IResourceFileEdit } from '@opensumi/ide-workspace-edit'; // eslint-disable-next-line import/no-restricted-paths import type { EndOfLineSequence } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { IWorkspaceEdit, IResourceTextEdit, IResourceFileEdit } from '@opensumi/ide-workspace-edit'; + +import { Uri, UriComponents } from './ext-types'; +import type * as model from './model.api'; export interface IMainThreadWorkspace extends IDisposable { $saveAll(): Promise; diff --git a/packages/extension/src/hosted/api/sumi/ext.host.api.impl.ts b/packages/extension/src/hosted/api/sumi/ext.host.api.impl.ts index 04e6e909df..59eb86c2ab 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.api.impl.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.api.impl.ts @@ -1,17 +1,19 @@ import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IExtensionHostService, IExtensionWorkerHost, WorkerHostAPIIdentifier } from '../../../common'; -import { createLayoutAPIFactory, ExtHostLayout } from './ext.host.layout'; -import { createWindowApiFactory, ExtHostIDEWindow } from './ext.host.window'; -import { ExtHostAPIIdentifier, IExtensionDescription } from '../../../common/vscode'; import { ReporterService, REPORT_HOST, IReporter } from '@opensumi/ide-core-common'; -import { ExtHostWebview, createWebviewApi } from './ext.host.webview'; + +import { IExtensionHostService, IExtensionWorkerHost, WorkerHostAPIIdentifier } from '../../../common'; import { ExtHostSumiAPIIdentifier } from '../../../common/sumi'; +import { ExtHostAPIIdentifier, IExtensionDescription } from '../../../common/vscode'; +import { ExtensionHostEditorService } from '../vscode/editor/editor.host'; + +import { createCommandsApiFactory } from './ext.host.command'; +import { ExtHostCommon, createEventAPIFactory } from './ext.host.common'; +import { createLayoutAPIFactory, ExtHostLayout } from './ext.host.layout'; import { ExtHostLifeCycle, createLifeCycleApi } from './ext.host.lifecycle'; import { ExtHostTheme, createThemeApi } from './ext.host.theme'; -import { ExtHostCommon, createEventAPIFactory } from './ext.host.common'; -import { createCommandsApiFactory } from './ext.host.command'; -import { ExtensionHostEditorService } from '../vscode/editor/editor.host'; import { ExtHostToolbarActionService, createToolbarAPIFactory } from './ext.host.toolbar'; +import { ExtHostWebview, createWebviewApi } from './ext.host.webview'; +import { createWindowApiFactory, ExtHostIDEWindow } from './ext.host.window'; export function createAPIFactory( rpcProtocol: IRPCProtocol, diff --git a/packages/extension/src/hosted/api/sumi/ext.host.command.ts b/packages/extension/src/hosted/api/sumi/ext.host.command.ts index af445d5928..e7a882b755 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.command.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.command.ts @@ -1,7 +1,7 @@ import { IExtHostCommands, Handler, PermittedHandler, IExtensionDescription } from '../../../common/vscode'; +import { Disposable } from '../../../common/vscode/ext-types'; import { ExtensionHostEditorService } from '../vscode/editor/editor.host'; import { createCommandsApiFactory as createVSCodeCommandsApiFactory } from '../vscode/ext.host.command'; -import { Disposable } from '../../../common/vscode/ext-types'; export function createCommandsApiFactory( extHostCommands: IExtHostCommands, diff --git a/packages/extension/src/hosted/api/sumi/ext.host.common.ts b/packages/extension/src/hosted/api/sumi/ext.host.common.ts index 30ff76cef4..ac4ccde7ed 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.common.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.common.ts @@ -1,9 +1,10 @@ -import { IExtHostCommands, IExtensionDescription } from '../../../common/vscode'; -import { Emitter, IDisposable } from '@opensumi/ide-core-common'; -import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Emitter, IDisposable } from '@opensumi/ide-core-common'; + import { EMIT_EXT_HOST_EVENT } from '../../../common'; +import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; import { IExtHostCommon, IMainThreadCommon } from '../../../common/sumi/common'; +import { IExtHostCommands, IExtensionDescription } from '../../../common/vscode'; export class ExtHostCommon implements IExtHostCommon { private emitters = new Map>(); diff --git a/packages/extension/src/hosted/api/sumi/ext.host.layout.ts b/packages/extension/src/hosted/api/sumi/ext.host.layout.ts index b31183e149..6793aefd04 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.layout.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.layout.ts @@ -1,8 +1,10 @@ -import { IExtHostCommands, IExtensionDescription } from '../../../common/vscode'; -import { ITabbarHandler, IMainThreadLayout, IExtHostLayout } from '../../../common/sumi/layout'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter } from '@opensumi/ide-core-common'; + import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; -import { IRPCProtocol } from '@opensumi/ide-connection'; +import { ITabbarHandler, IMainThreadLayout, IExtHostLayout } from '../../../common/sumi/layout'; +import { IExtHostCommands, IExtensionDescription } from '../../../common/vscode'; + export class TabbarHandler implements ITabbarHandler { public readonly onActivateEmitter = new Emitter(); diff --git a/packages/extension/src/hosted/api/sumi/ext.host.lifecycle.ts b/packages/extension/src/hosted/api/sumi/ext.host.lifecycle.ts index 45fdf488db..d4909e0d20 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.lifecycle.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.lifecycle.ts @@ -1,8 +1,8 @@ import { IRPCProtocol } from '@opensumi/ide-connection'; import { ExtensionCandidate } from '@opensumi/ide-core-common'; -import { IExtHostLifeCycle, IMainThreadLifeCycle } from '../../../common/sumi/lifecycle'; import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; +import { IExtHostLifeCycle, IMainThreadLifeCycle } from '../../../common/sumi/lifecycle'; import { IExtHostCommands } from '../../../common/vscode'; export function createLifeCycleApi(extHostCommands: IExtHostCommands, lifeCycle: IExtHostLifeCycle) { diff --git a/packages/extension/src/hosted/api/sumi/ext.host.toolbar.ts b/packages/extension/src/hosted/api/sumi/ext.host.toolbar.ts index 6061eede44..43c4e4011a 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.toolbar.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.toolbar.ts @@ -1,16 +1,19 @@ -import { IExtHostCommands, IExtensionDescription } from '../../../common/vscode'; -import { ExtHostCommon } from './ext.host.common'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IToolbarPopoverStyle } from '@opensumi/ide-core-browser/lib/toolbar'; +import { Emitter, Disposable } from '@opensumi/ide-core-common'; + +import { IToolbarButtonContribution, IToolbarSelectContribution } from '../../../browser/sumi/types'; +import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; import { IToolbarButtonActionHandle, IToolbarSelectActionHandle, IMainThreadToolbar, IExtHostToolbar, } from '../../../common/sumi/toolbar'; -import { Emitter, Disposable } from '@opensumi/ide-core-common'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; -import { IToolbarButtonContribution, IToolbarSelectContribution } from '../../../browser/sumi/types'; -import { IToolbarPopoverStyle } from '@opensumi/ide-core-browser/lib/toolbar'; +import { IExtHostCommands, IExtensionDescription } from '../../../common/vscode'; + +import { ExtHostCommon } from './ext.host.common'; + export function createToolbarAPIFactory(extension: IExtensionDescription, service: ExtHostToolbarActionService) { return { diff --git a/packages/extension/src/hosted/api/sumi/ext.host.webview.ts b/packages/extension/src/hosted/api/sumi/ext.host.webview.ts index b85393e62a..9558c61365 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.webview.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.webview.ts @@ -1,9 +1,10 @@ import { IRPCProtocol } from '@opensumi/ide-connection'; -import { MainThreadAPIIdentifier, IMainThreadWebview, IExtensionDescription } from '../../../common/vscode'; import { Disposable, Emitter } from '@opensumi/ide-core-common'; -import { IPlainWebviewHandle, IExtHostPlainWebview } from '../../../common/sumi/webview'; import { join } from '@opensumi/ide-core-common/lib/path'; +import { IPlainWebviewHandle, IExtHostPlainWebview } from '../../../common/sumi/webview'; +import { MainThreadAPIIdentifier, IMainThreadWebview, IExtensionDescription } from '../../../common/vscode'; + export class ExtHostWebview { _proxy: IMainThreadWebview; diff --git a/packages/extension/src/hosted/api/sumi/ext.host.window.ts b/packages/extension/src/hosted/api/sumi/ext.host.window.ts index df0efd33be..9555fdcff2 100644 --- a/packages/extension/src/hosted/api/sumi/ext.host.window.ts +++ b/packages/extension/src/hosted/api/sumi/ext.host.window.ts @@ -1,5 +1,6 @@ import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, Disposable, IDisposable, DisposableCollection } from '@opensumi/ide-core-common'; + import { MainThreadSumiAPIIdentifier } from '../../../common/sumi'; import { IExtHostIDEWindow, diff --git a/packages/extension/src/hosted/api/telemetry/ext.host.api.impl.ts b/packages/extension/src/hosted/api/telemetry/ext.host.api.impl.ts index 747d339b18..ea48293151 100644 --- a/packages/extension/src/hosted/api/telemetry/ext.host.api.impl.ts +++ b/packages/extension/src/hosted/api/telemetry/ext.host.api.impl.ts @@ -1,9 +1,11 @@ -import { ExtHostAPIIdentifier } from './../../../common/vscode/index'; import { IRPCProtocol } from '@opensumi/ide-connection'; -import { IExtensionDescription } from '../../../common/vscode'; + import { IExtensionHostService, IExtensionWorkerHost } from '../../../common'; -import { createCommandsApiFactory, ExtHostCommands } from '../vscode/ext.host.command'; +import { IExtensionDescription } from '../../../common/vscode'; import { ExtensionHostEditorService } from '../vscode/editor/editor.host'; +import { createCommandsApiFactory, ExtHostCommands } from '../vscode/ext.host.command'; + +import { ExtHostAPIIdentifier } from './../../../common/vscode/index'; interface IOptions { firstParty?: boolean; diff --git a/packages/extension/src/hosted/api/vscode/debug/abstract-debug-adapter-session.ts b/packages/extension/src/hosted/api/vscode/debug/abstract-debug-adapter-session.ts index d00f9b1611..b2d8883a46 100644 --- a/packages/extension/src/hosted/api/vscode/debug/abstract-debug-adapter-session.ts +++ b/packages/extension/src/hosted/api/vscode/debug/abstract-debug-adapter-session.ts @@ -1,9 +1,10 @@ -import { Disposable, DisposableCollection, Event } from '@opensumi/ide-core-common'; -import { DebugStreamConnection } from '@opensumi/ide-debug'; import type vscode from 'vscode'; -import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; + import { IWebSocket } from '@opensumi/ide-connection'; +import { Disposable, DisposableCollection, Event } from '@opensumi/ide-core-common'; +import { DebugStreamConnection } from '@opensumi/ide-debug'; import { getSequenceId } from '@opensumi/ide-debug'; +import { DebugProtocol } from '@opensumi/vscode-debugprotocol'; export abstract class AbstractDebugAdapter implements vscode.DebugAdapter { constructor(readonly id: string) {} diff --git a/packages/extension/src/hosted/api/vscode/debug/common.ts b/packages/extension/src/hosted/api/vscode/debug/common.ts index c60aa51e65..03f1262ff0 100644 --- a/packages/extension/src/hosted/api/vscode/debug/common.ts +++ b/packages/extension/src/hosted/api/vscode/debug/common.ts @@ -1,4 +1,5 @@ import type vscode from 'vscode'; + import { DebugConfigurationProviderTriggerKind } from '../../worker/worker.ext-types'; export interface IDebugConfigurationProvider extends vscode.DebugConfigurationProvider { diff --git a/packages/extension/src/hosted/api/vscode/debug/ext.host.debug.ts b/packages/extension/src/hosted/api/vscode/debug/ext.host.debug.ts index f243b0e0fd..53334cbc1c 100644 --- a/packages/extension/src/hosted/api/vscode/debug/ext.host.debug.ts +++ b/packages/extension/src/hosted/api/vscode/debug/ext.host.debug.ts @@ -1,4 +1,15 @@ import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Emitter, Event, uuid, IJSONSchema, IJSONSchemaSnippet } from '@opensumi/ide-core-common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; +import { + DebugConfiguration, + DebugStreamConnection, + IDebuggerContribution, + IDebugSessionDTO, +} from '@opensumi/ide-debug'; + import { IExtHostCommands, IExtHostDebugService, @@ -6,7 +17,7 @@ import { ExtensionWSChannel, IExtHostConnectionService, } from '../../../../common/vscode'; -import { Emitter, Event, uuid, IJSONSchema, IJSONSchemaSnippet } from '@opensumi/ide-core-common'; +import { MainThreadAPIIdentifier } from '../../../../common/vscode'; import { Disposable, Uri, @@ -17,27 +28,19 @@ import { DebugAdapterNamedPipeServer, DebugConfigurationProviderTriggerKind, } from '../../../../common/vscode/ext-types'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { MainThreadAPIIdentifier } from '../../../../common/vscode'; -import { ExtensionDebugAdapterSession } from './extension-debug-adapter-session'; import { Breakpoint } from '../../../../common/vscode/models'; -import { - DebugConfiguration, - DebugStreamConnection, - IDebuggerContribution, - IDebugSessionDTO, -} from '@opensumi/ide-debug'; -import { ExtensionDebugAdapterTracker } from './extension-debug-adapter-tracker'; +import { CustomeChildProcessModule } from '../../../ext.process-base'; + +import { IDebugConfigurationProvider } from './common'; +import { resolveDebugAdapterExecutable } from './extension-debug-adapter-excutable-resolver'; +import { ExtensionDebugAdapterSession } from './extension-debug-adapter-session'; import { connectDebugAdapter, startDebugAdapter, directDebugAdapter, namedPipeDebugAdapter, } from './extension-debug-adapter-starter'; -import { resolveDebugAdapterExecutable } from './extension-debug-adapter-excutable-resolver'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import { CustomeChildProcessModule } from '../../../ext.process-base'; -import { IDebugConfigurationProvider } from './common'; +import { ExtensionDebugAdapterTracker } from './extension-debug-adapter-tracker'; export function createDebugApiFactory(extHostDebugService: IExtHostDebugService) { const debug: typeof vscode.debug = { diff --git a/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-excutable-resolver.ts b/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-excutable-resolver.ts index de8095f84d..3823925e5f 100644 --- a/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-excutable-resolver.ts +++ b/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-excutable-resolver.ts @@ -1,7 +1,10 @@ import path from 'path'; + import type vscode from 'vscode'; + import { isWindows, isOSX } from '@opensumi/ide-core-common'; import { IDebuggerContribution, IPlatformSpecificAdapterContribution } from '@opensumi/ide-debug'; + import { DebugAdapterExecutable } from '../../../../common/vscode/ext-types'; export async function resolveDebugAdapterExecutable( diff --git a/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-session.ts b/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-session.ts index 93a63df0ba..75ea7b44c5 100644 --- a/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-session.ts +++ b/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-session.ts @@ -1,6 +1,8 @@ import type vscode from 'vscode'; -import { DebugStreamConnection, DebugConfiguration } from '@opensumi/ide-debug'; + import { IWebSocket } from '@opensumi/ide-connection'; +import { DebugStreamConnection, DebugConfiguration } from '@opensumi/ide-debug'; + import { StreamDebugAdapter } from './abstract-debug-adapter-session'; export class ExtensionDebugAdapterSession extends StreamDebugAdapter implements vscode.DebugSession { diff --git a/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-starter.ts b/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-starter.ts index 66d0ede062..f8326b58e0 100644 --- a/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-starter.ts +++ b/packages/extension/src/hosted/api/vscode/debug/extension-debug-adapter-starter.ts @@ -1,8 +1,12 @@ +import { ChildProcess, fork, SpawnOptions, spawn } from 'child_process'; import net from 'net'; + import type vscode from 'vscode'; + import { DebugStreamConnection, DebugAdapterForkExecutable } from '@opensumi/ide-debug'; -import { ChildProcess, fork, SpawnOptions, spawn } from 'child_process'; + import { CustomeChildProcessModule, CustomeChildProcess } from '../../../ext.process-base'; + import { DirectDebugAdapter } from './abstract-debug-adapter-session'; /** diff --git a/packages/extension/src/hosted/api/vscode/doc/doc-manager.host.ts b/packages/extension/src/hosted/api/vscode/doc/doc-manager.host.ts index e5b9cb4367..78996af3ca 100644 --- a/packages/extension/src/hosted/api/vscode/doc/doc-manager.host.ts +++ b/packages/extension/src/hosted/api/vscode/doc/doc-manager.host.ts @@ -1,6 +1,9 @@ +import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; import { CancellationTokenSource, Emitter, IDisposable } from '@opensumi/ide-core-common'; -import type vscode from 'vscode'; +import { isUTF8 } from '@opensumi/ide-core-common/lib/encoding'; +import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; import { ExtensionDocumentDataManager, @@ -17,9 +20,8 @@ import { import { TextEdit as TextEditConverter, toRange } from '../../../../common/vscode/converter'; import { TextDocumentChangeReason, TextEdit, Uri } from '../../../../common/vscode/ext-types'; import type * as model from '../../../../common/vscode/model.api'; + import { ExtHostDocumentData, setWordDefinitionFor } from './ext-data.host'; -import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; -import { isUTF8 } from '@opensumi/ide-core-common/lib/encoding'; const OPEN_TEXT_DOCUMENT_TIMEOUT = 5000; diff --git a/packages/extension/src/hosted/api/vscode/doc/ext-data.host.ts b/packages/extension/src/hosted/api/vscode/doc/ext-data.host.ts index 980c6dabe8..402920db10 100644 --- a/packages/extension/src/hosted/api/vscode/doc/ext-data.host.ts +++ b/packages/extension/src/hosted/api/vscode/doc/ext-data.host.ts @@ -1,8 +1,10 @@ import type vscode from 'vscode'; + +import { IMainThreadDocumentsShape } from '../../../../common/vscode'; +import { Range, Position, EndOfLine, Schemas, Uri } from '../../../../common/vscode/ext-types'; + import { MirrorTextModel } from './mirror'; import { ensureValidWordDefinition, getWordAtText } from './wordHelper'; -import { Range, Position, EndOfLine, Schemas, Uri } from '../../../../common/vscode/ext-types'; -import { IMainThreadDocumentsShape } from '../../../../common/vscode'; const _modeId2WordDefinition = new Map(); export function setWordDefinitionFor(modeId: string, wordDefinition: RegExp | undefined): void { diff --git a/packages/extension/src/hosted/api/vscode/doc/mirror.ts b/packages/extension/src/hosted/api/vscode/doc/mirror.ts index 3b82022107..364f34206a 100644 --- a/packages/extension/src/hosted/api/vscode/doc/mirror.ts +++ b/packages/extension/src/hosted/api/vscode/doc/mirror.ts @@ -1,8 +1,10 @@ import { IRange, Position } from '@opensumi/ide-core-common'; + import { IModelChangedEvent } from '../../../../common/vscode'; -import { PrefixSumComputer } from './prefixSumComputer'; import { Uri } from '../../../../common/vscode/ext-types'; +import { PrefixSumComputer } from './prefixSumComputer'; + export class MirrorTextModel { protected _uri: Uri; protected _lines: string[]; diff --git a/packages/extension/src/hosted/api/vscode/editor/edit.builder.ts b/packages/extension/src/hosted/api/vscode/editor/edit.builder.ts index a4f9a16640..c252ff1fc5 100644 --- a/packages/extension/src/hosted/api/vscode/editor/edit.builder.ts +++ b/packages/extension/src/hosted/api/vscode/editor/edit.builder.ts @@ -1,6 +1,7 @@ -import { EndOfLine, Position, Range, Selection } from '../../../../common/vscode/ext-types'; import type vscode from 'vscode'; +import { EndOfLine, Position, Range, Selection } from '../../../../common/vscode/ext-types'; + export interface ITextEditOperation { range: Range; text: string | null; diff --git a/packages/extension/src/hosted/api/vscode/editor/editor.host.ts b/packages/extension/src/hosted/api/vscode/editor/editor.host.ts index 8eb45e0967..ea8609046b 100644 --- a/packages/extension/src/hosted/api/vscode/editor/editor.host.ts +++ b/packages/extension/src/hosted/api/vscode/editor/editor.host.ts @@ -1,12 +1,15 @@ +import debounce = require('lodash.debounce'); +import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { ISelection, Emitter, Event, IRange, getDebugLogger, Disposable } from '@opensumi/ide-core-common'; +import { ISingleEditOperation, IDecorationApplyOptions, IResourceOpenOptions } from '@opensumi/ide-editor'; + import { IExtensionHostEditorService, ExtensionDocumentDataManager, MainThreadAPIIdentifier, } from '../../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import type vscode from 'vscode'; -import { Uri, Position, Range, Selection, TextEditorLineNumbersStyle } from '../../../../common/vscode/ext-types'; -import { ISelection, Emitter, Event, IRange, getDebugLogger, Disposable } from '@opensumi/ide-core-common'; import * as TypeConverts from '../../../../common/vscode/converter'; import { IEditorStatusChangeDTO, @@ -18,9 +21,11 @@ import { ITextEditorUpdateConfiguration, TextEditorCursorStyle, } from '../../../../common/vscode/editor'; +import { Uri, Position, Range, Selection, TextEditorLineNumbersStyle } from '../../../../common/vscode/ext-types'; + import { TextEditorEdit } from './edit.builder'; -import { ISingleEditOperation, IDecorationApplyOptions, IResourceOpenOptions } from '@opensumi/ide-editor'; -import debounce = require('lodash.debounce'); + + export class ExtensionHostEditorService implements IExtensionHostEditorService { private _editors: Map = new Map(); diff --git a/packages/extension/src/hosted/api/vscode/ext.host.api.command.ts b/packages/extension/src/hosted/api/vscode/ext.host.api.command.ts index f2890dc911..5e7fe22adf 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.api.command.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.api.command.ts @@ -3,15 +3,19 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CommandsConverter } from './ext.host.command'; -import * as typeConverters from '../../../common/vscode/converter'; -import * as types from '../../../common/vscode/ext-types'; -import * as modes from '../../../common/vscode/model.api'; +import type * as vscode from 'vscode'; + import { Uri as URI } from '@opensumi/ide-core-common'; import { isFalsyOrEmpty } from '@opensumi/ide-core-common/lib/arrays'; -import type * as vscode from 'vscode'; import type { ITextEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/platform/editor/common/editor'; +import * as typeConverters from '../../../common/vscode/converter'; +import * as types from '../../../common/vscode/ext-types'; +import * as modes from '../../../common/vscode/model.api'; + + +import { CommandsConverter } from './ext.host.command'; + type IPosition = modes.Position; type IRange = modes.Range; type ISelection = modes.Selection; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.api.impl.ts b/packages/extension/src/hosted/api/vscode/ext.host.api.impl.ts index cd32401dc2..e1af1073e5 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.api.impl.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.api.impl.ts @@ -1,7 +1,9 @@ -import { IExtHostEditorTabs } from './../../../common/vscode/editor-tabs'; -import { ExtHostFileSystemInfo } from './ext.host.file-system-info'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { CancellationTokenSource, Emitter, Event } from '@opensumi/ide-core-common'; +import { OverviewRulerLane } from '@opensumi/ide-editor'; + +import { IExtensionHostService } from '../../../common'; import { IExtHostConnectionService, IExtHostDebugService, @@ -12,45 +14,45 @@ import { IExtensionDescription, IExtHostTests, } from '../../../common/vscode'; // '../../common'; -import { IExtensionHostService } from '../../../common'; -import { createWindowApiFactory, ExtHostWindow } from './ext.host.window.api.impl'; -import { ExtensionDocumentDataManagerImpl } from './doc'; +import { ViewColumn } from '../../../common/vscode/enums'; import * as extTypes from '../../../common/vscode/ext-types'; import * as fileSystemTypes from '../../../common/vscode/file-system'; -import { ViewColumn } from '../../../common/vscode/enums'; -import { ExtHostCommands, createCommandsApiFactory } from './ext.host.command'; -import { ExtHostWorkspace, createWorkspaceApiFactory } from './ext.host.workspace'; +import { ExtHostAppConfig } from '../../ext.process-base'; + +import { IExtHostEditorTabs } from './../../../common/vscode/editor-tabs'; +import { ExtHostDebug, createDebugApiFactory } from './debug'; +import { ExtensionDocumentDataManagerImpl } from './doc'; import { ExtensionHostEditorService } from './editor/editor.host'; -import { CancellationTokenSource, Emitter, Event } from '@opensumi/ide-core-common'; -import { ExtHostPreference } from './ext.host.preference'; -import { createExtensionsApiFactory } from './ext.host.extensions'; +import { ExtHostWebviewService, ExtHostWebviewViews } from './ext.host.api.webview'; +import { ExtHostAuthentication, createAuthenticationApiFactory } from './ext.host.authentication'; +import { ExtHostCommands, createCommandsApiFactory } from './ext.host.command'; +import { ExtHostComments, createCommentsApiFactory } from './ext.host.comments'; +import { ExtHostConnection } from './ext.host.connection'; +import { ExtHostCustomEditorImpl } from './ext.host.custom-editor'; +import { ExtHostDecorations } from './ext.host.decoration'; +import { ExtHostEditorTabs } from './ext.host.editor-tabs'; import { createEnvApiFactory, ExtHostEnv } from './ext.host.env'; -import { createLanguagesApiFactory, ExtHostLanguages } from './ext.host.language'; +import { createExtensionsApiFactory } from './ext.host.extensions'; import { ExtHostFileSystem } from './ext.host.file-system'; -import { OverviewRulerLane } from '@opensumi/ide-editor'; +import { ExtHostFileSystemEvent } from './ext.host.file-system-event'; +import { ExtHostFileSystemInfo } from './ext.host.file-system-info'; +import { createLanguagesApiFactory, ExtHostLanguages } from './ext.host.language'; import { ExtHostMessage } from './ext.host.message'; -import { ExtHostTreeViews } from './ext.host.treeview'; -import { ExtHostWebviewService, ExtHostWebviewViews } from './ext.host.api.webview'; -import { ExtHostSCM } from './ext.host.scm'; -import { ExtHostWindowState } from './ext.host.window-state'; -import { ExtHostDecorations } from './ext.host.decoration'; -import { ExtHostQuickOpen } from './ext.host.quickopen'; import { ExtHostOutput } from './ext.host.output'; +import { ExtHostPreference } from './ext.host.preference'; +import { ExtHostProgress } from './ext.host.progress'; +import { ExtHostQuickOpen } from './ext.host.quickopen'; +import { ExtHostSCM } from './ext.host.scm'; import { ExtHostStatusBar } from './ext.host.statusbar'; -import { ExtHostDebug, createDebugApiFactory } from './debug'; -import { ExtHostConnection } from './ext.host.connection'; import { ExtHostTerminal } from './ext.host.terminal'; -import { ExtHostProgress } from './ext.host.progress'; -import { ExtHostAppConfig } from '../../ext.process-base'; -import { ExtHostTasks, createTaskApiFactory } from './tasks/ext.host.tasks'; -import { ExtHostComments, createCommentsApiFactory } from './ext.host.comments'; -import { ExtHostFileSystemEvent } from './ext.host.file-system-event'; -import { ExtHostUrls } from './ext.host.urls'; -import { ExtHostTheming } from './ext.host.theming'; -import { ExtHostCustomEditorImpl } from './ext.host.custom-editor'; -import { ExtHostAuthentication, createAuthenticationApiFactory } from './ext.host.authentication'; import { ExtHostTestsImpl } from './ext.host.tests'; -import { ExtHostEditorTabs } from './ext.host.editor-tabs'; +import { ExtHostTheming } from './ext.host.theming'; +import { ExtHostTreeViews } from './ext.host.treeview'; +import { ExtHostUrls } from './ext.host.urls'; +import { ExtHostWindowState } from './ext.host.window-state'; +import { createWindowApiFactory, ExtHostWindow } from './ext.host.window.api.impl'; +import { ExtHostWorkspace, createWorkspaceApiFactory } from './ext.host.workspace'; +import { ExtHostTasks, createTaskApiFactory } from './tasks/ext.host.tasks'; export function createApiFactory( rpcProtocol: IRPCProtocol, diff --git a/packages/extension/src/hosted/api/vscode/ext.host.api.webview.ts b/packages/extension/src/hosted/api/vscode/ext.host.api.webview.ts index 61d4cb6f75..b8611119d0 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.api.webview.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.api.webview.ts @@ -1,3 +1,12 @@ +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { + Emitter, + Event, + IExtensionInfo, + Disposable as IDEDisposable, + CancellationToken, +} from '@opensumi/ide-core-common'; + import { IMainThreadWebview, IExtHostWebview, @@ -17,15 +26,8 @@ import { IExtensionDescription, WebviewViewProvider, } from '../../../common/vscode'; -import { - Emitter, - Event, - IExtensionInfo, - Disposable as IDEDisposable, - CancellationToken, -} from '@opensumi/ide-core-common'; import { Uri, Disposable } from '../../../common/vscode/ext-types'; -import { IRPCProtocol } from '@opensumi/ide-connection'; + type IconPath = Uri | { light: Uri; dark: Uri }; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.authentication.ts b/packages/extension/src/hosted/api/vscode/ext.host.authentication.ts index b1e7918c7c..7bd760e880 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.authentication.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.authentication.ts @@ -4,6 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, Disposable, @@ -13,7 +15,7 @@ import { AuthenticationSession, getDebugLogger, } from '@opensumi/ide-core-common'; -import { IRPCProtocol } from '@opensumi/ide-connection'; + import { MainThreadAPIIdentifier, IExtHostAuthentication, IMainThreadAuthentication } from '../../../common/vscode'; import { ExtensionIdentifier, IExtensionDescription } from '../../../common/vscode/extension'; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.command.ts b/packages/extension/src/hosted/api/vscode/ext.host.command.ts index 439cb7dc21..a26c2c4476 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.command.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.command.ts @@ -1,7 +1,18 @@ import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; -import { Disposable, Position, Range, Location } from '../../../common/vscode/ext-types'; -import * as extHostTypeConverter from '../../../common/vscode/converter'; +import { + getDebugLogger, + revive, + toDisposable, + DisposableStore, + isNonEmptyArray, + IExtensionInfo, +} from '@opensumi/ide-core-common'; +import { Uri } from '@opensumi/ide-core-common'; +import { cloneAndChange } from '@opensumi/ide-core-common/lib/utils/objects'; +import { validateConstraint, isFunction } from '@opensumi/ide-core-common/lib/utils/types'; + import { MainThreadAPIIdentifier, IMainThreadCommands, @@ -12,23 +23,15 @@ import { CommandHandler, IExtensionDescription, } from '../../../common/vscode'; -import { cloneAndChange } from '@opensumi/ide-core-common/lib/utils/objects'; -import { validateConstraint, isFunction } from '@opensumi/ide-core-common/lib/utils/types'; -import { - getDebugLogger, - revive, - toDisposable, - DisposableStore, - isNonEmptyArray, - IExtensionInfo, -} from '@opensumi/ide-core-common'; -import { ExtensionHostEditorService } from './editor/editor.host'; -import { ObjectIdentifier } from './language/util'; -import { CommandDto } from '../../../common/vscode/scm'; +import * as extHostTypeConverter from '../../../common/vscode/converter'; +import { Disposable, Position, Range, Location } from '../../../common/vscode/ext-types'; import * as modes from '../../../common/vscode/model.api'; -import { Uri } from '@opensumi/ide-core-common'; +import { CommandDto } from '../../../common/vscode/scm'; import { IBuiltInCommand } from '../../ext.process-base'; + +import { ExtensionHostEditorService } from './editor/editor.host'; import { ApiCommand, ApiCommandResult, newCommands } from './ext.host.api.command'; +import { ObjectIdentifier } from './language/util'; export function createCommandsApiFactory( extHostCommands: IExtHostCommands, diff --git a/packages/extension/src/hosted/api/vscode/ext.host.comments.ts b/packages/extension/src/hosted/api/vscode/ext.host.comments.ts index fb5f0f7f99..b56f1fdd76 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.comments.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.comments.ts @@ -6,6 +6,8 @@ // some code copied and modified from https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostComments.ts#L32 import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Uri as URI, MutableDisposable, @@ -16,19 +18,19 @@ import { asPromise, CancellationToken, } from '@opensumi/ide-core-common'; -import { IExtHostComments, IMainThreadComments } from '../../../common/vscode/comments'; -import { IRPCProtocol } from '@opensumi/ide-connection'; +import type { UriComponents } from '@opensumi/ide-core-common'; + +import { getExtensionId } from '../../../common'; import { MainThreadAPIIdentifier, IExtHostCommands, ExtensionDocumentDataManager, IExtensionDescription, } from '../../../common/vscode'; -import type { UriComponents } from '@opensumi/ide-core-common'; +import { IExtHostComments, IMainThreadComments } from '../../../common/vscode/comments'; import * as extHostTypeConverter from '../../../common/vscode/converter'; -import * as models from '../../../common/vscode/models'; import * as types from '../../../common/vscode/ext-types'; -import { getExtensionId } from '../../../common'; +import * as models from '../../../common/vscode/models'; type ProviderHandle = number; type ReactionHandler = (comment: vscode.Comment, reaction: vscode.CommentReaction) => Promise; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.connection.ts b/packages/extension/src/hosted/api/vscode/ext.host.connection.ts index a517e3b577..04a3758140 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.connection.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.connection.ts @@ -1,3 +1,6 @@ +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { getDebugLogger } from '@opensumi/ide-core-common'; + import { IExtHostConnectionService, IMainThreadConnection, @@ -6,8 +9,6 @@ import { ExtensionMessageReader, ExtensionMessageWriter, } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { getDebugLogger } from '@opensumi/ide-core-common'; export class ExtHostConnection implements IExtHostConnectionService { private proxy: IMainThreadConnection; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.custom-editor.ts b/packages/extension/src/hosted/api/vscode/ext.host.custom-editor.ts index 22b7e22199..bb8fb8fd98 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.custom-editor.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.custom-editor.ts @@ -1,3 +1,10 @@ +import { CustomDocumentOpenContext } from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IDisposable, CancellationToken, IExtensionInfo, Emitter, Schemas } from '@opensumi/ide-core-common'; +import { iconvEncode } from '@opensumi/ide-core-common/lib/encoding'; +import { UriComponents } from '@opensumi/ide-editor'; + import { IExtHostCustomEditor, IMainThreadCustomEditor, @@ -7,11 +14,6 @@ import { IWebviewPanelOptions, TCustomEditorProvider, } from '../../../common/vscode'; -import { UriComponents } from '@opensumi/ide-editor'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostWebviewService } from './ext.host.api.webview'; -import { IDisposable, CancellationToken, IExtensionInfo, Emitter, Schemas } from '@opensumi/ide-core-common'; -import { Uri } from '../../../common/vscode/ext-types'; import { CustomEditorProvider, CustomReadonlyEditorProvider, @@ -20,8 +22,10 @@ import { CustomDocumentEditEvent, CustomDocumentContentChangeEvent, } from '../../../common/vscode/custom-editor'; -import { CustomDocumentOpenContext } from 'vscode'; -import { iconvEncode } from '@opensumi/ide-core-common/lib/encoding'; +import { Uri } from '../../../common/vscode/ext-types'; + +import { ExtHostWebviewService } from './ext.host.api.webview'; + export class ExtHostCustomEditorImpl implements IExtHostCustomEditor { private proxy: IMainThreadCustomEditor; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.decoration.ts b/packages/extension/src/hosted/api/vscode/ext.host.decoration.ts index f9a65844e4..e39b17ec10 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.decoration.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.decoration.ts @@ -1,11 +1,13 @@ import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Uri } from '@opensumi/ide-core-common'; import { CancellationToken } from '@opensumi/ide-core-common'; +import { getDebugLogger } from '@opensumi/ide-core-common'; import { toDisposable } from '@opensumi/ide-core-common/lib/disposable'; import { asArray } from '@opensumi/ide-core-common/lib/utils/arrays'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { getDebugLogger } from '@opensumi/ide-core-common'; +import { MainThreadAPIIdentifier } from '../../../common/vscode'; import { IMainThreadDecorationsShape, DecorationRequest, @@ -13,7 +15,6 @@ import { DecorationData, IExtHostDecorationsShape, } from '../../../common/vscode/decoration'; -import { MainThreadAPIIdentifier } from '../../../common/vscode'; import { FileDecoration } from '../../../common/vscode/ext-types'; interface ProviderData { diff --git a/packages/extension/src/hosted/api/vscode/ext.host.editor-tabs.ts b/packages/extension/src/hosted/api/vscode/ext.host.editor-tabs.ts index 7096f440cf..0f2194a833 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.editor-tabs.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.editor-tabs.ts @@ -1,12 +1,13 @@ -import { MainThreadAPIIdentifier } from './../../../common/vscode/index'; import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, Event, URI, Uri } from '@opensumi/ide-core-common'; + import { IExtHostEditorTabs, IEditorTab, IEditorTabDto, IMainThreadEditorTabsShape, } from './../../../common/vscode/editor-tabs'; +import { MainThreadAPIIdentifier } from './../../../common/vscode/index'; export class ExtHostEditorTabs implements IExtHostEditorTabs { private _proxy: IMainThreadEditorTabsShape; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.env.ts b/packages/extension/src/hosted/api/vscode/ext.host.env.ts index 28e1839d7f..b107c6f4a8 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.env.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.env.ts @@ -1,8 +1,12 @@ -import type vscode from 'vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { createHash } from 'crypto'; -import { v4 } from 'uuid'; + import address from 'address'; +import { v4 } from 'uuid'; +import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Event, Emitter, LogLevel as KTLogLevel, Schemas, URI } from '@opensumi/ide-core-common'; + import { MainThreadAPIIdentifier, IMainThreadEnv, @@ -11,7 +15,6 @@ import { } from '../../../common/vscode'; import { IExtHostEnv, ExtHostEnvValues } from '../../../common/vscode'; import { LogLevel } from '../../../common/vscode/ext-types'; -import { Event, Emitter, LogLevel as KTLogLevel, Schemas, URI } from '@opensumi/ide-core-common'; export class Env { private macMachineId: string; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.extensions.ts b/packages/extension/src/hosted/api/vscode/ext.host.extensions.ts index 0637048368..3cde29b31f 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.extensions.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.extensions.ts @@ -1,13 +1,16 @@ import path from 'path'; + import type vscode from 'vscode'; + import { Uri } from '@opensumi/ide-core-common/lib/uri'; +import { IExtendProxy, IExtensionHost, IExtensionProps } from '../../../common'; import { IExtHostTerminal } from '../../../common/vscode'; -import { KTExtension, KTWorkerExtension } from '../../vscode.extension'; import { ExtensionMode } from '../../../common/vscode/ext-types'; -import { ExtensionGlobalMemento, ExtensionMemento, ExtHostStorage } from './ext.host.storage'; -import { IExtendProxy, IExtensionHost, IExtensionProps } from '../../../common'; +import { KTExtension, KTWorkerExtension } from '../../vscode.extension'; + import { ExtensionSecrets, ExtHostSecret } from './ext.host.secrets'; +import { ExtensionGlobalMemento, ExtensionMemento, ExtHostStorage } from './ext.host.storage'; export interface IKTContextOptions { extensionId: string; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.file-system-event.ts b/packages/extension/src/hosted/api/vscode/ext.host.file-system-event.ts index 08d1ab4561..2e158bde14 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.file-system-event.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.file-system-event.ts @@ -15,6 +15,9 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/file-system-event-service-ext-impl.ts +import vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Event, Emitter, @@ -25,13 +28,15 @@ import { CancellationToken, getDebugLogger, } from '@opensumi/ide-core-common'; -import vscode from 'vscode'; +import { FileOperation } from '@opensumi/ide-workspace-edit'; + import { ExtensionDocumentDataManager, IMainThreadWorkspace, MainThreadAPIIdentifier, IExtensionDescription, } from '../../../common/vscode'; +import * as TypeConverts from '../../../common/vscode/converter'; import { WorkspaceEdit } from '../../../common/vscode/ext-types'; import { FileSystemEvents, @@ -40,9 +45,6 @@ import { SourceTargetPair, } from '../../../common/vscode/file-system'; import { IRelativePattern, parse } from '../../../common/vscode/glob'; -import * as TypeConverts from '../../../common/vscode/converter'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { FileOperation } from '@opensumi/ide-workspace-edit'; import * as model from '../../../common/vscode/model.api'; class FileSystemWatcher implements vscode.FileSystemWatcher { diff --git a/packages/extension/src/hosted/api/vscode/ext.host.file-system-info.ts b/packages/extension/src/hosted/api/vscode/ext.host.file-system-info.ts index 5177efec7e..877ffb349e 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.file-system-info.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.file-system-info.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Schemas } from '@opensumi/ide-core-common'; + import { IExtHostFileSystemInfoShape } from '../../../common/vscode/file-system'; export class ExtHostFileSystemInfo implements IExtHostFileSystemInfoShape { diff --git a/packages/extension/src/hosted/api/vscode/ext.host.file-system.ts b/packages/extension/src/hosted/api/vscode/ext.host.file-system.ts index 1763f94b87..4e1851ed63 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.file-system.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.file-system.ts @@ -16,13 +16,17 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/file-system-ext-impl.ts import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; -import { FileChangeType, FileStat, FileSystemProviderCapabilities, FileChange } from '@opensumi/ide-file-service'; import { URI, IDisposable, Schemas, toDisposable } from '@opensumi/ide-core-common'; +import { FileChangeType, FileStat, FileSystemProviderCapabilities, FileChange } from '@opensumi/ide-file-service'; + import { MainThreadAPIIdentifier } from '../../../common/vscode'; -import { ExtHostFileSystemInfo } from './ext.host.file-system-info'; -import * as files from '../../../common/vscode/file-system'; import { UriComponents } from '../../../common/vscode/ext-types'; +import * as files from '../../../common/vscode/file-system'; + +import { ExtHostFileSystemInfo } from './ext.host.file-system-info'; + export function convertToVSCFileStat(stat: FileStat): vscode.FileStat { return { diff --git a/packages/extension/src/hosted/api/vscode/ext.host.language.ts b/packages/extension/src/hosted/api/vscode/ext.host.language.ts index 6f968cbc47..8a83bac151 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.language.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.language.ts @@ -5,11 +5,6 @@ // some code copied and modified from https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostLanguageFeatures.ts import vscode from 'vscode'; -import { InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; -import type { CodeActionContext } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { ConstructorOf } from '@opensumi/di'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import * as typeConvert from '../../../common/vscode/converter'; import { DocumentSelector, HoverProvider, @@ -52,6 +47,35 @@ import { InlineValuesProvider, LinkedEditingRangeProvider, } from 'vscode'; +import { SymbolInformation } from 'vscode-languageserver-types'; + +import { ConstructorOf } from '@opensumi/di'; +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { + DisposableStore, + disposableTimeout, + IDisposable, + IExtensionLogger, + Severity, + Uri, + UriComponents, +} from '@opensumi/ide-core-common'; +import { InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; +import type { CodeActionContext } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + +import { + IMainThreadLanguages, + MainThreadAPIIdentifier, + ExtensionDocumentDataManager, + IExtHostLanguages, + ISuggestDataDto, + IExtensionDescription, + ICodeActionListDto, + IInlineValueContextDto, + ILinkedEditingRangesDto, +} from '../../../common/vscode'; +import * as typeConvert from '../../../common/vscode/converter'; +import { CancellationError, Disposable, LanguageStatusSeverity } from '../../../common/vscode/ext-types'; import { SerializedDocumentFilter, Hover, @@ -87,58 +111,37 @@ import { ISignatureHelpDto, ILinksListDto, } from '../../../common/vscode/model.api'; -import { - IMainThreadLanguages, - MainThreadAPIIdentifier, - ExtensionDocumentDataManager, - IExtHostLanguages, - ISuggestDataDto, - IExtensionDescription, - ICodeActionListDto, - IInlineValueContextDto, - ILinkedEditingRangesDto, -} from '../../../common/vscode'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { - DisposableStore, - disposableTimeout, - IDisposable, - IExtensionLogger, - Severity, - Uri, - UriComponents, -} from '@opensumi/ide-core-common'; -import { CancellationError, Disposable, LanguageStatusSeverity } from '../../../common/vscode/ext-types'; +import { serializeEnterRules, serializeRegExp, serializeIndentation } from '../../../common/vscode/utils'; + +import { ExtHostCommands } from './ext.host.command'; +import { CallHierarchyAdapter } from './language/callhierarchy'; +import { CodeActionAdapter } from './language/code-action'; +import { ColorProviderAdapter } from './language/color'; import { CompletionAdapter } from './language/completion'; -import { DefinitionAdapter } from './language/definition'; import { DeclarationAdapter } from './language/declaration'; -import { TypeDefinitionAdapter } from './language/type-definition'; -import { FoldingProviderAdapter } from './language/folding'; -import { ColorProviderAdapter } from './language/color'; +import { DefinitionAdapter } from './language/definition'; +import { Diagnostics } from './language/diagnostics'; import { DocumentHighlightAdapter } from './language/document-highlight'; +import { EvaluatableExpressionAdapter } from './language/evaluatableExpression'; +import { FoldingProviderAdapter } from './language/folding'; import { HoverAdapter } from './language/hover'; -import { CodeLensAdapter } from './language/lens'; -import { RangeFormattingAdapter, FormattingAdapter } from './language/range-formatting'; -import { OnTypeFormattingAdapter } from './language/on-type-formatting'; -import { CodeActionAdapter } from './language/code-action'; -import { Diagnostics } from './language/diagnostics'; import { ImplementationAdapter } from './language/implementation'; +import { InlayHintsAdapter } from './language/inlay-hints'; +import { InlineValuesAdapter } from './language/inline-values'; +import { CodeLensAdapter } from './language/lens'; import { LinkProviderAdapter } from './language/link-provider'; -import { ReferenceAdapter } from './language/reference'; -import { getDurationTimer, score } from './language/util'; -import { serializeEnterRules, serializeRegExp, serializeIndentation } from '../../../common/vscode/utils'; +import { LinkedEditingRangeAdapter } from './language/linked-editing-range'; +import { OnTypeFormattingAdapter } from './language/on-type-formatting'; import { OutlineAdapter } from './language/outline'; -import { WorkspaceSymbolAdapter } from './language/workspace-symbol'; -import { SignatureHelpAdapter } from './language/signature'; +import { RangeFormattingAdapter, FormattingAdapter } from './language/range-formatting'; +import { ReferenceAdapter } from './language/reference'; import { RenameAdapter } from './language/rename'; import { SelectionRangeAdapter } from './language/selection'; -import { CallHierarchyAdapter } from './language/callhierarchy'; -import { ExtHostCommands } from './ext.host.command'; import { DocumentRangeSemanticTokensAdapter, DocumentSemanticTokensAdapter } from './language/semantic-tokens'; -import { EvaluatableExpressionAdapter } from './language/evaluatableExpression'; -import { InlineValuesAdapter } from './language/inline-values'; -import { LinkedEditingRangeAdapter } from './language/linked-editing-range'; -import { InlayHintsAdapter } from './language/inlay-hints'; +import { SignatureHelpAdapter } from './language/signature'; +import { TypeDefinitionAdapter } from './language/type-definition'; +import { getDurationTimer, score } from './language/util'; +import { WorkspaceSymbolAdapter } from './language/workspace-symbol'; export function createLanguagesApiFactory( extHostLanguages: ExtHostLanguages, diff --git a/packages/extension/src/hosted/api/vscode/ext.host.message.ts b/packages/extension/src/hosted/api/vscode/ext.host.message.ts index 8d1d1e71ad..53797bc3ee 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.message.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.message.ts @@ -1,8 +1,10 @@ import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; +import { MessageType } from '@opensumi/ide-core-common'; import { MAX_MESSAGE_LENGTH } from '@opensumi/ide-overlay/lib/common'; + import { IMainThreadMessage, MainThreadAPIIdentifier, IExtHostMessage } from '../../../common/vscode'; -import { MessageType } from '@opensumi/ide-core-common'; export class ExtHostMessage implements IExtHostMessage { private proxy: IMainThreadMessage; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.output.ts b/packages/extension/src/hosted/api/vscode/ext.host.output.ts index 2e7c20d5be..409b32a394 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.output.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.output.ts @@ -1,7 +1,8 @@ -import * as types from '../../../common/vscode/ext-types'; -import { IExtHostOutput, IMainThreadOutput, MainThreadAPIIdentifier } from '../../../common/vscode'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IExtHostOutput, IMainThreadOutput, MainThreadAPIIdentifier } from '../../../common/vscode'; +import * as types from '../../../common/vscode/ext-types'; + export class ExtHostOutput implements IExtHostOutput { constructor(private rpcProtocol: IRPCProtocol) {} diff --git a/packages/extension/src/hosted/api/vscode/ext.host.preference.ts b/packages/extension/src/hosted/api/vscode/ext.host.preference.ts index a1c73f2af5..6cf9804232 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.preference.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.preference.ts @@ -15,7 +15,11 @@ ********************************************************************************/ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/preference-registry.ts -import { Configuration, ConfigurationChangeEvent, ConfigurationModel } from './preferences'; +import cloneDeep = require('lodash.clonedeep'); + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Emitter, Event, PreferenceScope, isObject, mixin, isUndefined } from '@opensumi/ide-core-common'; + import { MainThreadAPIIdentifier, IMainThreadPreference, @@ -26,10 +30,10 @@ import { IExtHostWorkspace, ConfigurationTarget, } from '../../../common/vscode'; -import { Emitter, Event, PreferenceScope, isObject, mixin, isUndefined } from '@opensumi/ide-core-common'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { Uri } from '../../../common/vscode/ext-types'; -import cloneDeep = require('lodash.clonedeep'); + +import { Configuration, ConfigurationChangeEvent, ConfigurationModel } from './preferences'; + interface ConfigurationInspect { key: string; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.progress.ts b/packages/extension/src/hosted/api/vscode/ext.host.progress.ts index 61178d3259..d5b990064c 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.progress.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.progress.ts @@ -3,12 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { - MainThreadAPIIdentifier, - IExtHostProgress, - IMainThreadProgress, - IExtensionDescription, -} from '../../../common/vscode'; +import { ProgressOptions } from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; import { formatLocalize, @@ -18,8 +14,15 @@ import { throttle, CancellationTokenSource, } from '@opensumi/ide-core-common'; + +import { + MainThreadAPIIdentifier, + IExtHostProgress, + IMainThreadProgress, + IExtensionDescription, +} from '../../../common/vscode'; import { ProgressLocation } from '../../../common/vscode/converter'; -import { ProgressOptions } from 'vscode'; + export class ExtHostProgress implements IExtHostProgress { private _handles = 0; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts b/packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts index c68f9f3d22..d5947e6bc8 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts @@ -1,11 +1,6 @@ import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; -import { - MainThreadAPIIdentifier, - IExtHostQuickOpen, - IMainThreadQuickOpen, - IExtHostWorkspace, -} from '../../../common/vscode'; import { CancellationToken, hookCancellationToken, @@ -17,6 +12,13 @@ import { } from '@opensumi/ide-core-common'; import { QuickPickItem, QuickPickOptions } from '@opensumi/ide-quick-open'; +import { + MainThreadAPIIdentifier, + IExtHostQuickOpen, + IMainThreadQuickOpen, + IExtHostWorkspace, +} from '../../../common/vscode'; + type Item = string | vscode.QuickPickItem; export class ExtHostQuickOpen implements IExtHostQuickOpen { diff --git a/packages/extension/src/hosted/api/vscode/ext.host.scm.ts b/packages/extension/src/hosted/api/vscode/ext.host.scm.ts index 0da80877bc..8799d6e412 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.scm.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.scm.ts @@ -16,6 +16,8 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/scm.ts import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { asPromise, comparePaths, @@ -32,7 +34,7 @@ import { IDisposable, } from '@opensumi/ide-core-common'; import { ISplice } from '@opensumi/ide-core-common/lib/sequence'; -import { IRPCProtocol } from '@opensumi/ide-connection'; + import { MainThreadAPIIdentifier, IExtensionDescription } from '../../../common/vscode'; import { SCMRawResourceSplices, @@ -42,6 +44,7 @@ import { IExtHostSCMShape, CommandDto, } from '../../../common/vscode/scm'; + import { ExtHostCommands } from './ext.host.command'; export type IMainContext = IRPCProtocol; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.secrets.ts b/packages/extension/src/hosted/api/vscode/ext.host.secrets.ts index 33dda31b65..17092f33c5 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.secrets.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.secrets.ts @@ -1,13 +1,14 @@ import type vscode from 'vscode'; +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, Event, IExtensionProps } from '@opensumi/ide-core-common'; + import { ExtensionIdentifier, IExtHostSecret, IMainThreadSecret, MainThreadAPIIdentifier, } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; export class ExtensionSecrets implements vscode.SecretStorage { protected readonly _id: string; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.statusbar.ts b/packages/extension/src/hosted/api/vscode/ext.host.statusbar.ts index d5ddfe6418..ad98ce9537 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.statusbar.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.statusbar.ts @@ -1,6 +1,9 @@ +import { v4 } from 'uuid'; +import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; import { formatLocalize } from '@opensumi/ide-core-common'; -import { Disposable, ThemeColor } from '../../../common/vscode/ext-types'; + import { MainThreadAPIIdentifier, IMainThreadStatusBar, @@ -8,9 +11,9 @@ import { ArgumentProcessor, IExtensionDescription, } from '../../../common/vscode'; -import { v4 } from 'uuid'; +import { Disposable, ThemeColor } from '../../../common/vscode/ext-types'; import * as types from '../../../common/vscode/ext-types'; -import type vscode from 'vscode'; + export class ExtHostStatusBar implements IExtHostStatusBar { protected readonly proxy: IMainThreadStatusBar; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.storage.ts b/packages/extension/src/hosted/api/vscode/ext.host.storage.ts index 5e9627a50a..d87466944d 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.storage.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.storage.ts @@ -1,4 +1,7 @@ +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, IDisposable } from '@opensumi/ide-core-common'; +import { ExtensionStorageUri } from '@opensumi/ide-extension-storage/lib/common/storage'; + import { IMainThreadStorage, IExtHostStorage, @@ -6,8 +9,6 @@ import { KeysToKeysToAnyValue, MainThreadAPIIdentifier, } from '../../../common/vscode'; -import { ExtensionStorageUri } from '@opensumi/ide-extension-storage/lib/common/storage'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { Memento } from '../../../common/vscode/ext-types'; export interface IStorageChangeEvent { diff --git a/packages/extension/src/hosted/api/vscode/ext.host.terminal.ts b/packages/extension/src/hosted/api/vscode/ext.host.terminal.ts index ec3c23f3a1..f6bc5c24a8 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.terminal.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.terminal.ts @@ -1,4 +1,8 @@ +import { userInfo } from 'os'; + import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { Event, Emitter, @@ -10,7 +14,6 @@ import { Disposable, CancellationTokenSource, } from '@opensumi/ide-core-common'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { ITerminalInfo, TerminalDataBufferer, @@ -23,18 +26,19 @@ import { ICreateContributedTerminalProfileOptions, ITerminalProfile, } from '@opensumi/ide-terminal-next'; +import { + EnvironmentVariableMutatorType, + ISerializableEnvironmentVariableCollection, +} from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; + +import { IExtension } from '../../../common'; import { IMainThreadTerminal, MainThreadAPIIdentifier, IExtHostTerminal, IExtensionDescription, } from '../../../common/vscode'; -import { userInfo } from 'os'; -import { IExtension } from '../../../common'; -import { - EnvironmentVariableMutatorType, - ISerializableEnvironmentVariableCollection, -} from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; + const debugLog = getDebugLogger(); diff --git a/packages/extension/src/hosted/api/vscode/ext.host.tests.ts b/packages/extension/src/hosted/api/vscode/ext.host.tests.ts index 1030c8ab0e..484ba92cf0 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.tests.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.tests.ts @@ -18,13 +18,17 @@ import type { TestsChangeEvent, TestRunResult, } from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpcProtocol'; import { Emitter, Event, getDebugLogger } from '@opensumi/ide-core-common'; -import { Disposable, DisposableStore, toDisposable } from '@opensumi/ide-core-common/lib/disposable'; +import { mapFind } from '@opensumi/ide-core-common/lib/arrays'; import { CancellationToken, CancellationTokenSource } from '@opensumi/ide-core-common/lib/cancellation'; +import { Disposable, DisposableStore, toDisposable } from '@opensumi/ide-core-common/lib/disposable'; +import { once } from '@opensumi/ide-core-common/lib/functional'; import { hash } from '@opensumi/ide-core-common/lib/utils/hash'; +import { deepFreeze } from '@opensumi/ide-core-common/lib/utils/objects'; +import { isDefined } from '@opensumi/ide-core-common/lib/utils/types'; import { uuid } from '@opensumi/ide-core-common/lib/uuid'; -import { TestId, TestIdPathParts, TestPosition } from '@opensumi/ide-testing/lib/common/testId'; import { AbstractIncrementalTestCollection, CoverageDetails, @@ -40,17 +44,14 @@ import { TestRunProfileBitset, TestsDiff, } from '@opensumi/ide-testing/lib/common/testCollection'; -import { isDefined } from '@opensumi/ide-core-common/lib/utils/types'; -import { once } from '@opensumi/ide-core-common/lib/functional'; -import { deepFreeze } from '@opensumi/ide-core-common/lib/utils/objects'; -import { mapFind } from '@opensumi/ide-core-common/lib/arrays'; +import { TestId, TestIdPathParts, TestPosition } from '@opensumi/ide-testing/lib/common/testId'; -import { InvalidTestItemError, TestItemImpl, TestItemRootImpl } from '../../../common/vscode/testing/testApi'; -import { IExtHostTests, IMainThreadTesting } from '../../../common/vscode/tests'; +import { MainThreadAPIIdentifier } from '../../../common/vscode'; import * as Convert from '../../../common/vscode/converter'; import { TestRunProfileKind, TestRunRequest } from '../../../common/vscode/ext-types'; -import { MainThreadAPIIdentifier } from '../../../common/vscode'; +import { InvalidTestItemError, TestItemImpl, TestItemRootImpl } from '../../../common/vscode/testing/testApi'; import { SingleUseTestCollection } from '../../../common/vscode/testing/testCollection'; +import { IExtHostTests, IMainThreadTesting } from '../../../common/vscode/tests'; interface ControllerInfo { controller: TestController; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.theming.ts b/packages/extension/src/hosted/api/vscode/ext.host.theming.ts index b3454cdd60..5bfbfd8879 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.theming.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.theming.ts @@ -1,7 +1,8 @@ import { IRPCProtocol } from '@opensumi/ide-connection'; import { Emitter, Event } from '@opensumi/ide-core-common'; -import { ColorTheme, ColorThemeKind } from '../../../common/vscode/ext-types'; + import { IExtHostTheming, IMainThreadTheming, MainThreadAPIIdentifier } from '../../../common/vscode'; +import { ColorTheme, ColorThemeKind } from '../../../common/vscode/ext-types'; export class ExtHostTheming implements IExtHostTheming { private _proxy: IMainThreadTheming; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.treeview.ts b/packages/extension/src/hosted/api/vscode/ext.host.treeview.ts index 2f364f1210..bef6e18fad 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.treeview.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.treeview.ts @@ -1,3 +1,9 @@ +import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { IDisposable, Emitter, Disposable, Uri, DisposableStore, toDisposable } from '@opensumi/ide-core-common'; +import type { CancellationToken } from '@opensumi/ide-core-common/lib/cancellation'; + import { IExtHostTreeView, IMainThreadTreeView, @@ -5,13 +11,11 @@ import { ITreeViewRevealOptions, MainThreadAPIIdentifier, } from '../../../common/vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { TreeView, TreeViewItem, TreeViewSelection, TreeViewOptions } from '../../../common/vscode'; -import { IDisposable, Emitter, Disposable, Uri, DisposableStore, toDisposable } from '@opensumi/ide-core-common'; import { ThemeIcon } from '../../../common/vscode/ext-types'; + import { ExtHostCommands } from './ext.host.command'; -import type { CancellationToken } from '@opensumi/ide-core-common/lib/cancellation'; -import type vscode from 'vscode'; + export class ExtHostTreeViews implements IExtHostTreeView { private proxy: IMainThreadTreeView; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.urls.ts b/packages/extension/src/hosted/api/vscode/ext.host.urls.ts index 0acc3cdc40..ee83042f74 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.urls.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.urls.ts @@ -1,6 +1,8 @@ import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; import { Uri, toDisposable, onUnexpectedError } from '@opensumi/ide-core-common'; + import { IExtHostUrls, IMainThreadUrls, MainThreadAPIIdentifier } from '../../../common/vscode'; import { UriComponents } from '../../../common/vscode/ext-types'; diff --git a/packages/extension/src/hosted/api/vscode/ext.host.window-state.ts b/packages/extension/src/hosted/api/vscode/ext.host.window-state.ts index f0b23be93e..a9f26ab6fa 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.window-state.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.window-state.ts @@ -1,7 +1,8 @@ -import * as types from '../../../common/vscode/ext-types'; -import { IExtHostWindowState } from '../../../common/vscode'; -import { Emitter, Event } from '@opensumi/ide-core-common'; import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Emitter, Event } from '@opensumi/ide-core-common'; + +import { IExtHostWindowState } from '../../../common/vscode'; +import * as types from '../../../common/vscode/ext-types'; export class ExtHostWindowState implements IExtHostWindowState { public readonly state: types.WindowState = new WindowStateImpl(); diff --git a/packages/extension/src/hosted/api/vscode/ext.host.window.api.impl.ts b/packages/extension/src/hosted/api/vscode/ext.host.window.api.impl.ts index a1537154d5..73b49057ab 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.window.api.impl.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.window.api.impl.ts @@ -1,4 +1,9 @@ import type vscode from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; +import { MessageType, IDisposable, CancellationToken, Emitter, IExtensionInfo } from '@opensumi/ide-core-common'; +import { QuickInputOptions } from '@opensumi/ide-quick-open'; + import { IExtHostMessage, IExtHostTreeView, @@ -21,19 +26,17 @@ import { IExtHostUrls, WebviewViewProvider, } from '../../../common/vscode'; -import { MessageType, IDisposable, CancellationToken, Emitter, IExtensionInfo } from '@opensumi/ide-core-common'; -import { ExtensionHostEditorService } from './editor/editor.host'; -import { ExtHostWebviewService, ExtHostWebviewViews } from './ext.host.api.webview'; +import { IExtHostDecorationsShape } from '../../../common/vscode/decoration'; import * as types from '../../../common/vscode/ext-types'; import { Uri } from '../../../common/vscode/ext-types'; -import { IExtHostDecorationsShape } from '../../../common/vscode/decoration'; import { throwProposedApiError, IExtensionDescription } from '../../../common/vscode/extension'; -import { IRPCProtocol } from '@opensumi/ide-connection'; -import { ExtHostProgress } from './ext.host.progress'; -import { QuickInputOptions } from '@opensumi/ide-quick-open'; -import { ExtHostTheming } from './ext.host.theming'; + +import { ExtensionHostEditorService } from './editor/editor.host'; +import { ExtHostWebviewService, ExtHostWebviewViews } from './ext.host.api.webview'; import { ExtHostCustomEditorImpl } from './ext.host.custom-editor'; import { ExtHostEditorTabs } from './ext.host.editor-tabs'; +import { ExtHostProgress } from './ext.host.progress'; +import { ExtHostTheming } from './ext.host.theming'; export function createWindowApiFactory( extension: IExtensionDescription, diff --git a/packages/extension/src/hosted/api/vscode/ext.host.workspace.ts b/packages/extension/src/hosted/api/vscode/ext.host.workspace.ts index f097b045c3..177023350e 100644 --- a/packages/extension/src/hosted/api/vscode/ext.host.workspace.ts +++ b/packages/extension/src/hosted/api/vscode/ext.host.workspace.ts @@ -1,25 +1,29 @@ -import type vscode from 'vscode'; import paths from 'path'; + +import type vscode from 'vscode'; + import { IRPCProtocol } from '@opensumi/ide-connection'; +import { CancellationToken, Emitter, Event, MessageType } from '@opensumi/ide-core-common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; +import { FileStat } from '@opensumi/ide-file-service'; + +import { WorkspaceRootsChangeEvent, IExtHostMessage, relative, normalize } from '../../../common/vscode'; import { MainThreadAPIIdentifier, IMainThreadWorkspace, IExtHostWorkspace, ExtensionDocumentDataManager, } from '../../../common/vscode'; +import * as TypeConverts from '../../../common/vscode/converter'; import { Uri, WorkspaceEdit } from '../../../common/vscode/ext-types'; +import { ExtensionIdentifier, IExtensionDescription } from '../../../common/vscode/extension'; import { UriComponents } from '../../../common/vscode/models'; -import { WorkspaceRootsChangeEvent, IExtHostMessage, relative, normalize } from '../../../common/vscode'; -import { ExtHostPreference } from './ext.host.preference'; -import { CancellationToken, Emitter, Event, MessageType } from '@opensumi/ide-core-common'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import { FileStat } from '@opensumi/ide-file-service'; -import * as TypeConverts from '../../../common/vscode/converter'; import { WorkspaceFolder } from '../../../common/vscode/models/workspace'; -import { ExtensionIdentifier, IExtensionDescription } from '../../../common/vscode/extension'; import { IExtHostTasks } from '../../../common/vscode/tasks'; + import { ExtHostFileSystem } from './ext.host.file-system'; import { ExtHostFileSystemEvent } from './ext.host.file-system-event'; +import { ExtHostPreference } from './ext.host.preference'; export function createWorkspaceApiFactory( extHostWorkspace: ExtHostWorkspace, diff --git a/packages/extension/src/hosted/api/vscode/language/callhierarchy.ts b/packages/extension/src/hosted/api/vscode/language/callhierarchy.ts index 74f16a775c..c041f7e87d 100644 --- a/packages/extension/src/hosted/api/vscode/language/callhierarchy.ts +++ b/packages/extension/src/hosted/api/vscode/language/callhierarchy.ts @@ -1,14 +1,16 @@ import type vscode from 'vscode'; + +import { Uri, CancellationToken } from '@opensumi/ide-core-common'; +import { IdGenerator } from '@opensumi/ide-core-common/lib/id-generator'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; import { Position, IIncomingCallDto, IOutgoingCallDto, ICallHierarchyItemDto, } from '../../../../common/vscode/model.api'; -import * as Converter from '../../../../common/vscode/converter'; -import { Uri, CancellationToken } from '@opensumi/ide-core-common'; -import { IdGenerator } from '@opensumi/ide-core-common/lib/id-generator'; export class CallHierarchyAdapter { private readonly _idPool = new IdGenerator(''); diff --git a/packages/extension/src/hosted/api/vscode/language/code-action.ts b/packages/extension/src/hosted/api/vscode/language/code-action.ts index 22e621c33c..472f8f542b 100644 --- a/packages/extension/src/hosted/api/vscode/language/code-action.ts +++ b/packages/extension/src/hosted/api/vscode/language/code-action.ts @@ -1,14 +1,18 @@ -import type { CodeActionContext, WorkspaceEdit } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; import type vscode from 'vscode'; + import { Uri as URI, Cache } from '@opensumi/ide-core-common'; +import { DisposableStore } from '@opensumi/ide-core-common'; +import type { CodeActionContext, WorkspaceEdit } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + +import { ExtensionDocumentDataManager, ICodeActionDto, ICodeActionListDto } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; import { CodeActionKind } from '../../../../common/vscode/ext-types'; import { Selection, Range, ChainedCacheId, IWorkspaceEditDto } from '../../../../common/vscode/model.api'; -import * as Converter from '../../../../common/vscode/converter'; -import { createToken } from './util'; -import { ExtensionDocumentDataManager, ICodeActionDto, ICodeActionListDto } from '../../../../common/vscode'; -import { Diagnostics } from './diagnostics'; import { CommandsConverter } from '../ext.host.command'; -import { DisposableStore } from '@opensumi/ide-core-common'; + +import { Diagnostics } from './diagnostics'; +import { createToken } from './util'; + export class CodeActionAdapter { private readonly _cache = new Cache('CodeAction'); diff --git a/packages/extension/src/hosted/api/vscode/language/color.ts b/packages/extension/src/hosted/api/vscode/language/color.ts index 2b651a85aa..a01182ea10 100644 --- a/packages/extension/src/hosted/api/vscode/language/color.ts +++ b/packages/extension/src/hosted/api/vscode/language/color.ts @@ -14,12 +14,14 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { ColorPresentation, RawColorInfo } from '../../../../common/vscode/model.api'; -import * as types from '../../../../common/vscode/ext-types'; import * as Converter from '../../../../common/vscode/converter'; +import * as types from '../../../../common/vscode/ext-types'; +import { ColorPresentation, RawColorInfo } from '../../../../common/vscode/model.api'; export class ColorProviderAdapter { constructor(private documents: ExtensionDocumentDataManager, private provider: vscode.DocumentColorProvider) {} diff --git a/packages/extension/src/hosted/api/vscode/language/completion.ts b/packages/extension/src/hosted/api/vscode/language/completion.ts index 284caf4cee..98ebdd77c8 100644 --- a/packages/extension/src/hosted/api/vscode/language/completion.ts +++ b/packages/extension/src/hosted/api/vscode/language/completion.ts @@ -1,4 +1,8 @@ +import type vscode from 'vscode'; + import { Uri as URI, Cache } from '@opensumi/ide-core-common'; +import { DisposableStore } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager, ISuggestDataDto, @@ -8,7 +12,7 @@ import { RangeSuggestDataDto, } from '../../../../common/vscode'; import * as Converter from '../../../../common/vscode/converter'; -import type vscode from 'vscode'; +import { SnippetString, Range, CompletionList, CompletionItemLabel } from '../../../../common/vscode/ext-types'; import { CompletionContext, Position, @@ -16,9 +20,8 @@ import { Range as ModelRange, ChainedCacheId, } from '../../../../common/vscode/model.api'; -import { SnippetString, Range, CompletionList, CompletionItemLabel } from '../../../../common/vscode/ext-types'; import { CommandsConverter } from '../ext.host.command'; -import { DisposableStore } from '@opensumi/ide-core-common'; + import { getPerformance } from './util'; export class CompletionAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/declaration.ts b/packages/extension/src/hosted/api/vscode/language/declaration.ts index 2e70270ba7..706c66a0fd 100644 --- a/packages/extension/src/hosted/api/vscode/language/declaration.ts +++ b/packages/extension/src/hosted/api/vscode/language/declaration.ts @@ -1,9 +1,12 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + +import * as Converter from '../../../../common/vscode/converter'; import { ExtensionDocumentDataManager } from '../../../../common/vscode/doc'; import * as types from '../../../../common/vscode/ext-types'; -import * as Converter from '../../../../common/vscode/converter'; import { Position, Definition, DefinitionLink, Location } from '../../../../common/vscode/model.api'; + import { isDefinitionLinkArray, isLocationArray } from './util'; export class DeclarationAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/definition.ts b/packages/extension/src/hosted/api/vscode/language/definition.ts index d3c30b3107..e277ecaf1e 100644 --- a/packages/extension/src/hosted/api/vscode/language/definition.ts +++ b/packages/extension/src/hosted/api/vscode/language/definition.ts @@ -1,10 +1,12 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; +import * as types from '../../../../common/vscode/ext-types'; import { Definition, DefinitionLink, Location, Position } from '../../../../common/vscode/model.api'; import { isDefinitionLinkArray, isLocationArray } from '../../../../common/vscode/utils'; -import * as types from '../../../../common/vscode/ext-types'; -import * as Converter from '../../../../common/vscode/converter'; export class DefinitionAdapter { constructor( diff --git a/packages/extension/src/hosted/api/vscode/language/diagnostics.ts b/packages/extension/src/hosted/api/vscode/language/diagnostics.ts index c79b096826..bca79ef0d7 100644 --- a/packages/extension/src/hosted/api/vscode/language/diagnostics.ts +++ b/packages/extension/src/hosted/api/vscode/language/diagnostics.ts @@ -16,10 +16,12 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/diagnostics.ts import type vscode from 'vscode'; + import { Emitter, Event, IMarkerData, MarkerSeverity } from '@opensumi/ide-core-common'; + import { IMainThreadLanguages } from '../../../../common/vscode'; -import { DiagnosticSeverity, Uri as URI } from '../../../../common/vscode/ext-types'; import { convertDiagnosticToMarkerData } from '../../../../common/vscode/converter'; +import { DiagnosticSeverity, Uri as URI } from '../../../../common/vscode/ext-types'; export class DiagnosticCollection implements vscode.DiagnosticCollection { private static DIAGNOSTICS_PRIORITY = [ diff --git a/packages/extension/src/hosted/api/vscode/language/document-highlight.ts b/packages/extension/src/hosted/api/vscode/language/document-highlight.ts index cb27919f72..6b3ded32f5 100644 --- a/packages/extension/src/hosted/api/vscode/language/document-highlight.ts +++ b/packages/extension/src/hosted/api/vscode/language/document-highlight.ts @@ -1,9 +1,11 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { Position, DocumentHighlight } from '../../../../common/vscode/model.api'; -import * as types from '../../../../common/vscode/ext-types'; import * as Converter from '../../../../common/vscode/converter'; +import * as types from '../../../../common/vscode/ext-types'; +import { Position, DocumentHighlight } from '../../../../common/vscode/model.api'; export class DocumentHighlightAdapter { constructor( diff --git a/packages/extension/src/hosted/api/vscode/language/evaluatableExpression.ts b/packages/extension/src/hosted/api/vscode/language/evaluatableExpression.ts index 72d9ab45fc..6efb2d1976 100644 --- a/packages/extension/src/hosted/api/vscode/language/evaluatableExpression.ts +++ b/packages/extension/src/hosted/api/vscode/language/evaluatableExpression.ts @@ -1,11 +1,12 @@ import vscode from 'vscode'; import { asPromise, CancellationToken } from '@opensumi/ide-core-common'; -import { Position } from '../../../../common/vscode/model.api'; -import * as Converter from '../../../../common/vscode/converter'; -import { ExtensionDocumentDataManager } from '../../../../common/vscode'; import { IEvaluatableExpression } from '@opensumi/ide-debug/lib/common/evaluatable-expression'; +import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; +import { Position } from '../../../../common/vscode/model.api'; + export class EvaluatableExpressionAdapter { constructor( private readonly _documents: ExtensionDocumentDataManager, diff --git a/packages/extension/src/hosted/api/vscode/language/folding.ts b/packages/extension/src/hosted/api/vscode/language/folding.ts index ef0bda0c78..8e86e5a70a 100644 --- a/packages/extension/src/hosted/api/vscode/language/folding.ts +++ b/packages/extension/src/hosted/api/vscode/language/folding.ts @@ -1,8 +1,10 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { FoldingContext, FoldingRange } from '../../../../common/vscode/model.api'; import * as Converter from '../../../../common/vscode/converter'; +import { FoldingContext, FoldingRange } from '../../../../common/vscode/model.api'; export class FoldingProviderAdapter { constructor(private documents: ExtensionDocumentDataManager, private provider: vscode.FoldingRangeProvider) {} diff --git a/packages/extension/src/hosted/api/vscode/language/hover.ts b/packages/extension/src/hosted/api/vscode/language/hover.ts index 11dcee5648..a5470809f0 100644 --- a/packages/extension/src/hosted/api/vscode/language/hover.ts +++ b/packages/extension/src/hosted/api/vscode/language/hover.ts @@ -1,9 +1,11 @@ import type vscode from 'vscode'; + import { Uri } from '@opensumi/ide-core-common'; -import * as Converter from '../../../../common/vscode/converter'; import { IPosition } from '@opensumi/ide-core-common'; -import { Range } from '../../../../common/vscode/ext-types'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; +import { Range } from '../../../../common/vscode/ext-types'; export class HoverAdapter { constructor( diff --git a/packages/extension/src/hosted/api/vscode/language/implementation.ts b/packages/extension/src/hosted/api/vscode/language/implementation.ts index 727f6d79b6..6ce8e28e68 100644 --- a/packages/extension/src/hosted/api/vscode/language/implementation.ts +++ b/packages/extension/src/hosted/api/vscode/language/implementation.ts @@ -1,9 +1,12 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + +import * as Converter from '../../../../common/vscode/converter'; import { ExtensionDocumentDataManager } from '../../../../common/vscode/doc'; import * as types from '../../../../common/vscode/ext-types'; -import * as Converter from '../../../../common/vscode/converter'; import { Position, Definition, DefinitionLink, Location } from '../../../../common/vscode/model.api'; + import { createToken, isDefinitionLinkArray, isLocationArray } from './util'; export class ImplementationAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/inlay-hints.ts b/packages/extension/src/hosted/api/vscode/language/inlay-hints.ts index 73e5cf63aa..5a5e3e030f 100644 --- a/packages/extension/src/hosted/api/vscode/language/inlay-hints.ts +++ b/packages/extension/src/hosted/api/vscode/language/inlay-hints.ts @@ -1,5 +1,7 @@ -import { Uri, CancellationToken, IRange } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri, CancellationToken, IRange } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; import * as typeConvert from '../../../../common/vscode/converter'; diff --git a/packages/extension/src/hosted/api/vscode/language/inline-values.ts b/packages/extension/src/hosted/api/vscode/language/inline-values.ts index 80822d997f..4ff51a7aaf 100644 --- a/packages/extension/src/hosted/api/vscode/language/inline-values.ts +++ b/packages/extension/src/hosted/api/vscode/language/inline-values.ts @@ -1,9 +1,11 @@ -import { InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; import type vscode from 'vscode'; + import { Uri, CancellationToken, IRange } from '@opensumi/ide-core-common'; -import * as Converter from '../../../../common/vscode/converter'; -import { ExtensionDocumentDataManager, IInlineValueContextDto } from '../../../../common/vscode'; import { asPromise } from '@opensumi/ide-core-common'; +import { InlineValue } from '@opensumi/ide-debug/lib/common/inline-values'; + +import { ExtensionDocumentDataManager, IInlineValueContextDto } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; export class InlineValuesAdapter { constructor( diff --git a/packages/extension/src/hosted/api/vscode/language/lens.ts b/packages/extension/src/hosted/api/vscode/language/lens.ts index 3173fb99c0..127d4ab8f3 100644 --- a/packages/extension/src/hosted/api/vscode/language/lens.ts +++ b/packages/extension/src/hosted/api/vscode/language/lens.ts @@ -17,12 +17,14 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/lens.ts import type vscode from 'vscode'; -import * as Converter from '../../../../common/vscode/converter'; + import { Uri as URI, Cache, CancellationToken } from '@opensumi/ide-core-common'; +import { DisposableStore } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; import { CodeLens, ICodeLensListDto } from '../../../../common/vscode/model.api'; import { CommandsConverter } from '../ext.host.command'; -import { DisposableStore } from '@opensumi/ide-core-common'; /** Adapts the calls from main to extension thread for providing/resolving the code lenses. */ export class CodeLensAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/link-provider.ts b/packages/extension/src/hosted/api/vscode/language/link-provider.ts index 9cffde1280..4f3194d352 100644 --- a/packages/extension/src/hosted/api/vscode/language/link-provider.ts +++ b/packages/extension/src/hosted/api/vscode/language/link-provider.ts @@ -1,7 +1,9 @@ import type vscode from 'vscode'; + import { Uri, Cache } from '@opensumi/ide-core-common'; -import * as Converter from '../../../../common/vscode/converter'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; import { ChainedCacheId, ILink, ILinkDto, ILinksListDto } from '../../../../common/vscode/model.api'; export class LinkProviderAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/linked-editing-range.ts b/packages/extension/src/hosted/api/vscode/language/linked-editing-range.ts index 2b00958549..774e50b1a5 100644 --- a/packages/extension/src/hosted/api/vscode/language/linked-editing-range.ts +++ b/packages/extension/src/hosted/api/vscode/language/linked-editing-range.ts @@ -1,6 +1,8 @@ import type vscode from 'vscode'; -import type * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + import { Uri, CancellationToken, IPosition, asPromise, coalesce } from '@opensumi/ide-core-common'; +import type * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; import * as typeConvert from '../../../../common/vscode/converter'; diff --git a/packages/extension/src/hosted/api/vscode/language/on-type-formatting.ts b/packages/extension/src/hosted/api/vscode/language/on-type-formatting.ts index 21e674e0ae..7be6bbe98c 100644 --- a/packages/extension/src/hosted/api/vscode/language/on-type-formatting.ts +++ b/packages/extension/src/hosted/api/vscode/language/on-type-formatting.ts @@ -17,10 +17,13 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/on-type-formatting.ts import type vscode from 'vscode'; -import * as Converter from '../../../../common/vscode/converter'; + import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; import { FormattingOptions, SingleEditOperation, Position } from '../../../../common/vscode/model.api'; + import { createToken } from './util'; export class OnTypeFormattingAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/outline.ts b/packages/extension/src/hosted/api/vscode/language/outline.ts index be4decdedb..5b7429113b 100644 --- a/packages/extension/src/hosted/api/vscode/language/outline.ts +++ b/packages/extension/src/hosted/api/vscode/language/outline.ts @@ -16,12 +16,14 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/outline.ts -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { DocumentSymbol, Range } from '../../../../common/vscode/model.api'; -import * as types from '../../../../common/vscode/ext-types'; import * as Converter from '../../../../common/vscode/converter'; +import * as types from '../../../../common/vscode/ext-types'; +import { DocumentSymbol, Range } from '../../../../common/vscode/model.api'; /** Adapts the calls from main to extension thread for providing the document symbols. */ export class OutlineAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/range-formatting.ts b/packages/extension/src/hosted/api/vscode/language/range-formatting.ts index 329819bd16..b165ab4c4c 100644 --- a/packages/extension/src/hosted/api/vscode/language/range-formatting.ts +++ b/packages/extension/src/hosted/api/vscode/language/range-formatting.ts @@ -17,10 +17,13 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/range-formatting.ts import type vscode from 'vscode'; + import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; import * as Converter from '../../../../common/vscode/converter'; import { FormattingOptions, Range, SingleEditOperation } from '../../../../common/vscode/model.api'; + import { createToken } from './util'; export class RangeFormattingAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/reference.ts b/packages/extension/src/hosted/api/vscode/language/reference.ts index 28bd90b44a..d638cb2051 100644 --- a/packages/extension/src/hosted/api/vscode/language/reference.ts +++ b/packages/extension/src/hosted/api/vscode/language/reference.ts @@ -1,9 +1,11 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; +import * as Converter from '../../../../common/vscode/converter'; import { Location, Position, ReferenceContext } from '../../../../common/vscode/model.api'; import { isLocationArray } from '../../../../common/vscode/utils'; -import * as Converter from '../../../../common/vscode/converter'; export class ReferenceAdapter { constructor( diff --git a/packages/extension/src/hosted/api/vscode/language/rename.ts b/packages/extension/src/hosted/api/vscode/language/rename.ts index cc10d943e2..63392c3c70 100644 --- a/packages/extension/src/hosted/api/vscode/language/rename.ts +++ b/packages/extension/src/hosted/api/vscode/language/rename.ts @@ -1,9 +1,11 @@ -import { getDebugLogger, Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { getDebugLogger, Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import * as model from '../../../../common/vscode/model.api'; -import * as types from '../../../../common/vscode/ext-types'; import * as Converter from '../../../../common/vscode/converter'; +import * as types from '../../../../common/vscode/ext-types'; +import * as model from '../../../../common/vscode/model.api'; import { isObject } from '../../../../common/vscode/utils'; export class RenameAdapter { diff --git a/packages/extension/src/hosted/api/vscode/language/selection.ts b/packages/extension/src/hosted/api/vscode/language/selection.ts index 7e94dc9b03..389596a363 100644 --- a/packages/extension/src/hosted/api/vscode/language/selection.ts +++ b/packages/extension/src/hosted/api/vscode/language/selection.ts @@ -1,9 +1,11 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; +import { isNonEmptyArray } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { Position, SelectionRange } from '../../../../common/vscode/model.api'; import * as Converter from '../../../../common/vscode/converter'; -import { isNonEmptyArray } from '@opensumi/ide-core-common'; +import { Position, SelectionRange } from '../../../../common/vscode/model.api'; export class SelectionRangeAdapter { constructor( diff --git a/packages/extension/src/hosted/api/vscode/language/semantic-tokens.ts b/packages/extension/src/hosted/api/vscode/language/semantic-tokens.ts index d30878f851..927fc2549c 100644 --- a/packages/extension/src/hosted/api/vscode/language/semantic-tokens.ts +++ b/packages/extension/src/hosted/api/vscode/language/semantic-tokens.ts @@ -1,9 +1,10 @@ import vscode from 'vscode'; + import { CancellationToken, IRange } from '@opensumi/ide-core-common'; import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { SemanticTokens, SemanticTokensEdit, SemanticTokensEdits, Uri } from '../../../../common/vscode/ext-types'; import * as TypeConverts from '../../../../common/vscode/converter'; +import { SemanticTokens, SemanticTokensEdit, SemanticTokensEdits, Uri } from '../../../../common/vscode/ext-types'; import { encodeSemanticTokensDto } from '../../../../common/vscode/semantic-tokens'; class SemanticTokensPreviousResult { diff --git a/packages/extension/src/hosted/api/vscode/language/signature.ts b/packages/extension/src/hosted/api/vscode/language/signature.ts index c1193cbdf8..1ddb1f1a84 100644 --- a/packages/extension/src/hosted/api/vscode/language/signature.ts +++ b/packages/extension/src/hosted/api/vscode/language/signature.ts @@ -1,8 +1,10 @@ -import { Uri as URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; + +import { Uri as URI } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import { Position, ISignatureHelpDto, SignatureHelpContextDto } from '../../../../common/vscode/model.api'; import * as typeConvert from '../../../../common/vscode/converter'; +import { Position, ISignatureHelpDto, SignatureHelpContextDto } from '../../../../common/vscode/model.api'; export class SignatureHelpAdapter { private cacheId = 0; diff --git a/packages/extension/src/hosted/api/vscode/language/type-definition.ts b/packages/extension/src/hosted/api/vscode/language/type-definition.ts index f4cbd80bf4..f91f910e3e 100644 --- a/packages/extension/src/hosted/api/vscode/language/type-definition.ts +++ b/packages/extension/src/hosted/api/vscode/language/type-definition.ts @@ -17,10 +17,12 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/type-definition.ts import type vscode from 'vscode'; + import { Uri } from '@opensumi/ide-core-common'; + import { ExtensionDocumentDataManager } from '../../../../common/vscode'; -import * as types from '../../../../common/vscode/ext-types'; import * as Converter from '../../../../common/vscode/converter'; +import * as types from '../../../../common/vscode/ext-types'; import { Definition, DefinitionLink, Location, Position } from '../../../../common/vscode/model.api'; import { isDefinitionLinkArray, isLocationArray } from '../../../../common/vscode/utils'; diff --git a/packages/extension/src/hosted/api/vscode/language/util.ts b/packages/extension/src/hosted/api/vscode/language/util.ts index f463346edc..69538ebffb 100644 --- a/packages/extension/src/hosted/api/vscode/language/util.ts +++ b/packages/extension/src/hosted/api/vscode/language/util.ts @@ -1,10 +1,12 @@ import type vscode from 'vscode'; -import * as types from '../../../../common/vscode/ext-types'; + import { Event } from '@opensumi/ide-core-common'; import { Uri } from '@opensumi/ide-core-common'; -import { match as matchGlobPattern } from '../../../../common/vscode/glob'; import { LanguageSelector } from '@opensumi/ide-editor'; +import * as types from '../../../../common/vscode/ext-types'; +import { match as matchGlobPattern } from '../../../../common/vscode/glob'; + // tslint:disable-next-line:no-any export function createToken(): any { return Object.freeze({ diff --git a/packages/extension/src/hosted/api/vscode/language/workspace-symbol.ts b/packages/extension/src/hosted/api/vscode/language/workspace-symbol.ts index 609f98c6e6..f7ae31c7a6 100644 --- a/packages/extension/src/hosted/api/vscode/language/workspace-symbol.ts +++ b/packages/extension/src/hosted/api/vscode/language/workspace-symbol.ts @@ -16,8 +16,9 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/plugin-ext/src/plugin/languages/workspace-symbol.ts -import { SymbolInformation } from 'vscode-languageserver-types'; import type vscode from 'vscode'; +import { SymbolInformation } from 'vscode-languageserver-types'; + import * as Converter from '../../../../common/vscode/converter'; export class WorkspaceSymbolAdapter { diff --git a/packages/extension/src/hosted/api/vscode/preferences/configuration.ts b/packages/extension/src/hosted/api/vscode/preferences/configuration.ts index 488a4e1fde..3225e0b482 100644 --- a/packages/extension/src/hosted/api/vscode/preferences/configuration.ts +++ b/packages/extension/src/hosted/api/vscode/preferences/configuration.ts @@ -1,7 +1,9 @@ -import { IExtHostWorkspace } from '../../../../common/vscode'; -import { Uri, isObject } from '@opensumi/ide-core-common'; import cloneDeep = require('lodash.clonedeep'); +import { Uri, isObject } from '@opensumi/ide-core-common'; + +import { IExtHostWorkspace } from '../../../../common/vscode'; + export class Configuration { private combinedConfig: ConfigurationModel | undefined; private folderCombinedConfigs: { [resource: string]: ConfigurationModel } = {}; diff --git a/packages/extension/src/hosted/api/vscode/tasks/ext.host.tasks.ts b/packages/extension/src/hosted/api/vscode/tasks/ext.host.tasks.ts index 48dce00abb..86c4481ee6 100644 --- a/packages/extension/src/hosted/api/vscode/tasks/ext.host.tasks.ts +++ b/packages/extension/src/hosted/api/vscode/tasks/ext.host.tasks.ts @@ -5,8 +5,9 @@ // some code copied and modified from https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostTask.ts import type vscode from 'vscode'; -import { IRPCProtocol } from '@opensumi/ide-connection'; import { TaskProvider, Task, TaskExecution, TaskFilter } from 'vscode'; + +import { IRPCProtocol } from '@opensumi/ide-connection'; import { getDebugLogger, Event, @@ -18,7 +19,11 @@ import { Uri, IDisposable, } from '@opensumi/ide-core-common'; +import { UriComponents } from '@opensumi/ide-editor/lib/common'; + import { IExtensionProps } from '../../../../common'; +import { MainThreadAPIIdentifier, IExtHostTerminal, IExtHostWorkspace } from '../../../../common/vscode'; +import * as types from '../../../../common/vscode/ext-types'; import { IExtHostTasks, TaskHandlerData, @@ -39,10 +44,8 @@ import { TaskHandleDTO, TaskProcessEndedDTO, } from '../../../../common/vscode/tasks'; -import { MainThreadAPIIdentifier, IExtHostTerminal, IExtHostWorkspace } from '../../../../common/vscode'; import { Terminal } from '../ext.host.terminal'; -import * as types from '../../../../common/vscode/ext-types'; -import { UriComponents } from '@opensumi/ide-editor/lib/common'; + import { toTask, TaskDto } from './taskTypes'; namespace TaskDefinitionDTO { diff --git a/packages/extension/src/hosted/api/vscode/tasks/taskTypes.ts b/packages/extension/src/hosted/api/vscode/tasks/taskTypes.ts index 1993512edc..66f9f21f0e 100644 --- a/packages/extension/src/hosted/api/vscode/tasks/taskTypes.ts +++ b/packages/extension/src/hosted/api/vscode/tasks/taskTypes.ts @@ -1,5 +1,6 @@ -import * as types from '../../../../common/vscode/ext-types'; import type vscode from 'vscode'; + +import * as types from '../../../../common/vscode/ext-types'; import { Uri } from '../../../../common/vscode/ext-types'; export interface TaskDto { diff --git a/packages/extension/src/hosted/api/worker/worker.host.api.impl.ts b/packages/extension/src/hosted/api/worker/worker.host.api.impl.ts index 02ee3d76e5..c442b2abc9 100644 --- a/packages/extension/src/hosted/api/worker/worker.host.api.impl.ts +++ b/packages/extension/src/hosted/api/worker/worker.host.api.impl.ts @@ -1,4 +1,7 @@ import { IRPCProtocol } from '@opensumi/ide-connection'; +import { Emitter, Event, CancellationTokenSource, DefaultReporter } from '@opensumi/ide-core-common'; +import { OverviewRulerLane } from '@opensumi/ide-editor'; + import { IExtensionHostService, IExtensionWorkerHost, WorkerHostAPIIdentifier } from '../../../common'; import { TextEditorCursorStyle, @@ -7,37 +10,36 @@ import { IExtensionDescription, } from '../../../common/vscode'; import { ExtHostAPIIdentifier } from '../../../common/vscode'; -import * as workerExtTypes from './worker.ext-types'; -import { OverviewRulerLane } from '@opensumi/ide-editor'; -import { ExtHostCommands, createCommandsApiFactory } from '../vscode/ext.host.command'; -import { createLanguagesApiFactory, ExtHostLanguages } from '../vscode/ext.host.language'; +import { createAPIFactory as createSumiAPIFactory } from '../sumi/ext.host.api.impl'; import { ExtensionDocumentDataManagerImpl } from '../vscode/doc'; import { ExtensionHostEditorService } from '../vscode/editor/editor.host'; -import { Emitter, Event, CancellationTokenSource, DefaultReporter } from '@opensumi/ide-core-common'; +import { ExtHostWebviewService, ExtHostWebviewViews } from '../vscode/ext.host.api.webview'; +import { ExtHostCommands, createCommandsApiFactory } from '../vscode/ext.host.command'; +import { ExtHostComments, createCommentsApiFactory } from '../vscode/ext.host.comments'; +import { ExtHostCustomEditorImpl } from '../vscode/ext.host.custom-editor'; +import { ExtHostDecorations } from '../vscode/ext.host.decoration'; +import { ExtHostEditorTabs } from '../vscode/ext.host.editor-tabs'; import { createExtensionsApiFactory } from '../vscode/ext.host.extensions'; -import { ExtHostWorkspace, createWorkspaceApiFactory } from '../vscode/ext.host.workspace'; -import { ExtHostMessage } from '../vscode/ext.host.message'; -import { ExtHostPreference } from '../vscode/ext.host.preference'; import { ExtHostFileSystem } from '../vscode/ext.host.file-system'; import { ExtHostFileSystemEvent } from '../vscode/ext.host.file-system-event'; -import { ExtHostTasks } from '../vscode/tasks/ext.host.tasks'; -import { ExtHostTerminal } from '../vscode/ext.host.terminal'; +import { ExtHostFileSystemInfo } from '../vscode/ext.host.file-system-info'; +import { createLanguagesApiFactory, ExtHostLanguages } from '../vscode/ext.host.language'; +import { ExtHostMessage } from '../vscode/ext.host.message'; import { ExtHostOutput } from '../vscode/ext.host.output'; -import { createWindowApiFactory, ExtHostWindow } from '../vscode/ext.host.window.api.impl'; -import { ExtHostWebviewService, ExtHostWebviewViews } from '../vscode/ext.host.api.webview'; -import { ExtHostTreeViews } from '../vscode/ext.host.treeview'; -import { ExtHostWindowState } from '../vscode/ext.host.window-state'; -import { ExtHostDecorations } from '../vscode/ext.host.decoration'; +import { ExtHostPreference } from '../vscode/ext.host.preference'; +import { ExtHostProgress } from '../vscode/ext.host.progress'; import { ExtHostQuickOpen } from '../vscode/ext.host.quickopen'; import { ExtHostStatusBar } from '../vscode/ext.host.statusbar'; -import { ExtHostProgress } from '../vscode/ext.host.progress'; -import { ExtHostUrls } from '../vscode/ext.host.urls'; -import { ExtHostComments, createCommentsApiFactory } from '../vscode/ext.host.comments'; +import { ExtHostTerminal } from '../vscode/ext.host.terminal'; import { ExtHostTheming } from '../vscode/ext.host.theming'; -import { ExtHostCustomEditorImpl } from '../vscode/ext.host.custom-editor'; -import { createAPIFactory as createSumiAPIFactory } from '../sumi/ext.host.api.impl'; -import { ExtHostFileSystemInfo } from '../vscode/ext.host.file-system-info'; -import { ExtHostEditorTabs } from '../vscode/ext.host.editor-tabs'; +import { ExtHostTreeViews } from '../vscode/ext.host.treeview'; +import { ExtHostUrls } from '../vscode/ext.host.urls'; +import { ExtHostWindowState } from '../vscode/ext.host.window-state'; +import { createWindowApiFactory, ExtHostWindow } from '../vscode/ext.host.window.api.impl'; +import { ExtHostWorkspace, createWorkspaceApiFactory } from '../vscode/ext.host.workspace'; +import { ExtHostTasks } from '../vscode/tasks/ext.host.tasks'; + +import * as workerExtTypes from './worker.ext-types'; export function createAPIFactory( rpcProtocol: IRPCProtocol, diff --git a/packages/extension/src/hosted/ext.host.proxy-base.ts b/packages/extension/src/hosted/ext.host.proxy-base.ts index 96b15cc522..8d19741061 100644 --- a/packages/extension/src/hosted/ext.host.proxy-base.ts +++ b/packages/extension/src/hosted/ext.host.proxy-base.ts @@ -1,6 +1,11 @@ +import type { ForkOptions } from 'child_process'; import net from 'net'; + import { RPCService, RPCServiceCenter, getRPCService, IRPCProtocol, RPCProtocol } from '@opensumi/ide-connection'; import { createSocketConnection } from '@opensumi/ide-connection/lib/node'; +import { Emitter, Disposable, IDisposable, getDebugLogger } from '@opensumi/ide-core-node'; + +import { IExtensionHostManager } from '../common'; import { IExtHostProxyRPCService, IExtHostProxy, @@ -11,10 +16,7 @@ import { EXT_SERVER_IDENTIFIER, EXT_HOST_PROXY_SERVER_PROT, } from '../common/ext.host.proxy'; -import { Emitter, Disposable, IDisposable, getDebugLogger } from '@opensumi/ide-core-node'; import { ExtensionHostManager } from '../node/extension.host.manager'; -import { IExtensionHostManager } from '../common'; -import type { ForkOptions } from 'child_process'; class ExtHostProxyRPCService extends RPCService implements IExtHostProxyRPCService { private extensionHostManager: IExtensionHostManager; diff --git a/packages/extension/src/hosted/ext.host.ts b/packages/extension/src/hosted/ext.host.ts index a9acfcdc04..78c129368f 100644 --- a/packages/extension/src/hosted/ext.host.ts +++ b/packages/extension/src/hosted/ext.host.ts @@ -1,4 +1,5 @@ import path from 'path'; + import { Injector } from '@opensumi/di'; import { RPCProtocol, ProxyIdentifier } from '@opensumi/ide-connection'; import { @@ -15,11 +16,10 @@ import { IExtensionLogger, enumValueToArray, } from '@opensumi/ide-core-common'; +import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; + import { EXTENSION_EXTEND_SERVICE_PREFIX, IExtensionHostService, IExtendProxy, getExtensionId } from '../common'; -import { ExtHostStorage } from './api/vscode/ext.host.storage'; -import { createApiFactory as createVSCodeAPIFactory } from './api/vscode/ext.host.api.impl'; -import { createAPIFactory as createSumiAPIFactory } from './api/sumi/ext.host.api.impl'; -import { createAPIFactory as createTelemetryAPIFactory } from './api/telemetry/ext.host.api.impl'; +import { ActivatedExtension, ExtensionsActivator, ActivatedExtensionJSON } from '../common/activator'; import { ExtHostAPIIdentifier, MainThreadAPIIdentifier, @@ -27,11 +27,14 @@ import { IExtensionDescription, ExtensionIdentifier, } from '../common/vscode'; + +import { createAPIFactory as createSumiAPIFactory } from './api/sumi/ext.host.api.impl'; +import { createAPIFactory as createTelemetryAPIFactory } from './api/telemetry/ext.host.api.impl'; +import { createApiFactory as createVSCodeAPIFactory } from './api/vscode/ext.host.api.impl'; import { ExtensionContext } from './api/vscode/ext.host.extensions'; -import { KTExtension } from './vscode.extension'; -import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; -import { ActivatedExtension, ExtensionsActivator, ActivatedExtensionJSON } from '../common/activator'; import { ExtHostSecret } from './api/vscode/ext.host.secrets'; +import { ExtHostStorage } from './api/vscode/ext.host.storage'; +import { KTExtension } from './vscode.extension'; /** * 在Electron中,会将kaitian中的extension-host使用webpack打成一个,所以需要其他方法来获取原始的require diff --git a/packages/extension/src/hosted/ext.process-base.ts b/packages/extension/src/hosted/ext.process-base.ts index 681bb41687..495390acd0 100644 --- a/packages/extension/src/hosted/ext.process-base.ts +++ b/packages/extension/src/hosted/ext.process-base.ts @@ -1,9 +1,10 @@ import net from 'net'; -import Stream from 'stream'; import { performance } from 'perf_hooks'; +import Stream from 'stream'; + import { ConstructorOf, Injector } from '@opensumi/di'; -import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; -import { isPromiseCanceledError } from '@opensumi/ide-core-common/lib/errors'; +import { RPCProtocol, initRPCService, RPCServiceCenter } from '@opensumi/ide-connection'; +import { createSocketConnection } from '@opensumi/ide-connection/lib/node'; import { Emitter, ReporterProcessMessage, @@ -12,15 +13,17 @@ import { setLanguageId, ILogService, } from '@opensumi/ide-core-common'; -import { RPCProtocol, initRPCService, RPCServiceCenter } from '@opensumi/ide-connection'; -import { createSocketConnection } from '@opensumi/ide-connection/lib/node'; +import { isPromiseCanceledError } from '@opensumi/ide-core-common/lib/errors'; +import { locale } from '@opensumi/ide-core-common/lib/platform'; +import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; +import { ProcessMessageType, IExtensionHostService, KT_PROCESS_SOCK_OPTION_KEY, KT_APP_CONFIG_KEY } from '../common'; import { CommandHandler } from '../common/vscode'; + +import { setPerformance } from './api/vscode/language/util'; import { ExtensionLogger2 } from './extension-log2'; import { ExtensionReporter } from './extension-reporter'; -import { setPerformance } from './api/vscode/language/util'; -import { ProcessMessageType, IExtensionHostService, KT_PROCESS_SOCK_OPTION_KEY, KT_APP_CONFIG_KEY } from '../common'; -import { locale } from '@opensumi/ide-core-common/lib/platform'; + import '@opensumi/ide-i18n'; diff --git a/packages/extension/src/hosted/extension-log.ts b/packages/extension/src/hosted/extension-log.ts index bfae6bb50b..17cf2ceda5 100644 --- a/packages/extension/src/hosted/extension-log.ts +++ b/packages/extension/src/hosted/extension-log.ts @@ -1,7 +1,8 @@ -import { MainThreadExtensionLogIdentifier, IMainThreadExtensionLog } from '../common/extension-log'; import { RPCProtocol } from '@opensumi/ide-connection'; import { DebugLog, IExtensionLogger, SupportLogNamespace } from '@opensumi/ide-core-common'; +import { MainThreadExtensionLogIdentifier, IMainThreadExtensionLog } from '../common/extension-log'; + export class ExtensionLogger implements IExtensionLogger { private rpcProtocol: RPCProtocol; private logger: IMainThreadExtensionLog; diff --git a/packages/extension/src/hosted/extension-log2.ts b/packages/extension/src/hosted/extension-log2.ts index 1f6203195d..e4d228de72 100644 --- a/packages/extension/src/hosted/extension-log2.ts +++ b/packages/extension/src/hosted/extension-log2.ts @@ -1,4 +1,3 @@ -import { LogServiceManager } from '@opensumi/ide-logs/lib/node/log-manager'; import { Injector } from '@opensumi/di'; import { getNodeRequire, @@ -8,6 +7,7 @@ import { IExtensionLogger, } from '@opensumi/ide-core-common'; import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; +import { LogServiceManager } from '@opensumi/ide-logs/lib/node/log-manager'; export class ExtensionLogger2 implements IExtensionLogger { private injector: Injector; diff --git a/packages/extension/src/hosted/vscode.extension.ts b/packages/extension/src/hosted/vscode.extension.ts index efe69151d4..7c9830d5d2 100644 --- a/packages/extension/src/hosted/vscode.extension.ts +++ b/packages/extension/src/hosted/vscode.extension.ts @@ -1,4 +1,5 @@ import type vscode from 'vscode'; + import { IExtensionHostService, IExtensionHost, IExtensionWorkerHost, JSONType, IExtensionProps } from '../common'; import { VSCodeExtensionService } from '../common/vscode'; diff --git a/packages/extension/src/hosted/worker.host-preload.ts b/packages/extension/src/hosted/worker.host-preload.ts index f0a5677158..805827969a 100644 --- a/packages/extension/src/hosted/worker.host-preload.ts +++ b/packages/extension/src/hosted/worker.host-preload.ts @@ -1,9 +1,11 @@ import path from 'path'; + import { Injector } from '@opensumi/di'; -import { ExtensionWorkerHost, initRPCProtocol } from './worker.host'; -import { setPerformance } from './api/vscode/language/util'; import { DefaultReporter, IReporter } from '@opensumi/ide-core-common'; +import { setPerformance } from './api/vscode/language/util'; +import { ExtensionWorkerHost, initRPCProtocol } from './worker.host'; + setPerformance(self.performance); // make sure Worker cors if (self.Worker) { diff --git a/packages/extension/src/hosted/worker.host.ts b/packages/extension/src/hosted/worker.host.ts index 84c2c795f3..7ba143cb89 100644 --- a/packages/extension/src/hosted/worker.host.ts +++ b/packages/extension/src/hosted/worker.host.ts @@ -1,4 +1,5 @@ import { Injector } from '@opensumi/di'; +import { RPCProtocol, ProxyIdentifier } from '@opensumi/ide-connection'; import { Emitter, Deferred, @@ -10,21 +11,23 @@ import { IReporter, REPORT_NAME, } from '@opensumi/ide-core-common'; -import { RPCProtocol, ProxyIdentifier } from '@opensumi/ide-connection'; + import { IExtensionWorkerHost, EXTENSION_EXTEND_SERVICE_PREFIX } from '../common'; -import { createAPIFactory } from './api/worker/worker.host.api.impl'; +import { ActivatedExtension, ActivatedExtensionJSON } from '../common/activator'; import { MainThreadAPIIdentifier, ExtHostAPIIdentifier, ExtensionIdentifier, SumiWorkerExtensionService, } from '../common/vscode'; -import { ExtensionLogger } from './extension-log'; -import { KTWorkerExtension } from './vscode.extension'; + import { ExtensionContext } from './api/vscode/ext.host.extensions'; -import { ExtHostStorage } from './api/vscode/ext.host.storage'; -import { ActivatedExtension, ActivatedExtensionJSON } from '../common/activator'; import { ExtHostSecret } from './api/vscode/ext.host.secrets'; +import { ExtHostStorage } from './api/vscode/ext.host.storage'; +import { createAPIFactory } from './api/worker/worker.host.api.impl'; +import { ExtensionLogger } from './extension-log'; +import { KTWorkerExtension } from './vscode.extension'; + export function initRPCProtocol() { const onMessageEmitter = new Emitter(); diff --git a/packages/extension/src/node/extension.host.manager.ts b/packages/extension/src/node/extension.host.manager.ts index 740d466730..b71c19f83c 100644 --- a/packages/extension/src/node/extension.host.manager.ts +++ b/packages/extension/src/node/extension.host.manager.ts @@ -1,11 +1,14 @@ -import { Injectable } from '@opensumi/di'; -import { MaybePromise, Event, findFreePort } from '@opensumi/ide-core-common'; -import { IExtensionHostManager, Output, OutputType } from '../common'; import assert from 'assert'; import cp from 'child_process'; + import isRunning from 'is-running'; import treeKill from 'tree-kill'; +import { Injectable } from '@opensumi/di'; +import { MaybePromise, Event, findFreePort } from '@opensumi/ide-core-common'; + +import { IExtensionHostManager, Output, OutputType } from '../common'; + @Injectable() export class ExtensionHostManager implements IExtensionHostManager { private readonly processMap = new Map(); diff --git a/packages/extension/src/node/extension.host.proxy.manager.ts b/packages/extension/src/node/extension.host.proxy.manager.ts index 32fbbb09c5..7b8ede11e3 100644 --- a/packages/extension/src/node/extension.host.proxy.manager.ts +++ b/packages/extension/src/node/extension.host.proxy.manager.ts @@ -1,5 +1,11 @@ +import net from 'net'; + import { Injectable, Optional, Autowired } from '@opensumi/di'; +import { getRPCService, RPCProtocol, IRPCProtocol } from '@opensumi/ide-connection'; +import { createSocketConnection } from '@opensumi/ide-connection/lib/node'; import { MaybePromise, Emitter, IDisposable, toDisposable, Disposable } from '@opensumi/ide-core-common'; +import { RPCServiceCenter, INodeLogger } from '@opensumi/ide-core-node'; + import { IExtensionHostManager, Output, @@ -9,10 +15,6 @@ import { EXT_HOST_PROXY_IDENTIFIER, EXT_HOST_PROXY_SERVER_PROT, } from '../common'; -import net from 'net'; -import { RPCServiceCenter, INodeLogger } from '@opensumi/ide-core-node'; -import { getRPCService, RPCProtocol, IRPCProtocol } from '@opensumi/ide-connection'; -import { createSocketConnection } from '@opensumi/ide-connection/lib/node'; @Injectable() export class ExtensionHostProxyManager implements IExtensionHostManager { diff --git a/packages/extension/src/node/extension.profiler.service.ts b/packages/extension/src/node/extension.profiler.service.ts index 0023ef3690..0e783497a7 100644 --- a/packages/extension/src/node/extension.profiler.service.ts +++ b/packages/extension/src/node/extension.profiler.service.ts @@ -1,10 +1,11 @@ -import { Injectable, Autowired } from '@opensumi/di'; +import { writeFile } from 'fs-extra'; import { ProfilingSession, Profile } from 'v8-inspect-profiler'; -import { IExtensionHostProfilerService, IExtensionNodeService } from '../common'; -import { writeFile } from 'fs-extra'; +import { Injectable, Autowired } from '@opensumi/di'; import { INodeLogger } from '@opensumi/ide-core-node/lib/logger/node-logger'; +import { IExtensionHostProfilerService, IExtensionNodeService } from '../common'; + export enum ProfileSessionState { None = 0, Starting = 1, diff --git a/packages/extension/src/node/extension.scanner.ts b/packages/extension/src/node/extension.scanner.ts index d64ed38f28..739710d90c 100644 --- a/packages/extension/src/node/extension.scanner.ts +++ b/packages/extension/src/node/extension.scanner.ts @@ -1,10 +1,14 @@ +import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; -import os from 'os'; -import { getDebugLogger, getNodeRequire, Uri } from '@opensumi/ide-core-node'; import semver from 'semver'; +import { getDebugLogger, getNodeRequire, Uri } from '@opensumi/ide-core-node'; + + import { IExtensionMetaData, IExtraMetaData } from '../common'; + import { mergeContributes } from './merge-contributes'; function resolvePath(path) { diff --git a/packages/extension/src/node/extension.service.client.ts b/packages/extension/src/node/extension.service.client.ts index 7a82d8a2f8..57ee59baf0 100644 --- a/packages/extension/src/node/extension.service.client.ts +++ b/packages/extension/src/node/extension.service.client.ts @@ -1,8 +1,11 @@ -import { Injectable, Autowired } from '@opensumi/di'; +import { createHash } from 'crypto'; +import os from 'os'; import path from 'path'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { RPCService } from '@opensumi/ide-connection'; import { uuid, INodeLogger, Uri } from '@opensumi/ide-core-node'; -import os from 'os'; -import { createHash } from 'crypto'; +import { IFileService } from '@opensumi/ide-file-service'; import { IExtraMetaData, @@ -11,9 +14,9 @@ import { IExtensionNodeClientService, ICreateProcessOptions, } from '../common'; -import { RPCService } from '@opensumi/ide-connection'; + + import * as lp from './languagePack'; -import { IFileService } from '@opensumi/ide-file-service'; export const DEFAULT_NLS_CONFIG_DIR = path.join(os.homedir(), '.sumi'); diff --git a/packages/extension/src/node/extension.service.ts b/packages/extension/src/node/extension.service.ts index 5735980495..8bb3a38f1f 100644 --- a/packages/extension/src/node/extension.service.ts +++ b/packages/extension/src/node/extension.service.ts @@ -1,13 +1,27 @@ +import type cp from 'child_process'; import net from 'net'; import path from 'path'; import util from 'util'; + import * as fs from 'fs-extra'; -import type cp from 'child_process'; + import { Injectable, Autowired } from '@opensumi/di'; -import { normalizedIpcHandlerPath } from '@opensumi/ide-core-common/lib/utils/ipc'; +import { WSChannel } from '@opensumi/ide-connection'; import { WebSocketMessageReader, WebSocketMessageWriter } from '@opensumi/ide-connection/lib/common/message'; import { commonChannelPathHandler, SocketMessageReader, SocketMessageWriter } from '@opensumi/ide-connection/lib/node'; -import { WSChannel } from '@opensumi/ide-connection'; +import { + Event, + Emitter, + timeout, + isUndefined, + findFreePort, + IReporterTimer, + getDebugLogger, + SupportLogNamespace, + ExtensionConnectOption, + ExtensionConnectModeOption, +} from '@opensumi/ide-core-common'; +import { normalizedIpcHandlerPath } from '@opensumi/ide-core-common/lib/utils/ipc'; import { Deferred, isWindows, @@ -23,20 +37,7 @@ import { IReporterService, ReporterProcessMessage, } from '@opensumi/ide-core-node'; -import { - Event, - Emitter, - timeout, - isUndefined, - findFreePort, - IReporterTimer, - getDebugLogger, - SupportLogNamespace, - ExtensionConnectOption, - ExtensionConnectModeOption, -} from '@opensumi/ide-core-common'; -import { ExtensionScanner } from './extension.scanner'; import { OutputType, IExtraMetaData, @@ -50,6 +51,8 @@ import { IExtensionNodeClientService, } from '../common'; +import { ExtensionScanner } from './extension.scanner'; + @Injectable() export class ExtensionNodeServiceImpl implements IExtensionNodeService { private instanceId = 'ExtensionNodeServiceImpl:' + new Date(); diff --git a/packages/extension/src/node/index.ts b/packages/extension/src/node/index.ts index 8731657e38..e3e2da0bb3 100644 --- a/packages/extension/src/node/index.ts +++ b/packages/extension/src/node/index.ts @@ -1,5 +1,6 @@ import { Provider, Injectable, Autowired } from '@opensumi/di'; import { NodeModule, ServerAppContribution, Domain, INodeLogger } from '@opensumi/ide-core-node'; + import { IExtensionNodeService, ExtensionNodeServiceServerPath, @@ -8,10 +9,11 @@ import { ExtensionHostProfilerServiceToken, IExtensionHostManager, } from '../common'; + +import { ExtensionHostManager } from './extension.host.manager'; +import { ExtensionProfilerService } from './extension.profiler.service'; import { ExtensionNodeServiceImpl } from './extension.service'; import { ExtensionServiceClientImpl } from './extension.service.client'; -import { ExtensionProfilerService } from './extension.profiler.service'; -import { ExtensionHostManager } from './extension.host.manager'; @Injectable() export class ExtensionModule extends NodeModule { diff --git a/packages/extension/src/node/languagePack.js b/packages/extension/src/node/languagePack.js index 7a7b3482f7..90ba1e82ac 100644 --- a/packages/extension/src/node/languagePack.js +++ b/packages/extension/src/node/languagePack.js @@ -286,7 +286,7 @@ function factory(nodeRequire, path, fs) { }; } -const path = require('path'); const fs = require('fs'); +const path = require('path'); module.exports = factory(require, path, fs); diff --git a/packages/extension/src/node/merge-contributes.ts b/packages/extension/src/node/merge-contributes.ts index 41a659d247..a38698d968 100644 --- a/packages/extension/src/node/merge-contributes.ts +++ b/packages/extension/src/node/merge-contributes.ts @@ -2,10 +2,11 @@ * handle `kaitianContributes` and `contributes` */ import mergeWith = require('lodash/mergeWith'); + import { asArray } from '@opensumi/ide-core-common'; -import { IExtensionContributions } from '../common/vscode/extension'; import { ISumiExtensionContributions } from '../common/sumi/extension'; +import { IExtensionContributions } from '../common/vscode/extension'; export function mergeContributes( contributes: IExtensionContributions | undefined, diff --git a/packages/extension/webpack.config.worker.js b/packages/extension/webpack.config.worker.js index be1b66ed8c..f66aeab6ba 100644 --- a/packages/extension/webpack.config.worker.js +++ b/packages/extension/webpack.config.worker.js @@ -1,5 +1,6 @@ -const path = require('path'); const fs = require('fs'); +const path = require('path'); + const { ProgressPlugin } = require('webpack'); const tsconfigPath = path.join(__dirname, '../../configs/ts/references/tsconfig.extension.json'); diff --git a/packages/file-scheme/__tests__/browser/resource.test.ts b/packages/file-scheme/__tests__/browser/resource.test.ts index f6a2e90853..d41f0e4f7c 100644 --- a/packages/file-scheme/__tests__/browser/resource.test.ts +++ b/packages/file-scheme/__tests__/browser/resource.test.ts @@ -1,7 +1,3 @@ -import { IDialogService } from '@opensumi/ide-overlay'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { DefaultUriLabelProvider } from '@opensumi/ide-core-browser/lib/services'; import { Disposable, URI, @@ -11,22 +7,28 @@ import { OS, IApplicationService, } from '@opensumi/ide-core-browser'; +import { DefaultUriLabelProvider } from '@opensumi/ide-core-browser/lib/services'; import { CommonServerPath } from '@opensumi/ide-core-common'; -import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks/file-service-client'; +import { + HashCalculateServiceImpl, + IHashCalculateService, +} from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { EditorPreferences } from '@opensumi/ide-editor/lib/browser'; +import { FileSystemResourceProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-resource'; import { FileSchemeDocNodeServicePath } from '@opensumi/ide-file-scheme'; import { FileSchemeDocumentProvider, VscodeSchemeDocumentProvider, } from '@opensumi/ide-file-scheme/lib/browser/file-doc'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { MockFileServiceClient } from '@opensumi/ide-file-service/lib/common/mocks/file-service-client'; +import { IDialogService } from '@opensumi/ide-overlay'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { FileSchemeModule } from '../../src/browser'; -import { EditorPreferences } from '@opensumi/ide-editor/lib/browser'; -import { FileSystemResourceProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-resource'; -import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; -import { - HashCalculateServiceImpl, - IHashCalculateService, -} from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; + describe('file scheme tests', () => { const injector = createBrowserInjector([FileSchemeModule]); diff --git a/packages/file-scheme/__tests__/node/file-doc-node.test.ts b/packages/file-scheme/__tests__/node/file-doc-node.test.ts index fa73fb5334..6b19d3413b 100644 --- a/packages/file-scheme/__tests__/node/file-doc-node.test.ts +++ b/packages/file-scheme/__tests__/node/file-doc-node.test.ts @@ -1,18 +1,21 @@ -import { IFileService, FileStat } from '@opensumi/ide-file-service'; -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { FileSchemeNodeModule } from '../../src/node'; -import { IFileSchemeDocNodeService } from '../../src/common'; -import { FileSchemeDocNodeServiceImpl } from '../../src/node/file-scheme-doc.service'; import { tmpdir } from 'os'; import { join, dirname } from 'path'; + import { ensureDir, writeFile, readFile } from 'fs-extra'; + import { URI } from '@opensumi/ide-core-common'; -import { encode, decode } from '@opensumi/ide-file-service/lib/node/encoding'; import { HashCalculateServiceImpl, IHashCalculateService, } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { IFileService, FileStat } from '@opensumi/ide-file-service'; +import { encode, decode } from '@opensumi/ide-file-service/lib/node/encoding'; + +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { IFileSchemeDocNodeService } from '../../src/common'; +import { FileSchemeNodeModule } from '../../src/node'; +import { FileSchemeDocNodeServiceImpl } from '../../src/node/file-scheme-doc.service'; describe('node file doc service test', () => { const injector = createNodeInjector([FileSchemeNodeModule]); diff --git a/packages/file-scheme/src/browser/external.view.tsx b/packages/file-scheme/src/browser/external.view.tsx index f2b5ca606d..a314d07a1f 100644 --- a/packages/file-scheme/src/browser/external.view.tsx +++ b/packages/file-scheme/src/browser/external.view.tsx @@ -1,9 +1,11 @@ import React from 'react'; + +import { INJECTOR_TOKEN } from '@opensumi/di'; import { localize, useInjectable, isElectronRenderer } from '@opensumi/ide-core-browser'; +import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; + import styles from './style.module.less'; -import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { INJECTOR_TOKEN } from '@opensumi/di'; export const BinaryEditorComponent: ReactEditorComponent = (props) => { const srcPath = props.resource.uri.codeUri.fsPath; diff --git a/packages/file-scheme/src/browser/file-doc.ts b/packages/file-scheme/src/browser/file-doc.ts index dec4a1f3c1..b60cf41753 100644 --- a/packages/file-scheme/src/browser/file-doc.ts +++ b/packages/file-scheme/src/browser/file-doc.ts @@ -1,6 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IEditorDocumentModelContentProvider } from '@opensumi/ide-editor/lib/browser'; -import { FILE_SCHEME, FILE_SAVE_BY_CHANGE_THRESHOLD, IFileSchemeDocClient } from '../common'; import { URI, Emitter, @@ -14,10 +12,13 @@ import { replaceLocalizePlaceholder, PreferenceService, } from '@opensumi/ide-core-browser'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; +import { IEditorDocumentModelContentProvider } from '@opensumi/ide-editor/lib/browser'; import { BaseFileSystemEditorDocumentProvider } from '@opensumi/ide-editor/lib/browser/fs-resource/fs-editor-doc'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; + +import { FILE_SCHEME, FILE_SAVE_BY_CHANGE_THRESHOLD, IFileSchemeDocClient } from '../common'; @Injectable() export class FileSchemeDocumentProvider diff --git a/packages/file-scheme/src/browser/file-scheme-doc.client.ts b/packages/file-scheme/src/browser/file-scheme-doc.client.ts index 3b01bfcae3..7b27f1079a 100644 --- a/packages/file-scheme/src/browser/file-scheme-doc.client.ts +++ b/packages/file-scheme/src/browser/file-scheme-doc.client.ts @@ -1,4 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { IEditorDocumentModelSaveResult } from '@opensumi/ide-core-browser'; + import { IFileSchemeDocNodeService, FileSchemeDocNodeServicePath, @@ -6,7 +8,6 @@ import { IContentChange, ISavingContent, } from '../common'; -import { IEditorDocumentModelSaveResult } from '@opensumi/ide-core-browser'; @Injectable() export class FileSchemeDocClientService implements IFileSchemeDocClient { diff --git a/packages/file-scheme/src/browser/file-scheme.contribution.ts b/packages/file-scheme/src/browser/file-scheme.contribution.ts index 464ae92860..b28f26c7e7 100644 --- a/packages/file-scheme/src/browser/file-scheme.contribution.ts +++ b/packages/file-scheme/src/browser/file-scheme.contribution.ts @@ -1,23 +1,24 @@ -import { ResourceService, IResource, IEditorOpenType } from '@opensumi/ide-editor'; -import { URI, Domain, localize, LRUMap, Schemas, PreferenceService } from '@opensumi/ide-core-browser'; import { Autowired } from '@opensumi/di'; +import { URI, Domain, localize, LRUMap, Schemas, PreferenceService } from '@opensumi/ide-core-browser'; import { getLanguageIdFromMonaco } from '@opensumi/ide-core-browser/lib/services'; +import { ResourceService, IResource, IEditorOpenType } from '@opensumi/ide-editor'; import { EditorComponentRegistry, BrowserEditorContribution, IEditorDocumentModelContentRegistry, } from '@opensumi/ide-editor/lib/browser'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; - -import { ImagePreview, VideoPreview } from './preview.view'; -import { BinaryEditorComponent } from './external.view'; -import { FILE_SCHEME } from '../common'; -import { FileSchemeDocumentProvider, VscodeSchemeDocumentProvider } from './file-doc'; import { UntitledSchemeResourceProvider, UntitledSchemeDocumentProvider, } from '@opensumi/ide-editor/lib/browser/untitled-resource'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; + +import { FILE_SCHEME } from '../common'; + +import { BinaryEditorComponent } from './external.view'; +import { FileSchemeDocumentProvider, VscodeSchemeDocumentProvider } from './file-doc'; import { LargeFilePrevent } from './prevent.view'; +import { ImagePreview, VideoPreview } from './preview.view'; const VIDEO_PREVIEW_COMPONENT_ID = 'video-preview'; const IMAGE_PREVIEW_COMPONENT_ID = 'image-preview'; diff --git a/packages/file-scheme/src/browser/index.ts b/packages/file-scheme/src/browser/index.ts index 0140154365..8e2d822229 100644 --- a/packages/file-scheme/src/browser/index.ts +++ b/packages/file-scheme/src/browser/index.ts @@ -1,12 +1,13 @@ import { Injectable, Provider } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; +import { FileSchemeDocNodeServicePath, IFileSchemeDocClient } from '../common'; + +import { FileSchemeDocClientService } from './file-scheme-doc.client'; import { FileSystemEditorResourceContribution, FileSystemEditorComponentContribution, } from './file-scheme.contribution'; -import { FileSchemeDocNodeServicePath, IFileSchemeDocClient } from '../common'; -import { FileSchemeDocClientService } from './file-scheme-doc.client'; @Injectable() export class FileSchemeModule extends BrowserModule { diff --git a/packages/file-scheme/src/browser/prevent.view.tsx b/packages/file-scheme/src/browser/prevent.view.tsx index 7b5a8ef985..7b64aebe72 100644 --- a/packages/file-scheme/src/browser/prevent.view.tsx +++ b/packages/file-scheme/src/browser/prevent.view.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { IEventBus, localize, useInjectable } from '@opensumi/ide-core-browser'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { ResourceOpenTypeChangedEvent } from '@opensumi/ide-editor/lib/browser/types'; diff --git a/packages/file-scheme/src/browser/preview.view.tsx b/packages/file-scheme/src/browser/preview.view.tsx index 6a1f3cf2ab..85066907ae 100644 --- a/packages/file-scheme/src/browser/preview.view.tsx +++ b/packages/file-scheme/src/browser/preview.view.tsx @@ -1,9 +1,11 @@ -import { ReactEditorComponent, IResource } from '@opensumi/ide-editor/lib/browser'; import React from 'react'; -import styles from './style.module.less'; + import { useInjectable, Disposable, DomListener } from '@opensumi/ide-core-browser'; +import { ReactEditorComponent, IResource } from '@opensumi/ide-editor/lib/browser'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import styles from './style.module.less'; + const useResource = (resource: IResource) => { const staticService = useInjectable(StaticResourceService); diff --git a/packages/file-scheme/src/node/file-scheme-doc.service.ts b/packages/file-scheme/src/node/file-scheme-doc.service.ts index eec18c8a5b..90e2bdcf19 100644 --- a/packages/file-scheme/src/node/file-scheme-doc.service.ts +++ b/packages/file-scheme/src/node/file-scheme-doc.service.ts @@ -1,4 +1,7 @@ +import { existsSync, readFile, statSync, writeFile } from 'fs-extra'; + import { Injectable, Autowired } from '@opensumi/di'; +import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; import { IEditorDocumentModelSaveResult, URI, @@ -7,11 +10,9 @@ import { isEditChange, } from '@opensumi/ide-core-node'; import { IFileService } from '@opensumi/ide-file-service'; +import { encode, decode } from '@opensumi/ide-file-service/lib/node/encoding'; import { IFileSchemeDocNodeService, ISavingContent, IContentChange } from '../common'; -import { existsSync, readFile, statSync, writeFile } from 'fs-extra'; -import { encode, decode } from '@opensumi/ide-file-service/lib/node/encoding'; -import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calculate/hash-calculate'; @Injectable() export class FileSchemeDocNodeServiceImpl implements IFileSchemeDocNodeService { diff --git a/packages/file-scheme/src/node/index.ts b/packages/file-scheme/src/node/index.ts index 74648119d0..75a94a129d 100644 --- a/packages/file-scheme/src/node/index.ts +++ b/packages/file-scheme/src/node/index.ts @@ -2,6 +2,7 @@ import { Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; import { IFileSchemeDocNodeService, FileSchemeDocNodeServicePath } from '../common'; + import { FileSchemeDocNodeServiceImpl } from './file-scheme-doc.service'; @Injectable() diff --git a/packages/file-search/__tests__/node/file-search.service.test.ts b/packages/file-search/__tests__/node/file-search.service.test.ts index 6083e85392..ec4884712e 100644 --- a/packages/file-search/__tests__/node/file-search.service.test.ts +++ b/packages/file-search/__tests__/node/file-search.service.test.ts @@ -1,9 +1,11 @@ import path from 'path'; -import { FileUri, URI, AppConfig, INodeLogger, NodeLogger } from '@opensumi/ide-core-node'; + import { CancellationTokenSource } from '@opensumi/ide-core-common'; +import { FileUri, URI, AppConfig, INodeLogger, NodeLogger } from '@opensumi/ide-core-node'; import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { ProcessModule } from '@opensumi/ide-process'; import { LogServiceModule } from '@opensumi/ide-logs/lib/node'; +import { ProcessModule } from '@opensumi/ide-process'; + import { FileSearchModule, IFileSearchService } from '../../src'; describe('search-service', () => { diff --git a/packages/file-search/src/node/file-search.service.ts b/packages/file-search/src/node/file-search.service.ts index f0064ab5d1..7d4668e17b 100644 --- a/packages/file-search/src/node/file-search.service.ts +++ b/packages/file-search/src/node/file-search.service.ts @@ -1,11 +1,14 @@ -import fuzzy from 'fuzzy'; -import readline from 'readline'; import path from 'path'; -import { rgPath } from '@opensumi/vscode-ripgrep'; +import readline from 'readline'; + +import fuzzy from 'fuzzy'; + import { Injectable, Autowired } from '@opensumi/di'; import { CancellationToken, CancellationTokenSource, replaceAsarInPath } from '@opensumi/ide-core-common'; import { URI, FileUri, INodeLogger } from '@opensumi/ide-core-node'; import { IProcessFactory } from '@opensumi/ide-process'; +import { rgPath } from '@opensumi/vscode-ripgrep'; + import { IFileSearchService } from '../common'; @Injectable() diff --git a/packages/file-search/src/node/index.ts b/packages/file-search/src/node/index.ts index 4c1096a30b..f62421b1a1 100644 --- a/packages/file-search/src/node/index.ts +++ b/packages/file-search/src/node/index.ts @@ -1,8 +1,10 @@ import { Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; -import { FileSearchService } from './file-search.service'; + import { IFileSearchService, FileSearchServicePath } from '../common'; +import { FileSearchService } from './file-search.service'; + @Injectable() export class FileSearchModule extends NodeModule { providers = [ diff --git a/packages/file-service/__tests__/browser/file-service-client.test.ts b/packages/file-service/__tests__/browser/file-service-client.test.ts index 374dc1cd57..4fb37d659c 100644 --- a/packages/file-service/__tests__/browser/file-service-client.test.ts +++ b/packages/file-service/__tests__/browser/file-service-client.test.ts @@ -1,12 +1,15 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import fs from 'fs-extra'; +import temp from 'temp'; + import { FileUri } from '@opensumi/ide-core-common'; import { UTF8 } from '@opensumi/ide-core-common/lib/encoding'; -import { FileServiceClientModule } from '../../src/browser'; -import { IFileServiceClient, FileServicePath, IDiskFileProvider } from '../../src'; -import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { FileService } from '@opensumi/ide-file-service/lib/node'; -import temp from 'temp'; -import fs from 'fs-extra'; +import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; + +import { IFileServiceClient, FileServicePath, IDiskFileProvider } from '../../src'; +import { FileServiceClientModule } from '../../src/browser'; + describe('FileServiceClient should be work', () => { const injector = createBrowserInjector([FileServiceClientModule]); diff --git a/packages/file-service/__tests__/browser/watcher.test.ts b/packages/file-service/__tests__/browser/watcher.test.ts index bfc73b5716..7a78ff3dde 100644 --- a/packages/file-service/__tests__/browser/watcher.test.ts +++ b/packages/file-service/__tests__/browser/watcher.test.ts @@ -1,7 +1,8 @@ -import { FileSystemWatcher } from '../../src/browser/watcher'; -import { FileChangeType, FileChange } from '../../src'; import { URI } from '@opensumi/ide-core-common'; +import { FileChangeType, FileChange } from '../../src'; +import { FileSystemWatcher } from '../../src/browser/watcher'; + describe('ExtensionFileSystemManage', () => { const calledMap: Map = new Map(); const mockChangeList = [ diff --git a/packages/file-service/__tests__/node/encoding/encoding.test.ts b/packages/file-service/__tests__/node/encoding/encoding.test.ts index dc583dd508..cd92c2474a 100644 --- a/packages/file-service/__tests__/node/encoding/encoding.test.ts +++ b/packages/file-service/__tests__/node/encoding/encoding.test.ts @@ -1,10 +1,13 @@ import path from 'path'; + import * as fs from 'fs-extra'; import temp from 'temp'; + import { Injector } from '@opensumi/di'; import { URI, AppConfig, FileUri } from '@opensumi/ide-core-node'; -import { IFileService } from '../../../src/common'; + import { createNodeInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { IFileService } from '../../../src/common'; import { FileServiceModule } from '../../../src/node'; import { detectEncodingByURI, getEncodingInfo, encode } from '../../../src/node/encoding'; diff --git a/packages/file-service/__tests__/node/file-change-collection.test.ts b/packages/file-service/__tests__/node/file-change-collection.test.ts index a096b841ab..526e0898c2 100644 --- a/packages/file-service/__tests__/node/file-change-collection.test.ts +++ b/packages/file-service/__tests__/node/file-change-collection.test.ts @@ -1,6 +1,7 @@ import { FileUri } from '@opensumi/ide-core-node'; -import { FileChangeCollection } from '../../src/node/file-change-collection'; + import { FileChangeType } from '../../src/common'; +import { FileChangeCollection } from '../../src/node/file-change-collection'; describe('FileChangeCollection', () => { assertChanges({ diff --git a/packages/file-service/__tests__/node/file-service-watcher.test.ts b/packages/file-service/__tests__/node/file-service-watcher.test.ts index eb8b36817f..01d2b3a3ca 100644 --- a/packages/file-service/__tests__/node/file-service-watcher.test.ts +++ b/packages/file-service/__tests__/node/file-service-watcher.test.ts @@ -1,11 +1,15 @@ -import temp from 'temp'; +import { execSync } from 'child_process'; + import * as fs from 'fs-extra'; import mv from 'mv'; -import { execSync } from 'child_process'; +import temp from 'temp'; + + import { URI } from '@opensumi/ide-core-common'; import { FileUri } from '@opensumi/ide-core-node'; -import { NsfwFileSystemWatcherServer } from '../../src/node/file-service-watcher'; + import { DidFilesChangedParams, FileChangeType } from '../../src/common'; +import { NsfwFileSystemWatcherServer } from '../../src/node/file-service-watcher'; // tslint:disable:no-unused-expression function createNsfwFileSystemWatcherServer() { diff --git a/packages/file-service/__tests__/node/index.test.ts b/packages/file-service/__tests__/node/index.test.ts index 998246ccf2..fbef381929 100644 --- a/packages/file-service/__tests__/node/index.test.ts +++ b/packages/file-service/__tests__/node/index.test.ts @@ -1,15 +1,20 @@ +import os from 'os'; +import path from 'path'; + +import * as fs from 'fs-extra'; +import * as fse from 'fs-extra'; + import { Injector } from '@opensumi/di'; -import { FileServiceModule, FileService } from '../../src/node'; -import { IFileService, FileChangeType } from '../../src/common'; -import { URI, FileUri, AppConfig } from '@opensumi/ide-core-node'; import { isWindows } from '@opensumi/ide-core-common'; -import * as fs from 'fs-extra'; +import { URI, FileUri, AppConfig } from '@opensumi/ide-core-node'; + import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { IFileService, FileChangeType } from '../../src/common'; +import { FileServiceModule, FileService } from '../../src/node'; + // import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; // import { SUPPORTED_ENCODINGS } from '../../src/node/encoding'; -import * as fse from 'fs-extra'; -import os from 'os'; -import path from 'path'; + // tslint:disable:variable-name describe('FileService', () => { diff --git a/packages/file-service/src/browser/file-service-client.ts b/packages/file-service/src/browser/file-service-client.ts index 87af767d95..dedbcd702f 100644 --- a/packages/file-service/src/browser/file-service-client.ts +++ b/packages/file-service/src/browser/file-service-client.ts @@ -1,4 +1,25 @@ +import { TextDocument } from 'vscode-languageserver-types'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { FilesChangeEvent, ExtensionActivateEvent, AppConfig } from '@opensumi/ide-core-browser'; +import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; +import { + URI, + Emitter, + Event, + IEventBus, + FileUri, + DisposableCollection, + IDisposable, + FileSystemProviderCapabilities, + Deferred, +} from '@opensumi/ide-core-common'; +import { Uri } from '@opensumi/ide-core-common'; +import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; +import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; +import { parse, ParsedPattern } from '@opensumi/ide-core-common/lib/utils/glob'; +import { Iterable } from '@opensumi/monaco-editor-core/esm/vs/base/common/iterator'; + import { FileStat, FileDeleteOptions, @@ -14,21 +35,6 @@ import { IFileSystemProviderRegistrationEvent, IFileSystemProviderCapabilitiesChangeEvent, } from '../common'; -import { TextDocument } from 'vscode-languageserver-types'; -import { - URI, - Emitter, - Event, - IEventBus, - FileUri, - DisposableCollection, - IDisposable, - FileSystemProviderCapabilities, - Deferred, -} from '@opensumi/ide-core-common'; -import { parse, ParsedPattern } from '@opensumi/ide-core-common/lib/utils/glob'; -import { Uri } from '@opensumi/ide-core-common'; -import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; import { FileChangeEvent, DidFilesChangedParams, @@ -40,11 +46,9 @@ import { IFileServiceWatcher, TextDocumentContentChangeEvent, } from '../common'; + import { FileSystemWatcher } from './watcher'; -import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { FilesChangeEvent, ExtensionActivateEvent, AppConfig } from '@opensumi/ide-core-browser'; -import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; -import { Iterable } from '@opensumi/monaco-editor-core/esm/vs/base/common/iterator'; + @Injectable() export class BrowserFileSystemRegistryImpl implements IBrowserFileSystemRegistry { diff --git a/packages/file-service/src/browser/file-service-contribution.ts b/packages/file-service/src/browser/file-service-contribution.ts index e9589b2fd1..10ad8ba64a 100644 --- a/packages/file-service/src/browser/file-service-contribution.ts +++ b/packages/file-service/src/browser/file-service-contribution.ts @@ -5,7 +5,9 @@ import { ContributionProvider, ClientAppContribution, } from '@opensumi/ide-core-browser'; + import { IFileServiceClient, IDiskFileProvider, FILE_SCHEME } from '../common'; + import { FileServiceClient } from './file-service-client'; // 常规文件资源读取 diff --git a/packages/file-service/src/browser/file-service-provider-client.ts b/packages/file-service/src/browser/file-service-provider-client.ts index 066940a7d8..ac1dd9f104 100644 --- a/packages/file-service/src/browser/file-service-provider-client.ts +++ b/packages/file-service/src/browser/file-service-provider-client.ts @@ -8,6 +8,7 @@ import { isLinux, debounce, } from '@opensumi/ide-core-common'; + import { IDiskFileProvider, FileChangeEvent, diff --git a/packages/file-service/src/browser/index.ts b/packages/file-service/src/browser/index.ts index 5f1cada24a..77c2063047 100644 --- a/packages/file-service/src/browser/index.ts +++ b/packages/file-service/src/browser/index.ts @@ -1,4 +1,6 @@ import { Provider, Injectable } from '@opensumi/di'; +import { BrowserModule } from '@opensumi/ide-core-browser'; + import { IFileServiceClient, IBrowserFileSystemRegistry, @@ -6,8 +8,8 @@ import { IShadowFileProvider, DiskFileServicePath, } from '../common/index'; + import { FileServiceClient, BrowserFileSystemRegistryImpl } from './file-service-client'; -import { BrowserModule } from '@opensumi/ide-core-browser'; import { FileServiceContribution } from './file-service-contribution'; import { DiskFsProviderClient } from './file-service-provider-client'; import { ShadowFileSystemProvider } from './shadow-file-system.provider'; diff --git a/packages/file-service/src/browser/shadow-file-system.provider.ts b/packages/file-service/src/browser/shadow-file-system.provider.ts index 161235ac5b..64a6531396 100644 --- a/packages/file-service/src/browser/shadow-file-system.provider.ts +++ b/packages/file-service/src/browser/shadow-file-system.provider.ts @@ -1,9 +1,10 @@ +import { Injectable } from '@opensumi/di'; import { Uri, FileSystemProviderCapabilities } from '@opensumi/ide-core-common'; import { Event, Emitter } from '@opensumi/ide-core-common'; -import { FileChangeEvent, FileStat, FileType, FileSystemProvider } from '../common'; -import { Injectable } from '@opensumi/di'; import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; +import { FileChangeEvent, FileStat, FileType, FileSystemProvider } from '../common'; + @Injectable() export class ShadowFileSystemProvider implements FileSystemProvider { capabilities = FileSystemProviderCapabilities.Readonly; diff --git a/packages/file-service/src/browser/watcher.ts b/packages/file-service/src/browser/watcher.ts index 48c1b23cd0..53cece3cca 100644 --- a/packages/file-service/src/browser/watcher.ts +++ b/packages/file-service/src/browser/watcher.ts @@ -1,4 +1,5 @@ import { Event, Emitter, DisposableCollection, URI } from '@opensumi/ide-core-common'; + import { IFileServiceClient, IFileServiceWatcher, FileServiceWatcherOptions, FileChange } from '../common'; function filterChange(fileChangeList: FileChange[], watchUri: string) { diff --git a/packages/file-service/src/common/file-service-client.ts b/packages/file-service/src/common/file-service-client.ts index 4179cfa04d..5f30692fe8 100644 --- a/packages/file-service/src/common/file-service-client.ts +++ b/packages/file-service/src/common/file-service-client.ts @@ -5,6 +5,9 @@ import { IDisposable, FileSystemProviderCapabilities, } from '@opensumi/ide-core-common'; +import { DidFilesChangedParams, FileChangeEvent } from '@opensumi/ide-core-common'; +import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; + import { FileStat, FileMoveOptions, @@ -18,8 +21,6 @@ import { IFileSystemProviderCapabilitiesChangeEvent, } from './files'; import { IFileServiceWatcher } from './watcher'; -import { DidFilesChangedParams, FileChangeEvent } from '@opensumi/ide-core-common'; -import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; export const IFileServiceClient = IFileServiceClientToken; diff --git a/packages/file-service/src/common/files.ts b/packages/file-service/src/common/files.ts index 46ebef7b13..8b19232dd3 100644 --- a/packages/file-service/src/common/files.ts +++ b/packages/file-service/src/common/files.ts @@ -16,6 +16,8 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/filesystem/src/common/filesystem.ts +import { Range } from 'vscode-languageserver-types'; + import { FileSystemWatcherServer, DidFilesChangedParams, WatchOptions } from '@opensumi/ide-core-common'; import { ApplicationError, @@ -29,7 +31,6 @@ import { FileChangeEvent, } from '@opensumi/ide-core-common'; import { FileSystemProvider, FileStat } from '@opensumi/ide-core-common/lib/types/file'; -import { Range } from 'vscode-languageserver-types'; export { FileSystemProviderCapabilities, FileSystemProvider, diff --git a/packages/file-service/src/common/mocks/file-service-client.ts b/packages/file-service/src/common/mocks/file-service-client.ts index 9c7df43396..1a587a8555 100644 --- a/packages/file-service/src/common/mocks/file-service-client.ts +++ b/packages/file-service/src/common/mocks/file-service-client.ts @@ -1,6 +1,9 @@ -import { IFileServiceClient } from '../file-service-client'; +import { Injectable } from '@opensumi/di'; import { URI, Emitter, Event, FileUri, IDisposable } from '@opensumi/ide-core-common'; +import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; + import { FileChangeEvent, DidFilesChangedParams, FileChange } from '..'; +import { IFileServiceClient } from '../file-service-client'; import { FileSetContentOptions, FileStat, @@ -12,8 +15,7 @@ import { TextDocumentContentChangeEvent, } from '../files'; import { IFileServiceWatcher } from '../watcher'; -import { Injectable } from '@opensumi/di'; -import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; + @Injectable() export class MockFileServiceClient implements IFileServiceClient { diff --git a/packages/file-service/src/common/mocks/file-system-provider.ts b/packages/file-service/src/common/mocks/file-system-provider.ts index 7a8876f640..a854a57cf0 100644 --- a/packages/file-service/src/common/mocks/file-system-provider.ts +++ b/packages/file-service/src/common/mocks/file-system-provider.ts @@ -1,9 +1,10 @@ import { Injectable } from '@opensumi/di'; -import { IDiskFileProvider, FileType } from '../'; import { Emitter, Event } from '@opensumi/ide-core-common'; -import { FileChangeEvent } from '..'; import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; +import { FileChangeEvent } from '..'; +import { IDiskFileProvider, FileType } from '../'; + @Injectable() export class MockFsProvider implements IDiskFileProvider { _onDidChangeFile = new Emitter(); diff --git a/packages/file-service/src/common/watcher.ts b/packages/file-service/src/common/watcher.ts index da497dd668..c1553f88c1 100644 --- a/packages/file-service/src/common/watcher.ts +++ b/packages/file-service/src/common/watcher.ts @@ -1,6 +1,7 @@ -import { IFileServiceClient } from './file-service-client'; import { URI, Event, FileChange } from '@opensumi/ide-core-common'; +import { IFileServiceClient } from './file-service-client'; + export interface FileServiceWatcherOptions { fileServiceClient: IFileServiceClient; watchId: number; diff --git a/packages/file-service/src/node/disk-file-system.provider.ts b/packages/file-service/src/node/disk-file-system.provider.ts index 548a39210a..579353cb95 100644 --- a/packages/file-service/src/node/disk-file-system.provider.ts +++ b/packages/file-service/src/node/disk-file-system.provider.ts @@ -1,10 +1,17 @@ -import * as fse from 'fs-extra'; -import trash from 'trash'; -import paths from 'path'; import os from 'os'; +import paths from 'path'; + +import fileType from 'file-type'; +import * as fse from 'fs-extra'; import mv from 'mv'; +import trash from 'trash'; import { v4 } from 'uuid'; import writeFileAtomic from 'write-file-atomic'; + +import { Injectable } from '@opensumi/di'; +import { RPCService } from '@opensumi/ide-connection'; +import { isLinux } from '@opensumi/ide-core-common/lib/platform'; +import { ParsedPattern, parse } from '@opensumi/ide-core-common/lib/utils/glob'; import { UriComponents, Uri, @@ -18,7 +25,7 @@ import { getDebugLogger, FileUri, } from '@opensumi/ide-core-node'; -import { NsfwFileSystemWatcherServer } from './file-service-watcher'; + import { FileChangeEvent, FileStat, @@ -32,11 +39,9 @@ import { FileAccess, FileSystemProviderCapabilities, } from '../common/'; -import { Injectable } from '@opensumi/di'; -import { RPCService } from '@opensumi/ide-connection'; -import fileType from 'file-type'; -import { ParsedPattern, parse } from '@opensumi/ide-core-common/lib/utils/glob'; -import { isLinux } from '@opensumi/ide-core-common/lib/platform'; + +import { NsfwFileSystemWatcherServer } from './file-service-watcher'; + const UNIX_DEFAULT_NODE_MODULES_EXCLUDE = '**/node_modules/**/*'; const WINDOWS_DEFAULT_NODE_MODULES_EXCLUDE = '**/node_modules/*/**'; diff --git a/packages/file-service/src/node/encoding.ts b/packages/file-service/src/node/encoding.ts index 99f2cee116..7a306d4152 100644 --- a/packages/file-service/src/node/encoding.ts +++ b/packages/file-service/src/node/encoding.ts @@ -1,11 +1,12 @@ // TODO: merge into core-common/encoding.ts import * as fs from 'fs-extra'; -import jschardet from 'jschardet'; import iconv from 'iconv-lite'; +import jschardet from 'jschardet'; + import { URI } from '@opensumi/ide-core-common'; -import { FileUri } from '@opensumi/ide-core-node'; import { SUPPORTED_ENCODINGS } from '@opensumi/ide-core-common/lib/const'; +import { FileUri } from '@opensumi/ide-core-node'; import { EncodingInfo } from '../common/encoding'; diff --git a/packages/file-service/src/node/file-service-watcher.ts b/packages/file-service/src/node/file-service-watcher.ts index 9569d4d1f0..22e7dbf25f 100644 --- a/packages/file-service/src/node/file-service-watcher.ts +++ b/packages/file-service/src/node/file-service-watcher.ts @@ -1,13 +1,17 @@ +import paths from 'path'; + import * as fs from 'fs-extra'; +import debounce = require('lodash.debounce'); import nsfw from 'nsfw'; -import paths from 'path'; -import { parse, ParsedPattern } from '@opensumi/ide-core-common/lib/utils/glob'; + import { IDisposable, Disposable, DisposableCollection, isWindows, URI, isLinux } from '@opensumi/ide-core-common'; +import { parse, ParsedPattern } from '@opensumi/ide-core-common/lib/utils/glob'; import { FileUri } from '@opensumi/ide-core-node'; + import { FileChangeType, FileSystemWatcherClient, FileSystemWatcherServer, WatchOptions } from '..'; -import { FileChangeCollection } from './file-change-collection'; import { INsfw } from '../common/watcher'; -import debounce = require('lodash.debounce'); + +import { FileChangeCollection } from './file-change-collection'; export interface WatcherOptions { excludesPattern: ParsedPattern[]; diff --git a/packages/file-service/src/node/file-service.ts b/packages/file-service/src/node/file-service.ts index 0ce8a8ad78..e4018d8460 100644 --- a/packages/file-service/src/node/file-service.ts +++ b/packages/file-service/src/node/file-service.ts @@ -1,11 +1,13 @@ -import { Injectable, Inject, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; -import drivelist from 'drivelist'; -import paths from 'path'; -import * as fs from 'fs-extra'; import os from 'os'; +import paths from 'path'; + +import drivelist from 'drivelist'; import fileType from 'file-type'; -import { Uri } from '@opensumi/ide-core-common'; +import * as fs from 'fs-extra'; import { TextDocument } from 'vscode-languageserver-types'; + +import { Injectable, Inject, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { Uri } from '@opensumi/ide-core-common'; import { URI, Emitter, @@ -16,11 +18,10 @@ import { isArray, isEmptyObject, } from '@opensumi/ide-core-common'; -import { FileUri, INodeLogger, AppConfig } from '@opensumi/ide-core-node'; import { parse, ParsedPattern, match } from '@opensumi/ide-core-common/lib/utils/glob'; +import { FileUri, INodeLogger, AppConfig } from '@opensumi/ide-core-node'; + import { FileChangeEvent, TextDocumentContentChangeEvent } from '../common'; -import { FileSystemManage } from './file-system-manage'; -import { getEncodingInfo, decode, encode, UTF8 } from './encoding'; import { FileSystemError, FileStat, @@ -37,6 +38,9 @@ import { IDiskFileProvider, } from '../common'; +import { getEncodingInfo, decode, encode, UTF8 } from './encoding'; +import { FileSystemManage } from './file-system-manage'; + export abstract class FileSystemNodeOptions { public static DEFAULT: FileSystemNodeOptions = { encoding: 'utf8', diff --git a/packages/file-service/src/node/file-system-manage.ts b/packages/file-service/src/node/file-system-manage.ts index 1f6c00d57c..76eef342f1 100644 --- a/packages/file-service/src/node/file-system-manage.ts +++ b/packages/file-service/src/node/file-system-manage.ts @@ -1,4 +1,5 @@ import { IDisposable } from '@opensumi/ide-core-common'; + import { FileSystemProvider, IDiskFileProvider } from '../common/'; export class FileSystemManage { diff --git a/packages/file-service/src/node/index.ts b/packages/file-service/src/node/index.ts index eb80057506..a3ee4ad8ef 100644 --- a/packages/file-service/src/node/index.ts +++ b/packages/file-service/src/node/index.ts @@ -1,5 +1,6 @@ -import { NodeModule } from '@opensumi/ide-core-node'; import { Injectable, Injector } from '@opensumi/di'; +import { NodeModule } from '@opensumi/ide-core-node'; + import { IFileService, IDiskFileProvider, @@ -9,6 +10,7 @@ import { FileSystemProvider, DiskFileServicePath, } from '../common'; + import { DiskFileSystemProvider } from './disk-file-system.provider'; import { getSafeFileservice } from './file-service'; diff --git a/packages/file-tree-next/__tests__/browser/dialog/file-dialog-model.service.test.ts b/packages/file-tree-next/__tests__/browser/dialog/file-dialog-model.service.test.ts index de104a1701..faa3cd398d 100644 --- a/packages/file-tree-next/__tests__/browser/dialog/file-dialog-model.service.test.ts +++ b/packages/file-tree-next/__tests__/browser/dialog/file-dialog-model.service.test.ts @@ -1,12 +1,13 @@ -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { TreeNodeType } from '@opensumi/ide-components'; import { URI, CorePreferences, Disposable } from '@opensumi/ide-core-browser'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { Directory, File } from '../../../src/common/file-tree-node.define'; -import { TreeNodeType } from '@opensumi/ide-components'; + +import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { FileTreeDialogModel } from '../../../src/browser/dialog/file-dialog-model.service'; -import { FileTreeDecorationService } from '../../../src/browser/services/file-tree-decoration.service'; import styles from '../../../src/browser/file-tree-node.modules.less'; +import { FileTreeDecorationService } from '../../../src/browser/services/file-tree-decoration.service'; +import { Directory, File } from '../../../src/common/file-tree-node.define'; class TempDirectory {} diff --git a/packages/file-tree-next/__tests__/browser/dialog/file-dialog.service.test.ts b/packages/file-tree-next/__tests__/browser/dialog/file-dialog.service.test.ts index 7cdf12a407..c4847f69fd 100644 --- a/packages/file-tree-next/__tests__/browser/dialog/file-dialog.service.test.ts +++ b/packages/file-tree-next/__tests__/browser/dialog/file-dialog.service.test.ts @@ -1,13 +1,15 @@ -import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { TreeNodeType } from '@opensumi/ide-components'; import { URI } from '@opensumi/ide-core-browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; import { FileStat } from '@opensumi/ide-file-service'; import { FileTreeDialogService } from '@opensumi/ide-file-tree-next/lib/browser/dialog/file-dialog.service'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { Directory, File } from '../../../src/common/file-tree-node.define'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; import { IFileTreeAPI } from '../../../src/common'; -import { TreeNodeType } from '@opensumi/ide-components'; +import { Directory, File } from '../../../src/common/file-tree-node.define'; + class TempDirectory {} class TempFile {} diff --git a/packages/file-tree-next/__tests__/browser/file-tree-contribution.test.ts b/packages/file-tree-next/__tests__/browser/file-tree-contribution.test.ts index f5d6701a3b..e4c08aecad 100644 --- a/packages/file-tree-next/__tests__/browser/file-tree-contribution.test.ts +++ b/packages/file-tree-next/__tests__/browser/file-tree-contribution.test.ts @@ -1,16 +1,3 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { OutlineModule } from '@opensumi/ide-outline/lib/browser'; -import { IMainLayoutService, IViewsRegistry } from '@opensumi/ide-main-layout'; -import { FileTreeContribution } from '@opensumi/ide-file-tree-next/lib/browser/file-tree-contribution'; -import { IFileTreeAPI, IFileTreeService } from '@opensumi/ide-file-tree-next'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { Emitter, URI } from '@opensumi/ide-core-node'; -import { ExplorerContainerId } from '@opensumi/ide-explorer/lib/browser/explorer-contribution'; -import { IDecorationsService } from '@opensumi/ide-decoration'; -import { MockWorkbenchEditorService } from '@opensumi/ide-editor/lib/common/mocks/workbench-editor.service'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { IDialogService, IMessageService, IWindowDialogService } from '@opensumi/ide-overlay'; import { IApplicationService, IClipboardService, @@ -21,7 +8,21 @@ import { PreferenceService, } from '@opensumi/ide-core-browser'; import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { Emitter, URI } from '@opensumi/ide-core-node'; +import { IDecorationsService } from '@opensumi/ide-decoration'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { MockWorkbenchEditorService } from '@opensumi/ide-editor/lib/common/mocks/workbench-editor.service'; +import { ExplorerContainerId } from '@opensumi/ide-explorer/lib/browser/explorer-contribution'; +import { IFileTreeAPI, IFileTreeService } from '@opensumi/ide-file-tree-next'; +import { FileTreeContribution } from '@opensumi/ide-file-tree-next/lib/browser/file-tree-contribution'; +import { IMainLayoutService, IViewsRegistry } from '@opensumi/ide-main-layout'; import { ViewsRegistry } from '@opensumi/ide-main-layout/lib/browser/views-registry'; +import { OutlineModule } from '@opensumi/ide-outline/lib/browser'; +import { IDialogService, IMessageService, IWindowDialogService } from '@opensumi/ide-overlay'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; describe('FileTreeContribution', () => { let mockInjector: MockInjector; diff --git a/packages/file-tree-next/__tests__/browser/file-tree-model.service.test.ts b/packages/file-tree-next/__tests__/browser/file-tree-model.service.test.ts index 19845aee33..8037869331 100644 --- a/packages/file-tree-next/__tests__/browser/file-tree-model.service.test.ts +++ b/packages/file-tree-next/__tests__/browser/file-tree-model.service.test.ts @@ -1,5 +1,4 @@ -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { TreeNodeType } from '@opensumi/ide-components'; import { URI, Disposable, @@ -12,22 +11,24 @@ import { OS, Emitter, } from '@opensumi/ide-core-browser'; +import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { Directory, File } from '../../src/common/file-tree-node.define'; -import { TreeNodeType } from '@opensumi/ide-components'; -import { FileTreeModelService } from '@opensumi/ide-file-tree-next/lib/browser/services/file-tree-model.service'; -import styles from '../../src/browser/file-tree-node.modules.less'; +import { IDecorationsService } from '@opensumi/ide-decoration'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IFileTreeService } from '@opensumi/ide-file-tree-next'; import { IFileTreeAPI } from '@opensumi/ide-file-tree-next'; +import { FileContextKey } from '@opensumi/ide-file-tree-next/lib/browser/file-contextkey'; +import { FileTreeModelService } from '@opensumi/ide-file-tree-next/lib/browser/services/file-tree-model.service'; import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { MockContextKeyService } from '../../..//monaco/__mocks__/monaco.context-key.service'; import { IThemeService } from '@opensumi/ide-theme'; -import { IDecorationsService } from '@opensumi/ide-decoration'; -import { ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../..//monaco/__mocks__/monaco.context-key.service'; import { createMockedMonaco } from '../../../monaco/__mocks__/monaco'; -import { FileContextKey } from '@opensumi/ide-file-tree-next/lib/browser/file-contextkey'; -import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; +import styles from '../../src/browser/file-tree-node.modules.less'; +import { Directory, File } from '../../src/common/file-tree-node.define'; class TempDirectory {} diff --git a/packages/file-tree-next/__tests__/browser/file-tree.service.test.ts b/packages/file-tree-next/__tests__/browser/file-tree.service.test.ts index 0923b80f49..c4a327a349 100644 --- a/packages/file-tree-next/__tests__/browser/file-tree.service.test.ts +++ b/packages/file-tree-next/__tests__/browser/file-tree.service.test.ts @@ -1,6 +1,4 @@ -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { FileTreeService } from '../../src/browser/file-tree.service'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { TreeNodeType } from '@opensumi/ide-components'; import { IContextKeyService, CorePreferences, @@ -15,19 +13,23 @@ import { isLinux, } from '@opensumi/ide-core-browser'; import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; -import { IWorkspaceService, DEFAULT_WORKSPACE_SUFFIX_NAME } from '@opensumi/ide-workspace'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { IFileServiceClient, FileChangeType } from '@opensumi/ide-file-service'; -import { FileTreeContribution } from '../../src/browser/file-tree-contribution'; import { IDecorationsService } from '@opensumi/ide-decoration'; -import { IMainLayoutService, IViewsRegistry } from '@opensumi/ide-main-layout'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IFileServiceClient, FileChangeType } from '@opensumi/ide-file-service'; +import { IMainLayoutService, IViewsRegistry } from '@opensumi/ide-main-layout'; +import { ViewsRegistry } from '@opensumi/ide-main-layout/lib/browser/views-registry'; import { IWindowDialogService, IDialogService, IMessageService } from '@opensumi/ide-overlay'; -import { IFileTreeAPI, IFileTreeService } from '../../src/common'; import { IThemeService, IIconService } from '@opensumi/ide-theme'; +import { IWorkspaceService, DEFAULT_WORKSPACE_SUFFIX_NAME } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { FileTreeContribution } from '../../src/browser/file-tree-contribution'; +import { FileTreeService } from '../../src/browser/file-tree.service'; +import { IFileTreeAPI, IFileTreeService } from '../../src/common'; import { Directory, File } from '../../src/common/file-tree-node.define'; -import { TreeNodeType } from '@opensumi/ide-components'; -import { ViewsRegistry } from '@opensumi/ide-main-layout/lib/browser/views-registry'; + class TempDirectory {} class TempFile {} diff --git a/packages/file-tree-next/__tests__/browser/file-tree.test.ts b/packages/file-tree-next/__tests__/browser/file-tree.test.ts index b7f0903795..c7945cdff3 100644 --- a/packages/file-tree-next/__tests__/browser/file-tree.test.ts +++ b/packages/file-tree-next/__tests__/browser/file-tree.test.ts @@ -1,5 +1,12 @@ -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import path from 'path'; + +import * as fs from 'fs-extra'; +import temp from 'temp'; + +import { TreeNodeEvent, TreeNodeType } from '@opensumi/ide-components'; +import { IContextKeyService, CorePreferences, EDITOR_COMMANDS, PreferenceService } from '@opensumi/ide-core-browser'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; import { FileUri, URI, @@ -10,33 +17,30 @@ import { isLinux, OS, } from '@opensumi/ide-core-common'; -import { FileTreeNextModule } from '../../src'; -import { IFileTreeAPI, IFileTreeService } from '../../src/common'; -import { FileTreeService } from '../../src/browser/file-tree.service'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { AppConfig, INodeLogger } from '@opensumi/ide-core-node'; +import { IDecorationsService } from '@opensumi/ide-decoration'; +import { FileDecorationsService } from '@opensumi/ide-decoration/lib/browser/decorationsService'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { FileStat, FileServicePath, IDiskFileProvider, IFileServiceClient } from '@opensumi/ide-file-service'; -import { FileTreeModelService } from '../../src/browser/services/file-tree-model.service'; import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; import { FileSystemNodeOptions, FileService } from '@opensumi/ide-file-service/lib/node'; -import { AppConfig, INodeLogger } from '@opensumi/ide-core-node'; -import { IDecorationsService } from '@opensumi/ide-decoration'; -import { IThemeService } from '@opensumi/ide-theme'; -import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; -import { Directory, File } from '../../src/common/file-tree-node.define'; -import { TreeNodeEvent, TreeNodeType } from '@opensumi/ide-components'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; -import { IContextKeyService, CorePreferences, EDITOR_COMMANDS, PreferenceService } from '@opensumi/ide-core-browser'; -import { FileDecorationsService } from '@opensumi/ide-decoration/lib/browser/decorationsService'; -import { FileTreeContribution } from '../../src/browser/file-tree-contribution'; +import { IThemeService } from '@opensumi/ide-theme'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { FileTreeNextModule } from '../../src'; import { PasteTypes } from '../../src'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import temp from 'temp'; -import * as fs from 'fs-extra'; -import path from 'path'; +import { FileTreeContribution } from '../../src/browser/file-tree-contribution'; import styles from '../../src/browser/file-tree-node.module.less'; -import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; +import { FileTreeService } from '../../src/browser/file-tree.service'; +import { FileTreeModelService } from '../../src/browser/services/file-tree-model.service'; +import { IFileTreeAPI, IFileTreeService } from '../../src/common'; +import { Directory, File } from '../../src/common/file-tree-node.define'; + function sleep(time: number) { return new Promise((resolve) => setTimeout(resolve, time)); diff --git a/packages/file-tree-next/src/browser/dialog/file-dialog-model.service.ts b/packages/file-tree-next/src/browser/dialog/file-dialog-model.service.ts index b6590ff627..4bcb085e6f 100644 --- a/packages/file-tree-next/src/browser/dialog/file-dialog-model.service.ts +++ b/packages/file-tree-next/src/browser/dialog/file-dialog-model.service.ts @@ -8,14 +8,16 @@ import { TreeNodeEvent, Tree, } from '@opensumi/ide-components'; -import { FileTreeModel } from '../file-tree-model'; -import { Directory, File } from '../../common/file-tree-node.define'; import { URI, DisposableCollection, Emitter, CorePreferences, Event } from '@opensumi/ide-core-browser'; -import { PasteTypes, IFileDialogTreeService, IFileDialogModel } from '../../common'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { FileTreeDialogService } from './file-dialog.service'; + +import { PasteTypes, IFileDialogTreeService, IFileDialogModel } from '../../common'; +import { Directory, File } from '../../common/file-tree-node.define'; +import { FileTreeModel } from '../file-tree-model'; import styles from '../file-tree-node.module.less'; +import { FileTreeDialogService } from './file-dialog.service'; + export interface IParseStore { files: (File | Directory)[]; type: PasteTypes; diff --git a/packages/file-tree-next/src/browser/dialog/file-dialog-node.tsx b/packages/file-tree-next/src/browser/dialog/file-dialog-node.tsx index 8e333b0e20..5dbc5e48fe 100644 --- a/packages/file-tree-next/src/browser/dialog/file-dialog-node.tsx +++ b/packages/file-tree-next/src/browser/dialog/file-dialog-node.tsx @@ -1,6 +1,7 @@ -import React from 'react'; import cls from 'classnames'; -import styles from '../file-tree-node.module.less'; +import React from 'react'; + + import { TreeNode, CompositeTreeNode, @@ -11,10 +12,12 @@ import { RenamePromptHandle, NewPromptHandle, } from '@opensumi/ide-components'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { Loading } from '@opensumi/ide-components'; import { getIcon, URI } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; + import { Directory, File } from '../../common/file-tree-node.define'; -import { Loading } from '@opensumi/ide-components'; +import styles from '../file-tree-node.module.less'; export interface IFileTreeDialogNodeProps { item: any; diff --git a/packages/file-tree-next/src/browser/dialog/file-dialog.service.ts b/packages/file-tree-next/src/browser/dialog/file-dialog.service.ts index 358a01a6a9..82b7e97109 100644 --- a/packages/file-tree-next/src/browser/dialog/file-dialog.service.ts +++ b/packages/file-tree-next/src/browser/dialog/file-dialog.service.ts @@ -1,11 +1,13 @@ import { Injectable, Autowired, Optional } from '@opensumi/di'; +import { Tree, ITreeNodeOrCompositeTreeNode, TreeNodeType } from '@opensumi/ide-components'; import { URI } from '@opensumi/ide-core-browser'; -import { IFileTreeAPI, IFileTreeService } from '../../common'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { Tree, ITreeNodeOrCompositeTreeNode, TreeNodeType } from '@opensumi/ide-components'; -import { Directory } from '../../common/file-tree-node.define'; import { FileStat } from '@opensumi/ide-file-service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { IFileTreeAPI, IFileTreeService } from '../../common'; +import { Directory } from '../../common/file-tree-node.define'; + @Injectable({ multiple: true }) export class FileTreeDialogService extends Tree implements IFileTreeService { diff --git a/packages/file-tree-next/src/browser/dialog/file-dialog.view.tsx b/packages/file-tree-next/src/browser/dialog/file-dialog.view.tsx index d93006b1a4..accc9285d1 100644 --- a/packages/file-tree-next/src/browser/dialog/file-dialog.view.tsx +++ b/packages/file-tree-next/src/browser/dialog/file-dialog.view.tsx @@ -1,6 +1,5 @@ import React from 'react'; -import { IDialogService, ISaveDialogOptions, IOpenDialogOptions } from '@opensumi/ide-overlay'; -import { useInjectable, localize, isOSX } from '@opensumi/ide-core-browser'; + import { Button, Input, @@ -11,12 +10,17 @@ import { INodeRendererProps, TreeNodeType, } from '@opensumi/ide-components'; -import { FileTreeDialogModel } from './file-dialog-model.service'; +import { useInjectable, localize, isOSX } from '@opensumi/ide-core-browser'; +import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; +import * as path from '@opensumi/ide-core-common/lib/utils/paths'; +import { IDialogService, ISaveDialogOptions, IOpenDialogOptions } from '@opensumi/ide-overlay'; + import { Directory, File } from '../../common/file-tree-node.define'; + +import { FileTreeDialogModel } from './file-dialog-model.service'; import { FileTreeDialogNode } from './file-dialog-node'; -import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; import styles from './file-dialog.module.less'; -import * as path from '@opensumi/ide-core-common/lib/utils/paths'; + export interface IFileDialogProps { options: ISaveDialogOptions | IOpenDialogOptions; diff --git a/packages/file-tree-next/src/browser/dialog/window-dialog.service.tsx b/packages/file-tree-next/src/browser/dialog/window-dialog.service.tsx index e576e9ab38..70dbb255d7 100644 --- a/packages/file-tree-next/src/browser/dialog/window-dialog.service.tsx +++ b/packages/file-tree-next/src/browser/dialog/window-dialog.service.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { IWindowDialogService, IOpenDialogOptions, IDialogService, ISaveDialogOptions } from '@opensumi/ide-overlay'; + import { Injectable, Injector, Autowired, INJECTOR_TOKEN } from '@opensumi/di'; import { isElectronRenderer, @@ -11,11 +11,13 @@ import { STORAGE_NAMESPACE, } from '@opensumi/ide-core-browser'; import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; -import { FileDialog } from './file-dialog.view'; -import { FileTreeDialogModel } from './file-dialog-model.service'; -import { FileTreeDialogService } from './file-dialog.service'; import { isMacintosh } from '@opensumi/ide-core-common/lib/platform'; import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { IWindowDialogService, IOpenDialogOptions, IDialogService, ISaveDialogOptions } from '@opensumi/ide-overlay'; + +import { FileTreeDialogModel } from './file-dialog-model.service'; +import { FileTreeDialogService } from './file-dialog.service'; +import { FileDialog } from './file-dialog.view'; @Injectable() export class WindowDialogServiceImpl implements IWindowDialogService { diff --git a/packages/file-tree-next/src/browser/empty.view.tsx b/packages/file-tree-next/src/browser/empty.view.tsx index 565d8f624c..496d089b5a 100644 --- a/packages/file-tree-next/src/browser/empty.view.tsx +++ b/packages/file-tree-next/src/browser/empty.view.tsx @@ -1,7 +1,9 @@ import React from 'react'; -import styles from './file-tree.module.less'; -import { localize, CommandService } from '@opensumi/ide-core-common'; + import { useInjectable, FILE_COMMANDS } from '@opensumi/ide-core-browser'; +import { localize, CommandService } from '@opensumi/ide-core-common'; + +import styles from './file-tree.module.less'; export const EmptyTreeView = () => { const commandService: CommandService = useInjectable(CommandService); diff --git a/packages/file-tree-next/src/browser/file-tree-contribution.ts b/packages/file-tree-next/src/browser/file-tree-contribution.ts index 63be1b7e74..3c30789421 100644 --- a/packages/file-tree-next/src/browser/file-tree-contribution.ts +++ b/packages/file-tree-next/src/browser/file-tree-contribution.ts @@ -1,3 +1,4 @@ +import { Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IApplicationService, URI, @@ -21,33 +22,35 @@ import { WORKSPACE_COMMANDS, AppConfig, } from '@opensumi/ide-core-browser'; -import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; -import { Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { FileTreeService } from './file-tree.service'; -import { IMainLayoutService, IViewsRegistry, MainLayoutContribution } from '@opensumi/ide-main-layout'; -import { ExplorerContainerId } from '@opensumi/ide-explorer/lib/browser/explorer-contribution'; -import { DEFAULT_WORKSPACE_SUFFIX_NAME, IWorkspaceService, UNTITLED_WORKSPACE } from '@opensumi/ide-workspace'; -import { FileTree } from './file-tree'; -import { SymlinkDecorationsProvider } from './symlink-file-decoration'; -import { IDecorationsService } from '@opensumi/ide-decoration'; +import { FilesExplorerFilteredContext } from '@opensumi/ide-core-browser/lib/contextkey/explorer'; +import { + FilesExplorerFocusedContext, + FilesExplorerInputFocusedContext, +} from '@opensumi/ide-core-browser/lib/contextkey/explorer'; import { MenuContribution, IMenuRegistry, MenuId, ExplorerContextCallback, } from '@opensumi/ide-core-browser/lib/menu/next'; -import { FileTreeModelService } from './services/file-tree-model.service'; -import { Directory } from '../common/file-tree-node.define'; +import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; +import { IDecorationsService } from '@opensumi/ide-decoration'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { ExplorerContainerId } from '@opensumi/ide-explorer/lib/browser/explorer-contribution'; +import { IMainLayoutService, IViewsRegistry, MainLayoutContribution } from '@opensumi/ide-main-layout'; +import { ViewContentGroups } from '@opensumi/ide-main-layout/lib/browser/views-registry'; import { IOpenDialogOptions, IWindowDialogService, ISaveDialogOptions } from '@opensumi/ide-overlay'; -import { FilesExplorerFilteredContext } from '@opensumi/ide-core-browser/lib/contextkey/explorer'; -import { - FilesExplorerFocusedContext, - FilesExplorerInputFocusedContext, -} from '@opensumi/ide-core-browser/lib/contextkey/explorer'; -import { IFileTreeService, PasteTypes } from '../common'; import { TERMINAL_COMMANDS } from '@opensumi/ide-terminal-next'; -import { ViewContentGroups } from '@opensumi/ide-main-layout/lib/browser/views-registry'; +import { DEFAULT_WORKSPACE_SUFFIX_NAME, IWorkspaceService, UNTITLED_WORKSPACE } from '@opensumi/ide-workspace'; + +import { IFileTreeService, PasteTypes } from '../common'; +import { Directory } from '../common/file-tree-node.define'; + +import { FileTree } from './file-tree'; +import { FileTreeService } from './file-tree.service'; +import { FileTreeModelService } from './services/file-tree-model.service'; +import { SymlinkDecorationsProvider } from './symlink-file-decoration'; + export const ExplorerResourceViewId = 'file-explorer-next'; diff --git a/packages/file-tree-next/src/browser/file-tree-model.ts b/packages/file-tree-next/src/browser/file-tree-model.ts index e5c87b37a0..270bb85efa 100644 --- a/packages/file-tree-next/src/browser/file-tree-model.ts +++ b/packages/file-tree-next/src/browser/file-tree-model.ts @@ -1,8 +1,10 @@ -import { TreeModel, IOptionalMetaData, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { Injectable, Optional, Autowired } from '@opensumi/di'; -import { Directory } from '../common/file-tree-node.define'; +import { TreeModel, IOptionalMetaData, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { URI, ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; import { FileStat } from '@opensumi/ide-file-service'; + +import { Directory } from '../common/file-tree-node.define'; + import { FileTreeDecorationService } from './services/file-tree-decoration.service'; export interface IFileTreeMetaData extends IOptionalMetaData { diff --git a/packages/file-tree-next/src/browser/file-tree-node.tsx b/packages/file-tree-next/src/browser/file-tree-node.tsx index fb93f74e32..d37ae7e739 100644 --- a/packages/file-tree-next/src/browser/file-tree-node.tsx +++ b/packages/file-tree-next/src/browser/file-tree-node.tsx @@ -1,6 +1,6 @@ -import React from 'react'; import cls from 'classnames'; -import styles from './file-tree-node.module.less'; +import React from 'react'; + import { TreeNode, CompositeTreeNode, @@ -11,13 +11,17 @@ import { RenamePromptHandle, NewPromptHandle, } from '@opensumi/ide-components'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { Loading } from '@opensumi/ide-components'; import { getIcon, URI } from '@opensumi/ide-core-browser'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { Path } from '@opensumi/ide-core-common/lib/path'; + import { Directory, File } from '../common/file-tree-node.define'; + +import styles from './file-tree-node.module.less'; import { FileTreeDecorationService } from './services/file-tree-decoration.service'; import { DragAndDropService } from './services/file-tree-dnd.service'; -import { Loading } from '@opensumi/ide-components'; -import { Path } from '@opensumi/ide-core-common/lib/path'; + export interface IFileTreeNodeProps { item: any; diff --git a/packages/file-tree-next/src/browser/file-tree.service.ts b/packages/file-tree-next/src/browser/file-tree.service.ts index 0966994384..bc156c749c 100644 --- a/packages/file-tree-next/src/browser/file-tree.service.ts +++ b/packages/file-tree-next/src/browser/file-tree.service.ts @@ -1,4 +1,14 @@ +import pSeries = require('p-series'); + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { + Tree, + ITree, + WatchEvent, + ITreeNodeOrCompositeTreeNode, + IWatcherEvent, + TreeNodeType, +} from '@opensumi/ide-components'; import { CommandService, IContextKeyService, @@ -14,7 +24,8 @@ import { IApplicationService, } from '@opensumi/ide-core-browser'; import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; -import { IFileTreeAPI, IFileTreeService } from '../common'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { Path } from '@opensumi/ide-core-common/lib/path'; import { FileChange, IFileServiceClient, @@ -22,22 +33,15 @@ import { FileStat, IFileServiceWatcher, } from '@opensumi/ide-file-service/lib/common'; +import { IIconService } from '@opensumi/ide-theme'; import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { - Tree, - ITree, - WatchEvent, - ITreeNodeOrCompositeTreeNode, - IWatcherEvent, - TreeNodeType, -} from '@opensumi/ide-components'; + +import { IFileTreeAPI, IFileTreeService } from '../common'; import { Directory, File } from '../common/file-tree-node.define'; -import { FileTreeDecorationService } from './services/file-tree-decoration.service'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import pSeries = require('p-series'); + import { FileContextKey } from './file-contextkey'; -import { IIconService } from '@opensumi/ide-theme'; +import { FileTreeDecorationService } from './services/file-tree-decoration.service'; + export interface IMoveChange { source: FileChange; target: FileChange; diff --git a/packages/file-tree-next/src/browser/file-tree.tsx b/packages/file-tree-next/src/browser/file-tree.tsx index 4b0b895d00..f56debcb10 100644 --- a/packages/file-tree-next/src/browser/file-tree.tsx +++ b/packages/file-tree-next/src/browser/file-tree.tsx @@ -1,3 +1,4 @@ +import cls from 'classnames'; import React, { createRef, useRef, @@ -10,7 +11,7 @@ import React, { MouseEvent, DragEvent, } from 'react'; -import { ViewState, useInjectable, isOSX, URI, DisposableCollection } from '@opensumi/ide-core-browser'; + import { RecycleTreeFilterDecorator, RecycleTree, @@ -19,15 +20,18 @@ import { IRecycleTreeFilterHandle, TreeModel, } from '@opensumi/ide-components'; +import { ViewState, useInjectable, isOSX, URI, DisposableCollection } from '@opensumi/ide-core-browser'; import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; +import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; + +import { IFileTreeService } from '../common'; +import { Directory, File } from '../common/file-tree-node.define'; + import { FileTreeNode, FILE_TREE_NODE_HEIGHT } from './file-tree-node'; +import styles from './file-tree.module.less'; import { FileTreeService, ITreeIndent } from './file-tree.service'; import { FileTreeModelService } from './services/file-tree-model.service'; -import { Directory, File } from '../common/file-tree-node.define'; -import cls from 'classnames'; -import styles from './file-tree.module.less'; -import { IFileTreeService } from '../common'; -import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; + export const FILTER_AREA_HEIGHT = 30; export const FILE_TREE_FILTER_DELAY = 500; diff --git a/packages/file-tree-next/src/browser/index.ts b/packages/file-tree-next/src/browser/index.ts index 1e52d771a6..c32101d8e6 100644 --- a/packages/file-tree-next/src/browser/index.ts +++ b/packages/file-tree-next/src/browser/index.ts @@ -1,14 +1,17 @@ import { Provider } from '@opensumi/di'; -import { IFileTreeAPI, IFileTreeService } from '../common'; -import { FileTreeAPI } from './services/file-tree-api.service'; -import { FileTreeService } from './file-tree.service'; -import { FileTreeContribution } from './file-tree-contribution'; import { BrowserModule, EffectDomain, ModuleDependencies } from '@opensumi/ide-core-browser'; +import { IWindowDialogService } from '@opensumi/ide-overlay'; import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; + +import { IFileTreeAPI, IFileTreeService } from '../common'; + +import { WindowDialogServiceImpl } from './dialog/window-dialog.service'; +import { FileTreeContribution } from './file-tree-contribution'; +import { FileTreeService } from './file-tree.service'; +import { FileTreeAPI } from './services/file-tree-api.service'; import { FileTreeDecorationService } from './services/file-tree-decoration.service'; import { FileTreeModelService } from './services/file-tree-model.service'; -import { WindowDialogServiceImpl } from './dialog/window-dialog.service'; -import { IWindowDialogService } from '@opensumi/ide-overlay'; + const pkgJson = require('../../package.json'); diff --git a/packages/file-tree-next/src/browser/services/file-tree-api.service.ts b/packages/file-tree-next/src/browser/services/file-tree-api.service.ts index ef7475ab0d..6304dacfec 100644 --- a/packages/file-tree-next/src/browser/services/file-tree-api.service.ts +++ b/packages/file-tree-next/src/browser/services/file-tree-api.service.ts @@ -1,15 +1,16 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { FileStat } from '@opensumi/ide-file-service'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { ITree } from '@opensumi/ide-components'; -import { Directory, File } from '../../common/file-tree-node.define'; -import { IFileTreeAPI, IFileTreeService } from '../../common'; +import { Path } from '@opensumi/ide-components/lib/utils'; +import { EDITOR_COMMANDS, CorePreferences } from '@opensumi/ide-core-browser'; import { URI, localize, CommandService, formatLocalize } from '@opensumi/ide-core-common'; +import * as paths from '@opensumi/ide-core-common/lib/path'; +import { FileStat } from '@opensumi/ide-file-service'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; import { IDialogService } from '@opensumi/ide-overlay'; import { IWorkspaceEditService } from '@opensumi/ide-workspace-edit'; -import { EDITOR_COMMANDS, CorePreferences } from '@opensumi/ide-core-browser'; -import { Path } from '@opensumi/ide-components/lib/utils'; -import * as paths from '@opensumi/ide-core-common/lib/path'; + +import { IFileTreeAPI, IFileTreeService } from '../../common'; +import { Directory, File } from '../../common/file-tree-node.define'; @Injectable() export class FileTreeAPI implements IFileTreeAPI { diff --git a/packages/file-tree-next/src/browser/services/file-tree-decoration.service.ts b/packages/file-tree-next/src/browser/services/file-tree-decoration.service.ts index cc538ed5e0..0ad9b146fb 100644 --- a/packages/file-tree-next/src/browser/services/file-tree-decoration.service.ts +++ b/packages/file-tree-next/src/browser/services/file-tree-decoration.service.ts @@ -1,5 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IDecorationsService } from '@opensumi/ide-decoration'; import { URI, Uri, @@ -8,6 +7,7 @@ import { Emitter, DisposableCollection, } from '@opensumi/ide-core-browser'; +import { IDecorationsService } from '@opensumi/ide-decoration'; import { IThemeService } from '@opensumi/ide-theme'; @Injectable() diff --git a/packages/file-tree-next/src/browser/services/file-tree-dnd.service.ts b/packages/file-tree-next/src/browser/services/file-tree-dnd.service.ts index 34e333f641..1ab5f0f0cb 100644 --- a/packages/file-tree-next/src/browser/services/file-tree-dnd.service.ts +++ b/packages/file-tree-next/src/browser/services/file-tree-dnd.service.ts @@ -1,6 +1,5 @@ import { Injectable, Autowired, Optional } from '@opensumi/di'; -import { FileTreeModelService } from './file-tree-model.service'; -import { Directory, File } from '../../common/file-tree-node.define'; +import { Decoration, TargetMatchMode } from '@opensumi/ide-components'; import { DisposableCollection, Disposable, @@ -10,14 +9,17 @@ import { ThrottledDelayer, FileStat, } from '@opensumi/ide-core-browser'; -import { IFileTreeAPI, IFileTreeService } from '../../common'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { Decoration, TargetMatchMode } from '@opensumi/ide-components'; import { Path } from '@opensumi/ide-core-common/lib/path'; -import { FileTreeService } from '../file-tree.service'; -import styles from '../file-tree.module.less'; -import treeNodeStyles from '../file-tree-node.module.less'; import { FileTreeDropEvent } from '@opensumi/ide-core-common/lib/types/dnd'; +import { IMessageService } from '@opensumi/ide-overlay'; + +import { IFileTreeAPI, IFileTreeService } from '../../common'; +import { Directory, File } from '../../common/file-tree-node.define'; +import treeNodeStyles from '../file-tree-node.module.less'; +import styles from '../file-tree.module.less'; +import { FileTreeService } from '../file-tree.service'; + +import { FileTreeModelService } from './file-tree-model.service'; @Injectable() export class DragAndDropService extends WithEventBus { diff --git a/packages/file-tree-next/src/browser/services/file-tree-model.service.ts b/packages/file-tree-next/src/browser/services/file-tree-model.service.ts index df584775c0..4d0794e57f 100644 --- a/packages/file-tree-next/src/browser/services/file-tree-model.service.ts +++ b/packages/file-tree-next/src/browser/services/file-tree-model.service.ts @@ -11,9 +11,7 @@ import { TreeModel, IRecycleTreeFilterHandle, } from '@opensumi/ide-components'; -import { FileTreeService } from '../file-tree.service'; -import { FileTreeModel } from '../file-tree-model'; -import { Directory, File } from '../../common/file-tree-node.define'; +import { ISerializableState, TreeStateWatcher } from '@opensumi/ide-components/lib/recycle-tree/tree/model/treeState'; import { CorePreferences, IContextKey, @@ -37,16 +35,21 @@ import { } from '@opensumi/ide-core-browser'; import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey/resource'; import { AbstractContextMenuService, MenuId, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import { IFileTreeAPI, IFileTreeService, PasteTypes } from '../../common'; -import { DragAndDropService } from './file-tree-dnd.service'; -import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import styles from '../file-tree-node.module.less'; -import { FileStat, FileChangeType } from '@opensumi/ide-file-service'; -import { ISerializableState, TreeStateWatcher } from '@opensumi/ide-components/lib/recycle-tree/tree/model/treeState'; +import { Path } from '@opensumi/ide-core-common/lib/path'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { FileStat, FileChangeType } from '@opensumi/ide-file-service'; +import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; + + +import { IFileTreeAPI, IFileTreeService, PasteTypes } from '../../common'; +import { Directory, File } from '../../common/file-tree-node.define'; +import { FileTreeModel } from '../file-tree-model'; import { FILE_TREE_NODE_HEIGHT } from '../file-tree-node'; +import styles from '../file-tree-node.module.less'; +import { FileTreeService } from '../file-tree.service'; + +import { DragAndDropService } from './file-tree-dnd.service'; export interface IParseStore { files: (File | Directory)[]; diff --git a/packages/file-tree-next/src/browser/symlink-file-decoration.ts b/packages/file-tree-next/src/browser/symlink-file-decoration.ts index 4f5214280f..be0df5e8bd 100644 --- a/packages/file-tree-next/src/browser/symlink-file-decoration.ts +++ b/packages/file-tree-next/src/browser/symlink-file-decoration.ts @@ -1,6 +1,7 @@ import { Optional } from '@opensumi/di'; -import { IDecorationsProvider, IDecorationData } from '@opensumi/ide-decoration'; import { Uri, Emitter, localize } from '@opensumi/ide-core-browser'; +import { IDecorationsProvider, IDecorationData } from '@opensumi/ide-decoration'; + import { FileTreeService } from './file-tree.service'; export class SymlinkDecorationsProvider implements IDecorationsProvider { diff --git a/packages/file-tree-next/src/common/file-tree-node.define.ts b/packages/file-tree-next/src/common/file-tree-node.define.ts index 751f3d7eba..c0f8d4c1b2 100644 --- a/packages/file-tree-next/src/common/file-tree-node.define.ts +++ b/packages/file-tree-next/src/common/file-tree-node.define.ts @@ -1,6 +1,7 @@ +import { TreeNode, ICompositeTreeNode, CompositeTreeNode, ITree } from '@opensumi/ide-components'; import { URI } from '@opensumi/ide-core-browser'; import { FileStat } from '@opensumi/ide-file-service'; -import { TreeNode, ICompositeTreeNode, CompositeTreeNode, ITree } from '@opensumi/ide-components'; + import { IFileTreeService } from './index'; export class Directory extends CompositeTreeNode { diff --git a/packages/file-tree-next/src/common/index.ts b/packages/file-tree-next/src/common/index.ts index 0c5ac4d5c8..e438120c8f 100644 --- a/packages/file-tree-next/src/common/index.ts +++ b/packages/file-tree-next/src/common/index.ts @@ -1,6 +1,7 @@ -import { URI, BasicEvent, IDisposable } from '@opensumi/ide-core-common'; import { ITree, ITreeNode } from '@opensumi/ide-components'; +import { URI, BasicEvent, IDisposable } from '@opensumi/ide-core-common'; import { FileStat } from '@opensumi/ide-file-service'; + import { Directory, File } from './file-tree-node.define'; export const IFileTreeAPI = Symbol('IFileTreeAPI'); diff --git a/packages/i18n/src/common/index.ts b/packages/i18n/src/common/index.ts index 5bfbe4c5a2..05700dad3d 100644 --- a/packages/i18n/src/common/index.ts +++ b/packages/i18n/src/common/index.ts @@ -1,6 +1,7 @@ import { registerLocalizationBundle } from '@opensumi/ide-core-common'; -import { localizationBundle as zh } from './zh-CN.lang'; + import { localizationBundle as en } from './en-US.lang'; +import { localizationBundle as zh } from './zh-CN.lang'; registerLocalizationBundle(zh); registerLocalizationBundle(en); diff --git a/packages/keymaps/__tests__/browser/keymaps.service.test.ts b/packages/keymaps/__tests__/browser/keymaps.service.test.ts index 8c06d0767b..b0c5af0880 100644 --- a/packages/keymaps/__tests__/browser/keymaps.service.test.ts +++ b/packages/keymaps/__tests__/browser/keymaps.service.test.ts @@ -1,6 +1,9 @@ -import { KeymapService } from '@opensumi/ide-keymaps/lib/browser/keymaps.service'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import os from 'os'; +import path from 'path'; + +import * as fs from 'fs-extra'; + +import { Injectable, Provider } from '@opensumi/di'; import { KeybindingRegistry, KeybindingService, @@ -14,18 +17,18 @@ import { BrowserModule, AppConfig, } from '@opensumi/ide-core-browser'; -import { IUserStorageService } from '@opensumi/ide-preferences'; -import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; +import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; import { IDiskFileProvider, IFileServiceClient } from '@opensumi/ide-file-service'; -import { Injectable, Provider } from '@opensumi/di'; -import { UserStorageContribution, UserStorageServiceImpl } from '@opensumi/ide-preferences/lib/browser/userstorage'; -import os from 'os'; -import path from 'path'; -import * as fs from 'fs-extra'; -import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; import { FileServiceContribution } from '@opensumi/ide-file-service/lib/browser/file-service-contribution'; -import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; +import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; +import { KeymapService } from '@opensumi/ide-keymaps/lib/browser/keymaps.service'; +import { IUserStorageService } from '@opensumi/ide-preferences'; +import { UserStorageContribution, UserStorageServiceImpl } from '@opensumi/ide-preferences/lib/browser/userstorage'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; @Injectable() export class AddonModule extends BrowserModule { diff --git a/packages/keymaps/src/browser/index.ts b/packages/keymaps/src/browser/index.ts index ee2590e40e..3ad332feb3 100644 --- a/packages/keymaps/src/browser/index.ts +++ b/packages/keymaps/src/browser/index.ts @@ -1,7 +1,9 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { KeymapsContribution } from './keymaps.contribution'; + import { IKeymapService } from '../common'; + +import { KeymapsContribution } from './keymaps.contribution'; import { KeymapService } from './keymaps.service'; @Injectable() diff --git a/packages/keymaps/src/browser/keymaps-parser.ts b/packages/keymaps/src/browser/keymaps-parser.ts index f7326bd1e8..a95e3d2c94 100644 --- a/packages/keymaps/src/browser/keymaps-parser.ts +++ b/packages/keymaps/src/browser/keymaps-parser.ts @@ -1,6 +1,8 @@ -import { Injectable } from '@opensumi/di'; import Ajv from 'ajv'; import * as parser from 'jsonc-parser'; + +import { Injectable } from '@opensumi/di'; + import { KeymapItem } from '../common'; export const keymapsSchema = { diff --git a/packages/keymaps/src/browser/keymaps.contribution.ts b/packages/keymaps/src/browser/keymaps.contribution.ts index 5d2b5f399a..8fe6e3de6a 100644 --- a/packages/keymaps/src/browser/keymaps.contribution.ts +++ b/packages/keymaps/src/browser/keymaps.contribution.ts @@ -19,13 +19,16 @@ import { KeymapInfo, formatLocalize, } from '@opensumi/ide-core-browser'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; -import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { ResourceService, IResourceProvider, IResource } from '@opensumi/ide-editor'; +import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { QuickPickItem, QuickPickService } from '@opensumi/ide-quick-open'; + import { KEYMAPS_SCHEME, IKeymapService } from '../common'; + import { KeymapsView } from './keymaps.view'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { QuickPickItem, QuickPickService } from '@opensumi/ide-quick-open'; + const KEYMAPS_PREVIEW_COMPONENT_ID = 'keymaps-preview'; diff --git a/packages/keymaps/src/browser/keymaps.service.ts b/packages/keymaps/src/browser/keymaps.service.ts index eb09c54819..155e181b67 100644 --- a/packages/keymaps/src/browser/keymaps.service.ts +++ b/packages/keymaps/src/browser/keymaps.service.ts @@ -1,5 +1,7 @@ -import { Injectable, Autowired } from '@opensumi/di'; +import * as fuzzy from 'fuzzy'; import { observable, action } from 'mobx'; + +import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, IDisposable, @@ -26,12 +28,14 @@ import { IProgressStep, Deferred, } from '@opensumi/ide-core-browser'; -import { KeymapsParser } from './keymaps-parser'; -import * as fuzzy from 'fuzzy'; -import { KEYMAPS_FILE_NAME, IKeymapService, KEYMAPS_SCHEME, KeybindingItem, KeymapItem } from '../common'; -import { USER_STORAGE_SCHEME } from '@opensumi/ide-preferences'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { USER_STORAGE_SCHEME } from '@opensumi/ide-preferences'; + +import { KEYMAPS_FILE_NAME, IKeymapService, KEYMAPS_SCHEME, KeybindingItem, KeymapItem } from '../common'; + +import { KeymapsParser } from './keymaps-parser'; + @Injectable() export class KeymapService implements IKeymapService { diff --git a/packages/keymaps/src/browser/keymaps.view.tsx b/packages/keymaps/src/browser/keymaps.view.tsx index adc7d38a46..5b0def66e3 100644 --- a/packages/keymaps/src/browser/keymaps.view.tsx +++ b/packages/keymaps/src/browser/keymaps.view.tsx @@ -1,9 +1,9 @@ -import React, { useCallback } from 'react'; -import { observer } from 'mobx-react-lite'; import cls from 'classnames'; -import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; -import styles from './keymaps.module.less'; +import { observer } from 'mobx-react-lite'; +import React, { useCallback } from 'react'; + import { Input, ValidateInput, VALIDATE_TYPE, ValidateMessage } from '@opensumi/ide-components'; +import { RecycleList } from '@opensumi/ide-components'; import { localize, useInjectable, @@ -13,10 +13,14 @@ import { Key, formatLocalize, } from '@opensumi/ide-core-browser'; -import { KeymapService } from './keymaps.service'; -import { IKeymapService, KeybindingItem } from '../common'; import { getIcon } from '@opensumi/ide-core-browser'; -import { RecycleList } from '@opensumi/ide-components'; +import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; + +import { IKeymapService, KeybindingItem } from '../common'; + +import styles from './keymaps.module.less'; +import { KeymapService } from './keymaps.service'; + export const KeymapsView: ReactEditorComponent = observer(() => { const { diff --git a/packages/logs-core/__tests__/browser/log-manage.test.ts b/packages/logs-core/__tests__/browser/log-manage.test.ts index b8b0fb8c88..c7bf74967d 100644 --- a/packages/logs-core/__tests__/browser/log-manage.test.ts +++ b/packages/logs-core/__tests__/browser/log-manage.test.ts @@ -1,5 +1,6 @@ import { Injector, Injectable } from '@opensumi/di'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { LogModule } from '../../src/browser'; import { ILoggerManagerClient, SupportLogNamespace, LogLevel, LogServiceForClientPath } from '../../src/common'; diff --git a/packages/logs-core/__tests__/browser/log.service.test.ts b/packages/logs-core/__tests__/browser/log.service.test.ts index f6699a2dc8..a46d064fe8 100644 --- a/packages/logs-core/__tests__/browser/log.service.test.ts +++ b/packages/logs-core/__tests__/browser/log.service.test.ts @@ -1,6 +1,8 @@ import { Injector, Injectable } from '@opensumi/di'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { LogModule } from '../../src/browser'; +import { LogServiceClient } from '../../src/browser/log.service'; import { ILoggerManagerClient, SupportLogNamespace, @@ -8,7 +10,6 @@ import { LogServiceForClientPath, ILogServiceClient, } from '../../src/common'; -import { LogServiceClient } from '../../src/browser/log.service'; @Injectable() class MockLogServiceForClient { diff --git a/packages/logs-core/__tests__/node/log-manager.test.ts b/packages/logs-core/__tests__/node/log-manager.test.ts index 443a69fd38..5f1d65c0e2 100644 --- a/packages/logs-core/__tests__/node/log-manager.test.ts +++ b/packages/logs-core/__tests__/node/log-manager.test.ts @@ -1,11 +1,14 @@ import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; -import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { AppConfig } from '@opensumi/ide-core-node'; + import { toLocalISOString } from '@opensumi/ide-core-common'; -import { LogServiceModule } from '../../src/node'; +import { AppConfig } from '@opensumi/ide-core-node'; +import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { LogLevel, SupportLogNamespace, ILogServiceManager } from '../../src/common'; +import { LogServiceModule } from '../../src/node'; const ktDir = path.join(os.homedir(), '.sumi-test'); const logDir = path.join(ktDir, 'logs_0'); diff --git a/packages/logs-core/__tests__/node/log.service.test.ts b/packages/logs-core/__tests__/node/log.service.test.ts index a524a35de0..09ff2452a5 100644 --- a/packages/logs-core/__tests__/node/log.service.test.ts +++ b/packages/logs-core/__tests__/node/log.service.test.ts @@ -1,12 +1,15 @@ import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; -import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { AppConfig } from '@opensumi/ide-core-node'; + import { toLocalISOString, ILogService } from '@opensumi/ide-core-common'; +import { AppConfig } from '@opensumi/ide-core-node'; +import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + +import { LogLevel, SupportLogNamespace, ILogServiceManager } from '../../src/common'; import { LogServiceModule } from '../../src/node'; import { LogLevelMessageMap } from '../../src/node/log.service'; -import { LogLevel, SupportLogNamespace, ILogServiceManager } from '../../src/common'; const testDir = path.join(os.homedir(), '.sumi-test'); const logDir = path.join(testDir, 'logs_1'); diff --git a/packages/logs-core/src/browser/index.ts b/packages/logs-core/src/browser/index.ts index 2f1631ccf0..f09c293fca 100644 --- a/packages/logs-core/src/browser/index.ts +++ b/packages/logs-core/src/browser/index.ts @@ -1,6 +1,8 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { LogServiceForClientPath, ILoggerManagerClient } from '../common/'; + import { LoggerManagerClient } from './log-manage'; export * from '../common/'; diff --git a/packages/logs-core/src/browser/log-manage.ts b/packages/logs-core/src/browser/log-manage.ts index 0b4db84083..23fa77d805 100644 --- a/packages/logs-core/src/browser/log-manage.ts +++ b/packages/logs-core/src/browser/log-manage.ts @@ -1,6 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Emitter } from '@opensumi/ide-core-common'; -import { LogServiceClient } from './log.service'; + import { LogServiceForClientPath, ILogServiceForClient, @@ -10,6 +10,8 @@ import { ILogServiceClient, } from '../common/'; +import { LogServiceClient } from './log.service'; + @Injectable() export class LoggerManagerClient implements ILoggerManagerClient { protected readonly logLevelChangeEmitter = new Emitter(); diff --git a/packages/logs-core/src/node/index.ts b/packages/logs-core/src/node/index.ts index c24685f51f..212898d9e5 100644 --- a/packages/logs-core/src/node/index.ts +++ b/packages/logs-core/src/node/index.ts @@ -1,7 +1,9 @@ import { Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; -import { LogServiceManager } from './log-manager'; + import { LogServiceForClientPath, ILogServiceForClient, ILogServiceManager } from '../common/'; + +import { LogServiceManager } from './log-manager'; import { LogServiceForClient } from './log.service'; export * from '../common/'; diff --git a/packages/logs-core/src/node/log-manager.ts b/packages/logs-core/src/node/log-manager.ts index 1f02b8cc61..614ebbb027 100644 --- a/packages/logs-core/src/node/log-manager.ts +++ b/packages/logs-core/src/node/log-manager.ts @@ -1,7 +1,9 @@ -import { Injectable, Autowired, ConstructorOf } from '@opensumi/di'; import path from 'path'; -import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; + +import { Injectable, Autowired, ConstructorOf } from '@opensumi/di'; import { Emitter } from '@opensumi/ide-core-common'; +import { AppConfig } from '@opensumi/ide-core-node/lib/bootstrap/app'; + import { ILogService, LogLevel, @@ -11,8 +13,9 @@ import { LoggerManagerInitOptions, Archive, } from '../common/'; -import { getLogFolder, cleanOldLogs, cleanAllLogs, cleanExpiredLogs, getLogZipArchiveByFolder } from './utils'; + import { LogService, DEFAULT_LOG_FOLDER } from './log.service'; +import { getLogFolder, cleanOldLogs, cleanAllLogs, cleanExpiredLogs, getLogZipArchiveByFolder } from './utils'; @Injectable() export class LogServiceManager implements ILogServiceManager { diff --git a/packages/logs-core/src/node/log.service.ts b/packages/logs-core/src/node/log.service.ts index c6e7bfa4c8..2d3daeb95a 100644 --- a/packages/logs-core/src/node/log.service.ts +++ b/packages/logs-core/src/node/log.service.ts @@ -1,9 +1,12 @@ +import os from 'os'; import path from 'path'; -import spdlog from 'spdlog'; import process from 'process'; -import os from 'os'; -import { RPCService } from '@opensumi/ide-connection'; + +import spdlog from 'spdlog'; + import { Injectable, Autowired } from '@opensumi/di'; +import { RPCService } from '@opensumi/ide-connection'; + import { ILogService, ILogServiceOptions, diff --git a/packages/logs-core/src/node/logger.ts b/packages/logs-core/src/node/logger.ts index 93431b867a..28eb01a930 100644 --- a/packages/logs-core/src/node/logger.ts +++ b/packages/logs-core/src/node/logger.ts @@ -2,8 +2,9 @@ * 提供无依赖的 Logger 供无DI的环境使用 */ -import { BaseLogService, DEFAULT_LOG_FOLDER } from './log.service'; import { IBaseLogService, BaseLogServiceOptions } from '../common'; + +import { BaseLogService, DEFAULT_LOG_FOLDER } from './log.service'; import { getLogFolder } from './utils'; export * from './utils'; diff --git a/packages/logs-core/src/node/utils.ts b/packages/logs-core/src/node/utils.ts index 13cb3662cf..719644c3cb 100644 --- a/packages/logs-core/src/node/utils.ts +++ b/packages/logs-core/src/node/utils.ts @@ -1,6 +1,8 @@ import path from 'path'; -import * as fs from 'fs-extra'; + import archiver from 'archiver'; +import * as fs from 'fs-extra'; + import { toLocalISOString, getDebugLogger, Archive } from '@opensumi/ide-core-common'; const debugLog = getDebugLogger('LogUtils'); diff --git a/packages/main-layout/__tests__/browser/layout.service.test.tsx b/packages/main-layout/__tests__/browser/layout.service.test.tsx index 7ced735aef..d43ca2286d 100644 --- a/packages/main-layout/__tests__/browser/layout.service.test.tsx +++ b/packages/main-layout/__tests__/browser/layout.service.test.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { act } from 'react-dom/test-utils'; + import { ComponentRegistryImpl, ComponentRegistry, @@ -13,18 +14,20 @@ import { Disposable, ClientApp, } from '@opensumi/ide-core-browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; import { useMockStorage } from '@opensumi/ide-core-browser/__mocks__/storage'; import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; -import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; +import { CommonServerPath, Deferred, OS } from '@opensumi/ide-core-common'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { MainLayoutModule } from '@opensumi/ide-main-layout/lib/browser'; import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { MainLayoutModuleContribution } from '@opensumi/ide-main-layout/lib/browser/main-layout.contribution'; -import { act } from 'react-dom/test-utils'; -import { CommonServerPath, Deferred, OS } from '@opensumi/ide-core-common'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; + const MockView = (props) =>
Test view{props.message &&

has prop.message

}
; jest.useFakeTimers(); diff --git a/packages/main-layout/src/browser/accordion/accordion.service.ts b/packages/main-layout/src/browser/accordion/accordion.service.ts index 7f83e8c47b..de7061c143 100644 --- a/packages/main-layout/src/browser/accordion/accordion.service.ts +++ b/packages/main-layout/src/browser/accordion/accordion.service.ts @@ -1,3 +1,6 @@ +import { debounce } from 'lodash'; +import { action, observable } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; import { View, @@ -15,11 +18,12 @@ import { Emitter, IScopedContextKeyService, } from '@opensumi/ide-core-browser'; -import { action, observable } from 'mobx'; +import { RESIZE_LOCK } from '@opensumi/ide-core-browser/lib/components'; import { SplitPanelManager, SplitPanelService, } from '@opensumi/ide-core-browser/lib/components/layout/split-panel.service'; +import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { AbstractContextMenuService, AbstractMenuService, @@ -28,11 +32,10 @@ import { ICtxMenuRenderer, MenuId, } from '@opensumi/ide-core-browser/lib/menu/next'; -import { RESIZE_LOCK } from '@opensumi/ide-core-browser/lib/components'; -import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; + import { ViewCollapseChangedEvent } from '../../common'; -import { debounce } from 'lodash'; + export interface SectionState { collapsed: boolean; diff --git a/packages/main-layout/src/browser/accordion/accordion.view.tsx b/packages/main-layout/src/browser/accordion/accordion.view.tsx index bf460a07bf..8d22072805 100644 --- a/packages/main-layout/src/browser/accordion/accordion.view.tsx +++ b/packages/main-layout/src/browser/accordion/accordion.view.tsx @@ -1,11 +1,12 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { View, useInjectable } from '@opensumi/ide-core-browser'; -import { replaceLocalizePlaceholder } from '@opensumi/ide-core-common'; import { Layout, SplitPanel } from '@opensumi/ide-core-browser/lib/components'; +import { replaceLocalizePlaceholder } from '@opensumi/ide-core-common'; -import { AccordionSection } from './section.view'; import { AccordionServiceFactory, AccordionService, SectionState } from './accordion.service'; +import { AccordionSection } from './section.view'; interface AccordionContainerProps { alignment?: Layout.alignment; diff --git a/packages/main-layout/src/browser/accordion/section.view.tsx b/packages/main-layout/src/browser/accordion/section.view.tsx index 15415f8464..5ee92eb155 100644 --- a/packages/main-layout/src/browser/accordion/section.view.tsx +++ b/packages/main-layout/src/browser/accordion/section.view.tsx @@ -1,14 +1,17 @@ -import React from 'react'; import cls from 'classnames'; -import styles from './styles.module.less'; +import React from 'react'; + + import { getIcon, ErrorBoundary, useViewState } from '@opensumi/ide-core-browser'; -import { Layout, PanelContext } from '@opensumi/ide-core-browser/lib/components'; import { useInjectable } from '@opensumi/ide-core-browser'; +import { Layout, PanelContext } from '@opensumi/ide-core-browser/lib/components'; import { InlineActionBar, InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; import { isIMenu, IMenu, IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; import { ProgressBar } from '@opensumi/ide-core-browser/lib/progress/progress-bar'; +import styles from './styles.module.less'; + export interface CollapsePanelProps extends React.PropsWithChildren { // panel 头部标题 header: string; diff --git a/packages/main-layout/src/browser/index.ts b/packages/main-layout/src/browser/index.ts index a684115734..d3fae8f126 100644 --- a/packages/main-layout/src/browser/index.ts +++ b/packages/main-layout/src/browser/index.ts @@ -1,10 +1,12 @@ import { Provider, Injectable, Injector } from '@opensumi/di'; -import { MainLayoutModuleContribution } from './main-layout.contribution'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { IMainLayoutService, IViewsRegistry, MainLayoutContribution } from '../common'; -import { TabbarServiceFactory } from './tabbar/tabbar.service'; -import { LayoutService } from './layout.service'; + import { AccordionServiceFactory } from './accordion/accordion.service'; +import { LayoutService } from './layout.service'; +import { MainLayoutModuleContribution } from './main-layout.contribution'; +import { TabbarServiceFactory } from './tabbar/tabbar.service'; import { ViewsRegistry } from './views-registry'; @Injectable() diff --git a/packages/main-layout/src/browser/input/index.tsx b/packages/main-layout/src/browser/input/index.tsx index e547f05542..c4e28721fb 100644 --- a/packages/main-layout/src/browser/input/index.tsx +++ b/packages/main-layout/src/browser/input/index.tsx @@ -1,6 +1,8 @@ import React, { PropsWithChildren, useRef, useEffect } from 'react'; + import { IInputBaseProps, Input } from '@opensumi/ide-components'; import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; + import { IMainLayoutService } from '../../common'; export const AutoFocusedInput = ({ diff --git a/packages/main-layout/src/browser/layout.service.ts b/packages/main-layout/src/browser/layout.service.ts index d0e5e0427c..18d79cc3c2 100644 --- a/packages/main-layout/src/browser/layout.service.ts +++ b/packages/main-layout/src/browser/layout.service.ts @@ -1,3 +1,5 @@ +import debounce = require('lodash.debounce'); + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { WithEventBus, @@ -16,14 +18,7 @@ import { OnEvent, slotRendererRegistry, } from '@opensumi/ide-core-browser'; -import { - MainLayoutContribution, - IMainLayoutService, - ViewComponentOptions, - SUPPORT_ACCORDION_LOCATION, -} from '../common'; -import { TabBarHandler } from './tabbar-handler'; -import { TabbarService } from './tabbar/tabbar.service'; +import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { IMenuRegistry, AbstractContextMenuService, @@ -31,12 +26,21 @@ import { AbstractMenuService, IContextMenu, } from '@opensumi/ide-core-browser/lib/menu/next'; -import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; -import { AccordionService } from './accordion/accordion.service'; -import debounce = require('lodash.debounce'); import { Deferred, getDebugLogger } from '@opensumi/ide-core-common'; import { ThemeChangedEvent } from '@opensumi/ide-theme'; +import { + MainLayoutContribution, + IMainLayoutService, + ViewComponentOptions, + SUPPORT_ACCORDION_LOCATION, +} from '../common'; + +import { AccordionService } from './accordion/accordion.service'; +import { TabBarHandler } from './tabbar-handler'; +import { TabbarService } from './tabbar/tabbar.service'; + + @Injectable() export class LayoutService extends WithEventBus implements IMainLayoutService { @Autowired(INJECTOR_TOKEN) diff --git a/packages/main-layout/src/browser/main-layout.contribution.ts b/packages/main-layout/src/browser/main-layout.contribution.ts index 5675594b86..5e28a5fe8c 100644 --- a/packages/main-layout/src/browser/main-layout.contribution.ts +++ b/packages/main-layout/src/browser/main-layout.contribution.ts @@ -1,6 +1,4 @@ import { Autowired } from '@opensumi/di'; -import { CommandContribution, CommandRegistry, Command, CommandService } from '@opensumi/ide-core-common/lib/command'; -import { Domain, IEventBus, ContributionProvider, localize, WithEventBus } from '@opensumi/ide-core-common'; import { IContextKeyService, ClientAppContribution, @@ -10,7 +8,7 @@ import { slotRendererRegistry, KeybindingRegistry, } from '@opensumi/ide-core-browser'; -import { IMainLayoutService } from '../common'; +import { getIcon } from '@opensumi/ide-core-browser'; import { ComponentContribution, ComponentRegistry, @@ -18,14 +16,20 @@ import { ToolbarRegistry, } from '@opensumi/ide-core-browser/lib/layout'; import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; -import { RightTabRenderer, LeftTabRenderer, NextBottomTabRenderer } from './tabbar/renderer.view'; -import { getIcon } from '@opensumi/ide-core-browser'; import { IMenuRegistry, MenuCommandDesc, MenuContribution as MenuContribution, MenuId, } from '@opensumi/ide-core-browser/lib/menu/next'; +import { Domain, IEventBus, ContributionProvider, localize, WithEventBus } from '@opensumi/ide-core-common'; +import { CommandContribution, CommandRegistry, Command, CommandService } from '@opensumi/ide-core-common/lib/command'; + +import { IMainLayoutService } from '../common'; + + +import { RightTabRenderer, LeftTabRenderer, NextBottomTabRenderer } from './tabbar/renderer.view'; + // NOTE 左右侧面板的展开、折叠命令请使用组合命令 activity-bar.left.toggle,layout命令仅做折叠展开,不处理tab激活逻辑 export const HIDE_LEFT_PANEL_COMMAND: Command = { diff --git a/packages/main-layout/src/browser/tabbar-handler.ts b/packages/main-layout/src/browser/tabbar-handler.ts index f6fa8f62fc..19baa2a2b2 100644 --- a/packages/main-layout/src/browser/tabbar-handler.ts +++ b/packages/main-layout/src/browser/tabbar-handler.ts @@ -1,8 +1,11 @@ -import { Event, Emitter, ILogger } from '@opensumi/ide-core-common'; import { Injectable, Autowired } from '@opensumi/di'; -import { TabbarService } from './tabbar/tabbar.service'; +import { Event, Emitter, ILogger } from '@opensumi/ide-core-common'; + import { IMainLayoutService } from '../common'; +import { TabbarService } from './tabbar/tabbar.service'; + + @Injectable({ multiple: true }) export class TabBarHandler { @Autowired(IMainLayoutService) diff --git a/packages/main-layout/src/browser/tabbar/bar.view.tsx b/packages/main-layout/src/browser/tabbar/bar.view.tsx index 0117ebd4dd..3e6f669422 100644 --- a/packages/main-layout/src/browser/tabbar/bar.view.tsx +++ b/packages/main-layout/src/browser/tabbar/bar.view.tsx @@ -1,17 +1,20 @@ -import React from 'react'; import clsx from 'classnames'; -import styles from './styles.module.less'; -import { Layout } from '@opensumi/ide-core-browser/lib/components/layout/layout'; +import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { Badge, Icon } from '@opensumi/ide-components'; import { ComponentRegistryInfo, useInjectable, KeybindingRegistry, usePreference } from '@opensumi/ide-core-browser'; -import { TabbarService, TabbarServiceFactory } from './tabbar.service'; -import { observer } from 'mobx-react-lite'; -import { TabbarConfig } from './renderer.view'; import { getIcon } from '@opensumi/ide-core-browser'; -import { IMainLayoutService } from '../../common'; import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { Layout } from '@opensumi/ide-core-browser/lib/components/layout/layout'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { IMainLayoutService } from '../../common'; + +import { TabbarConfig } from './renderer.view'; +import styles from './styles.module.less'; +import { TabbarService, TabbarServiceFactory } from './tabbar.service'; + function splitVisibleTabs(containers: ComponentRegistryInfo[], tabSize: number, availableSize: number) { const visibleCount = Math.floor(availableSize / tabSize); if (visibleCount >= containers.length) { diff --git a/packages/main-layout/src/browser/tabbar/panel.view.tsx b/packages/main-layout/src/browser/tabbar/panel.view.tsx index eaa21eee1d..49b159a32c 100644 --- a/packages/main-layout/src/browser/tabbar/panel.view.tsx +++ b/packages/main-layout/src/browser/tabbar/panel.view.tsx @@ -1,6 +1,7 @@ -import React from 'react'; import clsx from 'classnames'; -import styles from './styles.module.less'; +import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { ComponentRegistryInfo, @@ -11,17 +12,19 @@ import { ErrorBoundary, useViewState, } from '@opensumi/ide-core-browser'; -import { TabbarService, TabbarServiceFactory } from './tabbar.service'; -import { observer } from 'mobx-react-lite'; -import { TabbarConfig } from './renderer.view'; -import { AccordionContainer } from '../accordion/accordion.view'; import { InlineActionBar, InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; import { IMenu } from '@opensumi/ide-core-browser/lib/menu/next'; -import { TitleBar } from '../accordion/titlebar.view'; -import { AccordionServiceFactory, AccordionService } from '../accordion/accordion.service'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; import { ProgressBar } from '@opensumi/ide-core-browser/lib/progress/progress-bar'; +import { AccordionServiceFactory, AccordionService } from '../accordion/accordion.service'; +import { AccordionContainer } from '../accordion/accordion.view'; +import { TitleBar } from '../accordion/titlebar.view'; + +import { TabbarConfig } from './renderer.view'; +import styles from './styles.module.less'; +import { TabbarService, TabbarServiceFactory } from './tabbar.service'; + const NoUpdateBoundary: React.FC<{ visible: boolean; children: React.ReactElement }> = React.memo( ({ children }) => children, (prev, next) => !(prev.visible || next.visible), diff --git a/packages/main-layout/src/browser/tabbar/renderer.view.tsx b/packages/main-layout/src/browser/tabbar/renderer.view.tsx index c405c7c65d..e112cd9a87 100644 --- a/packages/main-layout/src/browser/tabbar/renderer.view.tsx +++ b/packages/main-layout/src/browser/tabbar/renderer.view.tsx @@ -1,8 +1,11 @@ -import React from 'react'; import clsx from 'classnames'; -import styles from './styles.module.less'; -import { Layout } from '@opensumi/ide-core-browser/lib/components/layout/layout'; +import React from 'react'; + import { ComponentRegistryInfo, useInjectable, IEventBus, ResizeEvent } from '@opensumi/ide-core-browser'; +import { PanelContext } from '@opensumi/ide-core-browser/lib/components'; +import { Layout } from '@opensumi/ide-core-browser/lib/components/layout/layout'; + + import { RightTabbarRenderer, LeftTabbarRenderer, BottomTabbarRenderer, NextBottomTabbarRenderer } from './bar.view'; import { RightTabPanelRenderer, @@ -10,8 +13,9 @@ import { BottomTabPanelRenderer, NextBottomTabPanelRenderer, } from './panel.view'; +import styles from './styles.module.less'; import { TabbarServiceFactory, TabbarService } from './tabbar.service'; -import { PanelContext } from '@opensumi/ide-core-browser/lib/components'; + // TODO 将过深的prop挪到这里 export const TabbarConfig = React.createContext<{ diff --git a/packages/main-layout/src/browser/tabbar/tabbar.service.ts b/packages/main-layout/src/browser/tabbar/tabbar.service.ts index 5e5a8378bc..98881cac10 100644 --- a/packages/main-layout/src/browser/tabbar/tabbar.service.ts +++ b/packages/main-layout/src/browser/tabbar/tabbar.service.ts @@ -1,3 +1,7 @@ +import debounce = require('lodash.debounce'); +import { observable, action, observe, computed } from 'mobx'; + +import { Injectable, Autowired } from '@opensumi/di'; import { toDisposable, WithEventBus, @@ -18,8 +22,8 @@ import { IScopedContextKeyService, Deferred, } from '@opensumi/ide-core-browser'; -import { Injectable, Autowired } from '@opensumi/di'; -import { observable, action, observe, computed } from 'mobx'; +import { ResizeHandle } from '@opensumi/ide-core-browser/lib/components'; +import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { AbstractContextMenuService, AbstractMenuService, @@ -30,13 +34,12 @@ import { IMenu, MenuId, } from '@opensumi/ide-core-browser/lib/menu/next'; -import { TOGGLE_BOTTOM_PANEL_COMMAND, EXPAND_BOTTOM_PANEL, RETRACT_BOTTOM_PANEL } from '../main-layout.contribution'; -import { ResizeHandle } from '@opensumi/ide-core-browser/lib/components'; -import debounce = require('lodash.debounce'); -import { TabBarRegistrationEvent, IMainLayoutService, SUPPORT_ACCORDION_LOCATION } from '../../common'; -import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { TabBarRegistrationEvent, IMainLayoutService, SUPPORT_ACCORDION_LOCATION } from '../../common'; +import { TOGGLE_BOTTOM_PANEL_COMMAND, EXPAND_BOTTOM_PANEL, RETRACT_BOTTOM_PANEL } from '../main-layout.contribution'; + + export const TabbarServiceFactory = Symbol('TabbarServiceFactory'); export interface TabState { hidden: boolean; diff --git a/packages/main-layout/src/browser/views-registry.ts b/packages/main-layout/src/browser/views-registry.ts index 23fe75511c..04e14db671 100644 --- a/packages/main-layout/src/browser/views-registry.ts +++ b/packages/main-layout/src/browser/views-registry.ts @@ -1,6 +1,7 @@ import { Autowired, Injectable } from '@opensumi/di'; import { IDisposable, Event, Emitter, IContextKeyService, toDisposable } from '@opensumi/ide-core-browser'; import { SetMap } from '@opensumi/ide-core-common/lib/map'; + import { IViewContentDescriptor } from '..'; import { IViewsRegistry } from '../common'; diff --git a/packages/main-layout/src/browser/welcome.view.tsx b/packages/main-layout/src/browser/welcome.view.tsx index cc3dd62bb5..e83531034c 100644 --- a/packages/main-layout/src/browser/welcome.view.tsx +++ b/packages/main-layout/src/browser/welcome.view.tsx @@ -1,12 +1,16 @@ +import clsx from 'classnames'; import React from 'react'; + +import { Button } from '@opensumi/ide-components/lib/button'; import { getExternalIcon, IOpenerService, useInjectable } from '@opensumi/ide-core-browser'; -import { ViewsController } from './views-registry'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { parseLinkedText } from '@opensumi/ide-core-common/lib/linkedText'; + import { IViewContentDescriptor } from '../common'; + import styles from './accordion/styles.module.less'; -import { parseLinkedText } from '@opensumi/ide-core-common/lib/linkedText'; -import { Button } from '@opensumi/ide-components/lib/button'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; -import clsx from 'classnames'; +import { ViewsController } from './views-registry'; + export namespace CSSIcon { export const iconNameSegment = '[A-Za-z0-9]+'; diff --git a/packages/main-layout/src/common/main-layout.defination.ts b/packages/main-layout/src/common/main-layout.defination.ts index e32f90875d..5d26cd65b2 100644 --- a/packages/main-layout/src/common/main-layout.defination.ts +++ b/packages/main-layout/src/common/main-layout.defination.ts @@ -1,14 +1,15 @@ import { BasicEvent, IDisposable, SlotLocation } from '@opensumi/ide-core-browser'; import { ViewContainerOptions, View, SideStateManager } from '@opensumi/ide-core-browser/lib/layout'; +import { IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; +import { Deferred, Event } from '@opensumi/ide-core-common'; +import { IContextKeyExpression } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; + +// eslint-disable-next-line import/no-restricted-paths +import type { AccordionService } from '../browser/accordion/accordion.service'; // eslint-disable-next-line import/no-restricted-paths import type { TabBarHandler } from '../browser/tabbar-handler'; // eslint-disable-next-line import/no-restricted-paths import type { TabbarService } from '../browser/tabbar/tabbar.service'; -// eslint-disable-next-line import/no-restricted-paths -import type { AccordionService } from '../browser/accordion/accordion.service'; -import { IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; -import { Deferred, Event } from '@opensumi/ide-core-common'; -import { IContextKeyExpression } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; export interface ComponentCollection { views?: View[]; diff --git a/packages/markdown/__tests__/browser/markdown-service.test.ts b/packages/markdown/__tests__/browser/markdown-service.test.ts index 8abb9d1bd7..5f3363d5ce 100644 --- a/packages/markdown/__tests__/browser/markdown-service.test.ts +++ b/packages/markdown/__tests__/browser/markdown-service.test.ts @@ -1,8 +1,9 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MarkdownModule } from '@opensumi/ide-markdown/lib/browser'; -import { IWebviewService, IWebview } from '@opensumi/ide-webview'; import { CancellationTokenSource, Emitter, Disposable } from '@opensumi/ide-core-common'; import { IMarkdownService } from '@opensumi/ide-markdown'; +import { MarkdownModule } from '@opensumi/ide-markdown/lib/browser'; +import { IWebviewService, IWebview } from '@opensumi/ide-webview'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; describe('markdown test', () => { const injector = createBrowserInjector([MarkdownModule]); diff --git a/packages/markdown/src/browser/contribution.ts b/packages/markdown/src/browser/contribution.ts index d17f15ede1..7cdb8b00a2 100644 --- a/packages/markdown/src/browser/contribution.ts +++ b/packages/markdown/src/browser/contribution.ts @@ -1,9 +1,12 @@ -import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; -import { Domain, localize } from '@opensumi/ide-core-common'; import { Autowired } from '@opensumi/di'; +import { PreferenceService } from '@opensumi/ide-core-browser'; +import { Domain, localize } from '@opensumi/ide-core-common'; +import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; + import { IMarkdownService } from '../common'; + import { MarkdownEditorComponent } from './editor.markdown'; -import { PreferenceService } from '@opensumi/ide-core-browser'; + export const MARKDOWN_EDITOR_COMPONENT_ID = 'MARKDOWN_EDITOR_COMPONENT_ID'; diff --git a/packages/markdown/src/browser/editor.markdown.tsx b/packages/markdown/src/browser/editor.markdown.tsx index 5ee105bc34..1db2e17930 100644 --- a/packages/markdown/src/browser/editor.markdown.tsx +++ b/packages/markdown/src/browser/editor.markdown.tsx @@ -1,6 +1,8 @@ import React from 'react'; -import { ReactEditorComponent, IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; + import { useInjectable, Disposable, CancellationTokenSource, Emitter } from '@opensumi/ide-core-browser'; +import { ReactEditorComponent, IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; + import { IMarkdownService } from '../common'; export const MarkdownEditorComponent: ReactEditorComponent = ({ resource }) => { diff --git a/packages/markdown/src/browser/index.ts b/packages/markdown/src/browser/index.ts index 1086413b8b..1e06f00a06 100644 --- a/packages/markdown/src/browser/index.ts +++ b/packages/markdown/src/browser/index.ts @@ -1,8 +1,10 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { IMarkdownService } from '../common'; -import { MarkdownServiceImpl } from './markdown.service'; + import { EmbeddedMarkdownEditorContribution } from './contribution'; +import { MarkdownServiceImpl } from './markdown.service'; export { Markdown } from './markdown-widget'; @Injectable() export class MarkdownModule extends BrowserModule { diff --git a/packages/markdown/src/browser/markdown-widget.tsx b/packages/markdown/src/browser/markdown-widget.tsx index 21d58016d3..8b14299fff 100644 --- a/packages/markdown/src/browser/markdown-widget.tsx +++ b/packages/markdown/src/browser/markdown-widget.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { useInjectable, Disposable, CancellationTokenSource, URI } from '@opensumi/ide-core-browser'; + import { IMarkdownService } from '../common'; export const Markdown = ({ diff --git a/packages/markdown/src/browser/markdown.service.ts b/packages/markdown/src/browser/markdown.service.ts index 386cf6eeac..18806441af 100644 --- a/packages/markdown/src/browser/markdown.service.ts +++ b/packages/markdown/src/browser/markdown.service.ts @@ -1,10 +1,14 @@ -import { Injectable, Autowired } from '@opensumi/di'; -import { IMarkdownService } from '../common'; import { marked } from 'marked'; -import { markdownCss } from './mardown.style'; -import { IWebviewService } from '@opensumi/ide-webview'; + +import { Injectable, Autowired } from '@opensumi/di'; import { IDisposable, Disposable, CancellationToken, Event, URI, IOpenerService } from '@opensumi/ide-core-browser'; import { HttpOpener } from '@opensumi/ide-core-browser/lib/opener/http-opener'; +import { IWebviewService } from '@opensumi/ide-webview'; + +import { IMarkdownService } from '../common'; + +import { markdownCss } from './mardown.style'; + @Injectable() export class MarkdownServiceImpl implements IMarkdownService { diff --git a/packages/markers/__tests__/browser/markes-service.test.ts b/packages/markers/__tests__/browser/markes-service.test.ts index 5f7634b121..28255f831a 100644 --- a/packages/markers/__tests__/browser/markes-service.test.ts +++ b/packages/markers/__tests__/browser/markes-service.test.ts @@ -1,12 +1,13 @@ import { Injector, Injectable } from '@opensumi/di'; +import { Uri, URI, MarkerManager, Emitter } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { IThemeService } from '@opensumi/ide-theme'; import { WorkbenchEditorService, IEditorGroup } from '@opensumi/ide-editor'; -import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common'; -import { Uri, URI, MarkerManager, Emitter } from '@opensumi/ide-core-common'; import { EditorGroupCloseEvent, IResource } from '@opensumi/ide-editor/lib/browser'; -import { MarkerService } from '../../src/browser/markers-service'; +import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common'; +import { IThemeService } from '@opensumi/ide-theme'; + import { MarkerSeverity } from '../../../core-common/src/types/markers/markers'; +import { MarkerService } from '../../src/browser/markers-service'; @Injectable() class MockMainLayoutService { diff --git a/packages/markers/src/browser/index.ts b/packages/markers/src/browser/index.ts index 7afe55b74b..2096e55a84 100644 --- a/packages/markers/src/browser/index.ts +++ b/packages/markers/src/browser/index.ts @@ -1,6 +1,8 @@ import { Injectable, Provider } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { IMarkerService } from '../common'; + import { MarkersContribution } from './markers-contribution'; import { MarkerService } from './markers-service'; diff --git a/packages/markers/src/browser/markers-contribution.ts b/packages/markers/src/browser/markers-contribution.ts index 2608d37bc7..a525cc11ba 100644 --- a/packages/markers/src/browser/markers-contribution.ts +++ b/packages/markers/src/browser/markers-contribution.ts @@ -1,7 +1,9 @@ import { Autowired } from '@opensumi/di'; import { ComponentContribution, ComponentRegistry, Domain, Logger } from '@opensumi/ide-core-browser'; import { IMainLayoutService, MainLayoutContribution } from '@opensumi/ide-main-layout'; + import { IMarkerService, MARKER_CONTAINER_ID } from '../common'; + import { MarkerFilterPanel } from './markers-filter.view'; import { MarkerService } from './markers-service'; import { MarkerPanel } from './markers-tree.view'; diff --git a/packages/markers/src/browser/markers-filter.model.ts b/packages/markers/src/browser/markers-filter.model.ts index a635a1ffec..294693b708 100644 --- a/packages/markers/src/browser/markers-filter.model.ts +++ b/packages/markers/src/browser/markers-filter.model.ts @@ -2,6 +2,7 @@ import { IMarker, MarkerSeverity, URI } from '@opensumi/ide-core-common'; import { IFilter, matchesFuzzy, matchesFuzzy2, matchesPrefix } from '@opensumi/ide-core-common/lib/filters'; import { getEmptyExpression, IExpression, splitGlobAware } from '@opensumi/ide-core-common/lib/utils/glob'; import * as strings from '@opensumi/ide-core-common/lib/utils/strings'; + import { IFilterOptions, IRenderableMarker, @@ -10,6 +11,7 @@ import { MarkerModelBuilder, ResourceGlobMatcher, } from '../common'; + import Messages from './messages'; /** diff --git a/packages/markers/src/browser/markers-filter.view.tsx b/packages/markers/src/browser/markers-filter.view.tsx index 1230df787d..0471dfb006 100644 --- a/packages/markers/src/browser/markers-filter.view.tsx +++ b/packages/markers/src/browser/markers-filter.view.tsx @@ -1,15 +1,18 @@ +import debounce = require('lodash.debounce'); import { observer } from 'mobx-react-lite'; import React from 'react'; + +import { useInjectable } from '@opensumi/ide-core-browser'; +import { useDisposable } from '@opensumi/ide-core-browser/lib/utils/react-hooks'; +import { AutoFocusedInput } from '@opensumi/ide-main-layout/lib/browser/input'; + +import { IMarkerService, MARKER_CONTAINER_ID } from '../common'; + import { FilterOptions } from './markers-filter.model'; import styles from './markers-filter.module.less'; import { MarkerService } from './markers-service'; import Messages from './messages'; -import debounce = require('lodash.debounce'); -import { useDisposable } from '@opensumi/ide-core-browser/lib/utils/react-hooks'; -import { AutoFocusedInput } from '@opensumi/ide-main-layout/lib/browser/input'; -import { IMarkerService, MARKER_CONTAINER_ID } from '../common'; -import { useInjectable } from '@opensumi/ide-core-browser'; /** * Marker过滤面板 diff --git a/packages/markers/src/browser/markers-seriverty-icon.ts b/packages/markers/src/browser/markers-seriverty-icon.ts index 7c736b9dde..23540c5e44 100644 --- a/packages/markers/src/browser/markers-seriverty-icon.ts +++ b/packages/markers/src/browser/markers-seriverty-icon.ts @@ -1,6 +1,7 @@ +import { CSSProperties } from 'react'; + import { MarkerSeverity } from '@opensumi/ide-core-browser'; import { Color, DARK, LIGHT, ThemeType, HIGH_CONTRAST } from '@opensumi/ide-theme'; -import { CSSProperties } from 'react'; const errorStart = encodeURIComponent( ' FolderPreferenceProvider; diff --git a/packages/preferences/src/browser/folders-preferences-provider.ts b/packages/preferences/src/browser/folders-preferences-provider.ts index 02c4a862ce..06a67a467c 100644 --- a/packages/preferences/src/browser/folders-preferences-provider.ts +++ b/packages/preferences/src/browser/folders-preferences-provider.ts @@ -6,12 +6,13 @@ import { PreferenceConfigurations, ILogger, } from '@opensumi/ide-core-browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { FolderPreferenceProvider, FolderPreferenceProviderFactory, FolderPreferenceProviderOptions, } from './folder-preference-provider'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; @Injectable() export class FoldersPreferencesProvider extends PreferenceProvider { @Autowired(FolderPreferenceProviderFactory) diff --git a/packages/preferences/src/browser/index.ts b/packages/preferences/src/browser/index.ts index f9f2e2531f..cd00978071 100644 --- a/packages/preferences/src/browser/index.ts +++ b/packages/preferences/src/browser/index.ts @@ -1,28 +1,31 @@ import { Provider, Injector, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { PreferenceContribution } from './preference-contribution'; -import { FoldersPreferencesProvider } from './folders-preferences-provider'; -import { WorkspacePreferenceProvider } from './workspace-preference-provider'; -import { UserPreferenceProvider } from './user-preference-provider'; import { PreferenceScope, PreferenceConfigurations, PreferenceProvider, IPreferenceSettingsService, } from '@opensumi/ide-core-browser/lib/preferences'; + +import { IUserStorageService, SettingContribution } from '../common'; + import { FolderPreferenceProviderFactory, FolderPreferenceProviderOptions, FolderPreferenceProvider, } from './folder-preference-provider'; +import { FoldersPreferencesProvider } from './folders-preferences-provider'; +import { PreferenceContribution } from './preference-contribution'; +import { PreferenceSettingsService } from './preference-settings.service'; +import { UserPreferenceProvider } from './user-preference-provider'; +import { UserStorageContribution, UserStorageServiceImpl } from './userstorage'; import { WorkspaceFilePreferenceProviderFactory, WorkspaceFilePreferenceProviderOptions, WorkspaceFilePreferenceProvider, } from './workspace-file-preference-provider'; -import { PreferenceSettingsService } from './preference-settings.service'; -import { UserStorageContribution, UserStorageServiceImpl } from './userstorage'; -import { IUserStorageService, SettingContribution } from '../common'; +import { WorkspacePreferenceProvider } from './workspace-preference-provider'; + @Injectable() export class PreferencesModule extends BrowserModule { diff --git a/packages/preferences/src/browser/preference-contribution.ts b/packages/preferences/src/browser/preference-contribution.ts index 581953b286..70ac38a731 100644 --- a/packages/preferences/src/browser/preference-contribution.ts +++ b/packages/preferences/src/browser/preference-contribution.ts @@ -1,5 +1,6 @@ -import { Autowired, Injectable } from '@opensumi/di'; +import * as jsoncparser from 'jsonc-parser'; +import { Autowired, Injectable } from '@opensumi/di'; import { ClientAppContribution, PreferenceSchemaProvider, @@ -29,21 +30,23 @@ import { isString, ISettingSection, } from '@opensumi/ide-core-browser'; -import { USER_PREFERENCE_URI } from './user-preference-provider'; -import { WorkspacePreferenceProvider } from './workspace-preference-provider'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { ResourceService, IResourceProvider, IResource } from '@opensumi/ide-editor'; import { BrowserEditorContribution, EditorComponentRegistry, IResourceOpenResult, WorkbenchEditorService, } from '@opensumi/ide-editor/lib/browser'; -import { ResourceService, IResourceProvider, IResource } from '@opensumi/ide-editor'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; + import { PREF_SCHEME, SettingContribution } from '../common'; -import { PreferenceView } from './preferences.view'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; + import { PreferenceSettingsService, defaultSettingGroup, defaultSettingSections } from './preference-settings.service'; -import * as jsoncparser from 'jsonc-parser'; +import { PreferenceView } from './preferences.view'; +import { USER_PREFERENCE_URI } from './user-preference-provider'; +import { WorkspacePreferenceProvider } from './workspace-preference-provider'; + const PREF_PREVIEW_COMPONENT_ID = 'pref-preview'; diff --git a/packages/preferences/src/browser/preference-settings.service.ts b/packages/preferences/src/browser/preference-settings.service.ts index b8bfb00295..bdc431c4dc 100644 --- a/packages/preferences/src/browser/preference-settings.service.ts +++ b/packages/preferences/src/browser/preference-settings.service.ts @@ -1,5 +1,7 @@ -import { Injectable, Autowired } from '@opensumi/di'; import { observable, action } from 'mobx'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { IRecycleListHandler } from '@opensumi/ide-components'; import { IPreferenceViewDesc, IPreferenceSettingsService, @@ -23,9 +25,10 @@ import { replaceLocalizePlaceholder, ThrottledDelayer, } from '@opensumi/ide-core-browser'; -import { toPreferenceReadableName, PreferenceSettingId } from '../common'; import { IFileServiceClient } from '@opensumi/ide-file-service'; -import { IRecycleListHandler } from '@opensumi/ide-components'; + +import { toPreferenceReadableName, PreferenceSettingId } from '../common'; + import { PREFERENCE_COMMANDS } from './preference-contribution'; @Injectable() diff --git a/packages/preferences/src/browser/preferenceItem.view.tsx b/packages/preferences/src/browser/preferenceItem.view.tsx index 8e6ea541d7..5a78c367d4 100644 --- a/packages/preferences/src/browser/preferenceItem.view.tsx +++ b/packages/preferences/src/browser/preferenceItem.view.tsx @@ -1,4 +1,7 @@ +import classnames from 'classnames'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; + +import { Button, CheckBox, Input, Option, Select, ValidateInput, ValidateMessage } from '@opensumi/ide-components'; import { DisposableCollection, getIcon, @@ -13,12 +16,13 @@ import { useInjectable, formatLocalize, } from '@opensumi/ide-core-browser'; -import styles from './preferences.module.less'; -import classnames from 'classnames'; -import { Button, CheckBox, Input, Option, Select, ValidateInput, ValidateMessage } from '@opensumi/ide-components'; -import { PreferenceSettingsService } from './preference-settings.service'; + import { toPreferenceReadableName } from '../common'; +import { PreferenceSettingsService } from './preference-settings.service'; +import styles from './preferences.module.less'; + + interface IPreferenceItemProps { preferenceName: string; localizedName?: string; diff --git a/packages/preferences/src/browser/preferences.view.tsx b/packages/preferences/src/browser/preferences.view.tsx index 064b48418f..c2b4fd1bc0 100644 --- a/packages/preferences/src/browser/preferences.view.tsx +++ b/packages/preferences/src/browser/preferences.view.tsx @@ -1,6 +1,9 @@ -import React from 'react'; +import classnames from 'classnames'; +import debounce = require('lodash.debounce'); import { observer } from 'mobx-react-lite'; -import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; +import React from 'react'; + +import { Input, ComponentContextProvider, Tabs, RecycleList, IIconResourceOptions } from '@opensumi/ide-components'; import { replaceLocalizePlaceholder, useInjectable, @@ -15,15 +18,16 @@ import { URI, LabelService, } from '@opensumi/ide-core-browser'; -import { PreferenceSettingsService } from './preference-settings.service'; -import styles from './preferences.module.less'; -import classnames from 'classnames'; +import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; import { Scroll } from '@opensumi/ide-editor/lib/browser/component/scroll/scroll'; -import { Input, ComponentContextProvider, Tabs, RecycleList, IIconResourceOptions } from '@opensumi/ide-components'; + import { ISectionItemData, toNormalCase } from '../common'; + +import { PreferenceSettingsService } from './preference-settings.service'; import { NextPreferenceItem } from './preferenceItem.view'; +import styles from './preferences.module.less'; + import './index.less'; -import debounce = require('lodash.debounce'); const WorkspaceScope = { id: PreferenceScope.Workspace, diff --git a/packages/preferences/src/browser/user-preference-provider.ts b/packages/preferences/src/browser/user-preference-provider.ts index ebf5c4ccf1..058cc86d13 100644 --- a/packages/preferences/src/browser/user-preference-provider.ts +++ b/packages/preferences/src/browser/user-preference-provider.ts @@ -1,9 +1,11 @@ import { Injectable } from '@opensumi/di'; import { URI } from '@opensumi/ide-core-browser'; import { PreferenceScope } from '@opensumi/ide-core-browser/lib/preferences'; -import { AbstractResourcePreferenceProvider } from './abstract-resource-preference-provider'; + import { USER_STORAGE_SCHEME } from '../common'; +import { AbstractResourcePreferenceProvider } from './abstract-resource-preference-provider'; + export const USER_PREFERENCE_URI = new URI().withScheme(USER_STORAGE_SCHEME).withPath('settings.json'); @Injectable() diff --git a/packages/preferences/src/browser/userstorage/user-storage.contribution.ts b/packages/preferences/src/browser/userstorage/user-storage.contribution.ts index baf9c0dc4b..2ea6b8625c 100644 --- a/packages/preferences/src/browser/userstorage/user-storage.contribution.ts +++ b/packages/preferences/src/browser/userstorage/user-storage.contribution.ts @@ -2,6 +2,7 @@ import { Autowired } from '@opensumi/di'; import { Domain, ClientAppContribution } from '@opensumi/ide-core-browser'; import { IFileServiceClient } from '@opensumi/ide-file-service'; import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; + import { USER_STORAGE_SCHEME, IUserStorageService } from '../../common'; @Domain(ClientAppContribution) diff --git a/packages/preferences/src/browser/userstorage/user-storage.service.ts b/packages/preferences/src/browser/userstorage/user-storage.service.ts index 64b1454eff..2713554f10 100644 --- a/packages/preferences/src/browser/userstorage/user-storage.service.ts +++ b/packages/preferences/src/browser/userstorage/user-storage.service.ts @@ -1,5 +1,5 @@ -import { Event, FileSystemProviderCapabilities } from '@opensumi/ide-core-common'; +import { Injectable, Autowired } from '@opensumi/di'; import { DisposableCollection, ILogger, @@ -10,11 +10,12 @@ import { FileType, FileChangeEvent, } from '@opensumi/ide-core-browser'; -import { Injectable, Autowired } from '@opensumi/di'; -import { USER_STORAGE_SCHEME, IUserStorageService } from '../../common'; +import { Event, FileSystemProviderCapabilities } from '@opensumi/ide-core-common'; import { FileSetContentOptions } from '@opensumi/ide-file-service/lib/common'; import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { USER_STORAGE_SCHEME, IUserStorageService } from '../../common'; + export const DEFAULT_USER_STORAGE_FOLDER = '.sumi'; @Injectable() diff --git a/packages/preferences/src/browser/workspace-file-preference-provider.ts b/packages/preferences/src/browser/workspace-file-preference-provider.ts index e366091e7b..47e7c0ae09 100644 --- a/packages/preferences/src/browser/workspace-file-preference-provider.ts +++ b/packages/preferences/src/browser/workspace-file-preference-provider.ts @@ -2,6 +2,7 @@ import { Autowired, Injectable } from '@opensumi/di'; import { URI } from '@opensumi/ide-core-browser'; import { PreferenceScope } from '@opensumi/ide-core-browser/lib/preferences'; import { IWorkspaceService, WorkspaceData } from '@opensumi/ide-workspace'; + import { AbstractResourcePreferenceProvider } from './abstract-resource-preference-provider'; @Injectable() diff --git a/packages/preferences/src/browser/workspace-preference-provider.ts b/packages/preferences/src/browser/workspace-preference-provider.ts index 96c56911de..b275969a4a 100644 --- a/packages/preferences/src/browser/workspace-preference-provider.ts +++ b/packages/preferences/src/browser/workspace-preference-provider.ts @@ -2,6 +2,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { URI, DisposableCollection } from '@opensumi/ide-core-browser'; import { PreferenceScope, PreferenceProvider } from '@opensumi/ide-core-browser/lib/preferences'; import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { WorkspaceFilePreferenceProviderFactory } from './workspace-file-preference-provider'; @Injectable() diff --git a/packages/process/__tests__/node/index.test.ts b/packages/process/__tests__/node/index.test.ts index 93d8c08b08..14917d9c64 100644 --- a/packages/process/__tests__/node/index.test.ts +++ b/packages/process/__tests__/node/index.test.ts @@ -1,8 +1,10 @@ -import stream from 'stream'; import path from 'path'; +import stream from 'stream'; + import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { ProcessErrorEvent, IProcessStartEvent } from '../../src/common'; + import { ProcessModule, IProcessManage, IProcessFactory } from '../../src/'; +import { ProcessErrorEvent, IProcessStartEvent } from '../../src/common'; const FORK_TEST_FILE = path.join(__dirname, '../../scripts/process-fork-test.js'); diff --git a/packages/process/src/common/index.ts b/packages/process/src/common/index.ts index c48de8855a..1dfa68794e 100644 --- a/packages/process/src/common/index.ts +++ b/packages/process/src/common/index.ts @@ -1,5 +1,6 @@ import { ChildProcess } from 'child_process'; import stream from 'stream'; + import { Event } from '@opensumi/ide-core-common'; export const IProcessFactory = Symbol('IProcessFactory'); diff --git a/packages/process/src/node/index.ts b/packages/process/src/node/index.ts index 9fa82b45d2..0b5eb28dbb 100644 --- a/packages/process/src/node/index.ts +++ b/packages/process/src/node/index.ts @@ -1,9 +1,11 @@ import { Provider, Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; -import { ProcessManage } from './process-manager'; -import { ProcessFactory } from './process'; + import { IProcessManage, processManageServicePath, IProcessFactory } from '../common/'; +import { ProcessFactory } from './process'; +import { ProcessManage } from './process-manager'; + @Injectable() export class ProcessModule extends NodeModule { providers: Provider[] = [ diff --git a/packages/process/src/node/process-manager.ts b/packages/process/src/node/process-manager.ts index 694a76f6b8..576d19ad25 100644 --- a/packages/process/src/node/process-manager.ts +++ b/packages/process/src/node/process-manager.ts @@ -1,8 +1,10 @@ import { Injectable } from '@opensumi/di'; import { Disposable, getDebugLogger, Emitter, Event } from '@opensumi/ide-core-common'; -import { Process } from './process'; + import { IProcessManage } from '../common/index'; +import { Process } from './process'; + const logger = getDebugLogger(); @Injectable() diff --git a/packages/process/src/node/process.ts b/packages/process/src/node/process.ts index 7c2d947b31..a67a4d1f6d 100644 --- a/packages/process/src/node/process.ts +++ b/packages/process/src/node/process.ts @@ -1,9 +1,9 @@ -import { Injectable, Autowired } from '@opensumi/di'; import { ChildProcess, spawn, fork } from 'child_process'; import stream from 'stream'; + +import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, Emitter } from '@opensumi/ide-core-common'; -import { DevNullStream } from './dev-null-stream'; -import { ProcessManage } from './process-manager'; + import { ProcessOptions, ForkOptions, @@ -14,6 +14,9 @@ import { IProcess, } from '../common/index'; +import { DevNullStream } from './dev-null-stream'; +import { ProcessManage } from './process-manager'; + @Injectable() export class ProcessFactory { constructor() {} diff --git a/packages/quick-open/__tests__/browser/prefix-quick-open.service.test.ts b/packages/quick-open/__tests__/browser/prefix-quick-open.service.test.ts index d85debc361..f4e61450cf 100644 --- a/packages/quick-open/__tests__/browser/prefix-quick-open.service.test.ts +++ b/packages/quick-open/__tests__/browser/prefix-quick-open.service.test.ts @@ -1,16 +1,16 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; -import { ILogger, localize, Deferred } from '@opensumi/ide-core-common'; +import { quickFileOpen } from '@opensumi/ide-addons/lib/browser/file-search.contribution'; import { EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; +import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; import { QuickOpenService, QuickOpenModel, QuickOpenOptions, QuickOpenItem, } from '@opensumi/ide-core-browser/lib/quick-open'; -import { quickFileOpen } from '@opensumi/ide-addons/lib/browser/file-search.contribution'; +import { ILogger, localize, Deferred } from '@opensumi/ide-core-common'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; import { IIconService, IThemeService } from '@opensumi/ide-theme'; -import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; import { QuickOpenHandlerRegistry, PrefixQuickOpenServiceImpl } from '../../src/browser/prefix-quick-open.service'; import { QuickTitleBar } from '../../src/browser/quick-title-bar'; diff --git a/packages/quick-open/__tests__/browser/quick-open.service.test.ts b/packages/quick-open/__tests__/browser/quick-open.service.test.ts index 8c16e02c51..a214d75c57 100644 --- a/packages/quick-open/__tests__/browser/quick-open.service.test.ts +++ b/packages/quick-open/__tests__/browser/quick-open.service.test.ts @@ -1,12 +1,13 @@ +import { VALIDATE_TYPE } from '@opensumi/ide-components'; import { HideReason, IContextKeyService } from '@opensumi/ide-core-browser'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; import { MonacoContextKeyService } from '@opensumi/ide-monaco/lib/browser/monaco.context-key.service'; + import { QuickOpenModule } from '../../src/browser'; -import { QuickOpenItem, QuickOpenModel, QuickOpenService } from '../../src/common'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; import { IQuickOpenWidget } from '../../src/browser/quick-open.type'; -import { VALIDATE_TYPE } from '@opensumi/ide-components'; +import { QuickOpenItem, QuickOpenModel, QuickOpenService } from '../../src/common'; describe(__filename, () => { let injector: MockInjector; diff --git a/packages/quick-open/__tests__/browser/quick-pick.service.test.ts b/packages/quick-open/__tests__/browser/quick-pick.service.test.ts index 8952443c5b..78d1b66068 100644 --- a/packages/quick-open/__tests__/browser/quick-pick.service.test.ts +++ b/packages/quick-open/__tests__/browser/quick-pick.service.test.ts @@ -1,12 +1,14 @@ import { IContextKeyService, QuickOpenMode, QuickPickService } from '@opensumi/ide-core-browser'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; import { MonacoContextKeyService } from '@opensumi/ide-monaco/lib/browser/monaco.context-key.service'; +import { IThemeService, IIconService } from '@opensumi/ide-theme'; + import { QuickOpenModule } from '../../src/browser'; -import { QuickOpenService } from '../../src/common'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; import { IQuickOpenWidget } from '../../src/browser/quick-open.type'; -import { IThemeService, IIconService } from '@opensumi/ide-theme'; +import { QuickOpenService } from '../../src/common'; + describe(__filename, () => { let injector: MockInjector; diff --git a/packages/quick-open/src/browser/components/highlight-label/index.tsx b/packages/quick-open/src/browser/components/highlight-label/index.tsx index 06e2419899..4679779623 100644 --- a/packages/quick-open/src/browser/components/highlight-label/index.tsx +++ b/packages/quick-open/src/browser/components/highlight-label/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { escape } from '@opensumi/ide-core-common'; + import { Highlight } from '@opensumi/ide-core-browser/lib/quick-open'; +import { escape } from '@opensumi/ide-core-common'; export interface HighlightLabelProp { text?: string; diff --git a/packages/quick-open/src/browser/components/keybinding/index.tsx b/packages/quick-open/src/browser/components/keybinding/index.tsx index 810941b23e..487cbcdca7 100644 --- a/packages/quick-open/src/browser/components/keybinding/index.tsx +++ b/packages/quick-open/src/browser/components/keybinding/index.tsx @@ -1,6 +1,8 @@ +import clx from 'classnames'; import React from 'react'; + import { Keybinding, KeybindingRegistry, useInjectable } from '@opensumi/ide-core-browser'; -import clx from 'classnames'; + import styles from './styles.module.less'; export const KeybindingView: React.FC<{ diff --git a/packages/quick-open/src/browser/components/quick-open-tabs/index.tsx b/packages/quick-open/src/browser/components/quick-open-tabs/index.tsx index 2d39b4c90e..6c90617bf1 100644 --- a/packages/quick-open/src/browser/components/quick-open-tabs/index.tsx +++ b/packages/quick-open/src/browser/components/quick-open-tabs/index.tsx @@ -1,6 +1,8 @@ +import clx from 'classnames'; import React from 'react'; + import { KeybindingRegistry, useInjectable, localize, QuickOpenTab } from '@opensumi/ide-core-browser'; -import clx from 'classnames'; + import { KeybindingView } from '../keybinding'; import styles from './style.module.less'; diff --git a/packages/quick-open/src/browser/index.ts b/packages/quick-open/src/browser/index.ts index 042a8897c1..362374adc6 100644 --- a/packages/quick-open/src/browser/index.ts +++ b/packages/quick-open/src/browser/index.ts @@ -1,16 +1,16 @@ -import { BrowserModule, QuickOpenService } from '@opensumi/ide-core-browser'; import { Injectable, Provider } from '@opensumi/di'; - -import { CoreQuickOpenContribution, QuickOpenFeatureContribution } from './quick-open.contribution'; -import { PrefixQuickOpenServiceImpl, QuickOpenContribution } from './prefix-quick-open.service'; +import { BrowserModule, QuickOpenService } from '@opensumi/ide-core-browser'; import { PrefixQuickOpenService, QuickPickService, IQuickInputService, } from '@opensumi/ide-core-browser/lib/quick-open'; -import { QuickPickServiceImpl } from './quick-pick.service'; + +import { PrefixQuickOpenServiceImpl, QuickOpenContribution } from './prefix-quick-open.service'; import { QuickInputService } from './quick-input-service'; +import { CoreQuickOpenContribution, QuickOpenFeatureContribution } from './quick-open.contribution'; import { MonacoQuickOpenService } from './quick-open.service'; +import { QuickPickServiceImpl } from './quick-pick.service'; @Injectable() export class CoreQuickOpenModule extends BrowserModule { diff --git a/packages/quick-open/src/browser/prefix-quick-open.service.ts b/packages/quick-open/src/browser/prefix-quick-open.service.ts index 245d7a26fb..6400f9ea9d 100644 --- a/packages/quick-open/src/browser/prefix-quick-open.service.ts +++ b/packages/quick-open/src/browser/prefix-quick-open.service.ts @@ -17,8 +17,10 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/browser/quick-open/prefix-quick-open-service.ts import React from 'react'; + +import { Injectable, Autowired } from '@opensumi/di'; import { localize, QuickOpenActionProvider } from '@opensumi/ide-core-browser'; -import { DisposableCollection, IDisposable, Disposable, ILogger } from '@opensumi/ide-core-common'; +import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; import { IQuickOpenHandlerRegistry, QuickOpenHandler, @@ -29,10 +31,10 @@ import { QuickOpenItem, PrefixQuickOpenService, } from '@opensumi/ide-core-browser/lib/quick-open'; -import { Injectable, Autowired } from '@opensumi/di'; -import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; -import { QuickTitleBar } from './quick-title-bar'; +import { DisposableCollection, IDisposable, Disposable, ILogger } from '@opensumi/ide-core-common'; + import { QuickOpenTabs } from './components/quick-open-tabs'; +import { QuickTitleBar } from './quick-title-bar'; /** * @deprecated import from `@opensumi/ide-core-browser/lib/quick-open` instead */ diff --git a/packages/quick-open/src/browser/quick-input-service.ts b/packages/quick-open/src/browser/quick-input-service.ts index b2680b888c..0e2f823e1f 100644 --- a/packages/quick-open/src/browser/quick-input-service.ts +++ b/packages/quick-open/src/browser/quick-input-service.ts @@ -1,4 +1,5 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; import { QuickInputOptions, IQuickInputService, @@ -6,9 +7,9 @@ import { QuickOpenService, Mode, } from '@opensumi/ide-core-browser/lib/quick-open'; -import { QuickTitleBar } from './quick-title-bar'; import { Deferred, localize, Emitter, Event } from '@opensumi/ide-core-common'; -import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; + +import { QuickTitleBar } from './quick-title-bar'; @Injectable() export class QuickInputService implements IQuickInputService { diff --git a/packages/quick-open/src/browser/quick-open.command.service.ts b/packages/quick-open/src/browser/quick-open.command.service.ts index c31a17ca24..1475f891e6 100644 --- a/packages/quick-open/src/browser/quick-open.command.service.ts +++ b/packages/quick-open/src/browser/quick-open.command.service.ts @@ -1,5 +1,9 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { localize, IContextKeyService, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; +import { KeybindingRegistry, Keybinding } from '@opensumi/ide-core-browser'; +import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; +import { AbstractMenuService, MenuId, MenuItemNode } from '@opensumi/ide-core-browser/lib/menu/next'; +import { QuickOpenModel, QuickOpenItem, QuickOpenItemOptions, Mode } from '@opensumi/ide-core-browser/lib/quick-open'; import { CommandRegistry, Command, @@ -8,12 +12,9 @@ import { IReporterService, REPORT_NAME, } from '@opensumi/ide-core-common'; -import { QuickOpenModel, QuickOpenItem, QuickOpenItemOptions, Mode } from '@opensumi/ide-core-browser/lib/quick-open'; -import { KeybindingRegistry, Keybinding } from '@opensumi/ide-core-browser'; -import { QuickOpenHandler } from './prefix-quick-open.service'; import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; -import { AbstractMenuService, MenuId, MenuItemNode } from '@opensumi/ide-core-browser/lib/menu/next'; + +import { QuickOpenHandler } from './prefix-quick-open.service'; @Injectable() export class QuickCommandHandler implements QuickOpenHandler { diff --git a/packages/quick-open/src/browser/quick-open.contribution.ts b/packages/quick-open/src/browser/quick-open.contribution.ts index 02361805fb..ef4a59f010 100644 --- a/packages/quick-open/src/browser/quick-open.contribution.ts +++ b/packages/quick-open/src/browser/quick-open.contribution.ts @@ -11,10 +11,12 @@ import { import { ClientAppContribution } from '@opensumi/ide-core-browser'; import { MenuId, MenuContribution, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; import { PrefixQuickOpenService } from '@opensumi/ide-core-browser/lib/quick-open'; + +import { QUICK_OPEN_COMMANDS } from '../common'; + import { QuickOpenContribution, QuickOpenHandlerRegistry } from './prefix-quick-open.service'; import { QuickCommandHandler } from './quick-open.command.service'; import { HelpQuickOpenHandler } from './quick-open.help.service'; -import { QUICK_OPEN_COMMANDS } from '../common'; // 连接 monaco 内部的 quick-open // 作为 contribution provider 的职责 diff --git a/packages/quick-open/src/browser/quick-open.help.service.ts b/packages/quick-open/src/browser/quick-open.help.service.ts index bf836b7f9c..67a68f59bd 100644 --- a/packages/quick-open/src/browser/quick-open.help.service.ts +++ b/packages/quick-open/src/browser/quick-open.help.service.ts @@ -1,7 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { QuickOpenHandler, QuickOpenHandlerRegistry } from './prefix-quick-open.service'; -import { QuickOpenItem, PrefixQuickOpenService, QuickOpenModel, Mode } from '@opensumi/ide-core-browser/lib/quick-open'; import { CommandService, EDITOR_COMMANDS } from '@opensumi/ide-core-browser'; +import { QuickOpenItem, PrefixQuickOpenService, QuickOpenModel, Mode } from '@opensumi/ide-core-browser/lib/quick-open'; + +import { QuickOpenHandler, QuickOpenHandlerRegistry } from './prefix-quick-open.service'; + @Injectable() export class HelpQuickOpenHandler implements QuickOpenHandler { diff --git a/packages/quick-open/src/browser/quick-open.service.tsx b/packages/quick-open/src/browser/quick-open.service.tsx index 34ef0cd55e..18709d97ad 100644 --- a/packages/quick-open/src/browser/quick-open.service.tsx +++ b/packages/quick-open/src/browser/quick-open.service.tsx @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { matchesFuzzy } from '@opensumi/monaco-editor-core/esm/vs/base/common/filters'; + import { Autowired, Injectable, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { AppConfig, @@ -12,6 +12,7 @@ import { QuickOpenActionProvider, QuickOpenTabOptions, } from '@opensumi/ide-core-browser'; +import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; import { HideReason, Highlight, @@ -21,10 +22,11 @@ import { QuickOpenService, } from '@opensumi/ide-core-browser/lib/quick-open'; import { MonacoContextKeyService } from '@opensumi/ide-monaco/lib/browser/monaco.context-key.service'; -import { QuickOpenWidget } from './quick-open.widget'; +import { matchesFuzzy } from '@opensumi/monaco-editor-core/esm/vs/base/common/filters'; + import { IAutoFocus, IQuickOpenModel, QuickOpenContext } from './quick-open.type'; -import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; import { QuickOpenView } from './quick-open.view'; +import { QuickOpenWidget } from './quick-open.widget'; export interface IKaitianQuickOpenControllerOpts extends QuickOpenTabOptions { inputAriaLabel: string; diff --git a/packages/quick-open/src/browser/quick-open.type.ts b/packages/quick-open/src/browser/quick-open.type.ts index a19ecacfd0..50c40c32ae 100644 --- a/packages/quick-open/src/browser/quick-open.type.ts +++ b/packages/quick-open/src/browser/quick-open.type.ts @@ -1,4 +1,5 @@ import React from 'react'; + import { QuickOpenItem, HideReason, QuickOpenActionProvider, QuickOpenTabOptions } from '@opensumi/ide-core-browser'; import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; diff --git a/packages/quick-open/src/browser/quick-open.view.tsx b/packages/quick-open/src/browser/quick-open.view.tsx index a6afe240ee..fcc1289953 100644 --- a/packages/quick-open/src/browser/quick-open.view.tsx +++ b/packages/quick-open/src/browser/quick-open.view.tsx @@ -1,6 +1,7 @@ -import { KeyCode as KeyCodeEnum } from '@opensumi/monaco-editor-core/esm/vs/base/common/keyCodes'; -import React from 'react'; +import clx from 'classnames'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { Button, CheckBox, @@ -9,6 +10,7 @@ import { ValidateInput, VALIDATE_TYPE, } from '@opensumi/ide-components'; +import { Key, KeyCode, useInjectable, localize } from '@opensumi/ide-core-browser'; import { HideReason, QuickOpenAction, @@ -17,14 +19,13 @@ import { QuickTitleButton, } from '@opensumi/ide-core-browser/lib/quick-open'; import { KEY_CODE_MAP } from '@opensumi/ide-monaco/lib/browser/monaco.keycode-map'; -import clx from 'classnames'; -import styles from './styles.module.less'; +import { KeyCode as KeyCodeEnum } from '@opensumi/monaco-editor-core/esm/vs/base/common/keyCodes'; import { HighlightLabel } from './components/highlight-label'; import { KeybindingView } from './components/keybinding'; import { QuickOpenContext } from './quick-open.type'; -import { Key, KeyCode, useInjectable, localize } from '@opensumi/ide-core-browser'; import { QuickTitleBar } from './quick-title-bar'; +import styles from './styles.module.less'; interface IQuickOpenItemProps { data: QuickOpenItem; diff --git a/packages/quick-open/src/browser/quick-open.widget.tsx b/packages/quick-open/src/browser/quick-open.widget.tsx index d54d47417a..62b96cf3e7 100644 --- a/packages/quick-open/src/browser/quick-open.widget.tsx +++ b/packages/quick-open/src/browser/quick-open.widget.tsx @@ -1,5 +1,9 @@ import { observable, computed, action } from 'mobx'; + import { Injectable } from '@opensumi/di'; +import { QuickOpenItem, HideReason, QuickOpenActionProvider } from '@opensumi/ide-core-browser'; +import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; + import { IAutoFocus, IQuickOpenCallbacks, @@ -7,8 +11,6 @@ import { IQuickOpenWidget, QuickOpenInputOptions, } from './quick-open.type'; -import { QuickOpenItem, HideReason, QuickOpenActionProvider } from '@opensumi/ide-core-browser'; -import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; @Injectable({ multiple: true }) export class QuickOpenWidget implements IQuickOpenWidget { diff --git a/packages/quick-open/src/browser/quick-pick.service.ts b/packages/quick-open/src/browser/quick-pick.service.ts index f8574d64c5..9dc05e2130 100644 --- a/packages/quick-open/src/browser/quick-pick.service.ts +++ b/packages/quick-open/src/browser/quick-pick.service.ts @@ -1,4 +1,5 @@ import { Injectable, Autowired } from '@opensumi/di'; +import { getIcon, getIconClass, getExternalIcon } from '@opensumi/ide-core-browser'; import { QuickOpenService, QuickOpenItem, @@ -9,10 +10,11 @@ import { HideReason, Mode, } from '@opensumi/ide-core-browser/lib/quick-open'; -import { getIcon, getIconClass, getExternalIcon } from '@opensumi/ide-core-browser'; -import { QuickTitleBar } from './quick-title-bar'; import { Emitter, Event } from '@opensumi/ide-core-common'; +import { QuickTitleBar } from './quick-title-bar'; + + @Injectable() export class QuickPickServiceImpl implements QuickPickService { @Autowired(QuickTitleBar) diff --git a/packages/quick-open/src/browser/quick-title-bar.ts b/packages/quick-open/src/browser/quick-title-bar.ts index 3a8a97171f..5fea5071a5 100644 --- a/packages/quick-open/src/browser/quick-title-bar.ts +++ b/packages/quick-open/src/browser/quick-title-bar.ts @@ -1,9 +1,9 @@ -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; import { observable, computed, action } from 'mobx'; -import { Emitter, Event, isUndefined, URI } from '@opensumi/ide-core-common'; -import { Injectable, Autowired } from '@opensumi/di'; +import { Injectable, Autowired } from '@opensumi/di'; import { QuickTitleButton, QuickTitleButtonSide } from '@opensumi/ide-core-browser/lib/quick-open'; +import { Emitter, Event, isUndefined, URI } from '@opensumi/ide-core-common'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; import './quick-title-bar.less'; import { IconType, IIconService, IThemeService } from '@opensumi/ide-theme'; diff --git a/packages/quick-open/src/common/mocks/quick-open.service.ts b/packages/quick-open/src/common/mocks/quick-open.service.ts index 184139a7fe..3d91703542 100644 --- a/packages/quick-open/src/common/mocks/quick-open.service.ts +++ b/packages/quick-open/src/common/mocks/quick-open.service.ts @@ -1,7 +1,8 @@ -import { QuickOpenOptions, QuickOpenService, QuickOpenModel } from '../'; -import { HideReason } from '@opensumi/ide-core-browser/lib/quick-open'; import { Injectable } from '@opensumi/di'; import { VALIDATE_TYPE } from '@opensumi/ide-core-browser/lib/components'; +import { HideReason } from '@opensumi/ide-core-browser/lib/quick-open'; + +import { QuickOpenOptions, QuickOpenService, QuickOpenModel } from '../'; @Injectable() export class MockQuickOpenService implements QuickOpenService { diff --git a/packages/remote-cli/src/index.ts b/packages/remote-cli/src/index.ts index 91f820ff35..d800e68d65 100644 --- a/packages/remote-cli/src/index.ts +++ b/packages/remote-cli/src/index.ts @@ -1,8 +1,9 @@ -import { join } from 'path'; -import got from 'got'; import { statSync, existsSync } from 'fs'; -import { Command } from 'commander'; +import { join } from 'path'; + import { green, yellow, red } from 'chalk'; +import { Command } from 'commander'; +import got from 'got'; const CLI_NAME = process.env.CLI_NAME || 'sumi'; const PRODUCTION_NAME = process.env.PRODUCTION_NAME || 'OpenSumi'; diff --git a/packages/remote-cli/webpack.config.js b/packages/remote-cli/webpack.config.js index b9aaab2b00..24dd41a7f4 100644 --- a/packages/remote-cli/webpack.config.js +++ b/packages/remote-cli/webpack.config.js @@ -1,6 +1,7 @@ -const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const path = require('path'); +const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); + const tsConfigPath = path.join(__dirname, './tsconfig.json'); const srcDir = path.join(__dirname, './src'); const distDir = path.join(__dirname, './dist'); diff --git a/packages/remote-opener/__tests__/browser/remote-opener-converter.test.ts b/packages/remote-opener/__tests__/browser/remote-opener-converter.test.ts index 2daeef4bcf..efc5811f64 100644 --- a/packages/remote-opener/__tests__/browser/remote-opener-converter.test.ts +++ b/packages/remote-opener/__tests__/browser/remote-opener-converter.test.ts @@ -1,7 +1,8 @@ -import { IRemoteHostConverter } from '../../src/common'; import { Disposable } from '@opensumi/ide-core-common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { RemoteOpenerBrowserServiceImpl } from '../../../remote-opener/lib/browser'; +import { IRemoteHostConverter } from '../../src/common'; import { IRemoteOpenerBrowserService, RemoteOpenerBrowserServiceToken } from '../../src/common'; describe('packages/core-browser/src/remote-opener/converter.contribution.ts', () => { diff --git a/packages/remote-opener/__tests__/browser/remote.opener.service.test.ts b/packages/remote-opener/__tests__/browser/remote.opener.service.test.ts index 02a3db1d05..15b7d2665c 100644 --- a/packages/remote-opener/__tests__/browser/remote.opener.service.test.ts +++ b/packages/remote-opener/__tests__/browser/remote.opener.service.test.ts @@ -1,10 +1,11 @@ import { IOpenerService } from '@opensumi/ide-core-browser/lib/opener'; -import { IRemoteHostConverter, IRemoteOpenerBrowserService, RemoteOpenerBrowserServiceToken } from '../../src/common'; import { Disposable } from '@opensumi/ide-core-common'; import { URI, Uri } from '@opensumi/ide-core-common/lib/uri'; import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/common/editor'; import { RemoteOpenerBrowserServiceImpl } from '@opensumi/ide-remote-opener/lib/browser'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { IRemoteHostConverter, IRemoteOpenerBrowserService, RemoteOpenerBrowserServiceToken } from '../../src/common'; describe('packages/remote-opener/src/browser/remote.opener.service.ts', () => { let remoteOpenerService: IRemoteOpenerBrowserService; diff --git a/packages/remote-opener/__tests__/node/opener.client.test.ts b/packages/remote-opener/__tests__/node/opener.client.test.ts index 24ff1f4c6e..46ae91fbeb 100644 --- a/packages/remote-opener/__tests__/node/opener.client.test.ts +++ b/packages/remote-opener/__tests__/node/opener.client.test.ts @@ -1,4 +1,3 @@ -import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { IRemoteOpenerClient, IRemoteOpenerService, @@ -6,6 +5,8 @@ import { } from '@opensumi/ide-remote-opener/lib/common'; import { RemoteOpenerClientImpl } from '@opensumi/ide-remote-opener/lib/node/opener.client'; +import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; + describe('packages/remote-opener/src/node/opener.client.ts', () => { let remoteOpenerClient: IRemoteOpenerClient; diff --git a/packages/remote-opener/__tests__/node/opener.service.test.ts b/packages/remote-opener/__tests__/node/opener.service.test.ts index af7e086db6..17df5771c5 100644 --- a/packages/remote-opener/__tests__/node/opener.service.test.ts +++ b/packages/remote-opener/__tests__/node/opener.service.test.ts @@ -1,11 +1,11 @@ -import { RemoteOpenerServiceImpl } from '@opensumi/ide-remote-opener/lib/node/opener.service'; -import { RemoteOpenerClientImpl } from '@opensumi/ide-remote-opener/lib/node/opener.client'; import { IRemoteOpenerClient, IRemoteOpenerService, RemoteOpenerClientToken, RemoteOpenerServiceToken, } from '@opensumi/ide-remote-opener/lib/common'; +import { RemoteOpenerClientImpl } from '@opensumi/ide-remote-opener/lib/node/opener.client'; +import { RemoteOpenerServiceImpl } from '@opensumi/ide-remote-opener/lib/node/opener.service'; import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper'; diff --git a/packages/remote-opener/src/browser/index.ts b/packages/remote-opener/src/browser/index.ts index 7f6c22ece1..b552ed44ca 100644 --- a/packages/remote-opener/src/browser/index.ts +++ b/packages/remote-opener/src/browser/index.ts @@ -1,6 +1,8 @@ import { Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { RemoteOpenerConverterContribution, RemoteOpenerServicePath, RemoteOpenerBrowserServiceToken } from '../common'; + import { RemoteOpenerContributionClient } from './remote.opener.contribution'; import { RemoteOpenerBrowserServiceImpl } from './remote.opener.service'; diff --git a/packages/remote-opener/src/browser/remote.opener.contribution.ts b/packages/remote-opener/src/browser/remote.opener.contribution.ts index f2720563e7..3f9901cc41 100644 --- a/packages/remote-opener/src/browser/remote.opener.contribution.ts +++ b/packages/remote-opener/src/browser/remote.opener.contribution.ts @@ -1,4 +1,6 @@ import { Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; +import { AppConfig, ClientAppContribution, electronEnv } from '@opensumi/ide-core-browser'; import { ContributionProvider, Domain, getDebugLogger } from '@opensumi/ide-core-common'; import { IRemoteOpenerService, RemoteOpenerServicePath } from '../common'; @@ -8,8 +10,6 @@ import { RemoteOpenerConverterContribution, } from '../common'; -import { AppConfig, ClientAppContribution, electronEnv } from '@opensumi/ide-core-browser'; -import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser'; // 从extension.contribution.ts中Copy过来,因为直接引入会有一定概率触发IDE初始化问题 const getClientId = (injector: Injector) => { let clientId: string; diff --git a/packages/remote-opener/src/browser/remote.opener.service.ts b/packages/remote-opener/src/browser/remote.opener.service.ts index 3b49f69828..9f1c319d50 100644 --- a/packages/remote-opener/src/browser/remote.opener.service.ts +++ b/packages/remote-opener/src/browser/remote.opener.service.ts @@ -1,10 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { CommandService, Disposable, IDisposable, Uri, URI } from '@opensumi/ide-core-common'; import { RPCService } from '@opensumi/ide-connection/lib/common/proxy'; - -import { PreferenceService } from '@opensumi/ide-core-browser/lib/preferences'; import { IOpenerService } from '@opensumi/ide-core-browser/lib/opener'; +import { PreferenceService } from '@opensumi/ide-core-browser/lib/preferences'; +import { CommandService, Disposable, IDisposable, Uri, URI } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; + import { IRemoteHostConverter, IRemoteOpenerBrowserService } from '../common'; // 不预置SUPPORT_HOSTS,改为用户注册,默认走openerService来处理这部分逻辑 diff --git a/packages/remote-opener/src/node/index.ts b/packages/remote-opener/src/node/index.ts index 00a221dfdd..2a25885028 100644 --- a/packages/remote-opener/src/node/index.ts +++ b/packages/remote-opener/src/node/index.ts @@ -2,6 +2,7 @@ import { Injectable } from '@opensumi/di'; import { BackService, NodeModule } from '@opensumi/ide-core-node'; import { RemoteOpenerClientToken, RemoteOpenerServicePath, RemoteOpenerServiceToken } from '../common'; + import { RemoteOpenerClientImpl } from './opener.client'; import { RemoteOpenerServiceImpl } from './opener.service'; diff --git a/packages/remote-opener/src/node/opener.service.ts b/packages/remote-opener/src/node/opener.service.ts index 4cc8e2eae9..aeac3463bb 100644 --- a/packages/remote-opener/src/node/opener.service.ts +++ b/packages/remote-opener/src/node/opener.service.ts @@ -1,6 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { Uri } from '@opensumi/ide-core-common/lib/uri'; import { RPCService } from '@opensumi/ide-connection'; +import { Uri } from '@opensumi/ide-core-common/lib/uri'; import { IExternalFileArgs, diff --git a/packages/scm/__tests__/browser/dirty-diff/dirty-diff-decorator.test.ts b/packages/scm/__tests__/browser/dirty-diff/dirty-diff-decorator.test.ts index b66cde90f4..0ff7bfd5a6 100644 --- a/packages/scm/__tests__/browser/dirty-diff/dirty-diff-decorator.test.ts +++ b/packages/scm/__tests__/browser/dirty-diff/dirty-diff-decorator.test.ts @@ -1,17 +1,16 @@ import { Injectable } from '@opensumi/di'; import { URI } from '@opensumi/ide-core-common'; import { OverviewRulerLane, IDocPersistentCacheProvider } from '@opensumi/ide-editor'; -import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; -import { IEditorDocumentModel } from '@opensumi/ide-editor/src/browser/'; import { EmptyDocCacheImpl } from '@opensumi/ide-editor/src/browser'; +import { IEditorDocumentModel } from '@opensumi/ide-editor/src/browser/'; +import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; +import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; - -import { SCMPreferences } from '../../../src/browser/scm-preference'; import { DirtyDiffDecorator } from '../../../src/browser/dirty-diff/dirty-diff-decorator'; import { DirtyDiffModel } from '../../../src/browser/dirty-diff/dirty-diff-model'; -import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { SCMPreferences } from '../../../src/browser/scm-preference'; const fakeScmDiffDecorationsGetter = jest.fn(); diff --git a/packages/scm/__tests__/browser/dirty-diff/dirty-diff-model.test.ts b/packages/scm/__tests__/browser/dirty-diff/dirty-diff-model.test.ts index a9ad04c1f7..59dc9578a8 100644 --- a/packages/scm/__tests__/browser/dirty-diff/dirty-diff-model.test.ts +++ b/packages/scm/__tests__/browser/dirty-diff/dirty-diff-model.test.ts @@ -1,23 +1,21 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; -import type { IDiffComputationResult } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/editorWorkerService'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { toDisposable, Event, CommandService, positionToRange, URI } from '@opensumi/ide-core-common'; import { IDocPersistentCacheProvider } from '@opensumi/ide-editor'; -import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; -import { EmptyDocCacheImpl, IEditorDocumentModel, IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; -import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; import { EditorCollectionService } from '@opensumi/ide-editor'; +import { EmptyDocCacheImpl, IEditorDocumentModel, IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; +import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; +import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import type { IDiffComputationResult } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/editorWorkerService'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; - -import { MockSCMProvider } from '../../scm-test-util'; - +import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; +import { SCMService, ISCMRepository } from '../../../src'; import { DirtyDiffModel } from '../../../src/browser/dirty-diff/dirty-diff-model'; import { DirtyDiffWidget } from '../../../src/browser/dirty-diff/dirty-diff-widget'; -import { SCMService, ISCMRepository } from '../../../src'; +import { MockSCMProvider } from '../../scm-test-util'; @Injectable() class MockEditorDocumentModelService { diff --git a/packages/scm/__tests__/browser/dirty-diff/dirty-diff-widget.test.ts b/packages/scm/__tests__/browser/dirty-diff/dirty-diff-widget.test.ts index 7dfc149658..495f623fad 100644 --- a/packages/scm/__tests__/browser/dirty-diff/dirty-diff-widget.test.ts +++ b/packages/scm/__tests__/browser/dirty-diff/dirty-diff-widget.test.ts @@ -1,16 +1,15 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { positionToRange, URI, CommandService } from '@opensumi/ide-core-common'; import { IDocPersistentCacheProvider } from '@opensumi/ide-editor'; -import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; -import { IEditorDocumentModel } from '@opensumi/ide-editor/src/browser/'; import { EmptyDocCacheImpl, IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; -import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; +import { IEditorDocumentModel } from '@opensumi/ide-editor/src/browser/'; +import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; - -import { DirtyDiffModel } from '../../../src/browser/dirty-diff/dirty-diff-model'; +import { createMockedMonaco } from '../../../../monaco/__mocks__/monaco'; import { SCMService } from '../../../src'; +import { DirtyDiffModel } from '../../../src/browser/dirty-diff/dirty-diff-model'; import { DirtyDiffWidget } from '../../../src/browser/dirty-diff/dirty-diff-widget'; @Injectable() diff --git a/packages/scm/__tests__/browser/dirty-diff/index.test.ts b/packages/scm/__tests__/browser/dirty-diff/index.test.ts index 95fdebac8a..566b2da3f5 100644 --- a/packages/scm/__tests__/browser/dirty-diff/index.test.ts +++ b/packages/scm/__tests__/browser/dirty-diff/index.test.ts @@ -1,7 +1,5 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { monaco as monacoAPI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; import { Autowired, Injectable, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { PreferenceChange } from '@opensumi/ide-core-browser'; import { DisposableCollection, PreferenceScope, @@ -12,24 +10,25 @@ import { toDisposable, } from '@opensumi/ide-core-common'; import { WorkbenchEditorService, IDocPersistentCacheProvider } from '@opensumi/ide-editor'; -import { PreferenceChange } from '@opensumi/ide-core-browser'; import { IEditorFeatureRegistry, IEditorFeatureContribution, EmptyDocCacheImpl, IEditorDocumentModelService, } from '@opensumi/ide-editor/src/browser'; -import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/src/browser/workbench-editor.service'; -import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; import { IEditorDocumentModel } from '@opensumi/ide-editor/src/browser/'; +import { EditorDocumentModel } from '@opensumi/ide-editor/src/browser/doc-model/main'; +import { WorkbenchEditorServiceImpl } from '@opensumi/ide-editor/src/browser/workbench-editor.service'; +import { monaco as monacoAPI } from '@opensumi/ide-monaco/lib/browser/monaco-api'; +import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../../tools/dev-tool/src/mock-injector'; - import { IDirtyDiffWorkbenchController } from '../../../src'; import { DirtyDiffWorkbenchController, DirtyDiffItem } from '../../../src/browser/dirty-diff'; -import { DirtyDiffModel } from '../../../src/browser/dirty-diff/dirty-diff-model'; import { DirtyDiffDecorator } from '../../../src/browser/dirty-diff/dirty-diff-decorator'; +import { DirtyDiffModel } from '../../../src/browser/dirty-diff/dirty-diff-model'; import { DirtyDiffWidget } from '../../../src/browser/dirty-diff/dirty-diff-widget'; import { SCMPreferences } from '../../../src/browser/scm-preference'; diff --git a/packages/scm/__tests__/browser/scm-activity.test.ts b/packages/scm/__tests__/browser/scm-activity.test.ts index ebf3928ea7..34a6ede366 100644 --- a/packages/scm/__tests__/browser/scm-activity.test.ts +++ b/packages/scm/__tests__/browser/scm-activity.test.ts @@ -1,17 +1,15 @@ import { Injectable, Injector } from '@opensumi/di'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { StatusBarAlignment, IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; import { MaybeNull, Uri, URI, Event, Emitter } from '@opensumi/ide-core-common'; import { WorkbenchEditorService, IResource } from '@opensumi/ide-editor'; -import { StatusBarAlignment, IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { MockSCMProvider, MockSCMResourceGroup, MockSCMResource } from '../scm-test-util'; - import { SCMService } from '../../src'; -import { SCMBadgeController, SCMStatusBarController } from '../../src/browser/scm-activity'; import { SCMModule } from '../../src/browser'; +import { SCMBadgeController, SCMStatusBarController } from '../../src/browser/scm-activity'; +import { MockSCMProvider, MockSCMResourceGroup, MockSCMResource } from '../scm-test-util'; jest.useFakeTimers(); diff --git a/packages/scm/__tests__/browser/scm-menu.test.ts b/packages/scm/__tests__/browser/scm-menu.test.ts index f06d84dbf6..870106eaff 100644 --- a/packages/scm/__tests__/browser/scm-menu.test.ts +++ b/packages/scm/__tests__/browser/scm-menu.test.ts @@ -1,15 +1,13 @@ -import { DisposableStore } from '@opensumi/ide-core-common'; import { IContextKeyService } from '@opensumi/ide-core-browser'; import { IMenuRegistry, MenuRegistryImpl, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; +import { DisposableStore } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { MockSCMProvider, MockSCMResourceGroup, MockSCMResource } from '../scm-test-util'; - +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; import { SCMModule } from '../../src/browser'; import { ISCMMenus } from '../../src/common'; +import { MockSCMProvider, MockSCMResourceGroup, MockSCMResource } from '../scm-test-util'; describe('test for scm-menu.ts', () => { let injector: MockInjector; diff --git a/packages/scm/__tests__/browser/scm-model.test.ts b/packages/scm/__tests__/browser/scm-model.test.ts index 9a050400cc..b59715a189 100644 --- a/packages/scm/__tests__/browser/scm-model.test.ts +++ b/packages/scm/__tests__/browser/scm-model.test.ts @@ -1,16 +1,15 @@ import { IContextKeyService, URI } from '@opensumi/ide-core-browser'; import { IMenuRegistry, MenuId, MenuRegistryImpl } from '@opensumi/ide-core-browser/lib/menu/next'; import { DisposableCollection, Event } from '@opensumi/ide-core-common'; -import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; - -import { MockSCMProvider, MockSCMResource, MockSCMResourceGroup } from '../scm-test-util'; - +import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service'; import { ISCMProvider, ISCMRepository, ISCMResource, ISCMResourceGroup, SCMService } from '../../src'; import { SCMModule } from '../../src/browser'; import { ResourceGroupSplicer, ViewModelContext } from '../../src/browser/scm-model'; +import { MockSCMProvider, MockSCMResource, MockSCMResourceGroup } from '../scm-test-util'; describe('test for scm.store.ts', () => { const toTearDown = new DisposableCollection(); diff --git a/packages/scm/__tests__/browser/scm-util.test.ts b/packages/scm/__tests__/browser/scm-util.test.ts index 914a9fba06..4af527a9cf 100644 --- a/packages/scm/__tests__/browser/scm-util.test.ts +++ b/packages/scm/__tests__/browser/scm-util.test.ts @@ -1,7 +1,7 @@ import { SCMService } from '../../src'; +import { isSCMResource, getSCMResourceGroupContextValue, getSCMRepositoryDesc } from '../../src/browser/scm-util'; import { MockSCMProvider, MockSCMResourceGroup, MockSCMResource } from '../scm-test-util'; -import { isSCMResource, getSCMResourceGroupContextValue, getSCMRepositoryDesc } from '../../src/browser/scm-util'; describe('test for scm-util', () => { const mockSCMProvider = new MockSCMProvider(0); diff --git a/packages/scm/__tests__/common/scm.service.test.ts b/packages/scm/__tests__/common/scm.service.test.ts index 38a536a516..1adaa97932 100644 --- a/packages/scm/__tests__/common/scm.service.test.ts +++ b/packages/scm/__tests__/common/scm.service.test.ts @@ -1,8 +1,8 @@ import { DisposableCollection } from '@opensumi/ide-core-common'; +import { SCMService, InputValidationType } from '../../src/common'; import { MockSCMProvider } from '../scm-test-util'; -import { SCMService, InputValidationType } from '../../src/common'; describe('scm service', () => { let scmService: SCMService; diff --git a/packages/scm/__tests__/scm-test-util.ts b/packages/scm/__tests__/scm-test-util.ts index a88f1bf8e8..9ea9800034 100644 --- a/packages/scm/__tests__/scm-test-util.ts +++ b/packages/scm/__tests__/scm-test-util.ts @@ -1,5 +1,5 @@ -import { Sequence, ISplice } from '@opensumi/ide-core-common/lib/sequence'; import { URI, Uri, Event, Emitter } from '@opensumi/ide-core-common'; +import { Sequence, ISplice } from '@opensumi/ide-core-common/lib/sequence'; import { ISCMProvider, ISCMResourceGroup, ISCMResource, VSCommand } from '../src/common'; diff --git a/packages/scm/src/browser/components/scm-provider-list.tsx b/packages/scm/src/browser/components/scm-provider-list.tsx index e6ac880b45..31b2b8a8bb 100644 --- a/packages/scm/src/browser/components/scm-provider-list.tsx +++ b/packages/scm/src/browser/components/scm-provider-list.tsx @@ -1,11 +1,12 @@ +import clx from 'classnames'; import React from 'react'; + +import { Badge } from '@opensumi/ide-components'; import { useInjectable } from '@opensumi/ide-core-browser'; import { ViewState } from '@opensumi/ide-core-browser'; +import { ICtxMenuRenderer, MenuId, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { IStatusBarService } from '@opensumi/ide-status-bar'; -import clx from 'classnames'; -import { Badge } from '@opensumi/ide-components'; import { StatusBarItem } from '@opensumi/ide-status-bar/lib/browser/status-bar-item.view'; -import { ICtxMenuRenderer, MenuId, AbstractContextMenuService } from '@opensumi/ide-core-browser/lib/menu/next'; import { ISCMRepository } from '../../common'; import { getSCMRepositoryDesc } from '../scm-util'; diff --git a/packages/scm/src/browser/components/scm-resource-input.tsx b/packages/scm/src/browser/components/scm-resource-input.tsx index eb74087a2d..ead83f84d9 100644 --- a/packages/scm/src/browser/components/scm-resource-input.tsx +++ b/packages/scm/src/browser/components/scm-resource-input.tsx @@ -1,9 +1,10 @@ import React from 'react'; + import { useInjectable } from '@opensumi/ide-core-browser'; +import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { useHotKey } from '@opensumi/ide-core-browser/lib/react-hooks/hot-key'; import { isOSX, CommandService, DisposableStore } from '@opensumi/ide-core-common'; import { format } from '@opensumi/ide-core-common/lib/utils/strings'; -import { useHotKey } from '@opensumi/ide-core-browser/lib/react-hooks/hot-key'; -import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; import { AutoFocusedInput } from '@opensumi/ide-main-layout/lib/browser/input'; import { ISCMRepository, InputValidationType, ISCMProvider, scmContainerId } from '../../common'; diff --git a/packages/scm/src/browser/components/scm-resource-tree/index.tsx b/packages/scm/src/browser/components/scm-resource-tree/index.tsx index 7b1652972e..907f8caa88 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/index.tsx +++ b/packages/scm/src/browser/components/scm-resource-tree/index.tsx @@ -1,18 +1,19 @@ -import React from 'react'; import clx from 'classnames'; -import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { RecycleTree, IRecycleTreeHandle, TreeNodeType, TreeModel } from '@opensumi/ide-components'; +import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; import { isOSX } from '@opensumi/ide-core-common'; -import { SCMResourceFolder, SCMResourceFile, SCMResourceGroup, SCMResourceNotRoot } from './scm-tree-node'; +import { ViewModelContext } from '../../scm-model'; + +import styles from './index.module.less'; import { SCMTreeModelService } from './scm-tree-model.service'; +import { SCMResourceFolder, SCMResourceFile, SCMResourceGroup, SCMResourceNotRoot } from './scm-tree-node'; import { ISCMTreeNodeProps, SCMTreeNode, SCM_TREE_NODE_HEIGHT } from './scm-tree-node.view'; import { SCMTreeService } from './scm-tree.service'; -import { ViewModelContext } from '../../scm-model'; - -import styles from './index.module.less'; export const TREE_FIELD_NAME = 'SCM_TREE_TREE_FIELD'; diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-api.ts b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-api.ts index 76215ba124..9791bb6baa 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-api.ts +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-api.ts @@ -3,8 +3,8 @@ import { PreferenceService } from '@opensumi/ide-core-browser'; import { Disposable } from '@opensumi/ide-core-common'; import * as paths from '@opensumi/ide-core-common/lib/path'; -import { ViewModelContext } from '../../scm-model'; import { ISCMResource, ISCMResourceGroup, SCMViewModelMode } from '../../../common'; +import { ViewModelContext } from '../../scm-model'; import { isSCMResourceGroup } from '../../scm-util'; export interface ISCMTreeNodeDescription { diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-decoration.service.ts b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-decoration.service.ts index ba288395f0..c019aa6ca5 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-decoration.service.ts +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-decoration.service.ts @@ -1,5 +1,4 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IDecorationsService } from '@opensumi/ide-decoration'; import { URI, Uri, @@ -8,6 +7,7 @@ import { Emitter, DisposableCollection, } from '@opensumi/ide-core-browser'; +import { IDecorationsService } from '@opensumi/ide-decoration'; import { IThemeService } from '@opensumi/ide-theme'; @Injectable() diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.service.ts b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.service.ts index 493be98123..5380315c39 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.service.ts +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.service.ts @@ -1,3 +1,6 @@ +import { observable } from 'mobx'; +import pSeries from 'p-series'; + import { Autowired, Injectable, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { Decoration, DecorationsManager, IRecycleTreeHandle, TreeNodeType, WatchEvent } from '@opensumi/ide-components'; import { @@ -18,11 +21,11 @@ import { LabelService } from '@opensumi/ide-core-browser/lib/services'; import { Path } from '@opensumi/ide-core-common/lib/path'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IIconService, IIconTheme } from '@opensumi/ide-theme'; -import { observable } from 'mobx'; -import pSeries from 'p-series'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { ISCMRepository, ISCMResource, scmResourceViewId } from '../../../common'; import { ViewModelContext } from '../../scm-model'; + import { SCMTreeDecorationService } from './scm-tree-decoration.service'; import { SCMTreeModel } from './scm-tree-model'; import { @@ -32,10 +35,9 @@ import { SCMResourceRoot, SCMResourceNotRoot, } from './scm-tree-node'; +import styles from './scm-tree-node.module.less'; import { SCMTreeService } from './scm-tree.service'; -import styles from './scm-tree-node.module.less'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; export interface IEditorTreeHandle extends IRecycleTreeHandle { hasDirectFocus: () => boolean; diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.ts b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.ts index c43310dd60..41bb8b9780 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.ts +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-model.ts @@ -1,5 +1,5 @@ -import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { Injectable, Optional, Autowired } from '@opensumi/di'; +import { TreeModel, TreeNodeEvent, CompositeTreeNode } from '@opensumi/ide-components'; import { ThrottledDelayer, Emitter, Event } from '@opensumi/ide-core-browser'; import { SCMTreeDecorationService } from './scm-tree-decoration.service'; diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.ts b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.ts index ef66078f7c..73af526fbb 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.ts +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.ts @@ -1,11 +1,12 @@ -import { URI, memoize } from '@opensumi/ide-core-browser'; import { TreeNode, CompositeTreeNode, ITree } from '@opensumi/ide-components'; +import { URI, memoize } from '@opensumi/ide-core-browser'; import * as paths from '@opensumi/ide-core-common/lib/path'; -import { SCMTreeService } from './scm-tree.service'; import { ISCMResourceGroup, ISCMResource } from '../../../common'; import { isSCMResourceGroup } from '../../scm-util'; + import { ISCMTreeNodeDescription, collectSCMResourceDesc } from './scm-tree-api'; +import { SCMTreeService } from './scm-tree.service'; export class SCMResourceRoot extends CompositeTreeNode { static is(node: any): node is SCMResourceRoot { diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.view.tsx b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.view.tsx index d3858265f3..de0b9cdf3c 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.view.tsx +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree-node.view.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import clx from 'classnames'; +import React from 'react'; + import { Badge, TreeNode, @@ -8,19 +9,19 @@ import { ClasslistComposite, TreeNodeType, } from '@opensumi/ide-components'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services'; -import { useInjectable, URI, getIcon, CommandService } from '@opensumi/ide-core-browser'; import { Loading } from '@opensumi/ide-components'; -import { IThemeService, IIconTheme } from '@opensumi/ide-theme'; +import { useInjectable, URI, getIcon, CommandService } from '@opensumi/ide-core-browser'; import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; import { IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services'; +import { IThemeService, IIconTheme } from '@opensumi/ide-theme'; -import { SCMResourceNotRoot, SCMResourceFolder, SCMResourceGroup, SCMResourceFile } from './scm-tree-node'; -import { SCMTreeDecorationService } from './scm-tree-decoration.service'; import { ISCMResource, ISCMResourceGroup } from '../../../common'; +import { ViewModelContext } from '../../scm-model'; +import { SCMTreeDecorationService } from './scm-tree-decoration.service'; +import { SCMResourceNotRoot, SCMResourceFolder, SCMResourceGroup, SCMResourceFile } from './scm-tree-node'; import styles from './scm-tree-node.module.less'; -import { ViewModelContext } from '../../scm-model'; export const SCM_TREE_NODE_HEIGHT = 22; export const SCM_BADGE_LIMIT = 99; diff --git a/packages/scm/src/browser/components/scm-resource-tree/scm-tree.service.ts b/packages/scm/src/browser/components/scm-resource-tree/scm-tree.service.ts index 04ad621642..c865255090 100644 --- a/packages/scm/src/browser/components/scm-resource-tree/scm-tree.service.ts +++ b/packages/scm/src/browser/components/scm-resource-tree/scm-tree.service.ts @@ -1,8 +1,11 @@ import { Autowired, Injectable } from '@opensumi/di'; -import { Emitter, Event, PreferenceScope } from '@opensumi/ide-core-common'; import { Tree, ITreeNodeOrCompositeTreeNode } from '@opensumi/ide-components'; import { PreferenceService } from '@opensumi/ide-core-browser'; +import { Emitter, Event, PreferenceScope } from '@opensumi/ide-core-common'; + +import { ISCMResource, ISCMResourceGroup, SCMViewModelMode } from '../../../common'; +import { SCMTreeAPI, ISCMTreeNodeDescription } from './scm-tree-api'; import { SCMResourceRoot, SCMResourceGroup, @@ -12,8 +15,6 @@ import { SCMResourceNotFile, SCMResourceItem, } from './scm-tree-node'; -import { SCMTreeAPI, ISCMTreeNodeDescription } from './scm-tree-api'; -import { ISCMResource, ISCMResourceGroup, SCMViewModelMode } from '../../../common'; /** * 应为单例 diff --git a/packages/scm/src/browser/dirty-diff/dirty-diff-controller.ts b/packages/scm/src/browser/dirty-diff/dirty-diff-controller.ts index c7532f598e..14fd840571 100644 --- a/packages/scm/src/browser/dirty-diff/dirty-diff-controller.ts +++ b/packages/scm/src/browser/dirty-diff/dirty-diff-controller.ts @@ -1,8 +1,8 @@ +import { Disposable } from '@opensumi/ide-core-common/lib/disposable'; import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; /* istanbul ignore file */ // 文件没有使用 -import { Disposable } from '@opensumi/ide-core-common/lib/disposable'; export class DirtyDiffController extends Disposable { private static readonly ID = 'editor.contrib.dirtydiff'; diff --git a/packages/scm/src/browser/dirty-diff/dirty-diff-decorator.ts b/packages/scm/src/browser/dirty-diff/dirty-diff-decorator.ts index d422960a4e..892cb57016 100644 --- a/packages/scm/src/browser/dirty-diff/dirty-diff-decorator.ts +++ b/packages/scm/src/browser/dirty-diff/dirty-diff-decorator.ts @@ -1,12 +1,12 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as textModel from '@opensumi/monaco-editor-core/esm/vs/editor/common/model/textModel'; -import * as model from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; import { Autowired, Injectable, Optional } from '@opensumi/di'; -import { OverviewRulerLane } from '@opensumi/ide-editor'; import { IChange } from '@opensumi/ide-core-common'; import { Disposable } from '@opensumi/ide-core-common/lib/disposable'; -import { themeColorFromId } from '@opensumi/ide-theme'; +import { OverviewRulerLane } from '@opensumi/ide-editor'; import { IEditorDocumentModel } from '@opensumi/ide-editor/lib/browser'; +import { themeColorFromId } from '@opensumi/ide-theme'; +import * as model from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import * as textModel from '@opensumi/monaco-editor-core/esm/vs/editor/common/model/textModel'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; import { overviewRulerModifiedForeground, @@ -14,6 +14,7 @@ import { overviewRulerAddedForeground, } from '../scm-color'; import { SCMPreferences } from '../scm-preference'; + import { DirtyDiffModel } from './dirty-diff-model'; enum ChangeType { diff --git a/packages/scm/src/browser/dirty-diff/dirty-diff-model.ts b/packages/scm/src/browser/dirty-diff/dirty-diff-model.ts index 4c6e265cfc..46ee4ec959 100644 --- a/packages/scm/src/browser/dirty-diff/dirty-diff-model.ts +++ b/packages/scm/src/browser/dirty-diff/dirty-diff-model.ts @@ -1,9 +1,6 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; -import { IEditorWorkerService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/editorWorkerService'; import { Autowired, Injectable, Optional } from '@opensumi/di'; import { Emitter, Event, sortedDiff, ThrottledDelayer, IChange, positionToRange } from '@opensumi/ide-core-common'; -import { Uri, URI } from '@opensumi/ide-core-common/lib/uri'; +import { first } from '@opensumi/ide-core-common/lib/async'; import { IDisposable, dispose, @@ -11,15 +8,19 @@ import { DisposableStore, toDisposable, } from '@opensumi/ide-core-common/lib/disposable'; -import { first } from '@opensumi/ide-core-common/lib/async'; import { ISplice } from '@opensumi/ide-core-common/lib/sequence'; +import { Uri, URI } from '@opensumi/ide-core-common/lib/uri'; import { EditorCollectionService } from '@opensumi/ide-editor'; import { IEditorDocumentModelService, IEditorDocumentModel } from '@opensumi/ide-editor/lib/browser'; +import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; +import { IEditorWorkerService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/editorWorkerService'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { StaticServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; import { SCMService, ISCMRepository, IDirtyDiffModel } from '../../common'; + import { compareChanges, getModifiedEndLineNumber } from './dirty-diff-util'; import { DirtyDiffWidget } from './dirty-diff-widget'; -import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; @Injectable({ multiple: true }) export class DirtyDiffModel extends Disposable implements IDirtyDiffModel { diff --git a/packages/scm/src/browser/dirty-diff/dirty-diff-widget.ts b/packages/scm/src/browser/dirty-diff/dirty-diff-widget.ts index 1820db82ab..3178b3f6c6 100644 --- a/packages/scm/src/browser/dirty-diff/dirty-diff-widget.ts +++ b/packages/scm/src/browser/dirty-diff/dirty-diff-widget.ts @@ -1,10 +1,12 @@ -import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { ZoneWidget } from '@opensumi/ide-monaco-enhance/lib/browser'; -import { basename } from '@opensumi/ide-core-common/lib/utils/paths'; -import { IDirtyDiffModel, OPEN_DIRTY_DIFF_WIDGET } from '../../common'; import { getIcon } from '@opensumi/ide-core-browser'; -import { URI, CommandService } from '@opensumi/ide-core-common'; import { ScmChangeTitleCallback } from '@opensumi/ide-core-browser/lib/menu/next'; +import { URI, CommandService } from '@opensumi/ide-core-common'; +import { basename } from '@opensumi/ide-core-common/lib/utils/paths'; +import { ZoneWidget } from '@opensumi/ide-monaco-enhance/lib/browser'; +import type { ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; + +import { IDirtyDiffModel, OPEN_DIRTY_DIFF_WIDGET } from '../../common'; + export enum DirtyDiffWidgetActionType { close, diff --git a/packages/scm/src/browser/dirty-diff/index.ts b/packages/scm/src/browser/dirty-diff/index.ts index 2313248b42..6eed924495 100644 --- a/packages/scm/src/browser/dirty-diff/index.ts +++ b/packages/scm/src/browser/dirty-diff/index.ts @@ -1,17 +1,18 @@ -import type { ICodeEditor as IMonacoCodeEditor, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { EditorGroupChangeEvent, IEditorFeatureRegistry } from '@opensumi/ide-editor/lib/browser'; import { Autowired, Injectable, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { Event, IEventBus, CommandService, positionToRange } from '@opensumi/ide-core-common'; import { Disposable, DisposableStore, DisposableCollection } from '@opensumi/ide-core-common/lib/disposable'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { EditorGroupChangeEvent, IEditorFeatureRegistry } from '@opensumi/ide-editor/lib/browser'; import { IEditorDocumentModel } from '@opensumi/ide-editor/lib/browser'; import { IMonacoImplEditor } from '@opensumi/ide-editor/lib/browser/editor-collection.service'; -import { IDirtyDiffWorkbenchController } from '../../common'; +import type { ICodeEditor as IMonacoCodeEditor, ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { IDirtyDiffWorkbenchController } from '../../common'; import { SCMPreferences } from '../scm-preference'; -import { DirtyDiffModel } from './dirty-diff-model'; + import { DirtyDiffDecorator } from './dirty-diff-decorator'; +import { DirtyDiffModel } from './dirty-diff-model'; import { DirtyDiffWidget } from './dirty-diff-widget'; import './dirty-diff.module.less'; diff --git a/packages/scm/src/browser/index.ts b/packages/scm/src/browser/index.ts index 6639f92f55..b65657e9ab 100644 --- a/packages/scm/src/browser/index.ts +++ b/packages/scm/src/browser/index.ts @@ -3,11 +3,11 @@ import { BrowserModule } from '@opensumi/ide-core-browser'; import { ISCMMenus, SCMService, IDirtyDiffWorkbenchController } from '../common'; -import { SCMContribution } from './scm.contribution'; -import { SCMBadgeController, SCMStatusBarController } from './scm-activity'; -import { bindSCMPreference } from './scm-preference'; import { DirtyDiffWorkbenchController } from './dirty-diff'; +import { SCMBadgeController, SCMStatusBarController } from './scm-activity'; import { SCMMenus } from './scm-menu'; +import { bindSCMPreference } from './scm-preference'; +import { SCMContribution } from './scm.contribution'; @Injectable() export class SCMModule extends BrowserModule { diff --git a/packages/scm/src/browser/scm-activity.ts b/packages/scm/src/browser/scm-activity.ts index 3c8f78f987..caab81a6ef 100644 --- a/packages/scm/src/browser/scm-activity.ts +++ b/packages/scm/src/browser/scm-activity.ts @@ -1,14 +1,15 @@ import { Autowired, Injectable } from '@opensumi/di'; -import { Event } from '@opensumi/ide-core-common/lib/event'; +import { StatusBarAlignment, IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; +import { localize } from '@opensumi/ide-core-common'; import { Disposable, IDisposable, dispose, combinedDisposable } from '@opensumi/ide-core-common/lib/disposable'; +import { Event } from '@opensumi/ide-core-common/lib/event'; import { basename } from '@opensumi/ide-core-common/lib/path'; import { commonPrefixLength } from '@opensumi/ide-core-common/lib/utils/strings'; -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { StatusBarAlignment, IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { SCMService, ISCMRepository, scmContainerId } from '../common'; -import { localize } from '@opensumi/ide-core-common'; + // 更新 ActivityBar 中 SCM 模块边的数字, 标注当前的 changes 数量 @Injectable() diff --git a/packages/scm/src/browser/scm-menu.ts b/packages/scm/src/browser/scm-menu.ts index 996df1998b..24cf401c5c 100644 --- a/packages/scm/src/browser/scm-menu.ts +++ b/packages/scm/src/browser/scm-menu.ts @@ -1,8 +1,8 @@ import { Injectable, Autowired, Optional, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { Disposable } from '@opensumi/ide-core-common/lib/disposable'; -import { ISplice } from '@opensumi/ide-core-common/lib/sequence'; import { IContextKeyService } from '@opensumi/ide-core-browser'; import { MenuId, AbstractContextMenuService, IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; +import { Disposable } from '@opensumi/ide-core-common/lib/disposable'; +import { ISplice } from '@opensumi/ide-core-common/lib/sequence'; import { ISCMRepository, @@ -13,6 +13,7 @@ import { ISCMRepositoryMenus, ISCMMenus, } from '../common'; + import { isSCMResource } from './scm-util'; @Injectable({ multiple: true }) diff --git a/packages/scm/src/browser/scm-model.ts b/packages/scm/src/browser/scm-model.ts index 102e707118..f531ca396e 100644 --- a/packages/scm/src/browser/scm-model.ts +++ b/packages/scm/src/browser/scm-model.ts @@ -1,3 +1,5 @@ +import { action, observable } from 'mobx'; + import { Autowired, Injectable } from '@opensumi/di'; import { PreferenceService } from '@opensumi/ide-core-browser'; import { Disposable, Emitter, Event, getDebugLogger, Uri } from '@opensumi/ide-core-common'; @@ -9,7 +11,6 @@ import { toDisposable, } from '@opensumi/ide-core-common/lib/disposable'; import { ISplice } from '@opensumi/ide-core-common/lib/sequence'; -import { action, observable } from 'mobx'; import { ISCMMenus, ISCMRepository, ISCMResource, ISCMResourceGroup, SCMService } from '../common'; diff --git a/packages/scm/src/browser/scm-preference.ts b/packages/scm/src/browser/scm-preference.ts index 7d6acd369c..fb27967f9e 100644 --- a/packages/scm/src/browser/scm-preference.ts +++ b/packages/scm/src/browser/scm-preference.ts @@ -6,6 +6,7 @@ import { PreferenceSchema, localize, } from '@opensumi/ide-core-browser'; + import { SCMViewModelMode } from '../common'; // 这里都是 scm 相关配置项注册 diff --git a/packages/scm/src/browser/scm-util.ts b/packages/scm/src/browser/scm-util.ts index dab71c55f1..54f2e11dd6 100644 --- a/packages/scm/src/browser/scm-util.ts +++ b/packages/scm/src/browser/scm-util.ts @@ -1,4 +1,5 @@ import { basename } from '@opensumi/ide-core-common/lib/path'; + import { ISCMResourceGroup, ISCMResource, ISCMRepository } from '../common'; export function isSCMResource(element: ISCMResourceGroup | ISCMResource): element is ISCMResource { diff --git a/packages/scm/src/browser/scm-view-container.tsx b/packages/scm/src/browser/scm-view-container.tsx index 98a50450c8..96c1363fb4 100644 --- a/packages/scm/src/browser/scm-view-container.tsx +++ b/packages/scm/src/browser/scm-view-container.tsx @@ -1,22 +1,22 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { ViewState } from '@opensumi/ide-core-browser'; -import { localize } from '@opensumi/ide-core-common'; import { IContextKeyService, View, useInjectable } from '@opensumi/ide-core-browser'; +import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { localize } from '@opensumi/ide-core-common'; import { AccordionContainer } from '@opensumi/ide-main-layout/lib/browser/accordion/accordion.view'; import { TitleBar } from '@opensumi/ide-main-layout/lib/browser/accordion/titlebar.view'; -import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; import { ISCMRepository, scmProviderViewId, scmResourceViewId, scmContainerId } from '../common'; -import { ViewModelContext } from './scm-model'; +import { SCMProviderList } from './components/scm-provider-list'; import { SCMResourceInput } from './components/scm-resource-input'; import { SCMResourceTree } from './components/scm-resource-tree'; -import { SCMProviderList } from './components/scm-provider-list'; - -import styles from './scm.module.less'; +import { ViewModelContext } from './scm-model'; import { getSCMRepositoryDesc } from './scm-util'; -import { WelcomeView } from '@opensumi/ide-main-layout/lib/browser/welcome.view'; +import styles from './scm.module.less'; export const SCMResourcesView: React.FC<{ repository: ISCMRepository; diff --git a/packages/scm/src/browser/scm.contribution.ts b/packages/scm/src/browser/scm.contribution.ts index e7642435d2..273a2aafb7 100644 --- a/packages/scm/src/browser/scm.contribution.ts +++ b/packages/scm/src/browser/scm.contribution.ts @@ -1,4 +1,13 @@ import { Autowired } from '@opensumi/di'; +import { + ClientAppContribution, + PreferenceContribution, + PreferenceService, + getExternalIcon, +} from '@opensumi/ide-core-browser'; +import { getIcon } from '@opensumi/ide-core-browser'; +import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { CommandContribution, CommandRegistry, @@ -8,18 +17,11 @@ import { URI, PreferenceScope, } from '@opensumi/ide-core-common'; -import { - ClientAppContribution, - PreferenceContribution, - PreferenceService, - getExternalIcon, -} from '@opensumi/ide-core-browser'; import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; -import { IViewsRegistry, MainLayoutContribution } from '@opensumi/ide-main-layout'; -import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; import { Disposable } from '@opensumi/ide-core-common/lib/disposable'; +import { WorkbenchEditorService, EditorCollectionService, IEditor } from '@opensumi/ide-editor/lib/common'; +import { IViewsRegistry, MainLayoutContribution } from '@opensumi/ide-main-layout'; -import { SCMViewContainer } from './scm-view-container'; import { scmContainerId, IDirtyDiffWorkbenchController, @@ -32,13 +34,13 @@ import { SET_SCM_LIST_VIEW_MODE, SCMViewModelMode, } from '../common'; + +import { SCMTreeService } from './components/scm-resource-tree/scm-tree.service'; +import { DirtyDiffWorkbenchController } from './dirty-diff'; import { SCMBadgeController, SCMStatusBarController } from './scm-activity'; import { scmPreferenceSchema } from './scm-preference'; -import { DirtyDiffWorkbenchController } from './dirty-diff'; -import { getIcon } from '@opensumi/ide-core-browser'; -import { WorkbenchEditorService, EditorCollectionService, IEditor } from '@opensumi/ide-editor/lib/common'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { SCMTreeService } from './components/scm-resource-tree/scm-tree.service'; +import { SCMViewContainer } from './scm-view-container'; + export const SCM_ACCEPT_INPUT: Command = { id: 'scm.acceptInput', diff --git a/packages/scm/src/common/dirty-diff.ts b/packages/scm/src/common/dirty-diff.ts index 50140e45bd..6e55f065ed 100644 --- a/packages/scm/src/common/dirty-diff.ts +++ b/packages/scm/src/common/dirty-diff.ts @@ -1,6 +1,6 @@ +import { IChange, Command } from '@opensumi/ide-core-common'; // eslint-disable-next-line import/no-restricted-paths import type { ICodeEditor as IMonacoCodeEditor, IPosition } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { IChange, Command } from '@opensumi/ide-core-common'; export interface IDirtyDiffModel { changes: IChange[]; diff --git a/packages/scm/src/common/scm-menus.ts b/packages/scm/src/common/scm-menus.ts index 1484cdc4f1..281e08989a 100644 --- a/packages/scm/src/common/scm-menus.ts +++ b/packages/scm/src/common/scm-menus.ts @@ -1,4 +1,5 @@ import { IContextMenu } from '@opensumi/ide-core-browser/lib/menu/next'; + import { ISCMResource, ISCMResourceGroup, ISCMProvider } from './scm'; export interface ISCMRepositoryMenus { diff --git a/packages/scm/src/common/scm.service.ts b/packages/scm/src/common/scm.service.ts index fb10cdffa3..09ee97ffac 100644 --- a/packages/scm/src/common/scm.service.ts +++ b/packages/scm/src/common/scm.service.ts @@ -1,8 +1,10 @@ +import { observable, computed, action } from 'mobx'; + import { Injectable } from '@opensumi/di'; import { Event, Emitter, equals, getDebugLogger } from '@opensumi/ide-core-common'; import { IDisposable, toDisposable } from '@opensumi/ide-core-common/lib/disposable'; + import { ISCMProvider, ISCMInput, ISCMRepository, IInputValidator } from './scm'; -import { observable, computed, action } from 'mobx'; class SCMInput implements ISCMInput { private _value = ''; diff --git a/packages/scm/src/common/scm.ts b/packages/scm/src/common/scm.ts index e2d1839240..b857918862 100644 --- a/packages/scm/src/common/scm.ts +++ b/packages/scm/src/common/scm.ts @@ -1,6 +1,6 @@ import { Event, IDisposable } from '@opensumi/ide-core-common'; -import { Uri } from '@opensumi/ide-core-common/lib/uri'; import { ISequence } from '@opensumi/ide-core-common/lib/sequence'; +import { Uri } from '@opensumi/ide-core-common/lib/uri'; export interface VSCommand { id: string; diff --git a/packages/search/__tests__/browser/search-tree.service.test.ts b/packages/search/__tests__/browser/search-tree.service.test.ts index 0bd23c248e..6247087aa1 100644 --- a/packages/search/__tests__/browser/search-tree.service.test.ts +++ b/packages/search/__tests__/browser/search-tree.service.test.ts @@ -1,18 +1,21 @@ import path from 'path'; + import { Injector, Injectable } from '@opensumi/di'; +import { IContextKeyService } from '@opensumi/ide-core-browser'; import { ILoggerManagerClient, Uri, URI } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { LoggerManagerClient } from '@opensumi/ide-logs/src/browser/log-manage'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/lib/browser/doc-model/main'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IEditorDocumentModelService, IEditorDocumentModelContentRegistry } from '@opensumi/ide-editor/lib/browser'; +import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/lib/browser/doc-model/main'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { LoggerManagerClient } from '@opensumi/ide-logs/src/browser/log-manage'; import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { OverlayModule } from '@opensumi/ide-overlay/lib/browser'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { IWorkspaceEditService } from '@opensumi/ide-workspace-edit'; -import { IContextKeyService } from '@opensumi/ide-core-browser'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { SearchModule } from '../../src/browser/'; +import { SearchTreeService } from '../../src/browser/search-tree.service'; import { ContentSearchClientService } from '../../src/browser/search.service'; import { IContentSearchClientService, @@ -20,8 +23,6 @@ import { ContentSearchOptions, ContentSearchResult, } from '../../src/common'; -import { SearchModule } from '../../src/browser/'; -import { SearchTreeService } from '../../src/browser/search-tree.service'; const rootUri = Uri.file(path.resolve(__dirname, '../test-resources/')).toString(); diff --git a/packages/search/__tests__/browser/search.service.test.ts b/packages/search/__tests__/browser/search.service.test.ts index 3e8680861f..207042d93b 100644 --- a/packages/search/__tests__/browser/search.service.test.ts +++ b/packages/search/__tests__/browser/search.service.test.ts @@ -1,13 +1,17 @@ import path from 'path'; + import { Injector, Injectable } from '@opensumi/di'; +import { CorePreferences } from '@opensumi/ide-core-browser'; import { ILoggerManagerClient, Uri } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { LoggerManagerClient } from '@opensumi/ide-logs/src/browser/log-manage'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/lib/browser/doc-model/main'; import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/lib/browser/doc-model/main'; +import { LoggerManagerClient } from '@opensumi/ide-logs/src/browser/log-manage'; import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { SearchModule } from '../../src/browser/'; +import { SearchPreferences } from '../../src/browser/search-preferences'; import { ContentSearchClientService } from '../../src/browser/search.service'; import { IContentSearchClientService, @@ -18,9 +22,6 @@ import { ContentSearchResult, IUIState, } from '../../src/common'; -import { SearchModule } from '../../src/browser/'; -import { SearchPreferences } from '../../src/browser/search-preferences'; -import { CorePreferences } from '@opensumi/ide-core-browser'; const rootUri = Uri.file(path.resolve(__dirname, '../test-resources/')).toString(); diff --git a/packages/search/__tests__/node/content-search.service.test.ts b/packages/search/__tests__/node/content-search.service.test.ts index a3b2db9aa1..dafa61604e 100644 --- a/packages/search/__tests__/node/content-search.service.test.ts +++ b/packages/search/__tests__/node/content-search.service.test.ts @@ -1,14 +1,17 @@ /** * 参考使用 theia 的单测 */ +import fs from 'fs'; import path from 'path'; + import temp from 'temp'; -import fs from 'fs'; -import { FileUri, AppConfig, INodeLogger, NodeLogger } from '@opensumi/ide-core-node'; + import { isWindows } from '@opensumi/ide-core-common'; +import { FileUri, AppConfig, INodeLogger, NodeLogger } from '@opensumi/ide-core-node'; import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { ProcessModule } from '@opensumi/ide-process'; import { LogServiceModule } from '@opensumi/ide-logs/lib/node'; +import { ProcessModule } from '@opensumi/ide-process'; + import { SearchModule, IContentSearchServer, ContentSearchResult, SEARCH_STATE } from '../../src'; // Allow creating temporary files, but remove them when we are done. diff --git a/packages/search/src/browser/index.ts b/packages/search/src/browser/index.ts index f2b5ceef3d..2d5d811df8 100644 --- a/packages/search/src/browser/index.ts +++ b/packages/search/src/browser/index.ts @@ -1,11 +1,12 @@ import { Provider, Injectable } from '@opensumi/di'; -import { SearchContribution } from './search.contribution'; import { BrowserModule } from '@opensumi/ide-core-browser'; import { ContentSearchServerPath } from '../common'; -import { ContentSearchClientService } from './search.service'; -import { bindSearchPreference } from './search-preferences'; + import { SearchContextKey } from './search-contextkey'; +import { bindSearchPreference } from './search-preferences'; +import { SearchContribution } from './search.contribution'; +import { ContentSearchClientService } from './search.service'; @Injectable() export class SearchModule extends BrowserModule { diff --git a/packages/search/src/browser/replace.ts b/packages/search/src/browser/replace.ts index 0f1e04de45..b447ab03fd 100644 --- a/packages/search/src/browser/replace.ts +++ b/packages/search/src/browser/replace.ts @@ -1,8 +1,9 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; -import { MessageType, URI } from '@opensumi/ide-core-common'; import { localize } from '@opensumi/ide-core-browser'; +import { MessageType, URI } from '@opensumi/ide-core-common'; +import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; import { IWorkspaceEditService } from '@opensumi/ide-workspace-edit'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { ContentSearchResult, ResultTotal } from '../common/'; export async function replaceAll( diff --git a/packages/search/src/browser/search-history.ts b/packages/search/src/browser/search-history.ts index 110499c6b1..c1829829c8 100644 --- a/packages/search/src/browser/search-history.ts +++ b/packages/search/src/browser/search-history.ts @@ -1,6 +1,7 @@ -import { IContentSearchClientService } from '../common'; import { RecentStorage, isArray } from '@opensumi/ide-core-browser'; +import { IContentSearchClientService } from '../common'; + export const SEARCH_WORD_SCOPE = 'SEARCH_WORD'; export class SearchHistory { diff --git a/packages/search/src/browser/search-tree.service.ts b/packages/search/src/browser/search-tree.service.ts index 6cc9b401dc..3832f5316a 100644 --- a/packages/search/src/browser/search-tree.service.ts +++ b/packages/search/src/browser/search-tree.service.ts @@ -1,7 +1,9 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import React from 'react'; import { action } from 'mobx'; +import React from 'react'; + +import { Injectable, Autowired } from '@opensumi/di'; import { LabelService } from '@opensumi/ide-core-browser'; +import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { URI, Schemas, @@ -15,25 +17,26 @@ import { MessageType, memoize, } from '@opensumi/ide-core-common'; -import { Injectable, Autowired } from '@opensumi/di'; +import { WorkbenchEditorService, TrackedRangeStickiness } from '@opensumi/ide-editor'; import { IEditorDocumentModelService, IEditorDocumentModelContentRegistry, IEditorDocumentModelContentProvider, } from '@opensumi/ide-editor/lib/browser'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { IDialogService } from '@opensumi/ide-overlay'; import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { WorkbenchEditorService, TrackedRangeStickiness } from '@opensumi/ide-editor'; import { IWorkspaceEditService } from '@opensumi/ide-workspace-edit'; -import { IDialogService } from '@opensumi/ide-overlay'; -import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { replaceAll, replace } from './replace'; -import { ContentSearchClientService } from './search.service'; import { ContentSearchResult, ISearchTreeItem } from '../common'; + +import { replaceAll, replace } from './replace'; import { SearchPreferences } from './search-preferences'; import styles from './search.module.less'; -import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { ContentSearchClientService } from './search.service'; + const REPLACE_PREVIEW = 'replacePreview'; diff --git a/packages/search/src/browser/search-tree.view.tsx b/packages/search/src/browser/search-tree.view.tsx index 661184625e..65a768415a 100644 --- a/packages/search/src/browser/search-tree.view.tsx +++ b/packages/search/src/browser/search-tree.view.tsx @@ -1,14 +1,18 @@ -import React from 'react'; +import cls from 'classnames'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { ConfigContext, localize } from '@opensumi/ide-core-browser'; -import { DeprecatedRecycleTree, TreeNode, TreeViewActionTypes } from '@opensumi/ide-core-browser/lib/components'; import { ViewState } from '@opensumi/ide-core-browser'; import { getIcon, getExternalIcon } from '@opensumi/ide-core-browser'; -import cls from 'classnames'; +import { DeprecatedRecycleTree, TreeNode, TreeViewActionTypes } from '@opensumi/ide-core-browser/lib/components'; + + +import { ResultTotal } from '../common'; + import { SearchTreeService } from './search-tree.service'; -import { ContentSearchClientService } from './search.service'; import styles from './search.module.less'; -import { ResultTotal } from '../common'; +import { ContentSearchClientService } from './search.service'; export interface ISearchTreeItem extends TreeNode { children?: ISearchTreeItem[]; diff --git a/packages/search/src/browser/search.contribution.ts b/packages/search/src/browser/search.contribution.ts index e9e143c423..fd8918f6c0 100644 --- a/packages/search/src/browser/search.contribution.ts +++ b/packages/search/src/browser/search.contribution.ts @@ -1,5 +1,4 @@ import { Autowired } from '@opensumi/di'; -import { CommandContribution, CommandRegistry, DisposableCollection } from '@opensumi/ide-core-common'; import { localize, PreferenceSchema, SEARCH_COMMANDS, IClipboardService } from '@opensumi/ide-core-browser'; import { KeybindingContribution, @@ -9,19 +8,23 @@ import { ComponentContribution, PreferenceContribution, } from '@opensumi/ide-core-browser'; -import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; -import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common'; +import { getIcon } from '@opensumi/ide-core-browser'; import { ToolbarRegistry, TabBarToolbarContribution } from '@opensumi/ide-core-browser/lib/layout'; -import { MainLayoutContribution } from '@opensumi/ide-main-layout'; import { MenuId, MenuContribution, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next'; -import { getIcon } from '@opensumi/ide-core-browser'; -import { Search } from './search.view'; -import { ContentSearchClientService } from './search.service'; -import { searchPreferenceSchema } from './search-preferences'; -import { SEARCH_CONTAINER_ID } from '../common/content-search'; -import { SearchTreeService } from './search-tree.service'; +import { CommandContribution, CommandRegistry, DisposableCollection } from '@opensumi/ide-core-common'; +import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; +import { MainLayoutContribution } from '@opensumi/ide-main-layout'; +import { IMainLayoutService } from '@opensumi/ide-main-layout/lib/common'; + + import { ContentSearchResult, ISearchTreeItem, OpenSearchCmdOptions } from '../common'; +import { SEARCH_CONTAINER_ID } from '../common/content-search'; + import { SearchContextKey, SearchInputFocused } from './search-contextkey'; +import { searchPreferenceSchema } from './search-preferences'; +import { SearchTreeService } from './search-tree.service'; +import { ContentSearchClientService } from './search.service'; +import { Search } from './search.view'; @Domain( ClientAppContribution, diff --git a/packages/search/src/browser/search.input.widget.tsx b/packages/search/src/browser/search.input.widget.tsx index 1b2f7e942f..e8160fcc7b 100644 --- a/packages/search/src/browser/search.input.widget.tsx +++ b/packages/search/src/browser/search.input.widget.tsx @@ -1,8 +1,9 @@ -import React, { RefObject } from 'react'; import cls from 'classnames'; +import React, { RefObject } from 'react'; + import { ValidateInput, CheckBox, ValidateMessage } from '@opensumi/ide-components'; -import { localize } from '@opensumi/ide-core-common/lib/localize'; import { getIcon } from '@opensumi/ide-core-browser/lib/style/icon/icon'; +import { localize } from '@opensumi/ide-core-common/lib/localize'; import styles from './search.module.less'; diff --git a/packages/search/src/browser/search.replace.widget.tsx b/packages/search/src/browser/search.replace.widget.tsx index ccac313203..11069179ac 100644 --- a/packages/search/src/browser/search.replace.widget.tsx +++ b/packages/search/src/browser/search.replace.widget.tsx @@ -1,7 +1,9 @@ -import React, { RefObject } from 'react'; import { observer } from 'mobx-react-lite'; -import { localize } from '@opensumi/ide-core-common/lib/localize'; +import React, { RefObject } from 'react'; + import { Input } from '@opensumi/ide-components'; +import { localize } from '@opensumi/ide-core-common/lib/localize'; + import styles from './search.module.less'; interface SearchReplaceWidgetProps { diff --git a/packages/search/src/browser/search.rules.widget.tsx b/packages/search/src/browser/search.rules.widget.tsx index 0e8d733998..6e85b20d08 100644 --- a/packages/search/src/browser/search.rules.widget.tsx +++ b/packages/search/src/browser/search.rules.widget.tsx @@ -1,12 +1,13 @@ -import React from 'react'; import cls from 'classnames'; -import { localize } from '@opensumi/ide-core-common/lib/localize'; +import React from 'react'; + import { Input, CheckBox, Popover, PopoverTriggerType, PopoverPosition } from '@opensumi/ide-components'; -import { getExternalIcon, getIcon } from '@opensumi/ide-core-browser/lib/style/icon/icon'; import { ConfigContext } from '@opensumi/ide-core-browser/lib/react-providers/config-provider'; +import { getExternalIcon, getIcon } from '@opensumi/ide-core-browser/lib/style/icon/icon'; +import { localize } from '@opensumi/ide-core-common/lib/localize'; -import { ContentSearchClientService } from './search.service'; import styles from './search.module.less'; +import { ContentSearchClientService } from './search.service'; const IncludeRuleContent = () => (
diff --git a/packages/search/src/browser/search.service.ts b/packages/search/src/browser/search.service.ts index 8c648b9fa3..7762531a19 100644 --- a/packages/search/src/browser/search.service.ts +++ b/packages/search/src/browser/search.service.ts @@ -1,10 +1,25 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { observable, transaction, action } from 'mobx'; +import React from 'react'; +import { createRef } from 'react'; + /** * 用于文件内容搜索 */ -import React from 'react'; -import { createRef } from 'react'; + import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { VALIDATE_TYPE, ValidateMessage } from '@opensumi/ide-components'; +import { + Key, + URI, + Schemas, + IDisposable, + CommandService, + COMMON_COMMANDS, + RecentStorage, + PreferenceService, +} from '@opensumi/ide-core-browser'; +import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; +import { GlobalBrowserStorageService } from '@opensumi/ide-core-browser/lib/services/storage-service'; import { Emitter, IEventBus, @@ -17,30 +32,19 @@ import { } from '@opensumi/ide-core-common'; import * as arrays from '@opensumi/ide-core-common/lib/arrays'; import { parse, ParsedPattern } from '@opensumi/ide-core-common/lib/utils/glob'; -import { - Key, - URI, - Schemas, - IDisposable, - CommandService, - COMMON_COMMANDS, - RecentStorage, - PreferenceService, -} from '@opensumi/ide-core-browser'; -import { GlobalBrowserStorageService } from '@opensumi/ide-core-browser/lib/services/storage-service'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IEditorDocumentModelService, IEditorDocumentModel, EditorDocumentModelContentChangedEvent, IEditorDocumentModelContentChangedEventPayload, } from '@opensumi/ide-editor/lib/browser'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { CorePreferences } from '@opensumi/ide-core-browser/lib/core-preferences'; import { IDialogService, IMessageService } from '@opensumi/ide-overlay'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { IWorkspaceEditService } from '@opensumi/ide-workspace-edit'; -import { VALIDATE_TYPE, ValidateMessage } from '@opensumi/ide-components'; -import { observable, transaction, action } from 'mobx'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + + import { ContentSearchResult, SEARCH_STATE, @@ -56,11 +60,12 @@ import { FilterFileWithGlobRelativePath, DEFAULT_SEARCH_IN_WORKSPACE_LIMIT, } from '../common'; -import { SearchPreferences } from './search-preferences'; -import { SearchHistory } from './search-history'; + import { replaceAll } from './replace'; -import { SearchResultCollection } from './search-result-collection'; import { SearchContextKey } from './search-contextkey'; +import { SearchHistory } from './search-history'; +import { SearchPreferences } from './search-preferences'; +import { SearchResultCollection } from './search-result-collection'; export interface SearchAllFromDocModelOptions { searchValue: string; diff --git a/packages/search/src/browser/search.view.tsx b/packages/search/src/browser/search.view.tsx index 1c32a1d458..fd17c8f459 100644 --- a/packages/search/src/browser/search.view.tsx +++ b/packages/search/src/browser/search.view.tsx @@ -1,16 +1,20 @@ -import React from 'react'; +import cls from 'classnames'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + +import { ViewState } from '@opensumi/ide-core-browser'; import { localize, useInjectable } from '@opensumi/ide-core-browser'; import { ProgressBar } from '@opensumi/ide-core-browser/lib/components/progressbar'; -import { ViewState } from '@opensumi/ide-core-browser'; -import cls from 'classnames'; -import styles from './search.module.less'; + + import { SEARCH_STATE } from '../common/'; -import { ContentSearchClientService } from './search.service'; + import { SearchTree } from './search-tree.view'; import { SearchInputWidget } from './search.input.widget'; +import styles from './search.module.less'; import { SearchReplaceWidget } from './search.replace.widget'; import { SearchRulesWidget } from './search.rules.widget'; +import { ContentSearchClientService } from './search.service'; export const Search = React.memo( observer(({ viewState }: React.PropsWithChildren<{ viewState: ViewState }>) => { diff --git a/packages/search/src/common/content-search.ts b/packages/search/src/common/content-search.ts index d1af811791..c246eccd14 100644 --- a/packages/search/src/common/content-search.ts +++ b/packages/search/src/common/content-search.ts @@ -1,5 +1,5 @@ -import { endsWith, startsWith, Command, URI } from '@opensumi/ide-core-common'; import { TreeNode, ValidateMessage } from '@opensumi/ide-core-browser/lib/components'; +import { endsWith, startsWith, Command, URI } from '@opensumi/ide-core-common'; import { parse, ParsedPattern } from '@opensumi/ide-core-common/lib/utils/glob'; export const ContentSearchServerPath = 'ContentSearchServerPath'; diff --git a/packages/search/src/node/content-search.service.ts b/packages/search/src/node/content-search.service.ts index 20fd76e726..2abb923c82 100644 --- a/packages/search/src/node/content-search.service.ts +++ b/packages/search/src/node/content-search.service.ts @@ -1,9 +1,10 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IProcessFactory, IProcess, ProcessOptions } from '@opensumi/ide-process'; -import { rgPath } from '@opensumi/vscode-ripgrep'; -import { FileUri, replaceAsarInPath } from '@opensumi/ide-core-node'; import { RPCService } from '@opensumi/ide-connection'; +import { FileUri, replaceAsarInPath } from '@opensumi/ide-core-node'; import { ILogServiceManager, SupportLogNamespace, ILogService } from '@opensumi/ide-logs/lib/node'; +import { IProcessFactory, IProcess, ProcessOptions } from '@opensumi/ide-process'; +import { rgPath } from '@opensumi/vscode-ripgrep'; + import { IContentSearchServer, ContentSearchOptions, diff --git a/packages/search/src/node/index.ts b/packages/search/src/node/index.ts index 32d895aa2f..6d0690c62c 100644 --- a/packages/search/src/node/index.ts +++ b/packages/search/src/node/index.ts @@ -1,8 +1,10 @@ import { Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; -import { ContentSearchService } from './content-search.service'; + import { IContentSearchServer, ContentSearchServerPath } from '../common'; +import { ContentSearchService } from './content-search.service'; + @Injectable() export class SearchModule extends NodeModule { providers = [ diff --git a/packages/startup/entry/sample-modules/editor-empty-component.contribution.tsx b/packages/startup/entry/sample-modules/editor-empty-component.contribution.tsx index b3fc19c9cf..505dfc9f63 100644 --- a/packages/startup/entry/sample-modules/editor-empty-component.contribution.tsx +++ b/packages/startup/entry/sample-modules/editor-empty-component.contribution.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { useMemo, useState } from 'react'; + import { Domain, ComponentContribution, @@ -10,11 +11,11 @@ import { } from '@opensumi/ide-core-browser'; import { KeybindingRegistry } from '@opensumi/ide-core-browser/lib/keybinding/keybinding'; import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; -import { KeybindingView } from '@opensumi/ide-quick-open/lib/browser/components/keybinding'; -import { QUICK_OPEN_COMMANDS } from '@opensumi/ide-quick-open/lib/common'; import { Disposable, localize, registerLocalizationBundle } from '@opensumi/ide-core-common'; -import { IKeymapService } from '@opensumi/ide-keymaps/lib/common/keymaps'; import { ThrottledDelayer } from '@opensumi/ide-core-common/lib/async'; +import { IKeymapService } from '@opensumi/ide-keymaps/lib/common/keymaps'; +import { KeybindingView } from '@opensumi/ide-quick-open/lib/browser/components/keybinding'; +import { QUICK_OPEN_COMMANDS } from '@opensumi/ide-quick-open/lib/common'; import styles from './editor-empty-component.module.less'; diff --git a/packages/startup/entry/sample-modules/editor-title-menu.contribution.ts b/packages/startup/entry/sample-modules/editor-title-menu.contribution.ts index 85e19431cc..c1f4c5b04c 100644 --- a/packages/startup/entry/sample-modules/editor-title-menu.contribution.ts +++ b/packages/startup/entry/sample-modules/editor-title-menu.contribution.ts @@ -1,6 +1,5 @@ // eslint-disable-next-line no-console import { Autowired } from '@opensumi/di'; -import { Disposable, IEventBus } from '@opensumi/ide-core-common'; import { ClientAppContribution, IContextKey, @@ -11,6 +10,7 @@ import { getIcon, } from '@opensumi/ide-core-browser'; import { NextMenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { Disposable, IEventBus } from '@opensumi/ide-core-common'; import { EditorGroupChangeEvent } from '@opensumi/ide-editor/lib/browser'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; diff --git a/packages/startup/entry/sample-modules/menu-bar/menu-bar.contribution.ts b/packages/startup/entry/sample-modules/menu-bar/menu-bar.contribution.ts index bf13bc2f3b..35f3f72162 100644 --- a/packages/startup/entry/sample-modules/menu-bar/menu-bar.contribution.ts +++ b/packages/startup/entry/sample-modules/menu-bar/menu-bar.contribution.ts @@ -1,5 +1,6 @@ import { Injectable } from '@opensumi/di'; import { ComponentContribution, ComponentRegistry, Domain } from '@opensumi/ide-core-browser'; + import { MenuBarView } from './menu-bar.view'; @Injectable() diff --git a/packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx b/packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx index 5805adfeb1..b70ec9d081 100644 --- a/packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx +++ b/packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { MenuBar } from '@opensumi/ide-menu-bar/lib/browser/menu-bar.view'; import * as styles from './menu-bar.module.less'; diff --git a/packages/startup/entry/sample-modules/menu-component.contribution.tsx b/packages/startup/entry/sample-modules/menu-component.contribution.tsx index d71c494cc7..7b1d0b1b3e 100644 --- a/packages/startup/entry/sample-modules/menu-component.contribution.tsx +++ b/packages/startup/entry/sample-modules/menu-component.contribution.tsx @@ -1,4 +1,6 @@ // eslint-disable-next-line no-console +import React from 'react'; + import { Domain } from '@opensumi/ide-core-browser'; import { MenuContribution, @@ -6,7 +8,6 @@ import { MenuId, IComponentMenuItemProps, } from '@opensumi/ide-core-browser/lib/menu/next'; -import React from 'react'; const CustomMenuItem: React.FC = (props) => { const handleClick = () => { diff --git a/packages/startup/entry/sample-modules/select-menu.contribution.ts b/packages/startup/entry/sample-modules/select-menu.contribution.ts index f3ec9f50fd..c15323abf5 100644 --- a/packages/startup/entry/sample-modules/select-menu.contribution.ts +++ b/packages/startup/entry/sample-modules/select-menu.contribution.ts @@ -1,4 +1,5 @@ import React from 'react'; + import { Autowired } from '@opensumi/di'; import { COMMON_COMMANDS, FILE_COMMANDS, getIcon } from '@opensumi/ide-core-browser'; import { IMenuRegistry, ISubmenuItem, MenuId, MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next'; diff --git a/packages/startup/entry/web-lite/app.tsx b/packages/startup/entry/web-lite/app.tsx index 2eaec56ebd..85063852b0 100644 --- a/packages/startup/entry/web-lite/app.tsx +++ b/packages/startup/entry/web-lite/app.tsx @@ -1,17 +1,16 @@ import '@opensumi/ide-i18n/lib/browser'; -import { SlotLocation } from '@opensumi/ide-core-browser'; import * as React from 'react'; +import { SlotLocation } from '@opensumi/ide-core-browser'; + +import { SampleModule } from '../sample-modules'; + import { CommonBrowserModules } from './common-modules'; +import { WebLiteModule } from './lite-module'; import { renderApp } from './render-app'; // 引入公共样式文件 import '@opensumi/ide-core-browser/lib/style/index.less'; - -import { WebLiteModule } from './lite-module'; - -import { SampleModule } from '../sample-modules'; - import './styles.less'; // 视图和slot插槽的对应关系 diff --git a/packages/startup/entry/web-lite/common-modules.ts b/packages/startup/entry/web-lite/common-modules.ts index a2ce07c63d..fcb98bd206 100644 --- a/packages/startup/entry/web-lite/common-modules.ts +++ b/packages/startup/entry/web-lite/common-modules.ts @@ -1,31 +1,32 @@ -import { MainLayoutModule } from '@opensumi/ide-main-layout/lib/browser'; -import { LogModule } from '@opensumi/ide-logs/lib/browser'; -import { MonacoModule } from '@opensumi/ide-monaco/lib/browser'; -import { EditorModule } from '@opensumi/ide-editor/lib/browser'; -import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; +import { CommentsModule } from '@opensumi/ide-comments/lib/browser'; import { ClientCommonModule, BrowserModule } from '@opensumi/ide-core-browser'; -import { QuickOpenModule } from '@opensumi/ide-quick-open/lib/browser'; import { ConstructorOf } from '@opensumi/ide-core-common'; -import { FileTreeNextModule } from '@opensumi/ide-file-tree-next/lib/browser'; -import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; -import { ThemeModule } from '@opensumi/ide-theme/lib/browser'; -import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; -import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; -import { StorageModule } from '@opensumi/ide-storage/lib/browser'; -import { OpenedEditorModule } from '@opensumi/ide-opened-editor/lib/browser'; -import { ExplorerModule } from '@opensumi/ide-explorer/lib/browser'; import { DecorationModule } from '@opensumi/ide-decoration/lib/browser'; -import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; +import { EditorModule } from '@opensumi/ide-editor/lib/browser'; +import { ExplorerModule } from '@opensumi/ide-explorer/lib/browser'; +import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; +import { ExtensionModule } from '@opensumi/ide-extension/lib/browser'; +import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; +import { FileTreeNextModule } from '@opensumi/ide-file-tree-next/lib/browser'; +import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; +import { LogModule } from '@opensumi/ide-logs/lib/browser'; +import { MainLayoutModule } from '@opensumi/ide-main-layout/lib/browser'; import { MenuBarModule } from '@opensumi/ide-menu-bar/lib/browser'; +import { MonacoModule } from '@opensumi/ide-monaco/lib/browser'; +import { OpenedEditorModule } from '@opensumi/ide-opened-editor/lib/browser'; +import { OutlineModule } from '@opensumi/ide-outline/lib/browser'; +import { OutputModule } from '@opensumi/ide-output/lib/browser'; import { OverlayModule } from '@opensumi/ide-overlay/lib/browser'; +import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; +import { QuickOpenModule } from '@opensumi/ide-quick-open/lib/browser'; import { StaticResourceModule } from '@opensumi/ide-static-resource/lib/browser'; -import { WorkspaceEditModule } from '@opensumi/ide-workspace-edit/lib/browser'; -import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; -import { ExtensionModule } from '@opensumi/ide-extension/lib/browser'; -import { CommentsModule } from '@opensumi/ide-comments/lib/browser'; +import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; +import { StorageModule } from '@opensumi/ide-storage/lib/browser'; +import { ThemeModule } from '@opensumi/ide-theme/lib/browser'; import { WebviewModule } from '@opensumi/ide-webview/lib/browser'; -import { OutputModule } from '@opensumi/ide-output/lib/browser'; -import { OutlineModule } from '@opensumi/ide-outline/lib/browser'; +import { WorkspaceEditModule } from '@opensumi/ide-workspace-edit/lib/browser'; +import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; + import { BrowserFileSchemeModule } from './lite-module/overrides/browser-file-scheme'; export const CommonBrowserModules: ConstructorOf[] = [ diff --git a/packages/startup/entry/web-lite/lite-module/extension/index.ts b/packages/startup/entry/web-lite/lite-module/extension/index.ts index d4f958a5bf..81cc9f1d77 100644 --- a/packages/startup/entry/web-lite/lite-module/extension/index.ts +++ b/packages/startup/entry/web-lite/lite-module/extension/index.ts @@ -1,5 +1,6 @@ import { Injectable } from '@opensumi/di'; import { IExtensionNodeClientService, IExtraMetaData, IExtensionMetaData } from '@opensumi/ide-extension/lib/common'; + import { getExtension } from './utils'; const extensionList = [ diff --git a/packages/startup/entry/web-lite/lite-module/extension/utils.ts b/packages/startup/entry/web-lite/lite-module/extension/utils.ts index af5060a128..492c547122 100644 --- a/packages/startup/entry/web-lite/lite-module/extension/utils.ts +++ b/packages/startup/entry/web-lite/lite-module/extension/utils.ts @@ -1,8 +1,9 @@ -import { IExtensionContributions } from '@opensumi/ide-extension/lib/common/vscode/extension'; -import { IExtensionMetaData } from '@opensumi/ide-extension/lib/common'; -import { Uri, asArray } from '@opensumi/ide-core-common'; import { mergeWith } from 'lodash'; + +import { Uri, asArray } from '@opensumi/ide-core-common'; +import { IExtensionMetaData } from '@opensumi/ide-extension/lib/common'; import { ISumiExtensionContributions } from '@opensumi/ide-extension/lib/common/sumi/extension'; +import { IExtensionContributions } from '@opensumi/ide-extension/lib/common/vscode/extension'; export function mergeContributes( contributes: IExtensionContributions | undefined, diff --git a/packages/startup/entry/web-lite/lite-module/file-provider/browser-fs-provider.ts b/packages/startup/entry/web-lite/lite-module/file-provider/browser-fs-provider.ts index 742254ae0e..d84eb758fa 100644 --- a/packages/startup/entry/web-lite/lite-module/file-provider/browser-fs-provider.ts +++ b/packages/startup/entry/web-lite/lite-module/file-provider/browser-fs-provider.ts @@ -1,12 +1,6 @@ -import { - IDiskFileProvider, - FileChangeEvent, - FileStat, - FileType, - FileSystemError, - notEmpty, - isErrnoException, -} from '@opensumi/ide-file-service/lib/common'; +import * as fs from 'fs'; +import * as paths from 'path'; + import { Event, URI, @@ -16,13 +10,20 @@ import { FileChangeType, FileSystemProviderCapabilities, } from '@opensumi/ide-core-common'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import { promisify } from '@opensumi/ide-core-common/lib/browser-fs/util'; import { ensureDir } from '@opensumi/ide-core-common/lib/browser-fs/ensure-dir'; - -import * as fs from 'fs'; -import * as paths from 'path'; +import { promisify } from '@opensumi/ide-core-common/lib/browser-fs/util'; +import { Path } from '@opensumi/ide-core-common/lib/path'; import { BinaryBuffer } from '@opensumi/ide-core-common/lib/utils/buffer'; +import { + IDiskFileProvider, + FileChangeEvent, + FileStat, + FileType, + FileSystemError, + notEmpty, + isErrnoException, +} from '@opensumi/ide-file-service/lib/common'; + import { HttpTreeList } from './http-file.service'; interface BrowserFsProviderOptions { diff --git a/packages/startup/entry/web-lite/lite-module/file-provider/http-file.service.ts b/packages/startup/entry/web-lite/lite-module/file-provider/http-file.service.ts index 554b1735f4..0d7c7b7e9c 100644 --- a/packages/startup/entry/web-lite/lite-module/file-provider/http-file.service.ts +++ b/packages/startup/entry/web-lite/lite-module/file-provider/http-file.service.ts @@ -1,5 +1,6 @@ import { Autowired, Injectable } from '@opensumi/di'; import { URI, Uri, AppConfig } from '@opensumi/ide-core-browser'; + import { AbstractHttpFileService } from './browser-fs-provider'; const mockFiles = [ diff --git a/packages/startup/entry/web-lite/lite-module/file-provider/index.contribution.ts b/packages/startup/entry/web-lite/lite-module/file-provider/index.contribution.ts index 2bda84347f..911db3162d 100644 --- a/packages/startup/entry/web-lite/lite-module/file-provider/index.contribution.ts +++ b/packages/startup/entry/web-lite/lite-module/file-provider/index.contribution.ts @@ -1,7 +1,6 @@ import { Autowired } from '@opensumi/di'; import { Domain, URI, FsProviderContribution, AppConfig, Uri } from '@opensumi/ide-core-browser'; import { Path } from '@opensumi/ide-core-common/lib/path'; -import { BrowserFsProvider, AbstractHttpFileService } from './browser-fs-provider'; import { IFileServiceClient } from '@opensumi/ide-file-service'; import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; import { @@ -10,6 +9,7 @@ import { } from '@opensumi/ide-static-resource/lib/browser/static.definition'; import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { BrowserFsProvider, AbstractHttpFileService } from './browser-fs-provider'; import { ExtFsProvider } from './ext-fs-provider'; import { HttpFileService } from './http-file.service'; diff --git a/packages/startup/entry/web-lite/lite-module/grammar/index.contribution.ts b/packages/startup/entry/web-lite/lite-module/grammar/index.contribution.ts index e2e088d183..3f4fd70930 100644 --- a/packages/startup/entry/web-lite/lite-module/grammar/index.contribution.ts +++ b/packages/startup/entry/web-lite/lite-module/grammar/index.contribution.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import { Autowired } from '@opensumi/di'; -import { Disposable, Domain } from '@opensumi/ide-core-common'; import { ClientAppContribution } from '@opensumi/ide-core-browser'; +import { Disposable, Domain } from '@opensumi/ide-core-common'; import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer'; import { getLanguageById } from '@opensumi/textmate-languages/es/utils'; diff --git a/packages/startup/entry/web-lite/lite-module/index.ts b/packages/startup/entry/web-lite/lite-module/index.ts index 1e35b1533b..2ccf96887d 100644 --- a/packages/startup/entry/web-lite/lite-module/index.ts +++ b/packages/startup/entry/web-lite/lite-module/index.ts @@ -1,9 +1,9 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule, LogServiceForClientPath } from '@opensumi/ide-core-browser'; import { CommonServerPath, KeytarServicePath } from '@opensumi/ide-core-common'; +import { DebugPreferences } from '@opensumi/ide-debug/lib/browser'; import { ExtensionNodeServiceServerPath } from '@opensumi/ide-extension/lib/common'; import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common'; -import { DebugPreferences } from '@opensumi/ide-debug/lib/browser'; import { ExtensionClientService } from './extension'; import { FileProviderContribution } from './file-provider/index.contribution'; @@ -11,12 +11,11 @@ import { TextmateLanguageGrammarContribution } from './grammar/index.contributio // import { LanguageServiceContribution } from './language-service/language.contribution'; // import { LsifServiceImpl } from './language-service/lsif-service'; // import { ILsifService } from './language-service/lsif-service/base'; - import { BrowserCommonServer } from './overrides/browser-common-server'; +import { BrowserFileSchemeModule } from './overrides/browser-file-scheme'; +import { MockCredentialService } from './overrides/mock-credential.service'; import { MockFileSearch } from './overrides/mock-file-search'; import { MockLogServiceForClient } from './overrides/mock-logger'; -import { MockCredentialService } from './overrides/mock-credential.service'; -import { BrowserFileSchemeModule } from './overrides/browser-file-scheme'; @Injectable() export class WebLiteModule extends BrowserModule { diff --git a/packages/startup/entry/web-lite/lite-module/language-service/language.contribution.ts b/packages/startup/entry/web-lite/lite-module/language-service/language.contribution.ts index 19c7c1dfce..4f3bfd5a67 100644 --- a/packages/startup/entry/web-lite/lite-module/language-service/language.contribution.ts +++ b/packages/startup/entry/web-lite/lite-module/language-service/language.contribution.ts @@ -1,12 +1,12 @@ +import type * as vscode from 'vscode'; + import { Autowired } from '@opensumi/di'; -import { Disposable, Domain, URI } from '@opensumi/ide-core-common'; import { ClientAppContribution } from '@opensumi/ide-core-browser'; +import { Disposable, Domain, URI } from '@opensumi/ide-core-common'; import { Position } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; -import type * as vscode from 'vscode'; import { IWorkspaceService } from '@opensumi/ide-workspace'; import { ILsifService } from './lsif-service/base'; - import { SimpleLanguageService } from './simple.service'; @Domain(ClientAppContribution) diff --git a/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/index.ts b/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/index.ts index f34d2402f0..defcd14a15 100644 --- a/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/index.ts +++ b/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/index.ts @@ -1,6 +1,7 @@ -import { Autowired, Injectable } from '@opensumi/di'; import type * as vscode from 'vscode'; +import { Autowired, Injectable } from '@opensumi/di'; + import { ILsifService, ILsifPayload } from './base'; import { LsifClient } from './lsif-client'; diff --git a/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/lsif-client.ts b/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/lsif-client.ts index 767a3a49d8..e1d89c0a9b 100644 --- a/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/lsif-client.ts +++ b/packages/startup/entry/web-lite/lite-module/language-service/lsif-service/lsif-client.ts @@ -1,4 +1,5 @@ import type * as vscode from 'vscode'; + import { Autowired, Injectable } from '@opensumi/di'; import { URI, Uri } from '@opensumi/ide-core-common'; import { Position, Range, Location } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; diff --git a/packages/startup/entry/web-lite/lite-module/language-service/simple.service.ts b/packages/startup/entry/web-lite/lite-module/language-service/simple.service.ts index db8388e81d..2d224b0194 100644 --- a/packages/startup/entry/web-lite/lite-module/language-service/simple.service.ts +++ b/packages/startup/entry/web-lite/lite-module/language-service/simple.service.ts @@ -1,7 +1,15 @@ import * as monaco from '@ali/monaco-editor-core/esm/vs/editor/editor.api'; -import { Autowired, Injectable, ConstructorOf } from '@opensumi/di'; import type * as vscode from 'vscode'; import { DocumentSelector, HoverProvider, CancellationToken, DefinitionProvider, ReferenceProvider } from 'vscode'; +import { DocumentFilter } from 'vscode-languageserver-protocol'; + +import { Autowired, Injectable, ConstructorOf } from '@opensumi/di'; +import { Uri, URI, LRUMap, DisposableCollection } from '@opensumi/ide-core-common'; +import { IEditorDocumentModelService, LanguageSelector } from '@opensumi/ide-editor/lib/browser'; +import { ExtensionDocumentDataManager, IExtHostLanguages } from '@opensumi/ide-extension/lib/common/vscode'; +import { MonacoModelIdentifier, testGlob } from '@opensumi/ide-extension/lib/common/vscode'; +import { fromLanguageSelector } from '@opensumi/ide-extension/lib/common/vscode/converter'; +import { Disposable } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; import { SerializedDocumentFilter, Hover, @@ -11,20 +19,11 @@ import { ReferenceContext, Location, } from '@opensumi/ide-extension/lib/common/vscode/model.api'; -import { ExtensionDocumentDataManager, IExtHostLanguages } from '@opensumi/ide-extension/lib/common/vscode'; -import { Uri, URI, LRUMap, DisposableCollection } from '@opensumi/ide-core-common'; -import { Disposable } from '@opensumi/ide-extension/lib/common/vscode/ext-types'; - +import { ExtHostDocumentData } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc/ext-data.host'; +import { Adapter } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.language'; import { DefinitionAdapter } from '@opensumi/ide-extension/lib/hosted/api/vscode/language/definition'; import { HoverAdapter } from '@opensumi/ide-extension/lib/hosted/api/vscode/language/hover'; import { ReferenceAdapter } from '@opensumi/ide-extension/lib/hosted/api/vscode/language/reference'; -import { Adapter } from '@opensumi/ide-extension/lib/hosted/api/vscode/ext.host.language'; - -import { ExtHostDocumentData } from '@opensumi/ide-extension/lib/hosted/api/vscode/doc/ext-data.host'; -import { IEditorDocumentModelService, LanguageSelector } from '@opensumi/ide-editor/lib/browser'; -import { DocumentFilter } from 'vscode-languageserver-protocol'; -import { fromLanguageSelector } from '@opensumi/ide-extension/lib/common/vscode/converter'; -import { MonacoModelIdentifier, testGlob } from '@opensumi/ide-extension/lib/common/vscode'; import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; @Injectable() diff --git a/packages/startup/entry/web-lite/lite-module/overrides/browser-file-scheme.ts b/packages/startup/entry/web-lite/lite-module/overrides/browser-file-scheme.ts index f1ddb6eb41..a2a0ee6ad1 100644 --- a/packages/startup/entry/web-lite/lite-module/overrides/browser-file-scheme.ts +++ b/packages/startup/entry/web-lite/lite-module/overrides/browser-file-scheme.ts @@ -1,11 +1,10 @@ import { Injectable, Provider } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; - +import { IFileSchemeDocClient } from '@opensumi/ide-file-scheme'; import { FileSystemEditorResourceContribution, FileSystemEditorComponentContribution, } from '@opensumi/ide-file-scheme/lib/browser/file-scheme.contribution'; -import { IFileSchemeDocClient } from '@opensumi/ide-file-scheme'; import { FileSchemeDocClientService } from './doc-client'; diff --git a/packages/startup/entry/web-lite/lite-module/overrides/doc-client.ts b/packages/startup/entry/web-lite/lite-module/overrides/doc-client.ts index b08d50d8a6..f8e1a001e9 100644 --- a/packages/startup/entry/web-lite/lite-module/overrides/doc-client.ts +++ b/packages/startup/entry/web-lite/lite-module/overrides/doc-client.ts @@ -1,9 +1,10 @@ +import * as md5 from 'md5'; +import { Range } from 'vscode-languageserver-types'; + import { Injectable, Autowired } from '@opensumi/di'; -import { IFileSchemeDocClient, IContentChange, ISavingContent } from '@opensumi/ide-file-scheme'; import { IEditorDocumentModelSaveResult, IEditorDocumentEditChange } from '@opensumi/ide-core-browser'; +import { IFileSchemeDocClient, IContentChange, ISavingContent } from '@opensumi/ide-file-scheme'; import { IFileServiceClient, TextDocumentContentChangeEvent } from '@opensumi/ide-file-service'; -import { Range } from 'vscode-languageserver-types'; -import * as md5 from 'md5'; /** * todo: 重写文档保存逻辑 diff --git a/packages/startup/entry/web-lite/lite-module/overrides/mock-storage.ts b/packages/startup/entry/web-lite/lite-module/overrides/mock-storage.ts index 462dd55fac..aac65a2209 100644 --- a/packages/startup/entry/web-lite/lite-module/overrides/mock-storage.ts +++ b/packages/startup/entry/web-lite/lite-module/overrides/mock-storage.ts @@ -1,3 +1,4 @@ +import { Injector } from '@opensumi/di'; import { isUndefinedOrNull, StorageProvider, @@ -7,7 +8,6 @@ import { Disposable, URI, } from '@opensumi/ide-core-common'; -import { Injector } from '@opensumi/di'; let mockedStorage: MockedStorage | null = null; diff --git a/packages/startup/entry/web-lite/modules/view/sample.view.tsx b/packages/startup/entry/web-lite/modules/view/sample.view.tsx index 4427ba8990..bfd531def4 100644 --- a/packages/startup/entry/web-lite/modules/view/sample.view.tsx +++ b/packages/startup/entry/web-lite/modules/view/sample.view.tsx @@ -1,8 +1,8 @@ /* eslint-disable no-console */ import React from 'react'; -import { createFromIconfontCN } from '@opensumi/ide-components/lib/icon/iconfont-cn'; import { Icon } from '@opensumi/ide-components/lib/icon'; +import { createFromIconfontCN } from '@opensumi/ide-components/lib/icon/iconfont-cn'; type IconFontMap = 'icon-javascript' | 'icon-java' | 'icon-shoppingcart' | 'icon-python'; diff --git a/packages/startup/entry/web-lite/render-app.tsx b/packages/startup/entry/web-lite/render-app.tsx index e030348f70..1da1e1ef68 100644 --- a/packages/startup/entry/web-lite/render-app.tsx +++ b/packages/startup/entry/web-lite/render-app.tsx @@ -1,16 +1,18 @@ -import { Injector } from '@opensumi/di'; -import { ClientApp, IClientAppOpts, DEFAULT_WORKSPACE_STORAGE_DIR_NAME, Uri } from '@opensumi/ide-core-browser'; -import { ensureDir } from '@opensumi/ide-core-common/lib/browser-fs/ensure-dir'; import * as BrowserFS from 'browserfs'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; + +import { Injector } from '@opensumi/di'; +import { ClientApp, IClientAppOpts, DEFAULT_WORKSPACE_STORAGE_DIR_NAME, Uri } from '@opensumi/ide-core-browser'; +import { ensureDir } from '@opensumi/ide-core-common/lib/browser-fs/ensure-dir'; +import { IDiskFileProvider } from '@opensumi/ide-file-service/lib/common'; + import { AbstractHttpFileService, BrowserFsProvider, BROWSER_HOME_DIR, } from './lite-module/file-provider/browser-fs-provider'; import { HttpFileService } from './lite-module/file-provider/http-file.service'; -import { IDiskFileProvider } from '@opensumi/ide-file-service/lib/common'; export async function renderApp(opts: IClientAppOpts) { const injector = new Injector(); diff --git a/packages/startup/entry/web/app.tsx b/packages/startup/entry/web/app.tsx index 5b9fccc556..22c0e1cf4a 100644 --- a/packages/startup/entry/web/app.tsx +++ b/packages/startup/entry/web/app.tsx @@ -1,18 +1,20 @@ +// eslint-disable-next-line import/order import { setLocale } from '@opensumi/ide-monaco/lib/browser/monaco-localize'; // 这里建议传实际 preferences 的设置项 // 如果不传则默认会根据 PreferenceScope 的优先级从 LocalStorage 取值 setLocale('zh-CN'); import '@opensumi/ide-i18n'; import '@opensumi/ide-core-browser/lib/style/index.less'; -import { ExpressFileServerModule } from '@opensumi/ide-express-file-server/lib/browser'; import { SlotLocation } from '@opensumi/ide-core-browser'; +import { ExpressFileServerModule } from '@opensumi/ide-express-file-server/lib/browser'; import { defaultConfig } from '@opensumi/ide-main-layout/lib/browser/default-config'; import { RemoteOpenerModule } from '@opensumi/ide-remote-opener/lib/browser'; -import { renderApp } from './render-app'; import { CommonBrowserModules } from '../../src/browser/common-modules'; import { SampleModule } from '../sample-modules'; +import { renderApp } from './render-app'; + import '../styles.less'; renderApp({ diff --git a/packages/startup/entry/web/render-app.tsx b/packages/startup/entry/web/render-app.tsx index cfe688cd2c..c93c1a04cb 100644 --- a/packages/startup/entry/web/render-app.tsx +++ b/packages/startup/entry/web/render-app.tsx @@ -1,9 +1,10 @@ // eslint-disable-next-line no-console console.time('Render'); +import { generate } from 'shortid'; + import { Injector } from '@opensumi/di'; import { ClientApp, IClientAppOpts } from '@opensumi/ide-core-browser'; import { ToolbarActionBasedLayout } from '@opensumi/ide-core-browser/lib/components'; -import { generate } from 'shortid'; const CLIENT_ID = 'W_' + generate(); export async function renderApp(opts: IClientAppOpts) { diff --git a/packages/startup/entry/web/server.ts b/packages/startup/entry/web/server.ts index fc8ebe51ff..ff49695f70 100644 --- a/packages/startup/entry/web/server.ts +++ b/packages/startup/entry/web/server.ts @@ -1,6 +1,7 @@ import { startServer } from '@opensumi/ide-dev-tool/src/server'; import { ExpressFileServerModule } from '@opensumi/ide-express-file-server'; import { OpenerModule } from '@opensumi/ide-remote-opener/lib/node'; + import { CommonNodeModules } from '../../src/node/common-modules'; startServer({ diff --git a/packages/startup/src/browser/common-modules.ts b/packages/startup/src/browser/common-modules.ts index a35c2ebe9f..fb37b84274 100644 --- a/packages/startup/src/browser/common-modules.ts +++ b/packages/startup/src/browser/common-modules.ts @@ -1,52 +1,45 @@ -import { MainLayoutModule } from '@opensumi/ide-main-layout/lib/browser'; -import { MenuBarModule } from '@opensumi/ide-menu-bar/lib/browser'; -import { MonacoModule } from '@opensumi/ide-monaco/lib/browser'; -import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; -import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; +import { ClientAddonModule } from '@opensumi/ide-addons/lib/browser'; +import { CommentsModule } from '@opensumi/ide-comments/lib/browser'; +import { ClientCommonModule, BrowserModule, ConstructorOf } from '@opensumi/ide-core-browser'; +import { DebugModule } from '@opensumi/ide-debug/lib/browser'; +import { DecorationModule } from '@opensumi/ide-decoration/lib/browser'; import { EditorModule } from '@opensumi/ide-editor/lib/browser'; import { ExplorerModule } from '@opensumi/ide-explorer/lib/browser'; -import { FileTreeNextModule } from '@opensumi/ide-file-tree-next/lib/browser'; -import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; -import { StaticResourceModule } from '@opensumi/ide-static-resource/lib/browser'; -import { SearchModule } from '@opensumi/ide-search/lib/browser'; +import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager/lib/browser'; +import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; +import { ExtensionModule } from '@opensumi/ide-extension/lib/browser'; import { FileSchemeModule } from '@opensumi/ide-file-scheme/lib/browser'; -import { OutputModule } from '@opensumi/ide-output/lib/browser'; -import { QuickOpenModule } from '@opensumi/ide-quick-open/lib/browser'; -import { ClientCommonModule, BrowserModule, ConstructorOf } from '@opensumi/ide-core-browser'; -import { ThemeModule } from '@opensumi/ide-theme/lib/browser'; - +import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; +import { FileTreeNextModule } from '@opensumi/ide-file-tree-next/lib/browser'; +import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; +import { LogModule } from '@opensumi/ide-logs/lib/browser'; +import { MainLayoutModule } from '@opensumi/ide-main-layout/lib/browser'; +// import { Terminal2Module } from '@opensumi/ide-terminal2/lib/browser'; +import { MarkdownModule } from '@opensumi/ide-markdown'; +import { MarkersModule } from '@opensumi/ide-markers/lib/browser'; +import { MenuBarModule } from '@opensumi/ide-menu-bar/lib/browser'; +import { MonacoEnhanceModule } from '@opensumi/ide-monaco-enhance/lib/browser/module'; +import { MonacoModule } from '@opensumi/ide-monaco/lib/browser'; import { OpenedEditorModule } from '@opensumi/ide-opened-editor/lib/browser'; import { OutlineModule } from '@opensumi/ide-outline/lib/browser'; -import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; -import { ToolbarModule } from '@opensumi/ide-toolbar/lib/browser'; +import { OutputModule } from '@opensumi/ide-output/lib/browser'; import { OverlayModule } from '@opensumi/ide-overlay/lib/browser'; -import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; -import { StorageModule } from '@opensumi/ide-storage/lib/browser'; +import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; +import { QuickOpenModule } from '@opensumi/ide-quick-open/lib/browser'; import { SCMModule } from '@opensumi/ide-scm/lib/browser'; - -import { MarkersModule } from '@opensumi/ide-markers/lib/browser'; - -// import { Terminal2Module } from '@opensumi/ide-terminal2/lib/browser'; - -import { WebviewModule } from '@opensumi/ide-webview'; -import { MarkdownModule } from '@opensumi/ide-markdown'; - -import { LogModule } from '@opensumi/ide-logs/lib/browser'; -import { WorkspaceEditModule } from '@opensumi/ide-workspace-edit/lib/browser'; -import { ExtensionModule } from '@opensumi/ide-extension/lib/browser'; -import { DecorationModule } from '@opensumi/ide-decoration/lib/browser'; -import { DebugModule } from '@opensumi/ide-debug/lib/browser'; -import { VariableModule } from '@opensumi/ide-variable/lib/browser'; -import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; -import { MonacoEnhanceModule } from '@opensumi/ide-monaco-enhance/lib/browser/module'; - -import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager/lib/browser'; -import { TerminalNextModule } from '@opensumi/ide-terminal-next/lib/browser'; -import { CommentsModule } from '@opensumi/ide-comments/lib/browser'; - -import { ClientAddonModule } from '@opensumi/ide-addons/lib/browser'; +import { SearchModule } from '@opensumi/ide-search/lib/browser'; +import { StaticResourceModule } from '@opensumi/ide-static-resource/lib/browser'; +import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; +import { StorageModule } from '@opensumi/ide-storage/lib/browser'; import { TaskModule } from '@opensumi/ide-task/lib/browser'; +import { TerminalNextModule } from '@opensumi/ide-terminal-next/lib/browser'; import { TestingModule } from '@opensumi/ide-testing/lib/browser'; +import { ThemeModule } from '@opensumi/ide-theme/lib/browser'; +import { ToolbarModule } from '@opensumi/ide-toolbar/lib/browser'; +import { VariableModule } from '@opensumi/ide-variable/lib/browser'; +import { WebviewModule } from '@opensumi/ide-webview'; +import { WorkspaceEditModule } from '@opensumi/ide-workspace-edit/lib/browser'; +import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; export const CommonBrowserModules: ConstructorOf[] = [ MainLayoutModule, diff --git a/packages/startup/src/browser/editor-bottom-example.tsx b/packages/startup/src/browser/editor-bottom-example.tsx index 7ece2e3e82..514d4b733f 100644 --- a/packages/startup/src/browser/editor-bottom-example.tsx +++ b/packages/startup/src/browser/editor-bottom-example.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; export const ExampleEditorBottomWidget: ReactEditorComponent = ({ resource }) => ( diff --git a/packages/startup/src/browser/index.ts b/packages/startup/src/browser/index.ts index cbf38a4574..8922090faa 100644 --- a/packages/startup/src/browser/index.ts +++ b/packages/startup/src/browser/index.ts @@ -1,5 +1,6 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { StartupContribution } from './startup.contribution'; @Injectable() diff --git a/packages/startup/src/browser/startup.contribution.ts b/packages/startup/src/browser/startup.contribution.ts index 9327736128..93e0de470a 100644 --- a/packages/startup/src/browser/startup.contribution.ts +++ b/packages/startup/src/browser/startup.contribution.ts @@ -1,6 +1,5 @@ /* eslint-disable no-console */ import { Autowired } from '@opensumi/di'; -import { CommandContribution, CommandRegistry, IEventBus, CommandService } from '@opensumi/ide-core-common'; import { KeybindingContribution, KeybindingRegistry, @@ -11,14 +10,16 @@ import { createToolbarActionBtn, createToolbarActionSelect, } from '@opensumi/ide-core-browser'; -import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; +import { getIcon } from '@opensumi/ide-core-browser'; import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; +import { CommandContribution, CommandRegistry, IEventBus, CommandService } from '@opensumi/ide-core-common'; +import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; +import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { ISCMProvider } from '@opensumi/ide-scm'; -import { getIcon } from '@opensumi/ide-core-browser'; -import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; + import { ExampleEditorBottomWidget } from './editor-bottom-example'; import { ExamplePopover } from './exmaple-popover'; diff --git a/packages/startup/src/node/common-modules.ts b/packages/startup/src/node/common-modules.ts index 3f312399dd..52cc78f30c 100644 --- a/packages/startup/src/node/common-modules.ts +++ b/packages/startup/src/node/common-modules.ts @@ -1,17 +1,15 @@ +import { AddonsModule } from '@opensumi/ide-addons/lib/node'; import { NodeModule, ConstructorOf } from '@opensumi/ide-core-node'; import { ServerCommonModule } from '@opensumi/ide-core-node'; +import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager'; +import { ExtensionModule } from '@opensumi/ide-extension/lib/node'; +import { FileSchemeNodeModule } from '@opensumi/ide-file-scheme/lib/node'; +import { FileSearchModule } from '@opensumi/ide-file-search'; import { FileServiceModule } from '@opensumi/ide-file-service/lib/node'; - +import { LogServiceModule } from '@opensumi/ide-logs/lib/node'; import { ProcessModule } from '@opensumi/ide-process'; - -import { FileSearchModule } from '@opensumi/ide-file-search'; import { SearchModule } from '@opensumi/ide-search'; import { TerminalNodePtyModule } from '@opensumi/ide-terminal-next/lib/node'; -import { LogServiceModule } from '@opensumi/ide-logs/lib/node'; -import { ExtensionModule } from '@opensumi/ide-extension/lib/node'; -import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager'; -import { FileSchemeNodeModule } from '@opensumi/ide-file-scheme/lib/node'; -import { AddonsModule } from '@opensumi/ide-addons/lib/node'; export const CommonNodeModules: ConstructorOf[] = [ ServerCommonModule, diff --git a/packages/startup/webpack.lite.config.js b/packages/startup/webpack.lite.config.js index 1e87bc3a8f..2d74a7c82d 100644 --- a/packages/startup/webpack.lite.config.js +++ b/packages/startup/webpack.lite.config.js @@ -1,11 +1,11 @@ const path = require('path'); -const { createWebpackConfig } = require('@opensumi/ide-dev-tool/src/webpack'); -const webpack = require('webpack'); const CopyPlugin = require('copy-webpack-plugin'); +const webpack = require('webpack'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const baseDir = path.join(__dirname, 'entry/web-lite'); +const { createWebpackConfig } = require('@opensumi/ide-dev-tool/src/webpack'); module.exports = createWebpackConfig(baseDir, path.join(baseDir, 'app.tsx'), { mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', resolve: { diff --git a/packages/startup/webpack.standard.config.js b/packages/startup/webpack.standard.config.js index 42e064d7be..76109e599c 100644 --- a/packages/startup/webpack.standard.config.js +++ b/packages/startup/webpack.standard.config.js @@ -1,6 +1,7 @@ -const { createWebpackConfig } = require('@opensumi/ide-dev-tool/src/webpack'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; +const { createWebpackConfig } = require('@opensumi/ide-dev-tool/src/webpack'); + module.exports = createWebpackConfig(__dirname, require('path').join(__dirname, 'entry/web/app.tsx'), { mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', plugins: [].concat(process.env.analysis ? new BundleAnalyzerPlugin() : null).filter(Boolean), diff --git a/packages/static-resource/__test__/browser/static.service.test.ts b/packages/static-resource/__test__/browser/static.service.test.ts index 99d2ae1410..905343bbd5 100644 --- a/packages/static-resource/__test__/browser/static.service.test.ts +++ b/packages/static-resource/__test__/browser/static.service.test.ts @@ -1,6 +1,7 @@ +import { URI } from '@opensumi/ide-core-common'; import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { StaticResourceModule, StaticResourceService } from '../../src/browser/index'; -import { URI } from '@opensumi/ide-core-common'; describe('static-resource test', () => { const injector = createBrowserInjector([StaticResourceModule]); diff --git a/packages/static-resource/src/browser/index.ts b/packages/static-resource/src/browser/index.ts index 8835cf6a43..aa41dfca80 100644 --- a/packages/static-resource/src/browser/index.ts +++ b/packages/static-resource/src/browser/index.ts @@ -1,5 +1,6 @@ import { Injectable, Provider, Autowired } from '@opensumi/di'; import { BrowserModule, Domain, ContributionProvider, ClientAppContribution } from '@opensumi/ide-core-browser'; + import { StaticResourceService, StaticResourceContribution } from './static.definition'; import { StaticResourceServiceImpl } from './static.service'; export * from './static.definition'; diff --git a/packages/static-resource/src/browser/static.service.ts b/packages/static-resource/src/browser/static.service.ts index 8b26fa8049..14d8cad513 100644 --- a/packages/static-resource/src/browser/static.service.ts +++ b/packages/static-resource/src/browser/static.service.ts @@ -1,6 +1,7 @@ -import { StaticResourceService, IStaticResourceProvider } from './static.definition'; -import { URI } from '@opensumi/ide-core-browser'; import { Injectable } from '@opensumi/di'; +import { URI } from '@opensumi/ide-core-browser'; + +import { StaticResourceService, IStaticResourceProvider } from './static.definition'; @Injectable() export class StaticResourceServiceImpl implements StaticResourceService { diff --git a/packages/status-bar/__tests__/browser/status-bar.service.test.ts b/packages/status-bar/__tests__/browser/status-bar.service.test.ts index f23598d2ce..0f317d756c 100644 --- a/packages/status-bar/__tests__/browser/status-bar.service.test.ts +++ b/packages/status-bar/__tests__/browser/status-bar.service.test.ts @@ -1,12 +1,12 @@ -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { IStatusBarService, StatusBarAlignment, StatusBarEntry } from '@opensumi/ide-core-browser/lib/services'; -import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; import { CommandRegistry, IContextKeyService, ILoggerManagerClient } from '@opensumi/ide-core-browser'; -import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; -import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { IStatusBarService, StatusBarAlignment, StatusBarEntry } from '@opensumi/ide-core-browser/lib/services'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { MockInjector, mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; +import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; describe('template test', () => { const EN_CODING_ENTRY_ID = 'encoding'; diff --git a/packages/status-bar/src/browser/index.ts b/packages/status-bar/src/browser/index.ts index 893337fc92..521ed75103 100644 --- a/packages/status-bar/src/browser/index.ts +++ b/packages/status-bar/src/browser/index.ts @@ -1,10 +1,11 @@ import { Provider, Injectable } from '@opensumi/di'; -import { StatusBarView } from './status-bar.view'; -import { StatusBarService } from './status-bar.service'; import { BrowserModule } from '@opensumi/ide-core-browser'; +import { IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; + import { StatusBarContribution } from './status-bar.contribution'; // import { IStatusBarService } from '../common'; -import { IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; +import { StatusBarService } from './status-bar.service'; +import { StatusBarView } from './status-bar.view'; @Injectable() export class StatusBarModule extends BrowserModule { diff --git a/packages/status-bar/src/browser/status-bar-item.view.tsx b/packages/status-bar/src/browser/status-bar-item.view.tsx index 786888d78f..dae7fc55d8 100644 --- a/packages/status-bar/src/browser/status-bar-item.view.tsx +++ b/packages/status-bar/src/browser/status-bar-item.view.tsx @@ -1,14 +1,16 @@ import cls from 'classnames'; import React from 'react'; -import { IThemeService } from '@opensumi/ide-theme'; + +import { Button, Popover, PopoverPosition, PopoverTriggerType } from '@opensumi/ide-components'; import { getExternalIcon } from '@opensumi/ide-core-browser'; -import { IThemeColor, isThemeColor, CommandService, StatusBarHoverCommand } from '@opensumi/ide-core-common'; -import { StatusBarEntry, StatusBarHoverContent } from '@opensumi/ide-core-browser/lib/services'; +import { parseLabel, LabelPart, LabelIcon, replaceLocalizePlaceholder } from '@opensumi/ide-core-browser'; import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; +import { StatusBarEntry, StatusBarHoverContent } from '@opensumi/ide-core-browser/lib/services'; +import { IThemeColor, isThemeColor, CommandService, StatusBarHoverCommand } from '@opensumi/ide-core-common'; +import { IThemeService } from '@opensumi/ide-theme'; import styles from './status-bar.module.less'; -import { parseLabel, LabelPart, LabelIcon, replaceLocalizePlaceholder } from '@opensumi/ide-core-browser'; -import { Button, Popover, PopoverPosition, PopoverTriggerType } from '@opensumi/ide-components'; + interface StatusBarPopoverContent { contents: StatusBarHoverContent[]; diff --git a/packages/status-bar/src/browser/status-bar.contribution.ts b/packages/status-bar/src/browser/status-bar.contribution.ts index 0a8da96b23..8e25af2138 100644 --- a/packages/status-bar/src/browser/status-bar.contribution.ts +++ b/packages/status-bar/src/browser/status-bar.contribution.ts @@ -4,9 +4,10 @@ import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-bro import { StatusBarEntry, StatusBarCommand } from '@opensumi/ide-core-browser/lib/services'; import { CommandRegistry } from '@opensumi/ide-core-common'; -import { StatusBarView } from './status-bar.view'; import { IStatusBarService } from '../common'; +import { StatusBarView } from './status-bar.view'; + @Domain(ComponentContribution, CommandContribution) export class StatusBarContribution implements ComponentContribution, CommandContribution { @Autowired(IStatusBarService) diff --git a/packages/status-bar/src/browser/status-bar.service.ts b/packages/status-bar/src/browser/status-bar.service.ts index b8dce656ec..f54828c819 100644 --- a/packages/status-bar/src/browser/status-bar.service.ts +++ b/packages/status-bar/src/browser/status-bar.service.ts @@ -1,6 +1,10 @@ import { observable, computed, action } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; import { AppConfig, Disposable, IContextKeyService, isUndefined, IDisposable } from '@opensumi/ide-core-browser'; +import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; +import { AbstractMenuService, IMenu, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; import { IStatusBarService, StatusBarEntry, @@ -10,9 +14,6 @@ import { StatusBarState, } from '@opensumi/ide-core-browser/lib/services'; import { CommandService, DisposableCollection, memoize } from '@opensumi/ide-core-common'; -import { AbstractMenuService, IMenu, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; -import { LayoutState, LAYOUT_STATE } from '@opensumi/ide-core-browser/lib/layout/layout-state'; @Injectable() export class StatusBarService extends Disposable implements IStatusBarService { diff --git a/packages/status-bar/src/browser/status-bar.view.tsx b/packages/status-bar/src/browser/status-bar.view.tsx index f868c8fa5c..40ab15add3 100644 --- a/packages/status-bar/src/browser/status-bar.view.tsx +++ b/packages/status-bar/src/browser/status-bar.view.tsx @@ -1,11 +1,14 @@ -import React from 'react'; +import cls from 'classnames'; import { observer } from 'mobx-react-lite'; -import styles from './status-bar.module.less'; +import React from 'react'; + +import { generateCtxMenu, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; -import { StatusBarItem } from './status-bar-item.view'; import { IStatusBarService } from '@opensumi/ide-core-browser/lib/services'; -import cls from 'classnames'; -import { generateCtxMenu, ICtxMenuRenderer } from '@opensumi/ide-core-browser/lib/menu/next'; + +import { StatusBarItem } from './status-bar-item.view'; +import styles from './status-bar.module.less'; + export const StatusBarView = React.memo( observer(() => { diff --git a/packages/storage/__tests__/browser/index.test.ts b/packages/storage/__tests__/browser/index.test.ts index 829f425106..0f50de9f71 100644 --- a/packages/storage/__tests__/browser/index.test.ts +++ b/packages/storage/__tests__/browser/index.test.ts @@ -1,4 +1,19 @@ +import path from 'path'; + +import * as fs from 'fs-extra'; +import temp from 'temp'; + import { Injectable, Injector } from '@opensumi/di'; +import { URI, FileUri, AppConfig, Disposable, STORAGE_SCHEMA, ILoggerManagerClient } from '@opensumi/ide-core-node'; +import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; +import { IFileServiceClient, IDiskFileProvider } from '@opensumi/ide-file-service'; +import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; +import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; +import { Storage } from '@opensumi/ide-storage/lib/browser/storage'; +import { DatabaseStorageContribution } from '@opensumi/ide-storage/lib/browser/storage.contribution'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { StorageModule } from '../../src/browser'; import { IStorageServer, IStoragePathServer, @@ -6,18 +21,6 @@ import { IWorkspaceStorageServer, IGlobalStorageServer, } from '../../src/common'; -import { URI, FileUri, AppConfig, Disposable, STORAGE_SCHEMA, ILoggerManagerClient } from '@opensumi/ide-core-node'; -import temp from 'temp'; -import path from 'path'; -import * as fs from 'fs-extra'; -import { IFileServiceClient, IDiskFileProvider } from '@opensumi/ide-file-service'; -import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client'; -import { DiskFileSystemProvider } from '@opensumi/ide-file-service/lib/node/disk-file-system.provider'; -import { createBrowserInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; -import { StorageModule } from '../../src/browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { DatabaseStorageContribution } from '@opensumi/ide-storage/lib/browser/storage.contribution'; -import { Storage } from '@opensumi/ide-storage/lib/browser/storage'; const track = temp.track(); const root = FileUri.create(fs.realpathSync(temp.mkdirSync('node-fs-root'))); diff --git a/packages/storage/src/browser/index.ts b/packages/storage/src/browser/index.ts index 8cfc9cc8d0..7f429c10a9 100644 --- a/packages/storage/src/browser/index.ts +++ b/packages/storage/src/browser/index.ts @@ -1,8 +1,10 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { DatabaseStorageContribution } from './storage.contribution'; + import { IStoragePathServer, IGlobalStorageServer, IWorkspaceStorageServer } from '../common'; + import { StoragePathServer } from './storage-path'; +import { DatabaseStorageContribution } from './storage.contribution'; import { GlobalStorageServer, WorkspaceStorageServer } from './storage.service'; @Injectable() diff --git a/packages/storage/src/browser/storage-path.ts b/packages/storage/src/browser/storage-path.ts index 307706eca3..8bceac334b 100644 --- a/packages/storage/src/browser/storage-path.ts +++ b/packages/storage/src/browser/storage-path.ts @@ -1,8 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IStoragePathServer } from '../common'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { StoragePaths, Deferred, URI, isWindows, ILogger } from '@opensumi/ide-core-common'; import { Path } from '@opensumi/ide-core-common/lib/path'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; + +import { IStoragePathServer } from '../common'; @Injectable() export class StoragePathServer implements IStoragePathServer { diff --git a/packages/storage/src/browser/storage.contribution.ts b/packages/storage/src/browser/storage.contribution.ts index 0d62baa20d..cc56722e64 100644 --- a/packages/storage/src/browser/storage.contribution.ts +++ b/packages/storage/src/browser/storage.contribution.ts @@ -1,3 +1,4 @@ +import { Autowired } from '@opensumi/di'; import { Domain, StorageResolverContribution, @@ -7,11 +8,13 @@ import { STORAGE_SCHEMA, AppConfig, } from '@opensumi/ide-core-browser'; -import { Autowired } from '@opensumi/di'; -import { Storage } from './storage'; -import { IStorageServer, IWorkspaceStorageServer, IGlobalStorageServer } from '../common'; import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { IStorageServer, IWorkspaceStorageServer, IGlobalStorageServer } from '../common'; + +import { Storage } from './storage'; + + @Domain(StorageResolverContribution, ClientAppContribution) export class DatabaseStorageContribution implements StorageResolverContribution, ClientAppContribution { @Autowired(IWorkspaceStorageServer) diff --git a/packages/storage/src/browser/storage.service.ts b/packages/storage/src/browser/storage.service.ts index 87c546b27e..288fb59ddb 100644 --- a/packages/storage/src/browser/storage.service.ts +++ b/packages/storage/src/browser/storage.service.ts @@ -1,8 +1,9 @@ -import { IStorageServer, IUpdateRequest, IStoragePathServer, StorageChange, StringKeyToAnyValue } from '../common'; import { Injectable, Autowired } from '@opensumi/di'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { Deferred, URI, Emitter, Event, ILogger } from '@opensumi/ide-core-common'; import { Path } from '@opensumi/ide-core-common/lib/path'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; + +import { IStorageServer, IUpdateRequest, IStoragePathServer, StorageChange, StringKeyToAnyValue } from '../common'; @Injectable() export abstract class StorageServer implements IStorageServer { diff --git a/packages/storage/src/browser/storage.ts b/packages/storage/src/browser/storage.ts index 46146a9623..bd730276ff 100644 --- a/packages/storage/src/browser/storage.ts +++ b/packages/storage/src/browser/storage.ts @@ -1,3 +1,4 @@ +import { AppConfig } from '@opensumi/ide-core-browser'; import { getDebugLogger, IStorage, @@ -8,8 +9,8 @@ import { DisposableCollection, } from '@opensumi/ide-core-common'; import { IWorkspaceService } from '@opensumi/ide-workspace'; + import { IStorageServer, IUpdateRequest } from '../common'; -import { AppConfig } from '@opensumi/ide-core-browser'; enum StorageState { None, diff --git a/packages/task/__test__/browser/task.service.test.ts b/packages/task/__test__/browser/task.service.test.ts index 99c75de1c2..28ce63020d 100644 --- a/packages/task/__test__/browser/task.service.test.ts +++ b/packages/task/__test__/browser/task.service.test.ts @@ -1,22 +1,25 @@ import path from 'path'; -import { ITaskService, ITaskSystem, ITaskProvider } from '@opensumi/ide-task/lib/common'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; + +import { PreferenceService, IJSONSchemaRegistry, ISchemaStore, QuickOpenService } from '@opensumi/ide-core-browser'; +import { FileUri, Uri } from '@opensumi/ide-core-common'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; +import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/src/browser/doc-model/main'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { LayoutService } from '@opensumi/ide-main-layout/lib/browser/layout.service'; import { OutputPreferences } from '@opensumi/ide-output/lib/browser/output-preference'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { FileUri, Uri } from '@opensumi/ide-core-common'; -import { MonacoService } from '../../../monaco'; -import { PreferenceService, IJSONSchemaRegistry, ISchemaStore, QuickOpenService } from '@opensumi/ide-core-browser'; -import { SchemaRegistry, SchemaStore } from '../../../monaco/src/browser/schema-registry'; +import { MockQuickOpenService } from '@opensumi/ide-quick-open/lib/common/mocks/quick-open.service'; import { taskSchemaUri, schema } from '@opensumi/ide-task/lib/browser/task.schema'; import { TaskService } from '@opensumi/ide-task/lib/browser/task.service'; import { TerminalTaskSystem } from '@opensumi/ide-task/lib/browser/terminal-task-system'; -import { MockQuickOpenService } from '@opensumi/ide-quick-open/lib/common/mocks/quick-open.service'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/src/browser'; -import { EditorDocumentModelServiceImpl } from '@opensumi/ide-editor/src/browser/doc-model/main'; +import { ITaskService, ITaskSystem, ITaskProvider } from '@opensumi/ide-task/lib/common'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MonacoService } from '../../../monaco'; import { MockedMonacoService } from '../../../monaco/__mocks__/monaco.service.mock'; +import { SchemaRegistry, SchemaStore } from '../../../monaco/src/browser/schema-registry'; + const preferences: Map = new Map(); diff --git a/packages/task/__test__/browser/terminal-task-system.test.ts b/packages/task/__test__/browser/terminal-task-system.test.ts index 8b0e0effc9..b385c4cb5b 100644 --- a/packages/task/__test__/browser/terminal-task-system.test.ts +++ b/packages/task/__test__/browser/terminal-task-system.test.ts @@ -1,7 +1,8 @@ +import { TerminalTaskSystem } from '@opensumi/ide-task/lib/browser/terminal-task-system'; import { ITaskSystem } from '@opensumi/ide-task/lib/common'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { TerminalTaskSystem } from '@opensumi/ide-task/lib/browser/terminal-task-system'; describe('TerminalTaskSystem Test Suite', () => { const injector: MockInjector = createBrowserInjector([]); diff --git a/packages/task/src/browser/index.ts b/packages/task/src/browser/index.ts index c98acaa6d8..649e87991a 100644 --- a/packages/task/src/browser/index.ts +++ b/packages/task/src/browser/index.ts @@ -1,11 +1,13 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { TaskContribution } from './task.contribution'; +import { FolderPreferenceProvider } from '@opensumi/ide-preferences/lib/browser/folder-preference-provider'; + import { ITaskService, ITaskSystem } from '../common'; -import { TaskService } from './task.service'; + import { TaskPreferencesContribution } from './task-preferences.contribution'; -import { FolderPreferenceProvider } from '@opensumi/ide-preferences/lib/browser/folder-preference-provider'; import { TaskFolderPreferenceProvider } from './task-preferences.provider'; +import { TaskContribution } from './task.contribution'; +import { TaskService } from './task.service'; import { TerminalTaskSystem } from './terminal-task-system'; @Injectable() diff --git a/packages/task/src/browser/parser.ts b/packages/task/src/browser/parser.ts index a00fa05ebb..b91e976abd 100644 --- a/packages/task/src/browser/parser.ts +++ b/packages/task/src/browser/parser.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IProblemReporter, getProblemPatternFn, getProblemMatcherFn } from './task-config'; import { ProblemMatcher, ApplyToKind, @@ -29,6 +28,8 @@ import { deepClone, } from '@opensumi/ide-core-common'; +import { IProblemReporter, getProblemPatternFn, getProblemMatcherFn } from './task-config'; + export const enum ValidationState { OK = 0, Info = 1, diff --git a/packages/task/src/browser/problem-collector.ts b/packages/task/src/browser/problem-collector.ts index fd4ac08d88..b27ef6d26a 100644 --- a/packages/task/src/browser/problem-collector.ts +++ b/packages/task/src/browser/problem-collector.ts @@ -16,9 +16,10 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/task/src/node/task-problem-collector.ts -import { StartStopLineMatcher, WatchModeLineMatcher, AbstractLineMatcher } from './problem-line-matcher'; import { ProblemMatcher, ProblemMatch } from '@opensumi/ide-core-common'; +import { StartStopLineMatcher, WatchModeLineMatcher, AbstractLineMatcher } from './problem-line-matcher'; + export function isWatchModeWatcher(matcher: ProblemMatcher): boolean { return !!matcher.watching; } diff --git a/packages/task/src/browser/problem-line-matcher.ts b/packages/task/src/browser/problem-line-matcher.ts index 196d7bbdc5..3d62a47859 100644 --- a/packages/task/src/browser/problem-line-matcher.ts +++ b/packages/task/src/browser/problem-line-matcher.ts @@ -16,6 +16,8 @@ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/task/src/node/task-abstract-line-matcher.ts +import { Diagnostic, DiagnosticSeverity, Range } from 'vscode'; + import { isWindows, ProblemLocationKind, @@ -28,7 +30,6 @@ import { URI, WatchingPattern, } from '@opensumi/ide-core-common'; -import { Diagnostic, DiagnosticSeverity, Range } from 'vscode'; const endOfLine: string = isWindows ? '\r\n' : '\n'; diff --git a/packages/task/src/browser/task-config.ts b/packages/task/src/browser/task-config.ts index cea4686450..506cd2c8eb 100644 --- a/packages/task/src/browser/task-config.ts +++ b/packages/task/src/browser/task-config.ts @@ -24,8 +24,10 @@ import { NamedProblemPattern, } from '@opensumi/ide-core-common'; import { Platform } from '@opensumi/ide-core-common/lib/platform'; + import { IWorkspaceFolder } from '../common'; import * as TaskTypes from '../common/task'; + import { IProblemReporterBase, ValidationStatus, ProblemMatcherParser, Config } from './parser'; export interface CommandOptionsConfig { diff --git a/packages/task/src/browser/task-preferences.contribution.ts b/packages/task/src/browser/task-preferences.contribution.ts index cebe065099..713af0c6a8 100644 --- a/packages/task/src/browser/task-preferences.contribution.ts +++ b/packages/task/src/browser/task-preferences.contribution.ts @@ -1,4 +1,5 @@ import { PreferenceContribution, PreferenceSchema, Domain, PreferenceConfiguration } from '@opensumi/ide-core-browser'; + import { taskPreferencesSchema } from './task-preferences'; @Domain(PreferenceContribution, PreferenceConfiguration) diff --git a/packages/task/src/browser/task-preferences.ts b/packages/task/src/browser/task-preferences.ts index 09b0dc78e7..49084a1ea2 100644 --- a/packages/task/src/browser/task-preferences.ts +++ b/packages/task/src/browser/task-preferences.ts @@ -1,4 +1,5 @@ import { PreferenceSchema } from '@opensumi/ide-core-browser'; + import { taskSchemaUri } from './task.schema'; export const taskPreferencesSchema: PreferenceSchema = { diff --git a/packages/task/src/browser/task.contribution.ts b/packages/task/src/browser/task.contribution.ts index 398b624d04..9729a84622 100644 --- a/packages/task/src/browser/task.contribution.ts +++ b/packages/task/src/browser/task.contribution.ts @@ -7,7 +7,9 @@ import { JsonSchemaContribution, IJSONSchemaRegistry, } from '@opensumi/ide-core-browser'; + import { ITaskService } from '../common'; + import { schema, taskSchemaUri } from './task.schema'; @Domain(CommandContribution, JsonSchemaContribution) diff --git a/packages/task/src/browser/task.service.ts b/packages/task/src/browser/task.service.ts index 4a7a4bfab3..cca282e51d 100644 --- a/packages/task/src/browser/task.service.ts +++ b/packages/task/src/browser/task.service.ts @@ -1,11 +1,4 @@ import { Autowired, Injectable } from '@opensumi/di'; -import { - ITaskDefinitionRegistry, - IProblemMatcherRegistry, - Event, - IProblemPatternRegistry, - Emitter, -} from '@opensumi/ide-core-common'; import { Disposable, Uri, @@ -20,10 +13,19 @@ import { isString, Mode, } from '@opensumi/ide-core-browser'; -import { ITaskService, WorkspaceFolderTaskResult, ITaskProvider, ITaskSystem, ITaskSummary } from '../common'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; +import { + ITaskDefinitionRegistry, + IProblemMatcherRegistry, + Event, + IProblemPatternRegistry, + Emitter, +} from '@opensumi/ide-core-common'; +import { platform } from '@opensumi/ide-core-common/lib/platform'; import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel'; +import { OutputService } from '@opensumi/ide-output/lib/browser/output.service'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { ITaskService, WorkspaceFolderTaskResult, ITaskProvider, ITaskSystem, ITaskSummary } from '../common'; import { ConfiguringTask, TaskSet, @@ -34,9 +36,10 @@ import { KeyedTaskIdentifier, TaskEvent, } from '../common/task'; -import { parse, IProblemReporter, createCustomTask } from './task-config'; -import { platform } from '@opensumi/ide-core-common/lib/platform'; + import { ValidationState, ValidationStatus } from './parser'; +import { parse, IProblemReporter, createCustomTask } from './task-config'; + class ProblemReporter implements IProblemReporter { private _validationStatus: ValidationStatus; diff --git a/packages/task/src/browser/terminal-task-system.ts b/packages/task/src/browser/terminal-task-system.ts index 96e8a45a43..139254f917 100644 --- a/packages/task/src/browser/terminal-task-system.ts +++ b/packages/task/src/browser/terminal-task-system.ts @@ -14,6 +14,15 @@ import { ProblemMatch, ProblemMatchData, } from '@opensumi/ide-core-common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; +import { + TerminalOptions, + ITerminalController, + ITerminalGroupViewService, + ITerminalClient, + ITerminalService, +} from '@opensumi/ide-terminal-next/lib/common'; +import { IVariableResolverService } from '@opensumi/ide-variable'; import { ITaskSystem, @@ -32,17 +41,11 @@ import { TaskEventKind, RuntimeType, } from '../common/task'; -import { - TerminalOptions, - ITerminalController, - ITerminalGroupViewService, - ITerminalClient, - ITerminalService, -} from '@opensumi/ide-terminal-next/lib/common'; import { CustomTask } from '../common/task'; -import { IVariableResolverService } from '@opensumi/ide-variable'; + + import { ProblemCollector } from './problem-collector'; -import { Path } from '@opensumi/ide-core-common/lib/path'; + enum TaskStatus { PROCESS_INIT, diff --git a/packages/task/src/common/index.ts b/packages/task/src/common/index.ts index 027573c41e..2c3c614b99 100644 --- a/packages/task/src/common/index.ts +++ b/packages/task/src/common/index.ts @@ -1,10 +1,12 @@ import { IJSONSchemaMap } from '@opensumi/ide-core-browser'; import { IDisposable, Event, URI, TaskIdentifier, Uri, Deferred } from '@opensumi/ide-core-common'; -import { Task, ConfiguringTask, ContributedTask, TaskSet, KeyedTaskIdentifier, TaskEvent } from './task'; import { UriComponents } from '@opensumi/ide-editor'; +import { TerminalOptions } from '@opensumi/ide-terminal-next/lib/common'; + // eslint-disable-next-line import/no-restricted-paths import type { ProblemCollector } from '../browser/problem-collector'; -import { TerminalOptions } from '@opensumi/ide-terminal-next/lib/common'; + +import { Task, ConfiguringTask, ContributedTask, TaskSet, KeyedTaskIdentifier, TaskEvent } from './task'; // eslint-disable-next-line @typescript-eslint/no-empty-interface interface TaskMap {} diff --git a/packages/task/src/common/task.ts b/packages/task/src/common/task.ts index 67bd4c3d7d..303a37f348 100644 --- a/packages/task/src/common/task.ts +++ b/packages/task/src/common/task.ts @@ -3,9 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; import { IJSONSchemaMap, isString, basename, URI, ProblemMatcher, ProblemMatch } from '@opensumi/ide-core-common'; import { UriComponents } from '@opensumi/ide-editor'; -import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; + import { IWorkspaceFolder } from './index'; interface JSONType { diff --git a/packages/terminal-next/__tests__/browser/client.test.ts b/packages/terminal-next/__tests__/browser/client.test.ts index 50c439c300..ef2683e5f9 100644 --- a/packages/terminal-next/__tests__/browser/client.test.ts +++ b/packages/terminal-next/__tests__/browser/client.test.ts @@ -1,19 +1,24 @@ /** * Terminal Client Test */ -import WebSocket from 'ws'; -import httpProxy from 'http-proxy'; -import { Disposable, FileUri, URI } from '@opensumi/ide-core-common'; -import { createProxyServer, createWsServer, resetPort } from './proxy'; -import { defaultName } from './mock.service'; -import { ITerminalClientFactory, ITerminalGroupViewService, ITerminalClient, IWidget } from '../../src/common'; -import { delay } from './utils'; -import { injector } from './inject'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; import os from 'os'; import path from 'path'; + import * as fs from 'fs-extra'; +import httpProxy from 'http-proxy'; +import WebSocket from 'ws'; + +import { Disposable, FileUri, URI } from '@opensumi/ide-core-common'; import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { ITerminalClientFactory, ITerminalGroupViewService, ITerminalClient, IWidget } from '../../src/common'; + +import { injector } from './inject'; +import { defaultName } from './mock.service'; +import { createProxyServer, createWsServer, resetPort } from './proxy'; +import { delay } from './utils'; + function createDOMContainer() { const div = document.createElement('div'); diff --git a/packages/terminal-next/__tests__/browser/controller.test.ts b/packages/terminal-next/__tests__/browser/controller.test.ts index bcaebc52c6..0427ea3c8d 100644 --- a/packages/terminal-next/__tests__/browser/controller.test.ts +++ b/packages/terminal-next/__tests__/browser/controller.test.ts @@ -1,10 +1,13 @@ /** * Terminal Controller Test */ -import { createProxyServer, createWsServer, resetPort } from './proxy'; +import WebSocket from 'ws'; + import { ITerminalController } from '../../src/common'; + import { injector } from './inject'; -import WebSocket from 'ws'; +import { createProxyServer, createWsServer, resetPort } from './proxy'; + describe('Terminal Controller', () => { let controller: ITerminalController; diff --git a/packages/terminal-next/__tests__/browser/inject.ts b/packages/terminal-next/__tests__/browser/inject.ts index 8e75ab7cac..9bd8456ee7 100644 --- a/packages/terminal-next/__tests__/browser/inject.ts +++ b/packages/terminal-next/__tests__/browser/inject.ts @@ -1,5 +1,4 @@ import { Injector } from '@opensumi/di'; -import { IEventBus, CommandService, ILogger, IFileServiceClient, Disposable } from '@opensumi/ide-core-common'; import { AppConfig, IContextKeyService, @@ -8,16 +7,24 @@ import { CorePreferences, } from '@opensumi/ide-core-browser'; import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { IEventBus, CommandService, ILogger, IFileServiceClient, Disposable } from '@opensumi/ide-core-common'; +import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; +import { IMessageService } from '@opensumi/ide-overlay'; +import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; import { IThemeService } from '@opensumi/ide-theme'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { TerminalController } from '../../src/browser/terminal.controller'; +import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; + +import { TerminalProfileService } from '../../lib/browser/terminal.profile'; import { createTerminalClientFactory, createTerminalClientFactory2 } from '../../src/browser/terminal.client'; -import { TerminalGroupViewService } from '../../src/browser/terminal.view'; +import { TerminalController } from '../../src/browser/terminal.controller'; import { TerminalInternalService } from '../../src/browser/terminal.internal.service'; -import { TerminalPreference } from '../../src/browser/terminal.preference'; import { TerminalNetworkService } from '../../src/browser/terminal.network'; +import { TerminalPreference } from '../../src/browser/terminal.preference'; +import { TerminalGroupViewService } from '../../src/browser/terminal.view'; import { ITerminalService, ITerminalTheme, @@ -33,6 +40,7 @@ import { ITerminalServicePath, } from '../../src/common'; import { ITerminalPreference } from '../../src/common/preference'; + import { MockMainLayoutService, MockTerminalThemeService, @@ -45,12 +53,7 @@ import { MockProfileService, MockTerminalProfileInternalService, } from './mock.service'; -import { MockWorkspaceService } from '@opensumi/ide-workspace/lib/common/mocks'; -import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; -import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { TerminalProfileService } from '../../lib/browser/terminal.profile'; -import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; + const mockPreferences = new Map(); mockPreferences.set('terminal.integrated.shellArgs.linux', []); diff --git a/packages/terminal-next/__tests__/browser/links/protocol-link-provider.test.ts b/packages/terminal-next/__tests__/browser/links/protocol-link-provider.test.ts index f5cdae5037..160ac9a980 100644 --- a/packages/terminal-next/__tests__/browser/links/protocol-link-provider.test.ts +++ b/packages/terminal-next/__tests__/browser/links/protocol-link-provider.test.ts @@ -1,6 +1,7 @@ import { Terminal, ILink } from 'xterm'; -import { TerminalProtocolLinkProvider } from '../../../src/browser/links/protocol-link-provider'; + import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; +import { TerminalProtocolLinkProvider } from '../../../src/browser/links/protocol-link-provider'; describe('Workbench - TerminalWebLinkProvider', () => { const injector = createBrowserInjector([]); diff --git a/packages/terminal-next/__tests__/browser/links/validated-local-link-provider.test.ts b/packages/terminal-next/__tests__/browser/links/validated-local-link-provider.test.ts index e046694a6e..55b93977ba 100644 --- a/packages/terminal-next/__tests__/browser/links/validated-local-link-provider.test.ts +++ b/packages/terminal-next/__tests__/browser/links/validated-local-link-provider.test.ts @@ -1,6 +1,8 @@ import { Terminal, ILink } from 'xterm'; + import { URI } from '@opensumi/ide-core-common'; import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; + import { createBrowserInjector } from '../../../../../tools/dev-tool/src/injector-helper'; import { TerminalValidatedLocalLinkProvider } from '../../../src/browser/links/validated-local-link-provider'; diff --git a/packages/terminal-next/__tests__/browser/mock.service.ts b/packages/terminal-next/__tests__/browser/mock.service.ts index eb754df97f..1fcb4cbd73 100644 --- a/packages/terminal-next/__tests__/browser/mock.service.ts +++ b/packages/terminal-next/__tests__/browser/mock.service.ts @@ -1,8 +1,11 @@ import WebSocket from 'ws'; import { Terminal } from 'xterm'; + +import { Disposable, PreferenceProvider, PreferenceResolveResult } from '@opensumi/ide-core-browser'; +import { PreferenceService } from '@opensumi/ide-core-browser'; import { uuid, URI, Emitter, IDisposable, PreferenceScope } from '@opensumi/ide-core-common'; import { OS } from '@opensumi/ide-core-common/lib/platform'; -import { Disposable, PreferenceProvider, PreferenceResolveResult } from '@opensumi/ide-core-browser'; + import { ITerminalService, ITerminalConnection, @@ -16,9 +19,10 @@ import { IRegisterContributedProfileArgs, ITerminalProfileInternalService, } from '../../src/common'; + import { getPort, localhost, MessageMethod } from './proxy'; import { delay } from './utils'; -import { PreferenceService } from '@opensumi/ide-core-browser'; + // Ref: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom Object.defineProperty(window, 'matchMedia', { writable: true, diff --git a/packages/terminal-next/__tests__/browser/network.test.ts b/packages/terminal-next/__tests__/browser/network.test.ts index f2364158cd..d5dd181dbb 100644 --- a/packages/terminal-next/__tests__/browser/network.test.ts +++ b/packages/terminal-next/__tests__/browser/network.test.ts @@ -1,4 +1,5 @@ import { ITerminalNetwork, ITerminalErrorService, TerminalNetworkStatus } from '../../src/common'; + import { injector } from './inject'; import { delay } from './utils'; diff --git a/packages/terminal-next/__tests__/browser/proxy.ts b/packages/terminal-next/__tests__/browser/proxy.ts index 82629c777f..36d14cd73f 100644 --- a/packages/terminal-next/__tests__/browser/proxy.ts +++ b/packages/terminal-next/__tests__/browser/proxy.ts @@ -2,9 +2,11 @@ * 为了模拟断连而设计的 pty 和 proxy 服务 */ import os from 'os'; + +import httpProxy from 'http-proxy'; import * as pty from 'node-pty'; import WebSocket from 'ws'; -import httpProxy from 'http-proxy'; + import { uuid } from '@opensumi/ide-core-browser'; function getRandomInt(min: number, max: number) { diff --git a/packages/terminal-next/__tests__/browser/render.test.ts b/packages/terminal-next/__tests__/browser/render.test.ts index 3530e49296..cdd716993f 100644 --- a/packages/terminal-next/__tests__/browser/render.test.ts +++ b/packages/terminal-next/__tests__/browser/render.test.ts @@ -3,6 +3,7 @@ */ import * as puppeteer from 'puppeteer'; + import { getTerminalControllerState, selectTabIndex, isFocusedClientRenderedAndFit } from './utils'; const APP = 'http://0.0.0.0:8080'; diff --git a/packages/terminal-next/__tests__/browser/terminal.environment.service.test.ts b/packages/terminal-next/__tests__/browser/terminal.environment.service.test.ts index 2b5a6aeea5..5752af41a6 100644 --- a/packages/terminal-next/__tests__/browser/terminal.environment.service.test.ts +++ b/packages/terminal-next/__tests__/browser/terminal.environment.service.test.ts @@ -1,6 +1,6 @@ import { Injector } from '@opensumi/di'; -import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { CommandService, CommandServiceImpl } from '@opensumi/ide-core-common/lib/command'; import { mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; import { ILogger } from '@opensumi/ide-logs/lib/common'; @@ -11,6 +11,7 @@ import { ITerminalProcessPath } from '@opensumi/ide-terminal-next'; import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; import { MergedEnvironmentVariableCollection } from '@opensumi/ide-terminal-next/lib/common/environmentVariableCollection'; import { IWorkspaceStorageService } from '@opensumi/ide-workspace/lib/common'; + import { TerminalEnvironmentService } from '../../src/browser/terminal.environment.service'; const mockData = [ diff --git a/packages/terminal-next/__tests__/browser/terminal.hover.manager.test.ts b/packages/terminal-next/__tests__/browser/terminal.hover.manager.test.ts index 339e809831..35bde81fdb 100644 --- a/packages/terminal-next/__tests__/browser/terminal.hover.manager.test.ts +++ b/packages/terminal-next/__tests__/browser/terminal.hover.manager.test.ts @@ -1,7 +1,10 @@ /* eslint-disable no-console */ +import { IViewportRange, Terminal } from 'xterm'; + import { Injector } from '@opensumi/di'; -import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; import { MockLogger } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state'; +import { Disposable } from '@opensumi/ide-core-common'; import { CommandService, CommandServiceImpl } from '@opensumi/ide-core-common/lib/command'; import { mockService } from '@opensumi/ide-dev-tool/src/mock-injector'; import { ILogger } from '@opensumi/ide-logs/lib/common'; @@ -10,13 +13,14 @@ import { IStatusBarService } from '@opensumi/ide-status-bar'; import { StatusBarService } from '@opensumi/ide-status-bar/lib/browser/status-bar.service'; import { ITerminalProcessPath } from '@opensumi/ide-terminal-next'; import { IWorkspaceStorageService } from '@opensumi/ide-workspace/lib/common'; -import { TerminalHoverManagerService } from '../../src/browser/terminal.hover.manager'; -import { ITerminalHoverManagerService } from '../../lib/common'; -import { IViewportRange, Terminal } from 'xterm'; + import { TerminalLink } from '../../lib/browser/links/link'; +import { ITerminalHoverManagerService } from '../../lib/common'; import { convertBufferRangeToViewport, convertLinkRangeToBuffer } from '../../src/browser/links/helpers'; +import { TerminalHoverManagerService } from '../../src/browser/terminal.hover.manager'; + import { createBufferLineArray } from './utils'; -import { Disposable } from '@opensumi/ide-core-common'; + const mockData = [ { diff --git a/packages/terminal-next/__tests__/browser/terminal.service.test.ts b/packages/terminal-next/__tests__/browser/terminal.service.test.ts index 3f08de3a41..684f80b730 100644 --- a/packages/terminal-next/__tests__/browser/terminal.service.test.ts +++ b/packages/terminal-next/__tests__/browser/terminal.service.test.ts @@ -1,18 +1,21 @@ import os from 'os'; import path from 'path'; + import fse from 'fs-extra'; -import WebSocket from 'ws'; import httpProxy from 'http-proxy'; +import WebSocket from 'ws'; + import { AppConfig } from '@opensumi/ide-core-browser'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; import { Disposable, FileUri, URI } from '@opensumi/ide-core-common'; import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; import { EnvironmentVariableServiceToken } from '@opensumi/ide-terminal-next/lib/common/environmentVariable'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; + +import { NodePtyTerminalService } from '../../src/browser/terminal.service'; +import { IShellLaunchConfig, ITerminalService, ITerminalServicePath } from '../../src/common'; import { injector } from './inject'; import { createProxyServer, createWsServer, resetPort } from './proxy'; -import { IShellLaunchConfig, ITerminalService, ITerminalServicePath } from '../../src/common'; -import { NodePtyTerminalService } from '../../src/browser/terminal.service'; describe('terminal service test cases', () => { let terminalService: ITerminalService; diff --git a/packages/terminal-next/__tests__/browser/view.test.ts b/packages/terminal-next/__tests__/browser/view.test.ts index 89a339cc87..3169f9b1a9 100644 --- a/packages/terminal-next/__tests__/browser/view.test.ts +++ b/packages/terminal-next/__tests__/browser/view.test.ts @@ -1,7 +1,9 @@ import { uuid } from '@opensumi/ide-core-common'; -import { injector } from './inject'; -import { ITerminalGroupViewService } from '../../src/common'; + import { Widget, WidgetGroup } from '../../src/browser/terminal.view'; +import { ITerminalGroupViewService } from '../../src/common'; + +import { injector } from './inject'; describe('Terminal View Test', () => { let view: ITerminalGroupViewService; diff --git a/packages/terminal-next/__tests__/common/environmentVariableCollection.test.ts b/packages/terminal-next/__tests__/common/environmentVariableCollection.test.ts index 80b3aee544..779e7bebf8 100644 --- a/packages/terminal-next/__tests__/common/environmentVariableCollection.test.ts +++ b/packages/terminal-next/__tests__/common/environmentVariableCollection.test.ts @@ -1,4 +1,5 @@ import { OS } from '@opensumi/ide-core-common'; + import { MergedEnvironmentVariableCollection } from '../../src/common/environmentVariableCollection'; describe('MergedEnvironmentVariableCollection', () => { diff --git a/packages/terminal-next/__tests__/node/pty.test.ts b/packages/terminal-next/__tests__/node/pty.test.ts index 9b6919b583..d30cc910ba 100644 --- a/packages/terminal-next/__tests__/node/pty.test.ts +++ b/packages/terminal-next/__tests__/node/pty.test.ts @@ -1,8 +1,10 @@ +import os from 'os'; + import { Injector } from '@opensumi/di'; import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { TerminalNodePtyModule } from '../../src/node'; import { PtyService } from '../../src/node/pty'; -import os from 'os'; describe('PtyService function should be valid', () => { jest.setTimeout(10000); diff --git a/packages/terminal-next/__tests__/node/termina.profile.test.ts b/packages/terminal-next/__tests__/node/termina.profile.test.ts index 90c497ac7b..76488f561a 100644 --- a/packages/terminal-next/__tests__/node/termina.profile.test.ts +++ b/packages/terminal-next/__tests__/node/termina.profile.test.ts @@ -1,5 +1,6 @@ import { Injector } from '@opensumi/di'; import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { TerminalNodePtyModule } from '../../src/node'; import { TerminalProfileServiceNode } from '../../src/node/terminal.profile.service'; diff --git a/packages/terminal-next/__tests__/node/terminal.service.client.test.ts b/packages/terminal-next/__tests__/node/terminal.service.client.test.ts index 5410f52a2d..88b9be647c 100644 --- a/packages/terminal-next/__tests__/node/terminal.service.client.test.ts +++ b/packages/terminal-next/__tests__/node/terminal.service.client.test.ts @@ -1,9 +1,11 @@ +import os from 'os'; + import { Injector } from '@opensumi/di'; import { createNodeInjector } from '@opensumi/ide-dev-tool/src/injector-helper'; + import { ITerminalServiceClient, ITerminalNodeService } from '../../src/common'; -import { TerminalNodePtyModule } from '../../src/node'; import { IPtyProcess } from '../../src/common/pty'; -import os from 'os'; +import { TerminalNodePtyModule } from '../../src/node'; describe('TerminalServiceClientImpl', () => { let terminalServiceClient: ITerminalServiceClient; diff --git a/packages/terminal-next/src/browser/component/resize.delegate.tsx b/packages/terminal-next/src/browser/component/resize.delegate.tsx index 327624941b..8d6e0d0389 100644 --- a/packages/terminal-next/src/browser/component/resize.delegate.tsx +++ b/packages/terminal-next/src/browser/component/resize.delegate.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { IWidget } from '../../common/resize'; import styles from './resize.module.less'; diff --git a/packages/terminal-next/src/browser/component/resize.view.tsx b/packages/terminal-next/src/browser/component/resize.view.tsx index 71dff0ea5d..32f73eacba 100644 --- a/packages/terminal-next/src/browser/component/resize.view.tsx +++ b/packages/terminal-next/src/browser/component/resize.view.tsx @@ -1,8 +1,9 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; -import ResizeDelegate from './resize.delegate'; +import React from 'react'; + import { IWidget, IWidgetGroup } from '../../common/resize'; +import ResizeDelegate from './resize.delegate'; import styles from './resize.module.less'; export enum ResizeDirection { diff --git a/packages/terminal-next/src/browser/component/tab.item.tsx b/packages/terminal-next/src/browser/component/tab.item.tsx index 015d6592a3..86ab99c971 100644 --- a/packages/terminal-next/src/browser/component/tab.item.tsx +++ b/packages/terminal-next/src/browser/component/tab.item.tsx @@ -1,8 +1,11 @@ -import React from 'react'; import clx from 'classnames'; +import debouce = require('lodash.debounce'); +import React from 'react'; + import { getIcon } from '@opensumi/ide-core-browser'; + import { ItemProps, ItemType } from '../../common'; -import debouce = require('lodash.debounce'); + import styles from './tab.module.less'; diff --git a/packages/terminal-next/src/browser/component/tab.view.tsx b/packages/terminal-next/src/browser/component/tab.view.tsx index c4425b9782..ce43d5ae3a 100644 --- a/packages/terminal-next/src/browser/component/tab.view.tsx +++ b/packages/terminal-next/src/browser/component/tab.view.tsx @@ -1,10 +1,12 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { useInjectable } from '@opensumi/ide-core-browser'; + import { ITerminalGroupViewService, ITerminalRenderProvider, ItemType } from '../../common'; -import TabItem from './tab.item'; import { TerminalContextMenuService } from '../terminal.context-menu'; +import TabItem from './tab.item'; import styles from './tab.module.less'; export default observer(() => { diff --git a/packages/terminal-next/src/browser/component/terminal.select.tsx b/packages/terminal-next/src/browser/component/terminal.select.tsx index b5103b04c4..5cb951a085 100644 --- a/packages/terminal-next/src/browser/component/terminal.select.tsx +++ b/packages/terminal-next/src/browser/component/terminal.select.tsx @@ -1,6 +1,8 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { useInjectable } from '@opensumi/ide-core-browser'; + import { ITerminalGroupViewService } from '../../common'; import styles from './terminal.module.less'; diff --git a/packages/terminal-next/src/browser/component/terminal.variable.tsx b/packages/terminal-next/src/browser/component/terminal.variable.tsx index 80269a0179..135cc89297 100644 --- a/packages/terminal-next/src/browser/component/terminal.variable.tsx +++ b/packages/terminal-next/src/browser/component/terminal.variable.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { localize } from '@opensumi/ide-core-common'; + import { IExtensionOwnedEnvironmentVariableMutator, IMergedEnvironmentVariableCollectionDiff, diff --git a/packages/terminal-next/src/browser/component/terminal.view.tsx b/packages/terminal-next/src/browser/component/terminal.view.tsx index 0a259aa180..22032df572 100644 --- a/packages/terminal-next/src/browser/component/terminal.view.tsx +++ b/packages/terminal-next/src/browser/component/terminal.view.tsx @@ -1,7 +1,8 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { useInjectable, getIcon } from '@opensumi/ide-core-browser'; -import ResizeView, { ResizeDirection } from './resize.view'; + import { ITerminalController, ITerminalGroupViewService, @@ -11,10 +12,12 @@ import { ITerminalNetwork, ITerminalError, } from '../../common'; + +import ResizeView, { ResizeDirection } from './resize.view'; +import styles from './terminal.module.less'; import TerminalWidget from './terminal.widget'; import 'xterm/css/xterm.css'; -import styles from './terminal.module.less'; export default observer(() => { const controller = useInjectable(ITerminalController); diff --git a/packages/terminal-next/src/browser/component/terminal.widget.tsx b/packages/terminal-next/src/browser/component/terminal.widget.tsx index b7bfb7e0b0..5e68190d1b 100644 --- a/packages/terminal-next/src/browser/component/terminal.widget.tsx +++ b/packages/terminal-next/src/browser/component/terminal.widget.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { useInjectable, localize } from '@opensumi/ide-core-browser'; + import { ITerminalGroupViewService, IWidget, diff --git a/packages/terminal-next/src/browser/contribution/terminal.command.ts b/packages/terminal-next/src/browser/contribution/terminal.command.ts index 6711287024..59734b9223 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.command.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.command.ts @@ -1,3 +1,4 @@ +import { Autowired } from '@opensumi/di'; import { URI, Domain, @@ -13,7 +14,7 @@ import { IClipboardService, PreferenceScope, } from '@opensumi/ide-core-browser'; -import { Autowired } from '@opensumi/di'; + import { ITerminalController, ITerminalRestore, @@ -22,9 +23,11 @@ import { ITerminalApiService, TERMINAL_COMMANDS, } from '../../common'; -import { EnvironmentVariableServiceToken } from './../../common/environmentVariable'; -import { TerminalKeyBoardInputService } from '../terminal.input'; import { TerminalEnvironmentService } from '../terminal.environment.service'; +import { TerminalKeyBoardInputService } from '../terminal.input'; + +import { EnvironmentVariableServiceToken } from './../../common/environmentVariable'; + @Domain(CommandContribution) export class TerminalCommandContribution implements CommandContribution { diff --git a/packages/terminal-next/src/browser/contribution/terminal.keybinding.ts b/packages/terminal-next/src/browser/contribution/terminal.keybinding.ts index 1355eb52d2..db7988b0eb 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.keybinding.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.keybinding.ts @@ -1,8 +1,9 @@ -import { Domain, isWindows } from '@opensumi/ide-core-common'; import { KeybindingContribution, KeybindingRegistry } from '@opensumi/ide-core-browser'; -import { TERMINAL_COMMANDS } from '../../common'; import { IsTerminalFocused } from '@opensumi/ide-core-browser/lib/contextkey'; import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key'; +import { Domain, isWindows } from '@opensumi/ide-core-common'; + +import { TERMINAL_COMMANDS } from '../../common'; @Domain(KeybindingContribution) export class TerminalKeybindinngContribution implements KeybindingContribution { diff --git a/packages/terminal-next/src/browser/contribution/terminal.lifecycle.ts b/packages/terminal-next/src/browser/contribution/terminal.lifecycle.ts index 1647c68d5c..dba88e1e39 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.lifecycle.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.lifecycle.ts @@ -1,6 +1,7 @@ import { Autowired } from '@opensumi/di'; import { Domain, ClientAppContribution } from '@opensumi/ide-core-browser'; import { MainLayoutContribution } from '@opensumi/ide-main-layout'; + import { ITerminalController, ITerminalRestore } from '../../common'; import { IEnvironmentVariableService, EnvironmentVariableServiceToken } from '../../common/environmentVariable'; import { registerTerminalColors } from '../terminal.color'; diff --git a/packages/terminal-next/src/browser/contribution/terminal.menu.ts b/packages/terminal-next/src/browser/contribution/terminal.menu.ts index c980d8a604..b6cac8fe2c 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.menu.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.menu.ts @@ -1,11 +1,4 @@ import { Autowired } from '@opensumi/di'; -import { Domain, CommandService, isWindows } from '@opensumi/ide-core-common'; -import { - MenuContribution, - IMenuRegistry, - getTabbarCommonMenuId, - MenuId as CoreMenuId, -} from '@opensumi/ide-core-browser/lib/menu/next'; import { localize, PreferenceService, @@ -14,6 +7,14 @@ import { AppConfig, getTabbarCtxKey, } from '@opensumi/ide-core-browser'; +import { + MenuContribution, + IMenuRegistry, + getTabbarCommonMenuId, + MenuId as CoreMenuId, +} from '@opensumi/ide-core-browser/lib/menu/next'; +import { Domain, CommandService, isWindows } from '@opensumi/ide-core-common'; + import { ITerminalController, ITerminalGroupViewService, diff --git a/packages/terminal-next/src/browser/contribution/terminal.network.ts b/packages/terminal-next/src/browser/contribution/terminal.network.ts index bd71ed0cbb..f87ec202b2 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.network.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.network.ts @@ -1,11 +1,12 @@ import { Autowired } from '@opensumi/di'; +import { Domain, ClientAppContribution } from '@opensumi/ide-core-browser'; import { OnEvent, WithEventBus, BrowserConnectionOpenEvent, BrowserConnectionCloseEvent, } from '@opensumi/ide-core-common'; -import { Domain, ClientAppContribution } from '@opensumi/ide-core-browser'; + import { ITerminalNetwork, ITerminalInternalService, TerminalNetworkStatus } from '../../common'; @Domain(ClientAppContribution) diff --git a/packages/terminal-next/src/browser/contribution/terminal.preference.ts b/packages/terminal-next/src/browser/contribution/terminal.preference.ts index 45ce74506e..417c39b395 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.preference.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.preference.ts @@ -1,5 +1,6 @@ import { PreferenceContribution } from '@opensumi/ide-core-browser'; import { Domain, PreferenceSchema } from '@opensumi/ide-core-common'; + import { terminalPreferenceSchema } from '../../common/preference'; @Domain(PreferenceContribution) diff --git a/packages/terminal-next/src/browser/contribution/terminal.view.ts b/packages/terminal-next/src/browser/contribution/terminal.view.ts index d88ac0aee1..2470d7db2b 100644 --- a/packages/terminal-next/src/browser/contribution/terminal.view.ts +++ b/packages/terminal-next/src/browser/contribution/terminal.view.ts @@ -6,9 +6,10 @@ import { ComponentContribution, TabBarToolbarContribution, } from '@opensumi/ide-core-browser'; + import { TERMINAL_COMMANDS, TerminalContainerId } from '../../common'; -import TerminalView from '../component/terminal.view'; import TerminalTabs from '../component/tab.view'; +import TerminalView from '../component/terminal.view'; @Domain(ComponentContribution, TabBarToolbarContribution) export class TerminalRenderContribution implements ComponentContribution, TabBarToolbarContribution { diff --git a/packages/terminal-next/src/browser/index.ts b/packages/terminal-next/src/browser/index.ts index 5acd33956a..11079876ea 100644 --- a/packages/terminal-next/src/browser/index.ts +++ b/packages/terminal-next/src/browser/index.ts @@ -1,5 +1,6 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { ITerminalController, ITerminalService, @@ -21,7 +22,9 @@ import { ITerminalContributionService, ITerminalProfileInternalService, } from '../common'; +import { EnvironmentVariableServiceToken } from '../common/environmentVariable'; import { ITerminalPreference } from '../common/preference'; + import { TerminalCommandContribution, TerminalMenuContribution, @@ -31,25 +34,24 @@ import { TerminalNetworkContribution, TerminalPreferenceContribution, } from './contribution'; -import { TerminalController } from './terminal.controller'; -import { TerminalTheme } from './terminal.theme'; -import { NodePtyTerminalService } from './terminal.service'; -import { TerminalInternalService } from './terminal.internal.service'; -import { TerminalRestore } from './terminal.restore'; -import { createTerminalClientFactory, createTerminalClientFactory2 } from './terminal.client'; import { TerminalApiService } from './terminal.api'; -import { TerminalSearchService } from './terminal.search'; -import { TerminalHoverManagerService } from './terminal.hover.manager'; -import { TerminalGroupViewService } from './terminal.view'; +import { createTerminalClientFactory, createTerminalClientFactory2 } from './terminal.client'; +import { TerminalContributionService } from './terminal.contribution'; +import { TerminalController } from './terminal.controller'; +import { TerminalEnvironmentService } from './terminal.environment.service'; import { TerminalErrorService } from './terminal.error'; -import { TerminalPreference } from './terminal.preference'; -import { TerminalRenderProvider } from './terminal.render'; +import { TerminalHoverManagerService } from './terminal.hover.manager'; +import { TerminalInternalService } from './terminal.internal.service'; import { TerminalNetworkService } from './terminal.network'; -import { EnvironmentVariableServiceToken } from '../common/environmentVariable'; -import { TerminalEnvironmentService } from './terminal.environment.service'; +import { TerminalPreference } from './terminal.preference'; import { TerminalProfileService } from './terminal.profile'; -import { TerminalContributionService } from './terminal.contribution'; import { TerminalProfileInternalService } from './terminal.profile.internal'; +import { TerminalRenderProvider } from './terminal.render'; +import { TerminalRestore } from './terminal.restore'; +import { TerminalSearchService } from './terminal.search'; +import { NodePtyTerminalService } from './terminal.service'; +import { TerminalTheme } from './terminal.theme'; +import { TerminalGroupViewService } from './terminal.view'; @Injectable() export class TerminalNextModule extends BrowserModule { diff --git a/packages/terminal-next/src/browser/links/base.ts b/packages/terminal-next/src/browser/links/base.ts index 62b685a71e..a5a58c4318 100644 --- a/packages/terminal-next/src/browser/links/base.ts +++ b/packages/terminal-next/src/browser/links/base.ts @@ -1,4 +1,5 @@ import type { ILinkProvider, ILink } from 'xterm'; + import { TerminalLink } from './link'; export abstract class TerminalBaseLinkProvider implements ILinkProvider { diff --git a/packages/terminal-next/src/browser/links/external-link-provider-adapter.ts b/packages/terminal-next/src/browser/links/external-link-provider-adapter.ts index e2bfbe47be..bf758d1d64 100644 --- a/packages/terminal-next/src/browser/links/external-link-provider-adapter.ts +++ b/packages/terminal-next/src/browser/links/external-link-provider-adapter.ts @@ -1,10 +1,13 @@ import type { Terminal, IBufferLine, IViewportRange } from 'xterm'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IDisposable } from '@opensumi/ide-core-common'; + +import { ITerminalExternalLinkProvider, ITerminalClient } from '../../common'; + +import { TerminalBaseLinkProvider } from './base'; import { getXtermLineContent, convertLinkRangeToBuffer } from './helpers'; import { TerminalLink } from './link'; -import { TerminalBaseLinkProvider } from './base'; -import { ITerminalExternalLinkProvider, ITerminalClient } from '../../common'; import { XtermLinkMatcherHandler } from './link-manager'; /** diff --git a/packages/terminal-next/src/browser/links/helpers.ts b/packages/terminal-next/src/browser/links/helpers.ts index ad2d3dc28e..f39abd0dab 100644 --- a/packages/terminal-next/src/browser/links/helpers.ts +++ b/packages/terminal-next/src/browser/links/helpers.ts @@ -5,6 +5,7 @@ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/workbench/contrib/terminal/browser/links/terminalLinkHelpers.ts import type { IViewportRange, IBufferRange, IBufferLine, IBuffer, IBufferCellPosition } from 'xterm'; + import { IRange } from '@opensumi/ide-core-common/lib/types'; export function convertLinkRangeToBuffer(lines: IBufferLine[], bufferWidth: number, range: IRange, startLine: number) { diff --git a/packages/terminal-next/src/browser/links/link-manager.ts b/packages/terminal-next/src/browser/links/link-manager.ts index 1db15c9272..5f269fad45 100644 --- a/packages/terminal-next/src/browser/links/link-manager.ts +++ b/packages/terminal-next/src/browser/links/link-manager.ts @@ -1,5 +1,7 @@ import { Terminal, ILinkProvider, IViewportRange } from 'xterm'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { IOpenerService, PreferenceService } from '@opensumi/ide-core-browser'; import { URI, Disposable, @@ -9,11 +11,17 @@ import { FileUri, localize, } from '@opensumi/ide-core-common'; -import { OperatingSystem, isWindows, isMacintosh } from '@opensumi/ide-core-common/lib/platform'; import { posix, win32, IPath } from '@opensumi/ide-core-common/lib/path'; -import { IOpenerService, PreferenceService } from '@opensumi/ide-core-browser'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { OperatingSystem, isWindows, isMacintosh } from '@opensumi/ide-core-common/lib/platform'; import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/common'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; + +import { ITerminalClient, ITerminalExternalLinkProvider, ITerminalHoverManagerService } from '../../common'; +import { XTermCore } from '../../common/xterm-private'; +import { TerminalClient } from '../terminal.client'; + +import { TerminalExternalLinkProviderAdapter } from './external-link-provider-adapter'; +import { TerminalLink } from './link'; import { TerminalProtocolLinkProvider } from './protocol-link-provider'; import { TerminalValidatedLocalLinkProvider, @@ -25,11 +33,7 @@ import { unixLineAndColumnMatchIndex, lineAndColumnClauseGroupCount, } from './validated-local-link-provider'; -import { TerminalExternalLinkProviderAdapter } from './external-link-provider-adapter'; -import { TerminalLink } from './link'; -import { ITerminalClient, ITerminalExternalLinkProvider, ITerminalHoverManagerService } from '../../common'; -import { TerminalClient } from '../terminal.client'; -import { XTermCore } from '../../common/xterm-private'; + export type XtermLinkMatcherHandler = (event: MouseEvent | undefined, link: string) => Promise; diff --git a/packages/terminal-next/src/browser/links/link.ts b/packages/terminal-next/src/browser/links/link.ts index 48e42c16ef..a51a2c4084 100644 --- a/packages/terminal-next/src/browser/links/link.ts +++ b/packages/terminal-next/src/browser/links/link.ts @@ -1,5 +1,7 @@ import type { IBufferRange, ILink, ILinkDecorations, IViewportRange, Terminal } from 'xterm'; + import { Injectable, Autowired } from '@opensumi/di'; +import { PreferenceService } from '@opensumi/ide-core-browser'; import { Disposable, IDisposable, @@ -10,7 +12,7 @@ import { RunOnceScheduler, localize, } from '@opensumi/ide-core-common'; -import { PreferenceService } from '@opensumi/ide-core-browser'; + import { convertBufferRangeToViewport } from './helpers'; // default delay time (ms) for showing tooltip when mouse is over a link diff --git a/packages/terminal-next/src/browser/links/protocol-link-provider.ts b/packages/terminal-next/src/browser/links/protocol-link-provider.ts index 1b253cb690..44f74eb3af 100644 --- a/packages/terminal-next/src/browser/links/protocol-link-provider.ts +++ b/packages/terminal-next/src/browser/links/protocol-link-provider.ts @@ -1,10 +1,13 @@ import type { Terminal, IBufferLine, IViewportRange } from 'xterm'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { IDisposable } from '@opensumi/ide-core-common'; + import { ILinkComputerTarget, LinkComputer } from '../../common'; + +import { TerminalBaseLinkProvider } from './base'; import { getXtermLineContent, convertLinkRangeToBuffer } from './helpers'; import { TerminalLink } from './link'; -import { TerminalBaseLinkProvider } from './base'; @Injectable({ multiple: true }) export class TerminalProtocolLinkProvider extends TerminalBaseLinkProvider { diff --git a/packages/terminal-next/src/browser/links/validated-local-link-provider.ts b/packages/terminal-next/src/browser/links/validated-local-link-provider.ts index 93213d885d..ab3fe37901 100644 --- a/packages/terminal-next/src/browser/links/validated-local-link-provider.ts +++ b/packages/terminal-next/src/browser/links/validated-local-link-provider.ts @@ -5,17 +5,20 @@ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.63.2/src/vs/workbench/contrib/terminal/browser/links/terminalValidatedLocalLinkProvider.ts import type { Terminal, IBufferLine, IViewportRange } from 'xterm'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { AppConfig } from '@opensumi/ide-core-browser/lib/react-providers/config-provider'; +import { IWindowService } from '@opensumi/ide-core-browser/lib/window'; import { CommandService, IDisposable, URI } from '@opensumi/ide-core-common'; import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; -import { IWindowService } from '@opensumi/ide-core-browser/lib/window'; import { IWorkspaceService } from '@opensumi/ide-workspace/lib/common/workspace-defination'; -import { AppConfig } from '@opensumi/ide-core-browser/lib/react-providers/config-provider'; + import type { TerminalClient } from '../terminal.client'; -import { FOLDER_IN_WORKSPACE_LABEL, FOLDER_NOT_IN_WORKSPACE_LABEL, OPEN_FILE_LABEL, TerminalLink } from './link'; -import { XtermLinkMatcherHandler } from './link-manager'; + import { TerminalBaseLinkProvider } from './base'; import { getXtermLineContent, convertLinkRangeToBuffer } from './helpers'; +import { FOLDER_IN_WORKSPACE_LABEL, FOLDER_NOT_IN_WORKSPACE_LABEL, OPEN_FILE_LABEL, TerminalLink } from './link'; +import { XtermLinkMatcherHandler } from './link-manager'; const pathPrefix = '(\\.\\.?|\\~)'; const pathSeparatorClause = '\\/'; diff --git a/packages/terminal-next/src/browser/terminal.addon.ts b/packages/terminal-next/src/browser/terminal.addon.ts index 040b78a0a1..9ddc04a008 100644 --- a/packages/terminal-next/src/browser/terminal.addon.ts +++ b/packages/terminal-next/src/browser/terminal.addon.ts @@ -1,10 +1,14 @@ import { Terminal, ILinkMatcherOptions, ITerminalAddon } from 'xterm'; -import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service/lib/common'; + import { URI, Disposable, Emitter, Event } from '@opensumi/ide-core-common'; import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/common'; -import { TerminalKeyBoardInputService } from './terminal.input'; +import { IFileServiceClient, FileStat } from '@opensumi/ide-file-service/lib/common'; + import { ITerminalConnection } from '../common'; +import { TerminalKeyBoardInputService } from './terminal.input'; + + const segmentClause = '\\~\\w\\.@_\\-'; const posClause = [ ':\\d+(?::\\d+)?', // :1 | :1:2 diff --git a/packages/terminal-next/src/browser/terminal.api.ts b/packages/terminal-next/src/browser/terminal.api.ts index 4811230099..eef51a27cb 100644 --- a/packages/terminal-next/src/browser/terminal.api.ts +++ b/packages/terminal-next/src/browser/terminal.api.ts @@ -1,7 +1,9 @@ +import { capitalize } from 'lodash'; import type vscode from 'vscode'; + import { Injectable, Autowired } from '@opensumi/di'; import { Event, Emitter } from '@opensumi/ide-core-common'; -import { capitalize } from 'lodash'; + import { ITerminalApiService, ITerminalGroupViewService, diff --git a/packages/terminal-next/src/browser/terminal.client.ts b/packages/terminal-next/src/browser/terminal.client.ts index 4fe5a37eac..a267b8aa20 100644 --- a/packages/terminal-next/src/browser/terminal.client.ts +++ b/packages/terminal-next/src/browser/terminal.client.ts @@ -2,6 +2,7 @@ import { observable } from 'mobx'; import type vscode from 'vscode'; import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { CorePreferences, QuickPickService } from '@opensumi/ide-core-browser'; import { Disposable, Deferred, @@ -21,10 +22,10 @@ import { import { OperatingSystem, OS } from '@opensumi/ide-core-common/lib/platform'; import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/common'; import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { IMessageService } from '@opensumi/ide-overlay'; import { IVariableResolverService } from '@opensumi/ide-variable/lib/common'; import { IWorkspaceService } from '@opensumi/ide-workspace/lib/common'; -import { AttachAddon, DEFAULT_COL, DEFAULT_ROW } from './terminal.addon'; -import { TerminalKeyBoardInputService } from './terminal.input'; + import { TerminalOptions, ITerminalController, @@ -44,13 +45,14 @@ import { ITerminalProfileInternalService, TerminalIcon, } from '../common'; +import { EnvironmentVariableServiceToken, IEnvironmentVariableService } from '../common/environmentVariable'; import { ITerminalPreference } from '../common/preference'; -import { CorePreferences, QuickPickService } from '@opensumi/ide-core-browser'; + import { TerminalLinkManager } from './links/link-manager'; -import { EnvironmentVariableServiceToken, IEnvironmentVariableService } from '../common/environmentVariable'; -import { IMessageService } from '@opensumi/ide-overlay'; -import { XTerm } from './xterm'; +import { AttachAddon, DEFAULT_COL, DEFAULT_ROW } from './terminal.addon'; import { TerminalProcessExtHostProxy } from './terminal.ext.host.proxy'; +import { TerminalKeyBoardInputService } from './terminal.input'; +import { XTerm } from './xterm'; @Injectable() export class TerminalClient extends Disposable implements ITerminalClient { diff --git a/packages/terminal-next/src/browser/terminal.context-menu.ts b/packages/terminal-next/src/browser/terminal.context-menu.ts index 5b3ccd1451..408b69e1e3 100644 --- a/packages/terminal-next/src/browser/terminal.context-menu.ts +++ b/packages/terminal-next/src/browser/terminal.context-menu.ts @@ -1,14 +1,15 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { Disposable } from '@opensumi/ide-core-common'; +import { memoize, IContextKeyService } from '@opensumi/ide-core-browser'; import { AbstractMenuService, IMenu, ICtxMenuRenderer, generateMergedCtxMenu, } from '@opensumi/ide-core-browser/lib/menu/next'; -import { memoize, IContextKeyService } from '@opensumi/ide-core-browser'; -import { MenuId } from '../common/menu'; +import { Disposable } from '@opensumi/ide-core-common'; + import { ITerminalController } from '../common'; +import { MenuId } from '../common/menu'; @Injectable() export class TerminalContextMenuService extends Disposable { diff --git a/packages/terminal-next/src/browser/terminal.contribution.ts b/packages/terminal-next/src/browser/terminal.contribution.ts index 7a676d9a07..25f0a33fc0 100644 --- a/packages/terminal-next/src/browser/terminal.contribution.ts +++ b/packages/terminal-next/src/browser/terminal.contribution.ts @@ -1,5 +1,6 @@ import { Injectable } from '@opensumi/di'; import { URI } from '@opensumi/ide-core-common'; + import { IExtensionTerminalProfile, ITerminalContributions, diff --git a/packages/terminal-next/src/browser/terminal.controller.ts b/packages/terminal-next/src/browser/terminal.controller.ts index 6ec3231c30..6c81acc99a 100644 --- a/packages/terminal-next/src/browser/terminal.controller.ts +++ b/packages/terminal-next/src/browser/terminal.controller.ts @@ -1,5 +1,10 @@ import { observable } from 'mobx'; + import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { ResizeEvent, getSlotLocation, AppConfig } from '@opensumi/ide-core-browser'; +import { ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { generateCtxMenu } from '@opensumi/ide-core-browser/lib/menu/next/menu-util'; +import { AbstractMenuService } from '@opensumi/ide-core-browser/lib/menu/next/menu.interface'; import { WithEventBus, Emitter, @@ -9,10 +14,11 @@ import { DisposableStore, ILogger, } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { TabBarHandler } from '@opensumi/ide-main-layout/lib/browser/tabbar-handler'; import { IThemeService } from '@opensumi/ide-theme'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; + import { ITerminalController, ITerminalClient, @@ -35,12 +41,9 @@ import { ITerminalClientFactory2, ICreateClientWithWidgetOptions, } from '../common'; -import { TerminalGroupViewService } from './terminal.view'; + import { TerminalContextKey } from './terminal.context-key'; -import { ResizeEvent, getSlotLocation, AppConfig } from '@opensumi/ide-core-browser'; -import { AbstractMenuService } from '@opensumi/ide-core-browser/lib/menu/next/menu.interface'; -import { generateCtxMenu } from '@opensumi/ide-core-browser/lib/menu/next/menu-util'; -import { ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { TerminalGroupViewService } from './terminal.view'; @Injectable() export class TerminalController extends WithEventBus implements ITerminalController { diff --git a/packages/terminal-next/src/browser/terminal.environment.service.ts b/packages/terminal-next/src/browser/terminal.environment.service.ts index 2ecf11f723..094108bbcc 100644 --- a/packages/terminal-next/src/browser/terminal.environment.service.ts +++ b/packages/terminal-next/src/browser/terminal.environment.service.ts @@ -1,6 +1,16 @@ +import debounce = require('lodash.debounce'); +import throttle = require('lodash.throttle'); import React from 'react'; + import { Injectable, Autowired } from '@opensumi/di'; +import { getIcon, StatusBarAlignment, StatusBarEntryAccessor } from '@opensumi/ide-core-browser'; import { CommandService, Emitter, Event, ILogger, localize, raceTimeout } from '@opensumi/ide-core-common'; +import { IDialogService } from '@opensumi/ide-overlay/lib/common'; +import { IStatusBarService } from '@opensumi/ide-status-bar/lib/common'; +import { IWorkspaceStorageService } from '@opensumi/ide-workspace/lib/common'; + +import { ITerminalProcessPath, ITerminalProcessService } from '../common'; +import { TERMINAL_COMMANDS } from '../common/commands'; import { deserializeEnvironmentVariableCollection, IEnvironmentVariableCollectionWithPersistence, @@ -11,17 +21,10 @@ import { mutatorTypeLabel, serializeEnvironmentVariableCollection, } from '../common/environmentVariable'; -import { IWorkspaceStorageService } from '@opensumi/ide-workspace/lib/common'; -import { IStatusBarService } from '@opensumi/ide-status-bar/lib/common'; -import { getIcon, StatusBarAlignment, StatusBarEntryAccessor } from '@opensumi/ide-core-browser'; -import { IDialogService } from '@opensumi/ide-overlay/lib/common'; - import { MergedEnvironmentVariableCollection } from '../common/environmentVariableCollection'; -import { TERMINAL_COMMANDS } from '../common/commands'; + import { TerminalVariable } from './component/terminal.variable'; -import { ITerminalProcessPath, ITerminalProcessService } from '../common'; -import throttle = require('lodash.throttle'); -import debounce = require('lodash.debounce'); + export const ENVIRONMENT_VARIABLE_COLLECTIONS_KEY = 'terminal.integrated.environmentVariableCollections'; diff --git a/packages/terminal-next/src/browser/terminal.error.ts b/packages/terminal-next/src/browser/terminal.error.ts index 62d95f2005..5c6de97cac 100644 --- a/packages/terminal-next/src/browser/terminal.error.ts +++ b/packages/terminal-next/src/browser/terminal.error.ts @@ -1,5 +1,7 @@ import { observable } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; + import { ITerminalErrorService, ITerminalError, diff --git a/packages/terminal-next/src/browser/terminal.ext.host.proxy.ts b/packages/terminal-next/src/browser/terminal.ext.host.proxy.ts index 0248398ff2..b6cc4e0d6b 100644 --- a/packages/terminal-next/src/browser/terminal.ext.host.proxy.ts +++ b/packages/terminal-next/src/browser/terminal.ext.host.proxy.ts @@ -1,4 +1,5 @@ import { Disposable, Emitter, Event } from '@opensumi/ide-core-common'; + import { ITerminalController, ITerminalChildProcess, diff --git a/packages/terminal-next/src/browser/terminal.hover.manager.ts b/packages/terminal-next/src/browser/terminal.hover.manager.ts index 0b476d4de1..e9455794f2 100644 --- a/packages/terminal-next/src/browser/terminal.hover.manager.ts +++ b/packages/terminal-next/src/browser/terminal.hover.manager.ts @@ -1,6 +1,8 @@ import { Injectable } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-core-common'; + import { ITerminalHoverManagerService } from '../common'; + import { ILinkHoverTargetOptions } from './links/link-manager'; const TIPS_OFFSET_Y = 20; diff --git a/packages/terminal-next/src/browser/terminal.internal.service.ts b/packages/terminal-next/src/browser/terminal.internal.service.ts index ba75ee661c..5e9f6d0d7d 100644 --- a/packages/terminal-next/src/browser/terminal.internal.service.ts +++ b/packages/terminal-next/src/browser/terminal.internal.service.ts @@ -1,5 +1,8 @@ import { Terminal as XTermTerminal } from 'xterm'; + import { Injectable, Autowired } from '@opensumi/di'; +import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; + import { generateSessionId, ITerminalService, @@ -12,8 +15,8 @@ import { IShellLaunchConfig, ITerminalConnection, } from '../common'; + import { TerminalProcessExtHostProxy } from './terminal.ext.host.proxy'; -import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; @Injectable() export class TerminalInternalService implements ITerminalInternalService { diff --git a/packages/terminal-next/src/browser/terminal.network.ts b/packages/terminal-next/src/browser/terminal.network.ts index bea84773c8..ba0ce4faed 100644 --- a/packages/terminal-next/src/browser/terminal.network.ts +++ b/packages/terminal-next/src/browser/terminal.network.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, Event, Disposable } from '@opensumi/ide-core-common'; + import { ITerminalErrorService, ITerminalNetwork, diff --git a/packages/terminal-next/src/browser/terminal.preference.ts b/packages/terminal-next/src/browser/terminal.preference.ts index f19593a91c..97856a0bf7 100644 --- a/packages/terminal-next/src/browser/terminal.preference.ts +++ b/packages/terminal-next/src/browser/terminal.preference.ts @@ -1,6 +1,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { PreferenceService } from '@opensumi/ide-core-browser'; import { Emitter, Event } from '@opensumi/ide-core-common'; + import { ITerminalPreference, IPreferenceValue, diff --git a/packages/terminal-next/src/browser/terminal.profile.internal.ts b/packages/terminal-next/src/browser/terminal.profile.internal.ts index e8506b9b2e..0ca04f47e4 100644 --- a/packages/terminal-next/src/browser/terminal.profile.internal.ts +++ b/packages/terminal-next/src/browser/terminal.profile.internal.ts @@ -4,6 +4,10 @@ */ import { Injectable, Autowired } from '@opensumi/di'; +import { PreferenceService } from '@opensumi/ide-core-browser'; +import * as path from '@opensumi/ide-core-common/lib/path'; +import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; + import { IResolveDefaultProfileOptions, ITerminalProfile, @@ -13,9 +17,6 @@ import { ITerminalServiceClient, ITerminalServicePath, } from '../common'; -import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; -import * as path from '@opensumi/ide-core-common/lib/path'; -import { PreferenceService } from '@opensumi/ide-core-browser'; import { CodeTerminalSettingPrefix } from '../common/preference'; import { WindowsShellType } from '../common/shell'; diff --git a/packages/terminal-next/src/browser/terminal.profile.ts b/packages/terminal-next/src/browser/terminal.profile.ts index 989767d22b..7119bbfb8a 100644 --- a/packages/terminal-next/src/browser/terminal.profile.ts +++ b/packages/terminal-next/src/browser/terminal.profile.ts @@ -1,3 +1,5 @@ +import { Injectable, Autowired } from '@opensumi/di'; +import { PreferenceService } from '@opensumi/ide-core-browser'; import { Disposable, Emitter, @@ -9,6 +11,7 @@ import { AutoOpenBarrier, PreferenceScope, } from '@opensumi/ide-core-common'; + import { IExtensionTerminalProfile, IRegisterContributedProfileArgs, @@ -21,9 +24,8 @@ import { ITerminalService, terminalProfileArgsMatch, } from '../common'; -import { Injectable, Autowired } from '@opensumi/di'; import { CodeTerminalSettingPrefix } from '../common/preference'; -import { PreferenceService } from '@opensumi/ide-core-browser'; + @Injectable() export class TerminalProfileService extends WithEventBus implements ITerminalProfileService { diff --git a/packages/terminal-next/src/browser/terminal.render.ts b/packages/terminal-next/src/browser/terminal.render.ts index 2b79bc550c..b3465c7a57 100644 --- a/packages/terminal-next/src/browser/terminal.render.ts +++ b/packages/terminal-next/src/browser/terminal.render.ts @@ -1,7 +1,9 @@ import { Injectable } from '@opensumi/di'; -import { renderInfoItem, renderAddItem } from './component/tab.item'; + import { ITerminalRenderProvider } from '../common'; +import { renderInfoItem, renderAddItem } from './component/tab.item'; + @Injectable() export class TerminalRenderProvider implements ITerminalRenderProvider { /** diff --git a/packages/terminal-next/src/browser/terminal.restore.ts b/packages/terminal-next/src/browser/terminal.restore.ts index 757fcbd661..1c2fe7e925 100644 --- a/packages/terminal-next/src/browser/terminal.restore.ts +++ b/packages/terminal-next/src/browser/terminal.restore.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-core-common'; + import { ITerminalRestore, ITerminalController, ITerminalInternalService } from '../common'; @Injectable() diff --git a/packages/terminal-next/src/browser/terminal.search.ts b/packages/terminal-next/src/browser/terminal.search.ts index b2da31d699..d125402312 100644 --- a/packages/terminal-next/src/browser/terminal.search.ts +++ b/packages/terminal-next/src/browser/terminal.search.ts @@ -1,6 +1,8 @@ import { observable } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, Event } from '@opensumi/ide-core-common'; + import { ITerminalSearchService, ITerminalGroupViewService, ITerminalController } from '../common'; @Injectable() diff --git a/packages/terminal-next/src/browser/terminal.service.ts b/packages/terminal-next/src/browser/terminal.service.ts index f001b294cc..79c830f7f0 100644 --- a/packages/terminal-next/src/browser/terminal.service.ts +++ b/packages/terminal-next/src/browser/terminal.service.ts @@ -1,10 +1,12 @@ +import { Emitter as Dispatcher } from 'event-kit'; import { Terminal } from 'xterm'; + import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; +import { WSChannelHandler as IWSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; +import { AppConfig, electronEnv, PreferenceService } from '@opensumi/ide-core-browser'; import { Emitter, ILogger, Event } from '@opensumi/ide-core-common'; import { OperatingSystem, OS } from '@opensumi/ide-core-common/lib/platform'; -import { Emitter as Dispatcher } from 'event-kit'; -import { AppConfig, electronEnv, PreferenceService } from '@opensumi/ide-core-browser'; -import { WSChannelHandler as IWSChannelHandler } from '@opensumi/ide-connection/lib/browser/ws-channel-handler'; + import { generateSessionId, ITerminalService, @@ -20,8 +22,8 @@ import { IShellLaunchConfig, IDetectProfileOptionsPreference, } from '../common'; -import { ShellType, WindowsShellType } from '../common/shell'; import { CodeTerminalSettingPrefix } from '../common/preference'; +import { ShellType, WindowsShellType } from '../common/shell'; export interface EventMessage { data: string; diff --git a/packages/terminal-next/src/browser/terminal.theme.ts b/packages/terminal-next/src/browser/terminal.theme.ts index f35ca07565..0335b24d3a 100644 --- a/packages/terminal-next/src/browser/terminal.theme.ts +++ b/packages/terminal-next/src/browser/terminal.theme.ts @@ -1,8 +1,11 @@ +import type { ITheme } from 'xterm'; + import { Injectable } from '@opensumi/di'; import { Themable } from '@opensumi/ide-theme/lib/browser/workbench.theme.service'; import { Color } from '@opensumi/ide-theme/lib/common/color'; + import { ITerminalTheme } from '../common'; -import type { ITheme } from 'xterm'; + import * as TERMINAL_COLOR from './terminal.color'; @Injectable() diff --git a/packages/terminal-next/src/browser/terminal.view.ts b/packages/terminal-next/src/browser/terminal.view.ts index 33c72be89a..ea98d6418d 100644 --- a/packages/terminal-next/src/browser/terminal.view.ts +++ b/packages/terminal-next/src/browser/terminal.view.ts @@ -1,6 +1,8 @@ import { observable, computed } from 'mobx'; + import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, Disposable, Event } from '@opensumi/ide-core-browser'; + import { ITerminalGroupViewService, IWidget, diff --git a/packages/terminal-next/src/browser/xterm.ts b/packages/terminal-next/src/browser/xterm.ts index a77cb40ceb..15f406a37f 100644 --- a/packages/terminal-next/src/browser/xterm.ts +++ b/packages/terminal-next/src/browser/xterm.ts @@ -1,11 +1,12 @@ -import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { ITerminalOptions, ITheme, Terminal, IEvent } from 'xterm'; import { FitAddon } from 'xterm-addon-fit'; import { SearchAddon } from 'xterm-addon-search'; -import { AttachAddon } from './terminal.addon'; + +import { Injectable, Autowired, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-core-common'; import styles from './component/terminal.module.less'; +import { AttachAddon } from './terminal.addon'; export interface XTermOptions { cwd?: string; diff --git a/packages/terminal-next/src/common/api.ts b/packages/terminal-next/src/common/api.ts index 2828cc31e6..c4482cecb9 100644 --- a/packages/terminal-next/src/common/api.ts +++ b/packages/terminal-next/src/common/api.ts @@ -1,7 +1,8 @@ import { Event } from '@opensumi/ide-core-common'; -import { TerminalOptions, ITerminalInfo } from './pty'; -import { ITerminalExternalClient } from './controller'; + import { ITerminalExitEvent } from './client'; +import { ITerminalExternalClient } from './controller'; +import { TerminalOptions, ITerminalInfo } from './pty'; export const ITerminalApiService = Symbol('ITerminalApiService'); export interface ITerminalApiService { diff --git a/packages/terminal-next/src/common/client.ts b/packages/terminal-next/src/common/client.ts index a7a9a382a6..9f7273bda9 100644 --- a/packages/terminal-next/src/common/client.ts +++ b/packages/terminal-next/src/common/client.ts @@ -1,5 +1,7 @@ import { Terminal } from 'xterm'; + import { IDisposable, Disposable, Event, Deferred } from '@opensumi/ide-core-common'; + import { INodePtyInstance, TerminalOptions, ICreateTerminalOptions } from './pty'; import { IWidget } from './resize'; diff --git a/packages/terminal-next/src/common/controller.ts b/packages/terminal-next/src/common/controller.ts index 51e3d5e1df..546c1f9d17 100644 --- a/packages/terminal-next/src/common/controller.ts +++ b/packages/terminal-next/src/common/controller.ts @@ -1,12 +1,14 @@ -import { Event, Disposable, Deferred, IDisposable } from '@opensumi/ide-core-common'; -import { ITerminalLaunchError, ITerminalProcessExtHostProxy, IStartExtensionTerminalRequest } from './extension'; -import { IWidgetGroup, IWidget } from './resize'; -import { ITerminalClient, ITerminalExitEvent, ITerminalExternalLinkProvider } from './client'; -import { TerminalOptions, ITerminalInfo } from './pty'; import { IContextKeyService } from '@opensumi/ide-core-browser'; +import { Event, Disposable, Deferred, IDisposable } from '@opensumi/ide-core-common'; + // eslint-disable-next-line import/no-restricted-paths import type { ILinkHoverTargetOptions } from '../browser/links/link-manager'; +import { ITerminalClient, ITerminalExitEvent, ITerminalExternalLinkProvider } from './client'; +import { ITerminalLaunchError, ITerminalProcessExtHostProxy, IStartExtensionTerminalRequest } from './extension'; +import { TerminalOptions, ITerminalInfo } from './pty'; +import { IWidgetGroup, IWidget } from './resize'; + export interface ITerminalExternalClient { readonly id: string; readonly processId: Promise; diff --git a/packages/terminal-next/src/common/environmentVariableCollection.ts b/packages/terminal-next/src/common/environmentVariableCollection.ts index 5343deba7b..909ef54955 100644 --- a/packages/terminal-next/src/common/environmentVariableCollection.ts +++ b/packages/terminal-next/src/common/environmentVariableCollection.ts @@ -7,6 +7,7 @@ import { OS } from '@opensumi/ide-core-common'; import { IProcessEnvironment } from '@opensumi/ide-core-common/lib/platform'; + import { IMergedEnvironmentVariableCollection, IExtensionOwnedEnvironmentVariableMutator, diff --git a/packages/terminal-next/src/common/extension.ts b/packages/terminal-next/src/common/extension.ts index 31b9dcf710..544045dea6 100644 --- a/packages/terminal-next/src/common/extension.ts +++ b/packages/terminal-next/src/common/extension.ts @@ -1,6 +1,7 @@ -import { Event, IDisposable, URI } from '@opensumi/ide-core-common'; import type vscode from 'vscode'; +import { Event, IDisposable, URI } from '@opensumi/ide-core-common'; + export interface IProcessDataEvent { data: string; sync: boolean; diff --git a/packages/terminal-next/src/common/preference.ts b/packages/terminal-next/src/common/preference.ts index 2549b84789..b82fa91f1f 100644 --- a/packages/terminal-next/src/common/preference.ts +++ b/packages/terminal-next/src/common/preference.ts @@ -1,5 +1,6 @@ import { Event } from '@opensumi/ide-core-common'; - +import { localize, isElectronRenderer, isWindows } from '@opensumi/ide-core-common'; +import { PreferenceSchema } from '@opensumi/ide-core-common/lib/preferences'; export interface IPreferenceValue { name: string; value: string | number | boolean; @@ -130,10 +131,6 @@ export const enum CodeTerminalSettingId { AutoReplies = 'terminal.integrated.autoReplies', } -import { localize, isElectronRenderer, isWindows } from '@opensumi/ide-core-common'; - -import { PreferenceSchema } from '@opensumi/ide-core-common/lib/preferences'; - const shellDeprecationMessageLinux = localize( 'terminal.integrated.shell.linux.deprecation', 'This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in {0} and setting its profile name as the default in {1}. This will currently take priority over the new profiles settings but that will change in the future.', diff --git a/packages/terminal-next/src/common/profile.ts b/packages/terminal-next/src/common/profile.ts index ac1be3be4c..8da00e18e6 100644 --- a/packages/terminal-next/src/common/profile.ts +++ b/packages/terminal-next/src/common/profile.ts @@ -1,4 +1,8 @@ +import type vscode from 'vscode'; + import { IDisposable, Event, URI } from '@opensumi/ide-core-common'; +import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; + import { ICreateContributedTerminalProfileOptions, IShellLaunchConfig, @@ -6,8 +10,6 @@ import { ITerminalProfileProvider, TerminalIcon, } from '..'; -import type vscode from 'vscode'; -import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; export interface IResolveDefaultProfileOptions { os?: OperatingSystem; diff --git a/packages/terminal-next/src/common/pty.ts b/packages/terminal-next/src/common/pty.ts index cc55733923..b980a1e2aa 100644 --- a/packages/terminal-next/src/common/pty.ts +++ b/packages/terminal-next/src/common/pty.ts @@ -1,12 +1,14 @@ +import { IPty as INodePty } from 'node-pty'; import type vscode from 'vscode'; import { Terminal as XTerm } from 'xterm'; + import { Uri } from '@opensumi/ide-core-common'; -import { WindowsShellType } from './shell'; -import { IPty as INodePty } from 'node-pty'; import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; + import { ITerminalError } from './error'; -import { IDetectProfileOptions, ITerminalProfile } from './profile'; import { ITerminalEnvironment, ITerminalProcessExtHostProxy, TerminalLocation } from './extension'; +import { IDetectProfileOptions, ITerminalProfile } from './profile'; +import { WindowsShellType } from './shell'; export interface IPtyProcess extends INodePty { /** diff --git a/packages/terminal-next/src/common/service.ts b/packages/terminal-next/src/common/service.ts index ec73e1f912..0308313a84 100644 --- a/packages/terminal-next/src/common/service.ts +++ b/packages/terminal-next/src/common/service.ts @@ -1,10 +1,12 @@ +import { ITerminalOptions as IXtermTerminalOptions, Terminal } from 'xterm'; + import { IDisposable } from '@opensumi/ide-core-common'; import { OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; -import { ITerminalOptions as IXtermTerminalOptions, Terminal } from 'xterm'; -import { ITerminalError } from './error'; -import { IShellLaunchConfig, TerminalOptions } from './pty'; + import { ITerminalConnection } from './client'; +import { ITerminalError } from './error'; import { ITerminalProfile } from './profile'; +import { IShellLaunchConfig, TerminalOptions } from './pty'; export interface IPtyExitEvent { sessionId: string; diff --git a/packages/terminal-next/src/node/index.ts b/packages/terminal-next/src/node/index.ts index 4eaae18d77..ea00fa2cfc 100644 --- a/packages/terminal-next/src/node/index.ts +++ b/packages/terminal-next/src/node/index.ts @@ -1,7 +1,6 @@ import { Provider, Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; -import { TerminalServiceImpl } from './terminal.service'; -import { TerminalServiceClientImpl } from './terminal.service.client'; + import { ITerminalNodeService, ITerminalProcessPath, @@ -9,9 +8,12 @@ import { ITerminalServiceClient, ITerminalServicePath, } from '../common'; -import { TerminalProcessServiceImpl } from './terminal.process.service'; + import { PtyService, IPtyService } from './pty'; +import { TerminalProcessServiceImpl } from './terminal.process.service'; import { ITerminalProfileServiceNode, TerminalProfileServiceNode } from './terminal.profile.service'; +import { TerminalServiceImpl } from './terminal.service'; +import { TerminalServiceClientImpl } from './terminal.service.client'; @Injectable() export class TerminalNodePtyModule extends NodeModule { diff --git a/packages/terminal-next/src/node/pty.ts b/packages/terminal-next/src/node/pty.ts index 9cc2afec71..2331c76a66 100644 --- a/packages/terminal-next/src/node/pty.ts +++ b/packages/terminal-next/src/node/pty.ts @@ -5,20 +5,25 @@ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.63.0/src/vs/platform/terminal/node/terminalProcess.ts -import * as pty from 'node-pty'; -import * as osLocale from 'os-locale'; +import { promises } from 'fs'; import os from 'os'; + import omit from 'lodash.omit'; -import { IShellLaunchConfig, ITerminalLaunchError } from '../common'; -import { IPtyProcess } from '../common/pty'; -import { findExecutable } from './shell'; -import { getShellPath } from '@opensumi/ide-core-node/lib/bootstrap/shell-path'; -import { Disposable, Emitter, INodeLogger } from '@opensumi/ide-core-node'; +import * as pty from 'node-pty'; +import * as osLocale from 'os-locale'; + import { Injectable, Autowired } from '@opensumi/di'; -import { promises } from 'fs'; import * as path from '@opensumi/ide-core-common/lib/path'; import { isWindows } from '@opensumi/ide-core-common/lib/platform'; +import { Disposable, Emitter, INodeLogger } from '@opensumi/ide-core-node'; +import { getShellPath } from '@opensumi/ide-core-node/lib/bootstrap/shell-path'; + +import { IShellLaunchConfig, ITerminalLaunchError } from '../common'; import { IProcessReadyEvent, IProcessExitEvent } from '../common/process'; +import { IPtyProcess } from '../common/pty'; + +import { findExecutable } from './shell'; + export const IPtyService = Symbol('IPtyService'); diff --git a/packages/terminal-next/src/node/shell.ts b/packages/terminal-next/src/node/shell.ts index 3fc0a8eb96..5fec3a0c1e 100644 --- a/packages/terminal-next/src/node/shell.ts +++ b/packages/terminal-next/src/node/shell.ts @@ -7,11 +7,11 @@ // - https://github.com/microsoft/vscode/blob/1.63.0/src/vs/platform/terminal/node/terminalEnvironment.ts // - https://github.com/microsoft/vscode/blob/ff383268424b1d4b6620e7ea197fb13ae513414f/src/vs/base/node/shell.ts -import { userInfo, release } from 'os'; import fs from 'fs'; +import { userInfo, release } from 'os'; -import { IProcessEnvironment, isLinux, isMacintosh, OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; import * as path from '@opensumi/ide-core-common/lib/path'; +import { IProcessEnvironment, isLinux, isMacintosh, OperatingSystem } from '@opensumi/ide-core-common/lib/platform'; import { isWindows } from '@opensumi/ide-core-node'; export const WINDOWS_GIT_BASH_PATHS = [ diff --git a/packages/terminal-next/src/node/terminal.process.service.ts b/packages/terminal-next/src/node/terminal.process.service.ts index 3779e78815..0eeebcc789 100644 --- a/packages/terminal-next/src/node/terminal.process.service.ts +++ b/packages/terminal-next/src/node/terminal.process.service.ts @@ -1,4 +1,5 @@ import { Injectable } from '@opensumi/di'; + import { ITerminalProcessService } from '../common'; @Injectable() diff --git a/packages/terminal-next/src/node/terminal.profile.service.ts b/packages/terminal-next/src/node/terminal.profile.service.ts index 993c54b4f1..63fb0e839e 100644 --- a/packages/terminal-next/src/node/terminal.profile.service.ts +++ b/packages/terminal-next/src/node/terminal.profile.service.ts @@ -5,23 +5,25 @@ // some code copied and modified from https://github.com/microsoft/vscode/blob/ff383268424b1d4b6620e7ea197fb13ae513414f/src/vs/platform/terminal/node/terminalProfiles.ts -import { URI } from '@opensumi/ide-core-common'; -import { isWindows } from '@opensumi/ide-core-common/lib/platform'; - +import { readFile } from 'fs-extra'; import type vscode from 'vscode'; import { Injectable, Autowired } from '@opensumi/di'; +import { URI } from '@opensumi/ide-core-common'; +import * as path from '@opensumi/ide-core-common/lib/path'; +import { isWindows } from '@opensumi/ide-core-common/lib/platform'; +import { INodeLogger } from '@opensumi/ide-core-node'; + +import { IDetectProfileOptions, ITerminalEnvironment } from '..'; import { IPotentialTerminalProfile, ITerminalProfile, IUnresolvedTerminalProfile, ProfileSource, } from '../common/profile'; + import { exists, findExecutable, getPowershellPaths, WINDOWS_GIT_BASH_PATHS } from './shell'; -import { INodeLogger } from '@opensumi/ide-core-node'; -import { IDetectProfileOptions, ITerminalEnvironment } from '..'; -import { readFile } from 'fs-extra'; -import * as path from '@opensumi/ide-core-common/lib/path'; + function applyConfigProfilesToMap( configProfiles: { [key: string]: IUnresolvedTerminalProfile } | undefined, diff --git a/packages/terminal-next/src/node/terminal.service.client.ts b/packages/terminal-next/src/node/terminal.service.client.ts index fe6bb72125..2d176cc5af 100644 --- a/packages/terminal-next/src/node/terminal.service.client.ts +++ b/packages/terminal-next/src/node/terminal.service.client.ts @@ -1,5 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; import { RPCService } from '@opensumi/ide-connection'; +import { OperatingSystem, OS } from '@opensumi/ide-core-common/lib/platform'; +import { INodeLogger } from '@opensumi/ide-core-node'; + import { IShellLaunchConfig, ITerminalNodeService, @@ -7,13 +10,13 @@ import { INodePtyInstance, ITerminalError, } from '../common'; +import { IDetectProfileOptions, ITerminalProfile } from '../common/profile'; import { IPtyProcess } from '../common/pty'; -import { INodeLogger } from '@opensumi/ide-core-node'; import { WindowsShellType, WINDOWS_DEFAULT_SHELL_PATH_MAPS } from '../common/shell'; + import { findExecutable, findShellExecutableAsync, getSystemShell, WINDOWS_GIT_BASH_PATHS } from './shell'; import { ITerminalProfileServiceNode, TerminalProfileServiceNode } from './terminal.profile.service'; -import { IDetectProfileOptions, ITerminalProfile } from '../common/profile'; -import { OperatingSystem, OS } from '@opensumi/ide-core-common/lib/platform'; + /** * this RPC target: NodePtyTerminalService diff --git a/packages/terminal-next/src/node/terminal.service.ts b/packages/terminal-next/src/node/terminal.service.ts index f233b9825a..f1c50fb3fd 100644 --- a/packages/terminal-next/src/node/terminal.service.ts +++ b/packages/terminal-next/src/node/terminal.service.ts @@ -1,9 +1,12 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; -import { PtyService } from './pty'; -import { IPtyProcess, IShellLaunchConfig } from '../common/pty'; -import { ETerminalErrorType, ITerminalNodeService, ITerminalServiceClient } from '../common'; import { INodeLogger, AppConfig, isDevelopment } from '@opensumi/ide-core-node'; +import { ETerminalErrorType, ITerminalNodeService, ITerminalServiceClient } from '../common'; +import { IPtyProcess, IShellLaunchConfig } from '../common/pty'; + +import { PtyService } from './pty'; + + // ref: https://github.com/vercel/hyper/blob/4c90d7555c79fb6dc438fa9549f1d0ef7c7a5aa7/app/session.ts#L27-L32 // 批处理字符最大长度 const BATCH_MAX_SIZE = 200 * 1024; diff --git a/packages/testing/src/browser/components/testing.explorer.tree.tsx b/packages/testing/src/browser/components/testing.explorer.tree.tsx index 30dc300ede..cdf4b9f4f6 100644 --- a/packages/testing/src/browser/components/testing.explorer.tree.tsx +++ b/packages/testing/src/browser/components/testing.explorer.tree.tsx @@ -1,18 +1,19 @@ -import React, { useEffect, useState } from 'react'; import { observer } from 'mobx-react-lite'; -import { CommandService, Event, map, useInjectable } from '@opensumi/ide-core-browser'; +import React, { useEffect, useState } from 'react'; + import { BasicRecycleTree, IRecycleTreeHandle, RecycleTree } from '@opensumi/ide-components/lib/recycle-tree'; +import { BasicCompositeTreeNode } from '@opensumi/ide-components/lib/recycle-tree/basic/tree-node.define'; +import { CommandService, Event, map, useInjectable } from '@opensumi/ide-core-browser'; -import { ITestTreeData, ITestTreeItem, TestTreeViewModelToken } from '../../common/tree-view.model'; -import { TestItemExpandState, TestRunProfileBitset } from '../../common/testCollection'; -import { DebugTestCommand, GoToTestCommand, RuntTestCommand } from '../../common/commands'; import { ITestService, TestServiceToken } from '../../common'; -import { getIconWithColor } from '../icons/icons'; -import { BasicCompositeTreeNode } from '@opensumi/ide-components/lib/recycle-tree/basic/tree-node.define'; +import { DebugTestCommand, GoToTestCommand, RuntTestCommand } from '../../common/commands'; +import { TestItemExpandState, TestRunProfileBitset } from '../../common/testCollection'; import { TestingExplorerInlineMenus } from '../../common/testing-view'; +import { ITestTreeData, ITestTreeItem, TestTreeViewModelToken } from '../../common/tree-view.model'; +import { getIconWithColor } from '../icons/icons'; +import { TestTreeViewModelImpl } from '../test-tree-view.model'; import styles from './testing.module.less'; -import { TestTreeViewModelImpl } from '../test-tree-view.model'; export const TestingExplorerTree: React.FC<{}> = observer(() => { const testViewModel = useInjectable(TestTreeViewModelToken); diff --git a/packages/testing/src/browser/components/testing.view.tsx b/packages/testing/src/browser/components/testing.view.tsx index 8b4cbeab6c..6d2c961593 100644 --- a/packages/testing/src/browser/components/testing.view.tsx +++ b/packages/testing/src/browser/components/testing.view.tsx @@ -1,12 +1,14 @@ import React, { useEffect, useState } from 'react'; -import { TitleBar } from '@opensumi/ide-main-layout/lib/browser/accordion/titlebar.view'; + import { localize, useInjectable, ViewContextKeyRegistry } from '@opensumi/ide-core-browser'; +import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { AbstractContextMenuService, IContextMenu, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { TitleBar } from '@opensumi/ide-main-layout/lib/browser/accordion/titlebar.view'; + +import { Testing } from '../../common/constants'; import { TestingExplorerTree } from './testing.explorer.tree'; import styles from './testing.module.less'; -import { AbstractContextMenuService, IContextMenu, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; -import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { Testing } from '../../common/constants'; export const TestingView = () => { const menuService = useInjectable(AbstractContextMenuService); diff --git a/packages/testing/src/browser/icons/icons.ts b/packages/testing/src/browser/icons/icons.ts index 8c770b16e8..f639b267e4 100644 --- a/packages/testing/src/browser/icons/icons.ts +++ b/packages/testing/src/browser/icons/icons.ts @@ -1,4 +1,5 @@ import { getExternalIcon } from '@opensumi/ide-core-browser'; + import { TestResultState } from '../../common/testCollection'; export const defaultIconColor = 'testing_icon_iconPassed'; diff --git a/packages/testing/src/browser/index.ts b/packages/testing/src/browser/index.ts index 923df8ab1d..d8565dfa5f 100644 --- a/packages/testing/src/browser/index.ts +++ b/packages/testing/src/browser/index.ts @@ -1,23 +1,24 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; +import { TestPeekMessageToken, TestServiceToken } from '../common'; import { TestProfileServiceToken } from '../common/test-profile'; import { TestResultServiceToken } from '../common/test-result'; +import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener'; import { TestTreeViewModelToken } from '../common/tree-view.model'; + +import { TestingPeekMessageServiceImpl } from './outputPeek/test-peek-message.service'; +import { TestingPeekOpenerServiceImpl } from './outputPeek/test-peek-opener.service'; import { TestProfileServiceImpl } from './test-profile.service'; import { TestTreeViewModelImpl } from './test-tree-view.model'; import { TestResultServiceImpl } from './test.result.service'; import { TestServiceImpl } from './test.service'; import { TestingContribution } from './testing.contribution'; -import { TestPeekMessageToken, TestServiceToken } from '../common'; -import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener'; import './icons/icons.less'; import './outputPeek/test-peek-widget.less'; import './theme.less'; -import { TestingPeekOpenerServiceImpl } from './outputPeek/test-peek-opener.service'; -import { TestingPeekMessageServiceImpl } from './outputPeek/test-peek-message.service'; @Injectable() export class TestingModule extends BrowserModule { providers: Provider[] = [ diff --git a/packages/testing/src/browser/outputPeek/test-message-container.tsx b/packages/testing/src/browser/outputPeek/test-message-container.tsx index d569a0315f..4b23d1227f 100644 --- a/packages/testing/src/browser/outputPeek/test-message-container.tsx +++ b/packages/testing/src/browser/outputPeek/test-message-container.tsx @@ -1,3 +1,6 @@ +import React, { useEffect, useRef, useState } from 'react'; +import ReactDOM from 'react-dom'; + import { IOpenerService, useInjectable } from '@opensumi/ide-core-browser'; import { Disposable, Schemas, URI } from '@opensumi/ide-core-common'; import { @@ -7,16 +10,16 @@ import { IEditorDocumentModelService, IMarkdownString, } from '@opensumi/ide-editor/lib/browser'; +import { Markdown } from '@opensumi/ide-markdown'; import { IDiffEditorOptions, IEditorOptions } from '@opensumi/ide-monaco/lib/browser/monaco-api/editor'; -import React, { useEffect, useRef, useState } from 'react'; -import ReactDOM from 'react-dom'; + import { TestPeekMessageToken } from '../../common'; import { ITestErrorMessage } from '../../common/testCollection'; +import styles from '../components/testing.module.less'; + import { TestDto } from './test-output-peek'; import { TestingPeekMessageServiceImpl } from './test-peek-message.service'; -import { Markdown } from '@opensumi/ide-markdown'; -import styles from '../components/testing.module.less'; enum EContainerType { DIFF, diff --git a/packages/testing/src/browser/outputPeek/test-output-peek.ts b/packages/testing/src/browser/outputPeek/test-output-peek.ts index 8e4a31439d..90afe77b49 100644 --- a/packages/testing/src/browser/outputPeek/test-output-peek.ts +++ b/packages/testing/src/browser/outputPeek/test-output-peek.ts @@ -1,18 +1,20 @@ -import { EDITOR_COMMANDS, IContextKeyService, Schemas } from '@opensumi/ide-core-browser'; -import * as editorCommon from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon'; -import { buildTestUri, TestUriType } from './../../common/testingUri'; import { Injectable, Optional, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { EDITOR_COMMANDS, IContextKeyService, Schemas } from '@opensumi/ide-core-browser'; import { CommandService, Disposable, IDisposable, MutableDisposable, URI } from '@opensumi/ide-core-common'; import { IEditor, IEditorFeatureContribution } from '@opensumi/ide-editor/lib/browser'; import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; -import { IRichLocation, ITestItem, ITestMessage, TestMessageType, TestResultItem } from '../../common/testCollection'; -import { TestingOutputPeek } from './test-peek-widget'; -import { TestResultServiceImpl } from '../test.result.service'; +import * as editorCommon from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon'; + import { ITestResult, TestResultServiceToken } from '../../common/test-result'; +import { IRichLocation, ITestItem, ITestMessage, TestMessageType, TestResultItem } from '../../common/testCollection'; import { TestingPeekOpenerServiceToken } from '../../common/testingPeekOpener'; -import { TestingPeekOpenerServiceImpl } from './test-peek-opener.service'; import { isDiffable } from '../../common/testingStates'; import { TestContextKey } from '../test-contextkey.service'; +import { TestResultServiceImpl } from '../test.result.service'; + +import { buildTestUri, TestUriType } from './../../common/testingUri'; +import { TestingPeekOpenerServiceImpl } from './test-peek-opener.service'; +import { TestingOutputPeek } from './test-peek-widget'; export class TestDto { public readonly test: ITestItem; diff --git a/packages/testing/src/browser/outputPeek/test-peek-message.service.ts b/packages/testing/src/browser/outputPeek/test-peek-message.service.ts index 0fbc7f664e..365f33ad9a 100644 --- a/packages/testing/src/browser/outputPeek/test-peek-message.service.ts +++ b/packages/testing/src/browser/outputPeek/test-peek-message.service.ts @@ -1,6 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, URI, Emitter } from '@opensumi/ide-core-common'; + import { ITestingPeekMessageService } from '../../common'; + import { TestDto } from './test-output-peek'; @Injectable() diff --git a/packages/testing/src/browser/outputPeek/test-peek-opener.service.ts b/packages/testing/src/browser/outputPeek/test-peek-opener.service.ts index bbb6d3208c..32520e7a9a 100644 --- a/packages/testing/src/browser/outputPeek/test-peek-opener.service.ts +++ b/packages/testing/src/browser/outputPeek/test-peek-opener.service.ts @@ -1,14 +1,16 @@ -import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, URI } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { ITextEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/platform/editor/common/editor'; + import { ITestResult, TestResultServiceToken } from '../../common/test-result'; import { ITestMessage, ITestTaskState, TestResultItem } from '../../common/testCollection'; import { ITestingPeekOpenerService } from '../../common/testingPeekOpener'; import { buildTestUri, ParsedTestUri, TestUriType } from '../../common/testingUri'; -import { TestOutputPeekContribution } from './test-output-peek'; import { TestResultServiceImpl } from '../test.result.service'; +import { TestOutputPeekContribution } from './test-output-peek'; + type TestUriWithDocument = ParsedTestUri & { documentUri: URI }; const mapFindTestMessage = ( diff --git a/packages/testing/src/browser/outputPeek/test-peek-widget.tsx b/packages/testing/src/browser/outputPeek/test-peek-widget.tsx index 26ada90345..a8e5607bcc 100644 --- a/packages/testing/src/browser/outputPeek/test-peek-widget.tsx +++ b/packages/testing/src/browser/outputPeek/test-peek-widget.tsx @@ -1,21 +1,25 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { PeekViewWidget } from '@opensumi/ide-monaco-enhance/lib/browser/peek-view'; + import { Injectable, Autowired } from '@opensumi/di'; -import type { ICodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { TestDto } from './test-output-peek'; -import { TestMessageType } from '../../common/testCollection'; -import './test-peek-widget.less'; import { AppConfig, ConfigProvider, IContextKeyService } from '@opensumi/ide-core-browser'; +import { SplitPanel } from '@opensumi/ide-core-browser/lib/components'; +import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; +import { AbstractMenuService, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { PeekViewWidget } from '@opensumi/ide-monaco-enhance/lib/browser/peek-view'; +import type { ICodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import { renderMarkdown } from '@opensumi/monaco-editor-core/esm/vs/base/browser/markdownRenderer'; + +import { TestPeekMessageToken } from '../../common'; +import { TestMessageType } from '../../common/testCollection'; +import { firstLine, hintMessagePeekHeight } from '../../common/testingStates'; + import { TestMessageContainer } from './test-message-container'; +import { TestDto } from './test-output-peek'; import { TestingPeekMessageServiceImpl } from './test-peek-message.service'; -import { TestPeekMessageToken } from '../../common'; import { TestTreeContainer } from './test-tree-container'; -import { SplitPanel } from '@opensumi/ide-core-browser/lib/components'; -import { firstLine, hintMessagePeekHeight } from '../../common/testingStates'; -import { InlineActionBar } from '@opensumi/ide-core-browser/lib/components/actions'; -import { AbstractMenuService, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; + +import './test-peek-widget.less'; @Injectable({ multiple: true }) export class TestingOutputPeek extends PeekViewWidget { diff --git a/packages/testing/src/browser/outputPeek/test-tree-container.tsx b/packages/testing/src/browser/outputPeek/test-tree-container.tsx index 02a1138062..73c15aa848 100644 --- a/packages/testing/src/browser/outputPeek/test-tree-container.tsx +++ b/packages/testing/src/browser/outputPeek/test-tree-container.tsx @@ -1,19 +1,22 @@ +import React, { useEffect, useState } from 'react'; + import { BasicRecycleTree } from '@opensumi/ide-components'; import { useInjectable } from '@opensumi/ide-core-browser'; import { Disposable, localize } from '@opensumi/ide-core-common'; import { Iterable } from '@opensumi/monaco-editor-core/esm/vs/base/common/iterator'; -import React, { useEffect, useState } from 'react'; + import { TestPeekMessageToken } from '../../common'; import { ITestResult, maxCountPriority, resultItemParents, TestResultServiceToken } from '../../common/test-result'; import { ITestMessage, ITestTaskState, TestResultItem, TestResultState } from '../../common/testCollection'; import { firstLine, parseMarkdownText } from '../../common/testingStates'; import { buildTestUri, TestUriType } from '../../common/testingUri'; import { ITestTreeData } from '../../common/tree-view.model'; +import styles from '../components/testing.module.less'; import { getIconWithColor } from '../icons/icons'; import { TestResultServiceImpl } from '../test.result.service'; + import { TestingPeekMessageServiceImpl } from './test-peek-message.service'; -import styles from '../components/testing.module.less'; enum ETestTreeType { RESULT = 'result', diff --git a/packages/testing/src/browser/test-contextkey.service.ts b/packages/testing/src/browser/test-contextkey.service.ts index f3bfcbd98d..3d8dac48e7 100644 --- a/packages/testing/src/browser/test-contextkey.service.ts +++ b/packages/testing/src/browser/test-contextkey.service.ts @@ -1,8 +1,8 @@ -import { IContextKeyServiceTarget } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; -import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService'; import { Optional, Injectable, Autowired } from '@opensumi/di'; import { IContextKeyService, IContextKey, IScopedContextKeyService } from '@opensumi/ide-core-browser'; import { TestingIsPeekVisible } from '@opensumi/ide-core-browser/lib/contextkey/testing'; +import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService'; +import { IContextKeyServiceTarget } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; @Injectable() export class TestContextKey { diff --git a/packages/testing/src/browser/test-decorations.ts b/packages/testing/src/browser/test-decorations.ts index 4973cdb798..9ef7878232 100644 --- a/packages/testing/src/browser/test-decorations.ts +++ b/packages/testing/src/browser/test-decorations.ts @@ -1,19 +1,25 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import * as editorCommon from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon'; -import { EditorOption } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; -import { MouseTargetType } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/editorBrowser'; -import { MarkdownString } from '@opensumi/monaco-editor-core/esm/vs/base/common/htmlContent'; -import { maxPriority, parseMarkdownText } from './../common/testingStates'; -import { labelForTestInState, testMessageSeverityColors } from './../common/constants'; -import { ICodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; -import { TestResultImpl, TestResultServiceToken } from './../common/test-result'; -import { ResultChangeEvent, TestResultServiceImpl } from './test.result.service'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector, Optional } from '@opensumi/di'; +import { Event, IContextKeyService, MonacoOverrideServiceRegistry, ServiceNames } from '@opensumi/ide-core-browser'; +import { + AbstractMenuService, + generateMergedCtxMenu, + ICtxMenuRenderer, + IMenu, + MenuId, +} from '@opensumi/ide-core-browser/lib/menu/next'; import { Disposable, IDisposable, IRange, URI, uuid } from '@opensumi/ide-core-common'; +import { removeAnsiEscapeCodes } from '@opensumi/ide-core-common'; import { IEditor, IEditorFeatureContribution } from '@opensumi/ide-editor/lib/browser'; -import { TestServiceToken } from '../common'; +import { MonacoCodeService } from '@opensumi/ide-editor/lib/browser/editor.override'; +import { ICodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { MarkdownString } from '@opensumi/monaco-editor-core/esm/vs/base/common/htmlContent'; +import { MouseTargetType } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/editorBrowser'; +import { EditorOption } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import * as editorCommon from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon'; import { IModelDeltaDecoration } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model'; -import { Event, IContextKeyService, MonacoOverrideServiceRegistry, ServiceNames } from '@opensumi/ide-core-browser'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { TestServiceToken } from '../common'; import { IncrementalTestCollectionItem, InternalTestItem, @@ -25,6 +31,12 @@ import { TestRunProfileBitset, TestsDiff, } from '../common/testCollection'; +import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener'; +import { buildTestUri, TestUriType } from '../common/testingUri'; + +import { labelForTestInState, testMessageSeverityColors } from './../common/constants'; +import { TestResultImpl, TestResultServiceToken } from './../common/test-result'; +import { maxPriority, parseMarkdownText } from './../common/testingStates'; import { defaultIconColor, testingRunAllIcon, @@ -32,19 +44,10 @@ import { testingStatesToIcons, testStatesToIconColors, } from './icons/icons'; -import { TestServiceImpl } from './test.service'; -import { removeAnsiEscapeCodes } from '@opensumi/ide-core-common'; -import { MonacoCodeService } from '@opensumi/ide-editor/lib/browser/editor.override'; -import { buildTestUri, TestUriType } from '../common/testingUri'; import { TestingPeekOpenerServiceImpl } from './outputPeek/test-peek-opener.service'; -import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener'; -import { - AbstractMenuService, - generateMergedCtxMenu, - ICtxMenuRenderer, - IMenu, - MenuId, -} from '@opensumi/ide-core-browser/lib/menu/next'; +import { ResultChangeEvent, TestResultServiceImpl } from './test.result.service'; +import { TestServiceImpl } from './test.service'; + interface ITestDecoration extends IDisposable { id: string; diff --git a/packages/testing/src/browser/test-profile.service.ts b/packages/testing/src/browser/test-profile.service.ts index 686c02c646..3adb1dc103 100644 --- a/packages/testing/src/browser/test-profile.service.ts +++ b/packages/testing/src/browser/test-profile.service.ts @@ -1,9 +1,9 @@ import { Injectable } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-core-browser'; -import { ITestController } from '../index'; import { ITestProfileService, sorter } from '../common/test-profile'; import { ITestRunProfile, TestRunProfileBitset } from '../common/testCollection'; +import { ITestController } from '../index'; @Injectable() export class TestProfileServiceImpl extends Disposable implements ITestProfileService { diff --git a/packages/testing/src/browser/test-tree-view.model.ts b/packages/testing/src/browser/test-tree-view.model.ts index 8b2d644ba1..4cfc09b409 100644 --- a/packages/testing/src/browser/test-tree-view.model.ts +++ b/packages/testing/src/browser/test-tree-view.model.ts @@ -1,11 +1,13 @@ -import { Iterable } from '@opensumi/monaco-editor-core/esm/vs/base/common/iterator'; -import { ITestTreeData } from './../common/tree-view.model'; -import { applyTestItemUpdate, IncrementalTestCollectionItem, ITestItemUpdate } from './../common/testCollection'; import { Autowired, Injectable } from '@opensumi/di'; +import { CompositeTreeNode, IRecycleTreeHandle, TreeNodeEvent } from '@opensumi/ide-components'; +import { BasicCompositeTreeNode } from '@opensumi/ide-components/lib/recycle-tree/basic/tree-node.define'; import { Emitter } from '@opensumi/ide-components/lib/utils'; import { Disposable, isDefined, filter, map, getDebugLogger } from '@opensumi/ide-core-browser'; +import { Iterable } from '@opensumi/monaco-editor-core/esm/vs/base/common/iterator'; import { ITestService, TestServiceToken } from '../common'; +import { IComputedStateAndDurationAccessor, refreshComputedState } from '../common/getComputedState'; +import { TestResultServiceToken } from '../common/test-result'; import { InternalTestItem, TestDiffOpType, @@ -14,11 +16,11 @@ import { TestsDiff, } from '../common/testCollection'; import { ITestTreeItem, ITestTreeViewModel } from '../common/tree-view.model'; -import { CompositeTreeNode, IRecycleTreeHandle, TreeNodeEvent } from '@opensumi/ide-components'; -import { BasicCompositeTreeNode } from '@opensumi/ide-components/lib/recycle-tree/basic/tree-node.define'; -import { TestResultServiceToken } from '../common/test-result'; + + +import { applyTestItemUpdate, IncrementalTestCollectionItem, ITestItemUpdate } from './../common/testCollection'; +import { ITestTreeData } from './../common/tree-view.model'; import { ResultChangeEvent, TestResultServiceImpl } from './test.result.service'; -import { IComputedStateAndDurationAccessor, refreshComputedState } from '../common/getComputedState'; const computedStateAccessor: IComputedStateAndDurationAccessor = { getOwnState: (i) => (i instanceof TestTreeItem ? i.ownState : TestResultState.Unset), diff --git a/packages/testing/src/browser/test.result.service.ts b/packages/testing/src/browser/test.result.service.ts index 8bc661529f..1b61712dc9 100644 --- a/packages/testing/src/browser/test.result.service.ts +++ b/packages/testing/src/browser/test.result.service.ts @@ -2,6 +2,7 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Emitter, IContextKey, IContextKeyService, URI, uuid } from '@opensumi/ide-core-browser'; import { TestingHasAnyResults, TestingIsRunning } from '@opensumi/ide-core-browser/lib/contextkey/testing'; import { findFirstInSorted } from '@opensumi/ide-core-common/lib/arrays'; + import { ITestProfileService, TestProfileServiceToken } from '../common/test-profile'; import { ITestResult, @@ -18,6 +19,7 @@ import { TestResultState, } from '../common/testCollection'; import { parseTestUri } from '../common/testingUri'; + import { TestDto } from './outputPeek/test-output-peek'; export type ResultChangeEvent = diff --git a/packages/testing/src/browser/test.service.ts b/packages/testing/src/browser/test.service.ts index 4c281b1036..097bc1218a 100644 --- a/packages/testing/src/browser/test.service.ts +++ b/packages/testing/src/browser/test.service.ts @@ -1,8 +1,4 @@ -import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import { ITestResult } from './../common/test-result'; import { Injectable, Autowired } from '@opensumi/di'; -import { IContextKey, IContextKeyService } from '@opensumi/ide-core-browser/lib/context-key'; -import { TestingServiceProviderCount } from '@opensumi/ide-core-browser/lib/contextkey/testing'; import { CancellationToken, CancellationTokenSource, @@ -13,14 +9,19 @@ import { localize, SlotLocation, } from '@opensumi/ide-core-browser'; +import { IContextKey, IContextKeyService } from '@opensumi/ide-core-browser/lib/context-key'; +import { TestingServiceProviderCount } from '@opensumi/ide-core-browser/lib/contextkey/testing'; +import { IMainLayoutService } from '@opensumi/ide-main-layout'; import { AmbiguousRunTestsRequest, ITestController, ITestService, TestId } from '../common'; +import { Testing } from '../common/constants'; import { canUseProfileWithTest, ITestProfileService, TestProfileServiceToken } from '../common/test-profile'; import { ITestResultService, TestResultServiceToken } from '../common/test-result'; import { MainThreadTestCollection, ResolvedTestRunRequest, TestDiffOpType, TestsDiff } from '../common/testCollection'; -import { TestingView } from './components/testing.view'; import { TestingContainerId } from '../common/testing-view'; -import { Testing } from '../common/constants'; + +import { ITestResult } from './../common/test-result'; +import { TestingView } from './components/testing.view'; @Injectable() export class TestServiceImpl extends Disposable implements ITestService { diff --git a/packages/testing/src/browser/testing.contribution.ts b/packages/testing/src/browser/testing.contribution.ts index b261273259..0a123b7966 100644 --- a/packages/testing/src/browser/testing.contribution.ts +++ b/packages/testing/src/browser/testing.contribution.ts @@ -1,17 +1,3 @@ -import { Emitter } from '@opensumi/ide-core-common'; -import { TEST_DATA_SCHEME } from './../common/testingUri'; -import { IEditor } from '@opensumi/ide-editor/lib/common'; -import { - BrowserEditorContribution, - IEditorFeatureRegistry, - IEditorDocumentModelContentRegistry, - IEditorDocumentModelContentProvider, - WorkbenchEditorService, - EditorComponentRegistry, - ResourceService, - IResource, - IMarkdownString, -} from '@opensumi/ide-editor/lib/browser'; import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { ClientAppContribution, @@ -34,6 +20,26 @@ import { ToolbarRegistry, URI, } from '@opensumi/ide-core-browser'; +import { TestingIsPeekVisible } from '@opensumi/ide-core-browser/lib/contextkey/testing'; +import { IMenuRegistry, MenuContribution, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { Emitter } from '@opensumi/ide-core-common'; +import { + BrowserEditorContribution, + IEditorFeatureRegistry, + IEditorDocumentModelContentRegistry, + IEditorDocumentModelContentProvider, + WorkbenchEditorService, + EditorComponentRegistry, + ResourceService, + IResource, + IMarkdownString, +} from '@opensumi/ide-editor/lib/browser'; +import { IEditor } from '@opensumi/ide-editor/lib/common'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { MARKDOWN_EDITOR_COMPONENT_ID } from '@opensumi/ide-markdown/lib/browser/contribution'; +import { MarkdownEditorComponent } from '@opensumi/ide-markdown/lib/browser/editor.markdown'; + +import { TestServiceToken } from '../common'; import { ClearTestResults, ClosePeekTest, @@ -49,23 +55,19 @@ import { TestingDebugCurrentFile, TestingRunCurrentFile, } from '../common/commands'; - +import { Testing } from '../common/constants'; +import { TestResultServiceToken } from '../common/test-result'; +import { TestRunProfileBitset } from '../common/testCollection'; +import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener'; import { ITestTreeViewModel, TestTreeViewModelToken } from '../common/tree-view.model'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; -import { TestDecorationsContribution } from './test-decorations'; + +import { TEST_DATA_SCHEME } from './../common/testingUri'; import { TestOutputPeekContribution } from './outputPeek/test-output-peek'; -import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener'; import { TestingPeekOpenerServiceImpl } from './outputPeek/test-peek-opener.service'; -import { TestServiceImpl } from './test.service'; -import { TestServiceToken } from '../common'; -import { TestRunProfileBitset } from '../common/testCollection'; -import { IMenuRegistry, MenuContribution, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; +import { TestDecorationsContribution } from './test-decorations'; import { TestResultServiceImpl } from './test.result.service'; -import { TestResultServiceToken } from '../common/test-result'; -import { MarkdownEditorComponent } from '@opensumi/ide-markdown/lib/browser/editor.markdown'; -import { MARKDOWN_EDITOR_COMPONENT_ID } from '@opensumi/ide-markdown/lib/browser/contribution'; -import { Testing } from '../common/constants'; -import { TestingIsPeekVisible } from '@opensumi/ide-core-browser/lib/contextkey/testing'; +import { TestServiceImpl } from './test.service'; + @Injectable() export class TestingOutputPeekDocumentProvider implements IEditorDocumentModelContentProvider { diff --git a/packages/testing/src/common/constants.ts b/packages/testing/src/common/constants.ts index 3f5808eb32..00640c2875 100644 --- a/packages/testing/src/common/constants.ts +++ b/packages/testing/src/common/constants.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { localize } from '@opensumi/ide-core-common'; + import { TestMessageType, TestResultState, TestRunProfileBitset } from './testCollection'; export const enum Testing { diff --git a/packages/testing/src/common/getComputedState.ts b/packages/testing/src/common/getComputedState.ts index 93ed2fda8b..fc29c1552d 100644 --- a/packages/testing/src/common/getComputedState.ts +++ b/packages/testing/src/common/getComputedState.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Iterable } from '@opensumi/monaco-editor-core/esm/vs/base/common/iterator'; + import { TestResultState } from './testCollection'; import { maxPriority, statePriority } from './testingStates'; diff --git a/packages/testing/src/common/index.ts b/packages/testing/src/common/index.ts index 4002970da4..d02fdf131c 100644 --- a/packages/testing/src/common/index.ts +++ b/packages/testing/src/common/index.ts @@ -1,4 +1,5 @@ import { Event, IDisposable, CancellationToken } from '@opensumi/ide-core-browser'; + import { ITestResult } from './test-result'; import { InternalTestItem, diff --git a/packages/testing/src/common/test-profile.ts b/packages/testing/src/common/test-profile.ts index 8f98207ede..726684dfd6 100644 --- a/packages/testing/src/common/test-profile.ts +++ b/packages/testing/src/common/test-profile.ts @@ -1,4 +1,5 @@ import { ITestController, TestId } from '../index'; + import { InternalTestItem, ITestRunProfile, TestRunProfileBitset } from './testCollection'; export const sorter = (a: ITestRunProfile, b: ITestRunProfile) => { diff --git a/packages/testing/src/common/test-result.ts b/packages/testing/src/common/test-result.ts index e9da2cc00d..3298137561 100644 --- a/packages/testing/src/common/test-result.ts +++ b/packages/testing/src/common/test-result.ts @@ -1,4 +1,5 @@ import { Emitter, formatLocalize, localize } from '@opensumi/ide-core-common'; + import { IComputedStateAccessor, refreshComputedState } from './getComputedState'; import { ExtensionRunTestsRequest, diff --git a/packages/testing/src/common/testing-view.ts b/packages/testing/src/common/testing-view.ts index d1ea8e5499..e94f84fbfd 100644 --- a/packages/testing/src/common/testing-view.ts +++ b/packages/testing/src/common/testing-view.ts @@ -1,4 +1,5 @@ import { IBasicInlineMenu, IBasicInlineMenuPosition } from '@opensumi/ide-components'; + import { DebugTestCommand, GoToTestCommand, RuntTestCommand } from './commands'; export const TestingViewId = '@opensumi/ide-testing'; diff --git a/packages/testing/src/common/testingPeekOpener.ts b/packages/testing/src/common/testingPeekOpener.ts index ed37651c0b..35c883f6eb 100644 --- a/packages/testing/src/common/testingPeekOpener.ts +++ b/packages/testing/src/common/testingPeekOpener.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import type { ITextEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/platform/editor/common/editor'; + import { ITestResult } from './test-result'; import { TestResultItem } from './testCollection'; diff --git a/packages/testing/src/common/testingStates.ts b/packages/testing/src/common/testingStates.ts index 4aa3312f63..22eec025d6 100644 --- a/packages/testing/src/common/testingStates.ts +++ b/packages/testing/src/common/testingStates.ts @@ -3,10 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestErrorMessage, TestResultState } from './testCollection'; import { marked } from 'marked'; + import { count } from '@opensumi/ide-core-common'; +import { ITestErrorMessage, TestResultState } from './testCollection'; + export interface TreeStateNode { statusNode: true; state: TestResultState; diff --git a/packages/theme/__tests__/browser/icon.service.test.ts b/packages/theme/__tests__/browser/icon.service.test.ts index c260f5891f..1f9d818a43 100644 --- a/packages/theme/__tests__/browser/icon.service.test.ts +++ b/packages/theme/__tests__/browser/icon.service.test.ts @@ -1,7 +1,4 @@ -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { IconService } from '../../src/browser'; -import { IIconService, IconType } from '../../src'; +import { Injectable } from '@opensumi/di'; import { PreferenceSchemaProvider, IPreferenceSettingsService, @@ -9,14 +6,19 @@ import { IFileServiceClient, URI, } from '@opensumi/ide-core-browser'; +import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; import { MockPreferenceSchemaProvider, MockPreferenceSettingsService, } from '@opensumi/ide-core-browser/__mocks__/preference'; -import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { Injectable } from '@opensumi/di'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { IIconService, IconType } from '../../src'; +import { IconService } from '../../src/browser'; + + @Injectable() class MockFileServiceClient { readFile(uri: string) { diff --git a/packages/theme/__tests__/browser/semantic-tokens-registry.test.ts b/packages/theme/__tests__/browser/semantic-tokens-registry.test.ts index 8d0955cd11..bf13d2275a 100644 --- a/packages/theme/__tests__/browser/semantic-tokens-registry.test.ts +++ b/packages/theme/__tests__/browser/semantic-tokens-registry.test.ts @@ -1,6 +1,7 @@ import { ILogger } from '@opensumi/ide-logs/lib/common'; import { SemanticTokenRegistryImpl } from '@opensumi/ide-theme/lib/browser/semantic-tokens-registry'; import { getStylingSchemeEntry, ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; diff --git a/packages/theme/__tests__/browser/theme.service.test.ts b/packages/theme/__tests__/browser/theme.service.test.ts index ddc49134e0..79de4c3632 100644 --- a/packages/theme/__tests__/browser/theme.service.test.ts +++ b/packages/theme/__tests__/browser/theme.service.test.ts @@ -1,23 +1,25 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { WorkbenchThemeService } from '../../src/browser/workbench.theme.service'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; -import { IThemeService } from '../../'; +import { Injectable } from '@opensumi/di'; import { PreferenceSchemaProvider, IPreferenceSettingsService, ILoggerManagerClient, URI, } from '@opensumi/ide-core-browser'; +import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; import { MockPreferenceSchemaProvider, MockPreferenceSettingsService, } from '@opensumi/ide-core-browser/__mocks__/preference'; -import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; -import { Injectable } from '@opensumi/di'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; import { SemanticTokenRegistryImpl } from '@opensumi/ide-theme/lib/browser/semantic-tokens-registry'; -import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; import { Color } from '@opensumi/ide-theme/lib/common'; +import { ISemanticTokenRegistry } from '@opensumi/ide-theme/lib/common/semantic-tokens-registry'; + +import { IThemeService } from '../../'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { WorkbenchThemeService } from '../../src/browser/workbench.theme.service'; + @Injectable() class MockFileServiceClient { diff --git a/packages/theme/src/browser/icon-theme-data.ts b/packages/theme/src/browser/icon-theme-data.ts index 77fd5b9702..94c21ca1ad 100644 --- a/packages/theme/src/browser/icon-theme-data.ts +++ b/packages/theme/src/browser/icon-theme-data.ts @@ -1,7 +1,8 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; import { getDebugLogger, URI, parseWithComments, formatLocalize } from '@opensumi/ide-core-common'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; + import { IIconTheme } from '../common'; @Injectable({ multiple: true }) diff --git a/packages/theme/src/browser/icon-theme-store.ts b/packages/theme/src/browser/icon-theme-store.ts index 288e4e1a8c..f7048cda65 100644 --- a/packages/theme/src/browser/icon-theme-store.ts +++ b/packages/theme/src/browser/icon-theme-store.ts @@ -1,7 +1,9 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; +import { URI } from '@opensumi/ide-core-common'; + import { IIconTheme, ThemeContribution, getThemeId } from '../common'; + import { IconThemeData } from './icon-theme-data'; -import { URI } from '@opensumi/ide-core-common'; @Injectable() export class IconThemeStore { diff --git a/packages/theme/src/browser/icon.service.ts b/packages/theme/src/browser/icon.service.ts index 804f5c60ee..3bc595b63f 100644 --- a/packages/theme/src/browser/icon.service.ts +++ b/packages/theme/src/browser/icon.service.ts @@ -1,3 +1,4 @@ +import { Injectable, Autowired } from '@opensumi/di'; import { URI, PreferenceService, @@ -9,8 +10,9 @@ import { CODICON_OWNER, runWhenIdle, } from '@opensumi/ide-core-browser'; -import { Injectable, Autowired } from '@opensumi/di'; +import { Path } from '@opensumi/ide-core-common/lib/path'; import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; + import { ThemeType, IIconService, @@ -22,7 +24,8 @@ import { IconShape, IconThemeInfo, } from '../common'; -import { Path } from '@opensumi/ide-core-common/lib/path'; + + import { IconThemeStore } from './icon-theme-store'; import './icon.less'; diff --git a/packages/theme/src/browser/index.ts b/packages/theme/src/browser/index.ts index cb22a35f70..513969fef2 100644 --- a/packages/theme/src/browser/index.ts +++ b/packages/theme/src/browser/index.ts @@ -1,13 +1,15 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { ThemeServicePath, IThemeService, IIconService } from '../common/theme.service'; -import { WorkbenchThemeService } from './workbench.theme.service'; + +import { ISemanticTokenRegistry } from '../common/semantic-tokens-registry'; import { ICSSStyleService } from '../common/style'; -import { CSSStyleService } from './style.service'; +import { ThemeServicePath, IThemeService, IIconService } from '../common/theme.service'; + import { IconService } from './icon.service'; -import { ThemeContribution } from './theme.contribution'; -import { ISemanticTokenRegistry } from '../common/semantic-tokens-registry'; import { SemanticTokenRegistryImpl } from './semantic-tokens-registry'; +import { CSSStyleService } from './style.service'; +import { ThemeContribution } from './theme.contribution'; +import { WorkbenchThemeService } from './workbench.theme.service'; @Injectable() export class ThemeModule extends BrowserModule { diff --git a/packages/theme/src/browser/semantic-tokens-registry.ts b/packages/theme/src/browser/semantic-tokens-registry.ts index daaa21e3c5..c1278bcf79 100644 --- a/packages/theme/src/browser/semantic-tokens-registry.ts +++ b/packages/theme/src/browser/semantic-tokens-registry.ts @@ -1,6 +1,7 @@ import { Injectable } from '@opensumi/di'; import { IJSONSchema, IJSONSchemaMap } from '@opensumi/ide-core-common/lib/json-schema'; import { localize } from '@opensumi/ide-core-common/lib/localize'; + import { fontStylePattern, getStylingSchemeEntry, diff --git a/packages/theme/src/browser/style.service.ts b/packages/theme/src/browser/style.service.ts index 8744654f20..78e1d888fe 100644 --- a/packages/theme/src/browser/style.service.ts +++ b/packages/theme/src/browser/style.service.ts @@ -1,4 +1,5 @@ import { Injectable } from '@opensumi/di'; + import { ICSSStyleService } from '../common/style'; @Injectable() diff --git a/packages/theme/src/browser/theme-data.ts b/packages/theme/src/browser/theme-data.ts index 4586364655..a909da3120 100644 --- a/packages/theme/src/browser/theme-data.ts +++ b/packages/theme/src/browser/theme-data.ts @@ -1,7 +1,6 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { Autowired, Injectable } from '@opensumi/di'; import { IRawThemeSetting } from 'vscode-textmate'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; + +import { Autowired, Injectable } from '@opensumi/di'; import { URI, localize, @@ -13,21 +12,12 @@ import { CharCode, isBoolean, } from '@opensumi/ide-core-common'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import { - ITokenThemeRule, - IColors, - BuiltinTheme, - ITokenColorizationRule, - IColorMap, - getThemeType, - IThemeData, - ColorScheme, - ISemanticTokenColorizationSetting, -} from '../common/theme.service'; -import { parse as parsePList } from '../common/plistParser'; -import { convertSettings } from '../common/themeCompatibility'; import { Color } from '../common/color'; +import { editorBackground, editorForeground } from '../common/color-tokens/editor'; +import { parse as parsePList } from '../common/plistParser'; import { createMatchers, ISemanticTokenRegistry, @@ -45,7 +35,18 @@ import { TokenStyleDefinitions, TokenStyleValue, } from '../common/semantic-tokens-registry'; -import { editorBackground, editorForeground } from '../common/color-tokens/editor'; +import { + ITokenThemeRule, + IColors, + BuiltinTheme, + ITokenColorizationRule, + IColorMap, + getThemeType, + IThemeData, + ColorScheme, + ISemanticTokenColorizationSetting, +} from '../common/theme.service'; +import { convertSettings } from '../common/themeCompatibility'; function getScopeMatcher(rule: ITextMateThemingRule): Matcher { const ruleScope = rule.scope; diff --git a/packages/theme/src/browser/theme-store.ts b/packages/theme/src/browser/theme-store.ts index 2bcec6bbde..a4283316a7 100644 --- a/packages/theme/src/browser/theme-store.ts +++ b/packages/theme/src/browser/theme-store.ts @@ -1,9 +1,10 @@ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; import { URI, getDebugLogger } from '@opensumi/ide-core-common'; -import { ThemeData } from './theme-data'; import { ThemeContribution, getThemeId } from '../common/theme.service'; + import defaultTheme from './default-theme'; +import { ThemeData } from './theme-data'; @Injectable() export class ThemeStore { diff --git a/packages/theme/src/browser/theme.contribution.ts b/packages/theme/src/browser/theme.contribution.ts index 9a11ba0758..59395bf0c6 100644 --- a/packages/theme/src/browser/theme.contribution.ts +++ b/packages/theme/src/browser/theme.contribution.ts @@ -1,3 +1,4 @@ +import { Autowired } from '@opensumi/di'; import { Domain, CommandContribution, @@ -13,6 +14,8 @@ import { Mode, ClientAppContribution, } from '@opensumi/ide-core-browser'; +import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; + import { IThemeService, IIconService, @@ -21,8 +24,6 @@ import { BuiltinTheme, DEFAULT_THEME_ID, } from '../common'; -import { Autowired } from '@opensumi/di'; -import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next'; import { ISemanticTokenRegistry, ProbeScope } from '../common/semantic-tokens-registry'; export const THEME_TOGGLE_COMMAND: Command = { diff --git a/packages/theme/src/browser/workbench.theme.service.ts b/packages/theme/src/browser/workbench.theme.service.ts index a8035aaf13..7f09554ffe 100644 --- a/packages/theme/src/browser/workbench.theme.service.ts +++ b/packages/theme/src/browser/workbench.theme.service.ts @@ -1,3 +1,30 @@ +import { Autowired, Injectable } from '@opensumi/di'; +import { + Logger, + PreferenceService, + PreferenceSchemaProvider, + IPreferenceSettingsService, +} from '@opensumi/ide-core-browser'; +import { + Event, + URI, + WithEventBus, + localize, + Emitter, + isObject, + DisposableCollection, + uuid, + isLinux, + isWindows, + IThemeColor, + OnEvent, + ExtensionDidContributes, +} from '@opensumi/ide-core-common'; + +import { ICSSStyleService } from '../common'; +import { Color } from '../common/color'; +import { getColorRegistry } from '../common/color-registry'; +import { ThemeChangedEvent } from '../common/event'; import { ITheme, ThemeType, @@ -17,34 +44,11 @@ import { DEFAULT_THEME_ID, colorIdPattern, } from '../common/theme.service'; -import { - Event, - URI, - WithEventBus, - localize, - Emitter, - isObject, - DisposableCollection, - uuid, - isLinux, - isWindows, - IThemeColor, - OnEvent, - ExtensionDidContributes, -} from '@opensumi/ide-core-common'; -import { Autowired, Injectable } from '@opensumi/di'; -import { getColorRegistry } from '../common/color-registry'; -import { Color } from '../common/color'; -import { ThemeChangedEvent } from '../common/event'; + + import { ThemeData } from './theme-data'; import { ThemeStore } from './theme-store'; -import { - Logger, - PreferenceService, - PreferenceSchemaProvider, - IPreferenceSettingsService, -} from '@opensumi/ide-core-browser'; -import { ICSSStyleService } from '../common'; + export const CUSTOM_WORKBENCH_COLORS_SETTING = 'workbench.colorCustomizations'; export const CUSTOM_EDITOR_COLORS_SETTING = 'editor.tokenColorCustomizations'; diff --git a/packages/theme/src/common/color-registry.ts b/packages/theme/src/common/color-registry.ts index 9672c1eebc..1ff2bf5459 100644 --- a/packages/theme/src/common/color-registry.ts +++ b/packages/theme/src/common/color-registry.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Emitter, Event } from '@opensumi/ide-core-common'; + import { Color } from '../common/color'; import { ITheme, diff --git a/packages/theme/src/common/color-tokens/activity-bar.ts b/packages/theme/src/common/color-tokens/activity-bar.ts index e04f8eb881..d1d6c1027a 100644 --- a/packages/theme/src/common/color-tokens/activity-bar.ts +++ b/packages/theme/src/common/color-tokens/activity-bar.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor, transparent } from '../color-registry'; + import { contrastBorder } from './base'; import { hcActiveBorderColor } from './basic-color'; import { SIDE_BAR_BORDER } from './sidebar'; diff --git a/packages/theme/src/common/color-tokens/badge.ts b/packages/theme/src/common/color-tokens/badge.ts index ace48e5dc7..f149ca3ce4 100644 --- a/packages/theme/src/common/color-tokens/badge.ts +++ b/packages/theme/src/common/color-tokens/badge.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; export const badgeBackground = registerColor( 'badge.background', diff --git a/packages/theme/src/common/color-tokens/base.ts b/packages/theme/src/common/color-tokens/base.ts index 524ee64779..bab2a36a8d 100644 --- a/packages/theme/src/common/color-tokens/base.ts +++ b/packages/theme/src/common/color-tokens/base.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; import { registerColor, transparent } from '../color-registry'; + import { hcBorderColor } from './basic-color'; // base colors diff --git a/packages/theme/src/common/color-tokens/breadcrumb.ts b/packages/theme/src/common/color-tokens/breadcrumb.ts index a0fe56499c..36a96af273 100644 --- a/packages/theme/src/common/color-tokens/breadcrumb.ts +++ b/packages/theme/src/common/color-tokens/breadcrumb.ts @@ -1,5 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent, lighten, darken } from '../color-registry'; + import { foreground } from './base'; import { editorBackground, editorWidgetBackground } from './editor'; diff --git a/packages/theme/src/common/color-tokens/button.ts b/packages/theme/src/common/color-tokens/button.ts index cb2faa052c..6117439eb9 100644 --- a/packages/theme/src/common/color-tokens/button.ts +++ b/packages/theme/src/common/color-tokens/button.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; /** default button */ export const buttonForeground = registerColor( diff --git a/packages/theme/src/common/color-tokens/charts.ts b/packages/theme/src/common/color-tokens/charts.ts index 1e8e3f9c94..3bc72d47a7 100644 --- a/packages/theme/src/common/color-tokens/charts.ts +++ b/packages/theme/src/common/color-tokens/charts.ts @@ -1,5 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent } from '../color-registry'; + import { foreground } from './base'; import { editorErrorForeground, editorInfoForeground, editorWarningForeground } from './editor'; import { minimapFindMatch } from './minimap'; diff --git a/packages/theme/src/common/color-tokens/checkbox.ts b/packages/theme/src/common/color-tokens/checkbox.ts index d341db95ad..9332de1294 100644 --- a/packages/theme/src/common/color-tokens/checkbox.ts +++ b/packages/theme/src/common/color-tokens/checkbox.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../color-registry'; export const checkboxBorder = registerColor( diff --git a/packages/theme/src/common/color-tokens/custom/actionbar.ts b/packages/theme/src/common/color-tokens/custom/actionbar.ts index 05368563fb..2f90c8acec 100644 --- a/packages/theme/src/common/color-tokens/custom/actionbar.ts +++ b/packages/theme/src/common/color-tokens/custom/actionbar.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent } from '../../color-registry'; import { foreground } from '../base'; import { inputOptionActiveBorder, inputOptionActiveBackground } from '../input'; diff --git a/packages/theme/src/common/color-tokens/custom/badge.ts b/packages/theme/src/common/color-tokens/custom/badge.ts index 0f58802e81..6044c6da01 100644 --- a/packages/theme/src/common/color-tokens/custom/badge.ts +++ b/packages/theme/src/common/color-tokens/custom/badge.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; import { contrastBorder } from '../base'; diff --git a/packages/theme/src/common/color-tokens/custom/base.ts b/packages/theme/src/common/color-tokens/custom/base.ts index c048355bc7..6c3055c9e4 100644 --- a/packages/theme/src/common/color-tokens/custom/base.ts +++ b/packages/theme/src/common/color-tokens/custom/base.ts @@ -1,8 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; import { registerColor, transparent } from '../../color-registry'; -import { editorWarningForeground, editorErrorForeground, editorInfoForeground } from '../editor'; import { iconForeground, foreground } from '../base'; +import { editorWarningForeground, editorErrorForeground, editorInfoForeground } from '../editor'; // base custom colors // 强调色 diff --git a/packages/theme/src/common/color-tokens/custom/button.ts b/packages/theme/src/common/color-tokens/custom/button.ts index 470f13a903..b6a2ecd00b 100644 --- a/packages/theme/src/common/color-tokens/custom/button.ts +++ b/packages/theme/src/common/color-tokens/custom/button.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../../color-registry'; + import { RGBA, Color } from '../../color'; +import { registerColor } from '../../color-registry'; import { foreground } from '../base'; /* disable button */ diff --git a/packages/theme/src/common/color-tokens/custom/checkbox.ts b/packages/theme/src/common/color-tokens/custom/checkbox.ts index 1ebeb5eef8..8223b135b5 100644 --- a/packages/theme/src/common/color-tokens/custom/checkbox.ts +++ b/packages/theme/src/common/color-tokens/custom/checkbox.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; export const ktCheckboxHoverBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/custom/decoration.ts b/packages/theme/src/common/color-tokens/custom/decoration.ts index 0bc638bf2a..1d11c918d0 100644 --- a/packages/theme/src/common/color-tokens/custom/decoration.ts +++ b/packages/theme/src/common/color-tokens/custom/decoration.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; // https://github.com/microsoft/vscode/blob/master/extensions/git/package.json#L1696 diff --git a/packages/theme/src/common/color-tokens/custom/editor.ts b/packages/theme/src/common/color-tokens/custom/editor.ts index f791b0c321..cf8710bb32 100644 --- a/packages/theme/src/common/color-tokens/custom/editor.ts +++ b/packages/theme/src/common/color-tokens/custom/editor.ts @@ -1,7 +1,8 @@ -import { TAB_BORDER } from '../tab'; -import { registerColor } from '../../color-registry'; import { localize } from '@opensumi/ide-core-common'; + +import { registerColor } from '../../color-registry'; import { foreground } from '../base'; +import { TAB_BORDER } from '../tab'; export const ktEditorBreadcrumbBorderDown = registerColor( 'kt.editorBreadcrumb.borderDown', diff --git a/packages/theme/src/common/color-tokens/custom/extension.ts b/packages/theme/src/common/color-tokens/custom/extension.ts index e3431812cf..d2a502c6a0 100644 --- a/packages/theme/src/common/color-tokens/custom/extension.ts +++ b/packages/theme/src/common/color-tokens/custom/extension.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; export const ktStatusBarExtensionDebugginBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/custom/icon.ts b/packages/theme/src/common/color-tokens/custom/icon.ts index 200d9822b0..43877bd0c9 100644 --- a/packages/theme/src/common/color-tokens/custom/icon.ts +++ b/packages/theme/src/common/color-tokens/custom/icon.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, actionbarForeground } from '../../color-registry'; export const ktIconForeground = registerColor( diff --git a/packages/theme/src/common/color-tokens/custom/input.ts b/packages/theme/src/common/color-tokens/custom/input.ts index e9b1755e6d..d905ca7886 100644 --- a/packages/theme/src/common/color-tokens/custom/input.ts +++ b/packages/theme/src/common/color-tokens/custom/input.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, contrastBorder } from '../../color-registry'; import { inputBorder, inputOptionActiveBorder } from '../input'; diff --git a/packages/theme/src/common/color-tokens/custom/menu.ts b/packages/theme/src/common/color-tokens/custom/menu.ts index e55851a777..48db2ee0b5 100644 --- a/packages/theme/src/common/color-tokens/custom/menu.ts +++ b/packages/theme/src/common/color-tokens/custom/menu.ts @@ -1,10 +1,10 @@ import { localize } from '@opensumi/ide-core-common'; import { registerColor, transparent } from '../../color-registry'; -import { menuForeground } from '../menu'; -import { widgetShadow, foreground, descriptionForeground } from '../base'; import { ACTIVITY_BAR_BORDER } from '../activity-bar'; +import { widgetShadow, foreground, descriptionForeground } from '../base'; import { editorBackground } from '../editor'; +import { menuForeground } from '../menu'; /* --- menu --- */ export const menuDescriptionForeground = registerColor( diff --git a/packages/theme/src/common/color-tokens/custom/modal.ts b/packages/theme/src/common/color-tokens/custom/modal.ts index 4f2bc27e4d..067910f210 100644 --- a/packages/theme/src/common/color-tokens/custom/modal.ts +++ b/packages/theme/src/common/color-tokens/custom/modal.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; import { NOTIFICATIONS_BACKGROUND, NOTIFICATIONS_FOREGROUND } from '../notification'; diff --git a/packages/theme/src/common/color-tokens/custom/panel.ts b/packages/theme/src/common/color-tokens/custom/panel.ts index 0199ef07a0..e0073a3713 100644 --- a/packages/theme/src/common/color-tokens/custom/panel.ts +++ b/packages/theme/src/common/color-tokens/custom/panel.ts @@ -1,12 +1,13 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent, lighten, darken } from '../../color-registry'; -import { EDITOR_GROUP_HEADER_TABS_BACKGROUND } from '../editor'; -import { textLinkActiveForeground } from '../text'; -import { TAB_INACTIVE_BACKGROUND } from '../tab'; +import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER } from '../activity-bar'; import { foreground } from '../base'; +import { EDITOR_GROUP_HEADER_TABS_BACKGROUND } from '../editor'; import { PANEL_BACKGROUND, PANEL_INACTIVE_TITLE_FOREGROUND } from '../panel'; -import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER } from '../activity-bar'; import { SIDE_BAR_BORDER } from '../sidebar'; +import { TAB_INACTIVE_BACKGROUND } from '../tab'; +import { textLinkActiveForeground } from '../text'; /* --- panel --- */ export const ktPanelTitleBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/custom/select.ts b/packages/theme/src/common/color-tokens/custom/select.ts index 51a01fb0bb..fca41e8016 100644 --- a/packages/theme/src/common/color-tokens/custom/select.ts +++ b/packages/theme/src/common/color-tokens/custom/select.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { dropdownBackground, dropdownBorder } from '../dropdown'; + import { registerColor } from '../../color-registry'; +import { dropdownBackground, dropdownBorder } from '../dropdown'; import { inputForeground, inputBackground } from '../input'; import { settingsSelectBorder } from '../settings'; diff --git a/packages/theme/src/common/color-tokens/custom/settings.ts b/packages/theme/src/common/color-tokens/custom/settings.ts index 64db7c1558..f78f79099d 100644 --- a/packages/theme/src/common/color-tokens/custom/settings.ts +++ b/packages/theme/src/common/color-tokens/custom/settings.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; import { PANEL_ACTIVE_TITLE_BORDER, PANEL_ACTIVE_TITLE_FOREGROUND } from '../panel'; diff --git a/packages/theme/src/common/color-tokens/custom/statusbar.ts b/packages/theme/src/common/color-tokens/custom/statusbar.ts index 1fa7f25289..288c41af8f 100644 --- a/packages/theme/src/common/color-tokens/custom/statusbar.ts +++ b/packages/theme/src/common/color-tokens/custom/statusbar.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; // 断网是状态栏用的颜色 diff --git a/packages/theme/src/common/color-tokens/custom/tab.ts b/packages/theme/src/common/color-tokens/custom/tab.ts index f0e2004ed0..463b1686f7 100644 --- a/packages/theme/src/common/color-tokens/custom/tab.ts +++ b/packages/theme/src/common/color-tokens/custom/tab.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent } from '../../color-registry'; import { foreground } from '../base'; import { hcBorderColor } from '../basic-color'; diff --git a/packages/theme/src/common/color-tokens/custom/tree.ts b/packages/theme/src/common/color-tokens/custom/tree.ts index 8904228ebb..5858cc23ae 100644 --- a/packages/theme/src/common/color-tokens/custom/tree.ts +++ b/packages/theme/src/common/color-tokens/custom/tree.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../../color-registry'; import { listHoverBackground, diff --git a/packages/theme/src/common/color-tokens/debug.ts b/packages/theme/src/common/color-tokens/debug.ts index 44b6e10d50..9656c59a90 100644 --- a/packages/theme/src/common/color-tokens/debug.ts +++ b/packages/theme/src/common/color-tokens/debug.ts @@ -1,4 +1,5 @@ import { registerColor } from '../color-registry'; + import { foreground, errorForeground } from './base'; import { editorInfoForeground, editorWarningForeground } from './editor'; diff --git a/packages/theme/src/common/color-tokens/dropdown.ts b/packages/theme/src/common/color-tokens/dropdown.ts index 60eecb5104..95d8cef63e 100644 --- a/packages/theme/src/common/color-tokens/dropdown.ts +++ b/packages/theme/src/common/color-tokens/dropdown.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; + import { contrastBorder } from './base'; export const dropdownBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/editor.ts b/packages/theme/src/common/color-tokens/editor.ts index 25e0de2215..55465d4187 100644 --- a/packages/theme/src/common/color-tokens/editor.ts +++ b/packages/theme/src/common/color-tokens/editor.ts @@ -1,9 +1,11 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent, lighten, darken, lessProminent } from '../color-registry'; + import { Color, RGBA } from '../../common/color'; +import { registerColor, transparent, lighten, darken, lessProminent } from '../color-registry'; + +import { badgeBackground, badgeForeground } from './badge'; import { contrastBorder, activeContrastBorder, focusBorder, foreground } from './base'; import { backgroundColor, foregroundColor } from './basic-color'; -import { badgeBackground, badgeForeground } from './badge'; export const editorErrorForeground = registerColor( 'editorError.foreground', diff --git a/packages/theme/src/common/color-tokens/global.ts b/packages/theme/src/common/color-tokens/global.ts index 064f29c016..a32a50d998 100644 --- a/packages/theme/src/common/color-tokens/global.ts +++ b/packages/theme/src/common/color-tokens/global.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../color-registry'; // 全局聚焦状态边框颜色 包括 input diff --git a/packages/theme/src/common/color-tokens/input.ts b/packages/theme/src/common/color-tokens/input.ts index ccf611403e..6d13981f90 100644 --- a/packages/theme/src/common/color-tokens/input.ts +++ b/packages/theme/src/common/color-tokens/input.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; + import { contrastBorder, foreground } from './base'; import { secondaryForegroundColor } from './basic-color'; diff --git a/packages/theme/src/common/color-tokens/list-tree.ts b/packages/theme/src/common/color-tokens/list-tree.ts index 76a8e5230e..caf3fd45b1 100644 --- a/packages/theme/src/common/color-tokens/list-tree.ts +++ b/packages/theme/src/common/color-tokens/list-tree.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; + import { activeContrastBorder, contrastBorder, focusBorder } from './base'; export const listFocusBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/menu-bar.ts b/packages/theme/src/common/color-tokens/menu-bar.ts index 063230e648..8cd7fe1d0d 100644 --- a/packages/theme/src/common/color-tokens/menu-bar.ts +++ b/packages/theme/src/common/color-tokens/menu-bar.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor, transparent } from '../color-registry'; + import { activeContrastBorder } from './base'; import { TITLE_BAR_ACTIVE_FOREGROUND } from './title-bar'; diff --git a/packages/theme/src/common/color-tokens/menu.ts b/packages/theme/src/common/color-tokens/menu.ts index 0d8d825846..c5d609fed0 100644 --- a/packages/theme/src/common/color-tokens/menu.ts +++ b/packages/theme/src/common/color-tokens/menu.ts @@ -1,5 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../color-registry'; + import { contrastBorder, activeContrastBorder, foreground } from './base'; import { dropdownBackground, dropdownForeground } from './dropdown'; import { listActiveSelectionForeground, listActiveSelectionBackground } from './list-tree'; diff --git a/packages/theme/src/common/color-tokens/merge-conflict.ts b/packages/theme/src/common/color-tokens/merge-conflict.ts index 7a423888cd..4ca2e06c3a 100644 --- a/packages/theme/src/common/color-tokens/merge-conflict.ts +++ b/packages/theme/src/common/color-tokens/merge-conflict.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor, transparent } from '../color-registry'; /** * Merge-conflict colors diff --git a/packages/theme/src/common/color-tokens/minimap.ts b/packages/theme/src/common/color-tokens/minimap.ts index 022b05d1d3..c4da589a8a 100644 --- a/packages/theme/src/common/color-tokens/minimap.ts +++ b/packages/theme/src/common/color-tokens/minimap.ts @@ -1,7 +1,9 @@ import { localize } from '@opensumi/ide-core-common'; + +import { RGBA, Color } from '../color'; import { registerColor } from '../color-registry'; + import { editorWarningForeground, editorWarningBorder } from './editor'; -import { RGBA, Color } from '../color'; export const minimapFindMatch = registerColor( 'minimap.findMatchHighlight', diff --git a/packages/theme/src/common/color-tokens/notification.ts b/packages/theme/src/common/color-tokens/notification.ts index a148837522..a2837fa0a7 100644 --- a/packages/theme/src/common/color-tokens/notification.ts +++ b/packages/theme/src/common/color-tokens/notification.ts @@ -1,5 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, lighten, darken } from '../color-registry'; + +import { contrastBorder } from './base'; import { editorWidgetBackground, editorWidgetForeground, @@ -7,7 +10,6 @@ import { editorWarningForeground, editorInfoForeground, } from './editor'; -import { contrastBorder } from './base'; import { textLinkForeground } from './text'; // < --- Notifications --- > diff --git a/packages/theme/src/common/color-tokens/panel.ts b/packages/theme/src/common/color-tokens/panel.ts index d8446e7691..0c6d182be9 100644 --- a/packages/theme/src/common/color-tokens/panel.ts +++ b/packages/theme/src/common/color-tokens/panel.ts @@ -1,8 +1,10 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent } from '../color-registry'; + import { Color } from '../../common/color'; -import { editorBackground } from './editor'; +import { registerColor, transparent } from '../color-registry'; + import { contrastBorder } from './base'; +import { editorBackground } from './editor'; import { textLinkActiveForeground } from './text'; // < --- Panels --- > diff --git a/packages/theme/src/common/color-tokens/pick-view.ts b/packages/theme/src/common/color-tokens/pick-view.ts index b41e7281b3..3ef50cba0b 100644 --- a/packages/theme/src/common/color-tokens/pick-view.ts +++ b/packages/theme/src/common/color-tokens/pick-view.ts @@ -1,7 +1,9 @@ -import { registerColor } from '../color-registry'; -import { activeContrastBorder, contrastBorder } from './base'; import { localize } from '@opensumi/ide-core-common'; + import { Color } from '../color'; +import { registerColor } from '../color-registry'; + +import { activeContrastBorder, contrastBorder } from './base'; export const peekViewTitleBackground = registerColor( 'peekViewTitle.background', diff --git a/packages/theme/src/common/color-tokens/picker.ts b/packages/theme/src/common/color-tokens/picker.ts index c8b962fab1..964b1c9008 100644 --- a/packages/theme/src/common/color-tokens/picker.ts +++ b/packages/theme/src/common/color-tokens/picker.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; export const pickerGroupForeground = registerColor( 'pickerGroup.foreground', diff --git a/packages/theme/src/common/color-tokens/progress-bar.ts b/packages/theme/src/common/color-tokens/progress-bar.ts index aa04af3ef0..720230d79f 100644 --- a/packages/theme/src/common/color-tokens/progress-bar.ts +++ b/packages/theme/src/common/color-tokens/progress-bar.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; + import { contrastBorder } from './base'; export const progressBarBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/quick-input.ts b/packages/theme/src/common/color-tokens/quick-input.ts index dea2d1644c..8022aed50e 100644 --- a/packages/theme/src/common/color-tokens/quick-input.ts +++ b/packages/theme/src/common/color-tokens/quick-input.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; + import { Color, RGBA } from '../color'; import { registerColor } from '../color-registry'; + import { editorWidgetBackground, editorWidgetForeground } from './editor'; export const quickInputBackground = registerColor( diff --git a/packages/theme/src/common/color-tokens/scrollbar.ts b/packages/theme/src/common/color-tokens/scrollbar.ts index e67c1542b3..6e5fe20773 100644 --- a/packages/theme/src/common/color-tokens/scrollbar.ts +++ b/packages/theme/src/common/color-tokens/scrollbar.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor, transparent } from '../color-registry'; + import { contrastBorder } from './base'; export const scrollbarShadow = registerColor( diff --git a/packages/theme/src/common/color-tokens/settings.ts b/packages/theme/src/common/color-tokens/settings.ts index e064865cb0..b4b1acf485 100644 --- a/packages/theme/src/common/color-tokens/settings.ts +++ b/packages/theme/src/common/color-tokens/settings.ts @@ -1,8 +1,10 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color, RGBA } from '../../common/color'; -import { editorWidgetBorder } from './editor'; +import { registerColor } from '../color-registry'; + import { dropdownBackground, dropdownForeground, dropdownBorder } from './dropdown'; +import { editorWidgetBorder } from './editor'; import { inputBackground, inputForeground, inputBorder } from './input'; // Enum control colors diff --git a/packages/theme/src/common/color-tokens/sidebar.ts b/packages/theme/src/common/color-tokens/sidebar.ts index 2275e8eed6..c24c9c7125 100644 --- a/packages/theme/src/common/color-tokens/sidebar.ts +++ b/packages/theme/src/common/color-tokens/sidebar.ts @@ -1,6 +1,8 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; + import { contrastBorder } from './base'; // < --- Side Bar --- > diff --git a/packages/theme/src/common/color-tokens/snippet.ts b/packages/theme/src/common/color-tokens/snippet.ts index 0b541b4377..166eff3d2d 100644 --- a/packages/theme/src/common/color-tokens/snippet.ts +++ b/packages/theme/src/common/color-tokens/snippet.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color, RGBA } from '../../common/color'; +import { registerColor } from '../color-registry'; /** * Snippet placeholder colors diff --git a/packages/theme/src/common/color-tokens/status-bar.ts b/packages/theme/src/common/color-tokens/status-bar.ts index 8b95c39140..dc69ca39c9 100644 --- a/packages/theme/src/common/color-tokens/status-bar.ts +++ b/packages/theme/src/common/color-tokens/status-bar.ts @@ -1,10 +1,11 @@ import { localize } from '@opensumi/ide-core-common'; import { Color } from '../../common/color'; -import { editorWarningForeground } from './editor'; -import { contrastBorder, errorForeground } from './base'; import { darken, registerColor } from '../color-registry'; + import { ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND } from './activity-bar'; +import { contrastBorder, errorForeground } from './base'; +import { editorWarningForeground } from './editor'; // < --- Status --- > diff --git a/packages/theme/src/common/color-tokens/tab.ts b/packages/theme/src/common/color-tokens/tab.ts index c056ca1fe2..612902506f 100644 --- a/packages/theme/src/common/color-tokens/tab.ts +++ b/packages/theme/src/common/color-tokens/tab.ts @@ -1,9 +1,11 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor, transparent } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor, transparent } from '../color-registry'; + import { contrastBorder } from './base'; -import { editorBackground } from './editor'; import { hcActiveBorderColor, hcBorderColor } from './basic-color'; +import { editorBackground } from './editor'; // < --- Tabs --- > diff --git a/packages/theme/src/common/color-tokens/testing.ts b/packages/theme/src/common/color-tokens/testing.ts index 5fe4dede37..4c18e02471 100644 --- a/packages/theme/src/common/color-tokens/testing.ts +++ b/packages/theme/src/common/color-tokens/testing.ts @@ -1,5 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent } from '../color-registry'; + import { contrastBorder } from './base'; import { editorErrorForeground } from './editor'; diff --git a/packages/theme/src/common/color-tokens/text.ts b/packages/theme/src/common/color-tokens/text.ts index e1e362684e..9ca54e5fd5 100644 --- a/packages/theme/src/common/color-tokens/text.ts +++ b/packages/theme/src/common/color-tokens/text.ts @@ -1,6 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; -import { registerColor } from '../color-registry'; + import { Color } from '../../common/color'; +import { registerColor } from '../color-registry'; // ------ text colors export const textSeparatorForeground = registerColor( diff --git a/packages/theme/src/common/color-tokens/title-bar.ts b/packages/theme/src/common/color-tokens/title-bar.ts index 9ddf012c13..9451d2c7cb 100644 --- a/packages/theme/src/common/color-tokens/title-bar.ts +++ b/packages/theme/src/common/color-tokens/title-bar.ts @@ -1,5 +1,7 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor, transparent } from '../color-registry'; + import { contrastBorder } from './base'; // < --- Title Bar --- > diff --git a/packages/theme/src/common/color-tokens/welcome-page.ts b/packages/theme/src/common/color-tokens/welcome-page.ts index 58aaa34ca0..ca395b11b7 100644 --- a/packages/theme/src/common/color-tokens/welcome-page.ts +++ b/packages/theme/src/common/color-tokens/welcome-page.ts @@ -1,4 +1,5 @@ import { localize } from '@opensumi/ide-core-common'; + import { registerColor } from '../color-registry'; export const welcomePagebtnBackground = registerColor( diff --git a/packages/theme/src/common/event.ts b/packages/theme/src/common/event.ts index 18cfbd9af0..af6e493be7 100644 --- a/packages/theme/src/common/event.ts +++ b/packages/theme/src/common/event.ts @@ -1,4 +1,5 @@ import { BasicEvent } from '@opensumi/ide-core-common'; + import { ITheme } from './theme.service'; export class ThemeChangedEvent extends BasicEvent {} diff --git a/packages/theme/src/common/mocks/theme.service.ts b/packages/theme/src/common/mocks/theme.service.ts index 62c100cfea..c6279cb9e1 100644 --- a/packages/theme/src/common/mocks/theme.service.ts +++ b/packages/theme/src/common/mocks/theme.service.ts @@ -1,7 +1,8 @@ -import { ThemeContribution, ExtColorContribution, IThemeService, ITheme } from '../theme.service'; import { Injectable } from '@opensumi/di'; import { Emitter, Event, URI, IThemeColor } from '@opensumi/ide-core-common'; +import { ThemeContribution, ExtColorContribution, IThemeService, ITheme } from '../theme.service'; + @Injectable() export class MockThemeService implements IThemeService { public currentThemeId = 'dark'; diff --git a/packages/theme/src/common/semantic-tokens-registry.ts b/packages/theme/src/common/semantic-tokens-registry.ts index d439a55ea7..86e1b09f86 100644 --- a/packages/theme/src/common/semantic-tokens-registry.ts +++ b/packages/theme/src/common/semantic-tokens-registry.ts @@ -1,4 +1,5 @@ import { IJSONSchema } from '@opensumi/ide-core-common/lib/json-schema'; + import { Color } from './color'; import { ITokenColorizationSetting } from './theme.service'; diff --git a/packages/theme/src/common/theme.service.ts b/packages/theme/src/common/theme.service.ts index be280a3c2c..ca3de1cec3 100644 --- a/packages/theme/src/common/theme.service.ts +++ b/packages/theme/src/common/theme.service.ts @@ -1,7 +1,9 @@ +import { IRawThemeSetting } from 'vscode-textmate'; + +import { Event, URI, IDisposable, IThemeColor } from '@opensumi/ide-core-common'; + import { Color } from './color'; import { vs, vs_dark, hc_black } from './default-themes'; -import { Event, URI, IDisposable, IThemeColor } from '@opensumi/ide-core-common'; -import { IRawThemeSetting } from 'vscode-textmate'; export const ThemeServicePath = 'themeServicePath'; diff --git a/packages/theme/src/common/themeCompatibility.ts b/packages/theme/src/common/themeCompatibility.ts index 37c6c6d7d5..92893c9e0e 100644 --- a/packages/theme/src/common/themeCompatibility.ts +++ b/packages/theme/src/common/themeCompatibility.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITokenColorizationRule, IColorMap } from './theme.service'; import { Color } from './color'; import * as colorRegistry from './color-registry'; +import { ITokenColorizationRule, IColorMap } from './theme.service'; const settingToColorIdMapping: { [settingId: string]: string[] } = {}; function addSettingMapping(settingId: string, colorId: string) { diff --git a/packages/toolbar/src/browser/index.ts b/packages/toolbar/src/browser/index.ts index 2c62978a71..509dcc8b9e 100644 --- a/packages/toolbar/src/browser/index.ts +++ b/packages/toolbar/src/browser/index.ts @@ -9,9 +9,10 @@ import { IToolbarRegistry, } from '@opensumi/ide-core-browser'; import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; + import { ToolBar } from './toolbar.view'; -import { IToolBarViewService, ToolBarContribution } from './types'; import { ToolBarViewService } from './toolbar.view.service'; +import { IToolBarViewService, ToolBarContribution } from './types'; export * from './types'; @Injectable() diff --git a/packages/toolbar/src/browser/toolbar.view.service.tsx b/packages/toolbar/src/browser/toolbar.view.service.tsx index 2a0a6a74f5..547c6439c1 100644 --- a/packages/toolbar/src/browser/toolbar.view.service.tsx +++ b/packages/toolbar/src/browser/toolbar.view.service.tsx @@ -1,4 +1,6 @@ import { observable } from 'mobx'; +import React from 'react'; + import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, @@ -7,7 +9,6 @@ import { ToolbarActionBtnClickEvent, } from '@opensumi/ide-core-browser'; import { IEventBus } from '@opensumi/ide-core-common'; -import React from 'react'; import { IToolBarViewService, diff --git a/packages/toolbar/src/browser/toolbar.view.tsx b/packages/toolbar/src/browser/toolbar.view.tsx index 7413fb4911..47f30570d4 100644 --- a/packages/toolbar/src/browser/toolbar.view.tsx +++ b/packages/toolbar/src/browser/toolbar.view.tsx @@ -1,10 +1,12 @@ -import React from 'react'; import clx from 'classnames'; +import debounce = require('lodash.debounce'); import { observer } from 'mobx-react-lite'; +import React from 'react'; + import { ToolbarLocation, Disposable } from '@opensumi/ide-core-browser'; import styles from './toolbar.module.less'; -import debounce = require('lodash.debounce'); + declare let ResizeObserver: any; diff --git a/packages/types/build.ts b/packages/types/build.ts index ca9927841e..d1175becfb 100644 --- a/packages/types/build.ts +++ b/packages/types/build.ts @@ -1,9 +1,13 @@ -import { readAllMainPackages } from '../../scripts/pkg'; -import { collectPkgContains, collectPkgVersionList } from '../../scripts/manifest'; import path from 'path'; -import pkg from './package.json'; + import { ensureFileSync, writeFileSync } from 'fs-extra'; +import { collectPkgContains, collectPkgVersionList } from '../../scripts/manifest'; +import { readAllMainPackages } from '../../scripts/pkg'; + +import pkg from './package.json'; + + (async () => { const manifestFile = path.join(__dirname, 'manifest.json'); const packageDir = path.join(__dirname, '../../packages'); diff --git a/packages/types/sumi-browser.d.ts b/packages/types/sumi-browser.d.ts index e0006d03e7..475b68de6c 100644 --- a/packages/types/sumi-browser.d.ts +++ b/packages/types/sumi-browser.d.ts @@ -26,8 +26,8 @@ declare module 'kaitian-browser' { declare module 'sumi-browser' { export * from '@opensumi/ide-components'; - import type vscode from 'vscode'; import React from 'react'; + import type vscode from 'vscode'; import { URI as Uri } from 'vscode-uri'; import { ROTATE_TYPE, ANIM_TYPE } from '@opensumi/ide-components'; diff --git a/packages/variable/__tests__/browser/variable-quick-open.service.test.ts b/packages/variable/__tests__/browser/variable-quick-open.service.test.ts index cd0f2ceb64..20f3178a92 100644 --- a/packages/variable/__tests__/browser/variable-quick-open.service.test.ts +++ b/packages/variable/__tests__/browser/variable-quick-open.service.test.ts @@ -1,13 +1,14 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { VariableModule } from '@opensumi/ide-variable/lib/browser'; import { QuickOpenService, VariableRegistry, Variable, URI } from '@opensumi/ide-core-browser'; import { MockQuickOpenService } from '@opensumi/ide-quick-open/lib/common/mocks/quick-open.service'; +import { VariableModule } from '@opensumi/ide-variable/lib/browser'; import { VariableQuickOpenService, VariableQuickOpenItem, } from '@opensumi/ide-variable/lib/browser/variable-quick-open.service'; +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; + describe('VariableQuickOpenService should be work', () => { let variableQuickOpenService: VariableQuickOpenService; let variableRegistry: VariableRegistry; diff --git a/packages/variable/__tests__/browser/variable-resolver.service.test.ts b/packages/variable/__tests__/browser/variable-resolver.service.test.ts index 208602ad66..968c81170c 100644 --- a/packages/variable/__tests__/browser/variable-resolver.service.test.ts +++ b/packages/variable/__tests__/browser/variable-resolver.service.test.ts @@ -1,9 +1,10 @@ -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; -import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { VariableModule } from '@opensumi/ide-variable/lib/browser'; -import { IVariableResolverService } from '@opensumi/ide-variable/lib/common'; import { QuickOpenService, VariableRegistry, Variable, URI } from '@opensumi/ide-core-browser'; import { MockQuickOpenService } from '@opensumi/ide-quick-open/lib/common/mocks/quick-open.service'; +import { VariableModule } from '@opensumi/ide-variable/lib/browser'; +import { IVariableResolverService } from '@opensumi/ide-variable/lib/common'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; describe('VariableResolverService should be work', () => { let variableResolverService: IVariableResolverService; diff --git a/packages/variable/src/browser/index.ts b/packages/variable/src/browser/index.ts index 4584d2c907..d6b8910e12 100644 --- a/packages/variable/src/browser/index.ts +++ b/packages/variable/src/browser/index.ts @@ -1,8 +1,10 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; -import { VariableResolverContribution } from './variable-resolver.contribution'; -import { VariableQuickOpenService } from './variable-quick-open.service'; + import { IVariableResolverService } from '../common'; + +import { VariableQuickOpenService } from './variable-quick-open.service'; +import { VariableResolverContribution } from './variable-resolver.contribution'; import { VariableResolverService } from './variable-resolver.service'; @Injectable() diff --git a/packages/variable/src/browser/variable-quick-open.service.ts b/packages/variable/src/browser/variable-quick-open.service.ts index af049c5ce1..67bd58b8b4 100644 --- a/packages/variable/src/browser/variable-quick-open.service.ts +++ b/packages/variable/src/browser/variable-quick-open.service.ts @@ -1,6 +1,6 @@ import { Autowired, Injectable } from '@opensumi/di'; -import { QuickOpenService, QuickOpenModel, QuickOpenItem, Mode } from '@opensumi/ide-quick-open'; import { VariableRegistry, localize } from '@opensumi/ide-core-browser'; +import { QuickOpenService, QuickOpenModel, QuickOpenItem, Mode } from '@opensumi/ide-quick-open'; @Injectable() export class VariableQuickOpenService implements QuickOpenModel { diff --git a/packages/variable/src/browser/variable-resolver.contribution.ts b/packages/variable/src/browser/variable-resolver.contribution.ts index ddb8654f6d..f98ef5cb91 100644 --- a/packages/variable/src/browser/variable-resolver.contribution.ts +++ b/packages/variable/src/browser/variable-resolver.contribution.ts @@ -10,6 +10,7 @@ import { VariableContribution, localize, } from '@opensumi/ide-core-browser'; + import { VariableQuickOpenService } from './variable-quick-open.service'; export const LIST_VARIABLES: Command = { diff --git a/packages/variable/src/browser/variable-resolver.service.ts b/packages/variable/src/browser/variable-resolver.service.ts index 529d1cf477..ea26ba46da 100644 --- a/packages/variable/src/browser/variable-resolver.service.ts +++ b/packages/variable/src/browser/variable-resolver.service.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { isWindows, Variable, VariableRegistry } from '@opensumi/ide-core-browser'; + import { VariableResolveOptions, IVariableResolverService } from '../common'; @Injectable() diff --git a/packages/webview/__tests__/browser/webview.service.test.ts b/packages/webview/__tests__/browser/webview.service.test.ts index a17875a203..013635726d 100644 --- a/packages/webview/__tests__/browser/webview.service.test.ts +++ b/packages/webview/__tests__/browser/webview.service.test.ts @@ -1,14 +1,14 @@ -import { IThemeService, ITheme } from '@opensumi/ide-theme'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { Disposable } from '@opensumi/ide-core-common'; import { AppConfig } from '@opensumi/ide-core-browser'; -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { Disposable } from '@opensumi/ide-core-common'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; import { EditorComponentRegistry, EditorPreferences } from '@opensumi/ide-editor/lib/browser'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; +import { IThemeService, ITheme } from '@opensumi/ide-theme'; -import { IWebviewService } from '../../src/browser'; -import { WebviewServiceImpl } from '../../src/browser/webview.service'; import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; +import { IWebviewService } from '../../src/browser'; +import { WebviewServiceImpl } from '../../src/browser/webview.service'; let injector: MockInjector; const providers = [ diff --git a/packages/webview/__tests__/browser/window-webview.test.ts b/packages/webview/__tests__/browser/window-webview.test.ts index 90c596a8ce..c80c440108 100644 --- a/packages/webview/__tests__/browser/window-webview.test.ts +++ b/packages/webview/__tests__/browser/window-webview.test.ts @@ -1,8 +1,9 @@ -import { mockElectronRenderer } from '@opensumi/ide-core-common/lib/mocks/electron/browserMock'; -import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; +import { Emitter } from '@opensumi/ide-core-common'; import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron'; +import { mockElectronRenderer } from '@opensumi/ide-core-common/lib/mocks/electron/browserMock'; import { ElectronPlainWebviewWindow } from '@opensumi/ide-webview/lib/browser/webview-window'; -import { Emitter } from '@opensumi/ide-core-common'; + +import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; describe('webview-window-test', () => { const injector = createBrowserInjector([]); diff --git a/packages/webview/__tests__/webview/webview.channel.test.ts b/packages/webview/__tests__/webview/webview.channel.test.ts index 4a6b7fce90..931b3d4ec8 100644 --- a/packages/webview/__tests__/webview/webview.channel.test.ts +++ b/packages/webview/__tests__/webview/webview.channel.test.ts @@ -1,9 +1,13 @@ +// eslint-disable-next-line import/order import { mockElectronRenderer } from '@opensumi/ide-core-common/lib/mocks/electron/browserMock'; + mockElectronRenderer(); -import { WebviewPanelManager } from '../../src/webview-host/webview-manager'; -import { ElectronWebviewChannel } from '../../src/electron-webview/host-channel'; import { MockedElectronIpcRenderer } from '@opensumi/ide-core-common/lib/mocks/electron/ipcRenderer'; + +import { ElectronWebviewChannel } from '../../src/electron-webview/host-channel'; import { WebIframeChannel } from '../../src/webview-host/web-preload'; +import { WebviewPanelManager } from '../../src/webview-host/webview-manager'; + const { JSDOM } = require('jsdom'); describe('electron webview test', () => { diff --git a/packages/webview/src/browser/abstract-webview.ts b/packages/webview/src/browser/abstract-webview.ts index b185d7070e..549aa0eece 100644 --- a/packages/webview/src/browser/abstract-webview.ts +++ b/packages/webview/src/browser/abstract-webview.ts @@ -1,4 +1,4 @@ -import { IWebview, IWebviewContentOptions, IWebviewContentScrollPosition, IWebviewService } from './types'; +import { Autowired, Injectable } from '@opensumi/di'; import { Event, URI, @@ -9,10 +9,11 @@ import { MaybeNull, AppConfig, } from '@opensumi/ide-core-browser'; +import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; import { ITheme, IThemeService } from '@opensumi/ide-theme'; -import { Autowired, Injectable } from '@opensumi/di'; import { ThemeChangedEvent } from '@opensumi/ide-theme/lib/common/event'; -import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser'; + +import { IWebview, IWebviewContentOptions, IWebviewContentScrollPosition, IWebviewService } from './types'; @Injectable({ multiple: true }) export abstract class AbstractWebviewPanel extends Disposable implements IWebview { diff --git a/packages/webview/src/browser/contribution.ts b/packages/webview/src/browser/contribution.ts index cfd238b4de..e3b73d0cf4 100644 --- a/packages/webview/src/browser/contribution.ts +++ b/packages/webview/src/browser/contribution.ts @@ -1,10 +1,11 @@ /* istanbul ignore file */ -import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; +import { Autowired } from '@opensumi/di'; import { Domain, URI, CommandContribution, CommandRegistry, AppConfig } from '@opensumi/ide-core-browser'; import { localize } from '@opensumi/ide-core-common'; import { ResourceService, IResource } from '@opensumi/ide-editor'; +import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser'; + import { EDITOR_WEBVIEW_SCHEME, IWebviewService, IEditorWebviewMetaData, isWebview } from './types'; -import { Autowired } from '@opensumi/di'; import { WebviewServiceImpl } from './webview.service'; const WEBVIEW_DEVTOOLS_COMMAND = { diff --git a/packages/webview/src/browser/editor-webview.tsx b/packages/webview/src/browser/editor-webview.tsx index 9d3d709d70..5568c53fc1 100644 --- a/packages/webview/src/browser/editor-webview.tsx +++ b/packages/webview/src/browser/editor-webview.tsx @@ -1,7 +1,9 @@ import React from 'react'; + +import { Disposable, DomListener, useInjectable } from '@opensumi/ide-core-browser'; import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser'; + import { IWebview, IPlainWebview, IEditorWebviewMetaData, IWebviewService, isWebview } from './types'; -import { Disposable, DomListener, useInjectable } from '@opensumi/ide-core-browser'; import { WebviewServiceImpl } from './webview.service'; declare const ResizeObserver: any; diff --git a/packages/webview/src/browser/electron-webview-webview.ts b/packages/webview/src/browser/electron-webview-webview.ts index a5906168cd..834e9ba6b4 100644 --- a/packages/webview/src/browser/electron-webview-webview.ts +++ b/packages/webview/src/browser/electron-webview-webview.ts @@ -1,4 +1,4 @@ -import { IWebview, IWebviewContentOptions } from './types'; +import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, DomListener, @@ -7,10 +7,12 @@ import { AppConfig, electronEnv, } from '@opensumi/ide-core-browser'; -import { AbstractWebviewPanel } from './abstract-webview'; -import { Injectable, Autowired } from '@opensumi/di'; + import { WebviewScheme } from '../common'; +import { AbstractWebviewPanel } from './abstract-webview'; +import { IWebview, IWebviewContentOptions } from './types'; + @Injectable({ multiple: true }) export class ElectronWebviewWebviewPanel extends AbstractWebviewPanel implements IWebview { private webview: Electron.WebviewTag; diff --git a/packages/webview/src/browser/iframe-webview.ts b/packages/webview/src/browser/iframe-webview.ts index 991471baef..41e7d3b8a4 100644 --- a/packages/webview/src/browser/iframe-webview.ts +++ b/packages/webview/src/browser/iframe-webview.ts @@ -1,7 +1,9 @@ -import { IWebview, IWebviewContentOptions } from './types'; +import { Injectable, Autowired } from '@opensumi/di'; import { Disposable, DomListener, getDebugLogger, IDisposable, AppConfig } from '@opensumi/ide-core-browser'; + import { AbstractWebviewPanel } from './abstract-webview'; -import { Injectable, Autowired } from '@opensumi/di'; +import { IWebview, IWebviewContentOptions } from './types'; + @Injectable({ multiple: true }) export class IFrameWebviewPanel extends AbstractWebviewPanel implements IWebview { diff --git a/packages/webview/src/browser/index.ts b/packages/webview/src/browser/index.ts index c858ffaa3d..d7b6c19440 100644 --- a/packages/webview/src/browser/index.ts +++ b/packages/webview/src/browser/index.ts @@ -1,8 +1,9 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + +import { WebviewModuleContribution } from './contribution'; import { IWebviewService } from './types'; import { WebviewServiceImpl } from './webview.service'; -import { WebviewModuleContribution } from './contribution'; export * from './types'; export { PlainWebview } from './editor-webview'; diff --git a/packages/webview/src/browser/plain-webview.ts b/packages/webview/src/browser/plain-webview.ts index baa6354a74..99ad9834e3 100644 --- a/packages/webview/src/browser/plain-webview.ts +++ b/packages/webview/src/browser/plain-webview.ts @@ -1,6 +1,7 @@ -import { IPlainWebview } from './types'; import { Disposable, DomListener, electronEnv, Emitter, Deferred, Event } from '@opensumi/ide-core-browser'; +import { IPlainWebview } from './types'; + export class IframePlainWebview extends Disposable implements IPlainWebview { private _url: string | undefined; diff --git a/packages/webview/src/browser/types.ts b/packages/webview/src/browser/types.ts index 510428049f..df14178810 100644 --- a/packages/webview/src/browser/types.ts +++ b/packages/webview/src/browser/types.ts @@ -1,6 +1,6 @@ import { Event, URI, IDisposable, MaybeNull, MaybePromise } from '@opensumi/ide-core-common'; -import { ITheme } from '@opensumi/ide-theme'; import { IEditorGroup } from '@opensumi/ide-editor'; +import { ITheme } from '@opensumi/ide-theme'; export const EDITOR_WEBVIEW_SCHEME = 'editor-webview'; /** diff --git a/packages/webview/src/browser/webview-window.ts b/packages/webview/src/browser/webview-window.ts index ef2982248d..a9179c6f4e 100644 --- a/packages/webview/src/browser/webview-window.ts +++ b/packages/webview/src/browser/webview-window.ts @@ -1,8 +1,9 @@ -import { IPlainWebviewWindow } from './types'; import { Injectable, Autowired } from '@opensumi/di'; -import { IElectronMainUIService, IElectronPlainWebviewWindowOptions } from '@opensumi/ide-core-common/lib/electron'; -import { electronEnv } from '@opensumi/ide-core-browser/lib/utils/electron'; import { Emitter, Event, Disposable, URI } from '@opensumi/ide-core-browser'; +import { electronEnv } from '@opensumi/ide-core-browser/lib/utils/electron'; +import { IElectronMainUIService, IElectronPlainWebviewWindowOptions } from '@opensumi/ide-core-common/lib/electron'; + +import { IPlainWebviewWindow } from './types'; @Injectable({ multiple: true }) export class ElectronPlainWebviewWindow extends Disposable implements IPlainWebviewWindow { diff --git a/packages/webview/src/browser/webview.service.ts b/packages/webview/src/browser/webview.service.ts index df281c2b60..5b23c8a5bf 100644 --- a/packages/webview/src/browser/webview.service.ts +++ b/packages/webview/src/browser/webview.service.ts @@ -1,17 +1,4 @@ -import { - IWebviewService, - IPlainWebviewConstructionOptions, - IPlainWebview, - IWebview, - IWebviewContentOptions, - IWebviewThemeData, - IEditorWebviewComponent, - EDITOR_WEBVIEW_SCHEME, - IEditorWebviewMetaData, - IPlainWebviewComponentHandle, - IPlainWebviewWindow, - IWebviewReviver, -} from './types'; +import { Injectable, Injector, Autowired, INJECTOR_TOKEN } from '@opensumi/di'; import { getDebugLogger, localize, @@ -27,11 +14,6 @@ import { STORAGE_SCHEMA, AppConfig, } from '@opensumi/ide-core-browser'; -import { ElectronPlainWebview, IframePlainWebview } from './plain-webview'; -import { Injectable, Injector, Autowired, INJECTOR_TOKEN } from '@opensumi/di'; -import { IFrameWebviewPanel } from './iframe-webview'; -import { ITheme } from '@opensumi/ide-theme'; -import { getColorRegistry } from '@opensumi/ide-theme/lib/common/color-registry'; import { IEditorGroup, WorkbenchEditorService, ResourceNeedUpdateEvent, IResource } from '@opensumi/ide-editor'; import { EditorComponentRegistry, @@ -39,8 +21,27 @@ import { EditorPreferences, EditorGroupChangeEvent, } from '@opensumi/ide-editor/lib/browser'; +import { ITheme } from '@opensumi/ide-theme'; +import { getColorRegistry } from '@opensumi/ide-theme/lib/common/color-registry'; + import { EditorWebviewComponentView } from './editor-webview'; import { ElectronWebviewWebviewPanel } from './electron-webview-webview'; +import { IFrameWebviewPanel } from './iframe-webview'; +import { ElectronPlainWebview, IframePlainWebview } from './plain-webview'; +import { + IWebviewService, + IPlainWebviewConstructionOptions, + IPlainWebview, + IWebview, + IWebviewContentOptions, + IWebviewThemeData, + IEditorWebviewComponent, + EDITOR_WEBVIEW_SCHEME, + IEditorWebviewMetaData, + IPlainWebviewComponentHandle, + IPlainWebviewWindow, + IWebviewReviver, +} from './types'; import { ElectronPlainWebviewWindow } from './webview-window'; @Injectable() diff --git a/packages/webview/src/electron-main/index.ts b/packages/webview/src/electron-main/index.ts index 599d1eef5f..277fdf9e4e 100644 --- a/packages/webview/src/electron-main/index.ts +++ b/packages/webview/src/electron-main/index.ts @@ -1,9 +1,12 @@ -import { ElectronMainContribution, ElectronMainModule } from '@opensumi/ide-core-electron-main'; -import { Domain } from '@opensumi/ide-core-common'; import { protocol } from 'electron'; + +import { Injectable } from '@opensumi/di'; +import { Domain } from '@opensumi/ide-core-common'; +import { ElectronMainContribution, ElectronMainModule } from '@opensumi/ide-core-electron-main'; import { ProtocolElectronMainContribution } from '@opensumi/ide-core-electron-main/lib/bootstrap/services/protocol'; + import { WebviewScheme } from '../common'; -import { Injectable } from '@opensumi/di'; + ProtocolElectronMainContribution.schemePrivileges.push({ scheme: WebviewScheme, diff --git a/packages/webview/src/electron-webview/host-channel.ts b/packages/webview/src/electron-webview/host-channel.ts index c910d6c689..a41cbb2047 100644 --- a/packages/webview/src/electron-webview/host-channel.ts +++ b/packages/webview/src/electron-webview/host-channel.ts @@ -1,6 +1,7 @@ +import { ipcRenderer } from 'electron'; + import { IWebviewChannel } from '../webview-host/common'; import { WebviewPanelManager } from '../webview-host/webview-manager'; -import { ipcRenderer } from 'electron'; export class ElectronWebviewChannel implements IWebviewChannel { private handlers = new Map(); diff --git a/packages/workspace-edit/__tests__/index.test.ts b/packages/workspace-edit/__tests__/index.test.ts index ac692af507..eff41e303d 100644 --- a/packages/workspace-edit/__tests__/index.test.ts +++ b/packages/workspace-edit/__tests__/index.test.ts @@ -1,17 +1,19 @@ +import { URI } from '@opensumi/ide-core-browser'; +import { WorkbenchEditorService, IEditorGroup } from '@opensumi/ide-editor'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; +import { IFileServiceClient, FileSystemError } from '@opensumi/ide-file-service/lib/common'; +import { createMockedMonaco } from '@opensumi/ide-monaco/__mocks__/monaco'; import type { ResourceEdit, IBulkEditOptions, } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; +import { Uri } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { createBrowserInjector } from '../../../tools/dev-tool/src/injector-helper'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser'; -import { createMockedMonaco } from '@opensumi/ide-monaco/__mocks__/monaco'; -import { WorkbenchEditorService, IEditorGroup } from '@opensumi/ide-editor'; -import { URI } from '@opensumi/ide-core-browser'; -import { IWorkspaceEditService, IResourceFileEdit, IWorkspaceFileService } from '../src/common'; -import { IFileServiceClient, FileSystemError } from '@opensumi/ide-file-service/lib/common'; import { WorkspaceEditModule } from '../src/browser'; import { MonacoBulkEditService } from '../src/browser/bulk-edit.service'; -import { Uri } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { IWorkspaceEditService, IResourceFileEdit, IWorkspaceFileService } from '../src/common'; + function mockService(target) { return new Proxy(target, { diff --git a/packages/workspace-edit/src/browser/bulk-edit.service.ts b/packages/workspace-edit/src/browser/bulk-edit.service.ts index 40f00c57c0..a8d1d43831 100644 --- a/packages/workspace-edit/src/browser/bulk-edit.service.ts +++ b/packages/workspace-edit/src/browser/bulk-edit.service.ts @@ -1,19 +1,21 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { Injectable, Autowired } from '@opensumi/di'; +import { URI, ILogger, revive } from '@opensumi/ide-core-common'; +import { UriComponents } from '@opensumi/ide-editor'; +import { + ResourceEdit, + ResourceFileEdit, + ResourceTextEdit, +} from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; import type { IBulkEditPreviewHandler, IBulkEditResult, IBulkEditService, IBulkEditOptions, } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; -import { - ResourceEdit, - ResourceFileEdit, - ResourceTextEdit, -} from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; -import { Injectable, Autowired } from '@opensumi/di'; -import { URI, ILogger, revive } from '@opensumi/ide-core-common'; -import { UriComponents } from '@opensumi/ide-editor'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IWorkspaceEdit, IWorkspaceEditService, IResourceTextEdit, IResourceFileEdit } from '../common'; + import { isResourceFileEdit, isResourceTextEdit } from './utils'; function reviveWorkspaceEditDto2(data: ResourceEdit[] | undefined): ResourceEdit[] { diff --git a/packages/workspace-edit/src/browser/index.ts b/packages/workspace-edit/src/browser/index.ts index af2f999392..e53a8681fc 100644 --- a/packages/workspace-edit/src/browser/index.ts +++ b/packages/workspace-edit/src/browser/index.ts @@ -1,9 +1,4 @@ import { Provider, Injectable, Autowired } from '@opensumi/di'; -import type { - IBulkEditOptions, - ResourceEdit, -} from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; - import { BrowserModule, Domain, @@ -18,12 +13,17 @@ import { MonacoOverrideServiceRegistry, } from '@opensumi/ide-core-browser'; import { CommandRegistry } from '@opensumi/ide-core-common'; +import type { + IBulkEditOptions, + ResourceEdit, +} from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; import { IBulkEditServiceShape, IWorkspaceEditService, IWorkspaceFileService } from '../common'; -import { WorkspaceEditServiceImpl } from './workspace-edit.service'; + import { MonacoBulkEditService } from './bulk-edit.service'; -import { WorkspaceFileService } from './workspace-file.service'; import { IRefactorPreviewService, RefactorPreviewServiceImpl, PreviewViewId } from './refactor-preview.service'; +import { WorkspaceEditServiceImpl } from './workspace-edit.service'; +import { WorkspaceFileService } from './workspace-file.service'; const ClearEditsId = 'refactor-preview.clear.edits'; const ApplyEditsId = 'refactor-preview.apply.edits'; diff --git a/packages/workspace-edit/src/browser/refactor-preview.service.tsx b/packages/workspace-edit/src/browser/refactor-preview.service.tsx index 5b651c57a2..497deeab07 100644 --- a/packages/workspace-edit/src/browser/refactor-preview.service.tsx +++ b/packages/workspace-edit/src/browser/refactor-preview.service.tsx @@ -1,12 +1,13 @@ -import React from 'react'; -import { Injector, Injectable, Autowired, INJECTOR_TOKEN } from '@opensumi/di'; import { observable, action } from 'mobx'; +import React from 'react'; +import { Injector, Injectable, Autowired, INJECTOR_TOKEN } from '@opensumi/di'; +import { Deferred, localize, MessageType } from '@opensumi/ide-core-common'; import { IMainLayoutService } from '@opensumi/ide-main-layout'; -import type { WorkspaceFileEdit, WorkspaceTextEdit } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; -import { ResourceEdit } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; import { IDialogService } from '@opensumi/ide-overlay'; -import { Deferred, localize, MessageType } from '@opensumi/ide-core-common'; +import { ResourceEdit } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; +import type { WorkspaceFileEdit, WorkspaceTextEdit } from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes'; + import { RefactorPreview } from './refactor-preview'; export const PreviewViewId = 'RefactorPreview'; diff --git a/packages/workspace-edit/src/browser/refactor-preview.tsx b/packages/workspace-edit/src/browser/refactor-preview.tsx index a5bc9e5dc7..13a68b1c79 100644 --- a/packages/workspace-edit/src/browser/refactor-preview.tsx +++ b/packages/workspace-edit/src/browser/refactor-preview.tsx @@ -1,26 +1,26 @@ -import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; -import type { IRange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; -import * as paths from '@opensumi/ide-core-common/lib/path'; -import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; -import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser/doc-model/types'; -import { URI, Uri } from '@opensumi/ide-core-common/lib/uri'; -import { RecycleList } from '@opensumi/ide-components/lib/recycle-list'; import { CheckBox } from '@opensumi/ide-components/lib/checkbox'; -import { LabelService } from '@opensumi/ide-core-browser/lib/services/label-service'; +import { RecycleList } from '@opensumi/ide-components/lib/recycle-list'; import { ViewState } from '@opensumi/ide-core-browser/lib/layout'; - -import { IRefactorPreviewService } from './refactor-preview.service'; -import styles from './refactor_preview.module.less'; +import { useInjectable } from '@opensumi/ide-core-browser/lib/react-hooks'; +import { LabelService } from '@opensumi/ide-core-browser/lib/services/label-service'; import { localize } from '@opensumi/ide-core-common/lib/localize'; -import { isResourceFileEdit } from './utils'; +import * as paths from '@opensumi/ide-core-common/lib/path'; +import { URI, Uri } from '@opensumi/ide-core-common/lib/uri'; +import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser/doc-model/types'; import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; import type { ResourceFileEdit, ResourceTextEdit, } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; +import type { IRange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; +import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + +import { IRefactorPreviewService } from './refactor-preview.service'; +import styles from './refactor_preview.module.less'; +import { isResourceFileEdit } from './utils'; interface IRefactorNodeProps { data: ResourceTextEdit | ResourceFileEdit; diff --git a/packages/workspace-edit/src/browser/utils.ts b/packages/workspace-edit/src/browser/utils.ts index 3f73a406d1..68dca6f034 100644 --- a/packages/workspace-edit/src/browser/utils.ts +++ b/packages/workspace-edit/src/browser/utils.ts @@ -1,9 +1,9 @@ -import { Uri } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; +import { isObject } from '@opensumi/ide-core-common'; import type { ResourceFileEdit, ResourceTextEdit, } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; -import { isObject } from '@opensumi/ide-core-common'; +import { Uri } from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; export function isResourceFileEdit(thing: any): thing is ResourceFileEdit { return isObject(thing) && (Boolean(thing.newResource) || Boolean(thing.oldResource)); diff --git a/packages/workspace-edit/src/browser/workspace-edit.service.ts b/packages/workspace-edit/src/browser/workspace-edit.service.ts index b6bdfd3a53..127e4d4fca 100644 --- a/packages/workspace-edit/src/browser/workspace-edit.service.ts +++ b/packages/workspace-edit/src/browser/workspace-edit.service.ts @@ -1,4 +1,15 @@ +import { runInAction } from 'mobx'; + +import { Injectable, Autowired } from '@opensumi/di'; +import { URI, IEventBus, isWindows, isUndefined } from '@opensumi/ide-core-browser'; +import { WorkbenchEditorService } from '@opensumi/ide-editor'; +import { IEditorDocumentModelService, IResource, isDiffResource } from '@opensumi/ide-editor/lib/browser'; +import { EditorGroup } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; +import { FileSystemError } from '@opensumi/ide-file-service/lib/common'; +import { EndOfLineSequence, EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; +import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api'; + import { IResourceTextEdit, IWorkspaceEditService, @@ -8,15 +19,6 @@ import { WorkspaceEditDidDeleteFileEvent, IWorkspaceFileService, } from '../common'; -import { URI, IEventBus, isWindows, isUndefined } from '@opensumi/ide-core-browser'; -import { FileSystemError } from '@opensumi/ide-file-service/lib/common'; -import { Injectable, Autowired } from '@opensumi/di'; -import { WorkbenchEditorService } from '@opensumi/ide-editor'; -import { runInAction } from 'mobx'; -import { IEditorDocumentModelService, IResource, isDiffResource } from '@opensumi/ide-editor/lib/browser'; -import { EditorGroup } from '@opensumi/ide-editor/lib/browser/workbench-editor.service'; -import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range'; -import { EndOfLineSequence, EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types'; type WorkspaceEdit = ResourceTextEditTask | ResourceFileEdit; diff --git a/packages/workspace-edit/src/browser/workspace-file.service.ts b/packages/workspace-edit/src/browser/workspace-file.service.ts index 84c4644777..3cf37230fd 100644 --- a/packages/workspace-edit/src/browser/workspace-file.service.ts +++ b/packages/workspace-edit/src/browser/workspace-file.service.ts @@ -1,5 +1,5 @@ import { Injectable, Autowired } from '@opensumi/di'; -import { IFileServiceClient } from '@opensumi/ide-file-service'; +import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; import { URI, Uri, @@ -12,7 +12,8 @@ import { Event, FileStat, } from '@opensumi/ide-core-common'; -import { IProgressService } from '@opensumi/ide-core-browser/lib/progress'; +import { IFileServiceClient } from '@opensumi/ide-file-service'; + import { FileOperation, FILE_OPERATION_TIMEOUT, diff --git a/packages/workspace/__tests__/browser/workspace-contribution.test.ts b/packages/workspace/__tests__/browser/workspace-contribution.test.ts index c17d2d8d5f..2f2d025fae 100644 --- a/packages/workspace/__tests__/browser/workspace-contribution.test.ts +++ b/packages/workspace/__tests__/browser/workspace-contribution.test.ts @@ -1,12 +1,14 @@ +import { IContextKeyService, CommandService, WORKSPACE_COMMANDS } from '@opensumi/ide-core-browser'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { URI } from '@opensumi/ide-core-common'; +import { IWindowDialogService } from '@opensumi/ide-overlay'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; import { WorkspaceContribution } from '@opensumi/ide-workspace/lib/browser/workspace-contribution'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { URI } from '@opensumi/ide-core-common'; import { WorkspaceModule } from '../../src/browser'; -import { IContextKeyService, CommandService, WORKSPACE_COMMANDS } from '@opensumi/ide-core-browser'; -import { IWindowDialogService } from '@opensumi/ide-overlay'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; + describe('WorkspaceContribution should be work', () => { let workspaceContribution: WorkspaceContribution; diff --git a/packages/workspace/__tests__/browser/workspace-service.test.ts b/packages/workspace/__tests__/browser/workspace-service.test.ts index 20642ee339..7c05f7bd2a 100644 --- a/packages/workspace/__tests__/browser/workspace-service.test.ts +++ b/packages/workspace/__tests__/browser/workspace-service.test.ts @@ -1,16 +1,18 @@ +import { PreferenceService, FILES_DEFAULTS, IClientApp, IWindowService } from '@opensumi/ide-core-browser'; +import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; +import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; +import { URI, StorageProvider, Disposable, ILoggerManagerClient } from '@opensumi/ide-core-common'; +import { FileStat, DiskFileServicePath } from '@opensumi/ide-file-service'; +import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; +import { MockFsProvider } from '@opensumi/ide-file-service/lib/common/mocks'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkspaceService } from '@opensumi/ide-workspace/lib/browser/workspace-service'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; -import { URI, StorageProvider, Disposable, ILoggerManagerClient } from '@opensumi/ide-core-common'; -import { PreferenceService, FILES_DEFAULTS, IClientApp, IWindowService } from '@opensumi/ide-core-browser'; import { WorkspaceModule } from '../../src/browser'; -import { FileStat, DiskFileServicePath } from '@opensumi/ide-file-service'; import { WorkspacePreferences } from '../../src/browser/workspace-preferences'; -import { MockedStorageProvider } from '@opensumi/ide-core-browser/__mocks__/storage'; -import { WorkspaceService } from '@opensumi/ide-workspace/lib/browser/workspace-service'; -import { MockFsProvider } from '@opensumi/ide-file-service/lib/common/mocks'; -import { MockLoggerManageClient } from '@opensumi/ide-core-browser/__mocks__/logger'; + describe('WorkspaceService should be work while workspace was a single directory', () => { let workspaceService: WorkspaceService; diff --git a/packages/workspace/__tests__/browser/workspace-storage-service.test.ts b/packages/workspace/__tests__/browser/workspace-storage-service.test.ts index c720b9b0ce..415fb2e992 100644 --- a/packages/workspace/__tests__/browser/workspace-storage-service.test.ts +++ b/packages/workspace/__tests__/browser/workspace-storage-service.test.ts @@ -1,10 +1,12 @@ +import { IContextKeyService, CommandService } from '@opensumi/ide-core-browser'; +import { URI } from '@opensumi/ide-core-common'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkspaceVariableContribution } from '@opensumi/ide-workspace/lib/browser/workspace-variable-contribution'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { URI } from '@opensumi/ide-core-common'; import { WorkspaceModule } from '../../src/browser'; -import { IContextKeyService, CommandService } from '@opensumi/ide-core-browser'; -import { WorkspaceVariableContribution } from '@opensumi/ide-workspace/lib/browser/workspace-variable-contribution'; + describe('WorkspaceContribution should be work', () => { let workspaceVariableContribution: WorkspaceVariableContribution; diff --git a/packages/workspace/__tests__/browser/workspace-variable-cnotribution.test.ts b/packages/workspace/__tests__/browser/workspace-variable-cnotribution.test.ts index b7b4398ed1..966f52e64d 100644 --- a/packages/workspace/__tests__/browser/workspace-variable-cnotribution.test.ts +++ b/packages/workspace/__tests__/browser/workspace-variable-cnotribution.test.ts @@ -1,11 +1,13 @@ +import { IContextKeyService, CommandService } from '@opensumi/ide-core-browser'; +import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; +import { URI } from '@opensumi/ide-core-common'; +import { IWorkspaceService } from '@opensumi/ide-workspace'; +import { WorkspaceVariableContribution } from '@opensumi/ide-workspace/lib/browser/workspace-variable-contribution'; + import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper'; import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector'; -import { IWorkspaceService } from '@opensumi/ide-workspace'; -import { URI } from '@opensumi/ide-core-common'; import { WorkspaceModule } from '../../src/browser'; -import { IContextKeyService, CommandService } from '@opensumi/ide-core-browser'; -import { WorkspaceVariableContribution } from '@opensumi/ide-workspace/lib/browser/workspace-variable-contribution'; -import { MockContextKeyService } from '@opensumi/ide-core-browser/__mocks__/context-key'; + describe('WorkspaceVariableContribution should be work', () => { let workspaceVariableContribution: WorkspaceVariableContribution; diff --git a/packages/workspace/src/browser/index.ts b/packages/workspace/src/browser/index.ts index a562da11fc..12b781cbb9 100644 --- a/packages/workspace/src/browser/index.ts +++ b/packages/workspace/src/browser/index.ts @@ -1,9 +1,11 @@ -import { IWorkspaceStorageService } from '../common'; -import { WorkspaceContribution } from './workspace-contribution'; import { Provider } from '@opensumi/di'; import { BrowserModule, EffectDomain } from '@opensumi/ide-core-browser'; -import { injectWorkspacePreferences } from './workspace-preferences'; + +import { IWorkspaceStorageService } from '../common'; import { IWorkspaceService } from '../common'; + +import { WorkspaceContribution } from './workspace-contribution'; +import { injectWorkspacePreferences } from './workspace-preferences'; import { WorkspaceService } from './workspace-service'; import { WorkspaceStorageService } from './workspace-storage-service'; import { WorkspaceVariableContribution } from './workspace-variable-contribution'; diff --git a/packages/workspace/src/browser/workspace-contribution.ts b/packages/workspace/src/browser/workspace-contribution.ts index a98cf2a905..b3c7d88722 100644 --- a/packages/workspace/src/browser/workspace-contribution.ts +++ b/packages/workspace/src/browser/workspace-contribution.ts @@ -1,5 +1,4 @@ import { Autowired } from '@opensumi/di'; - import { CommandRegistry, ClientAppContribution, @@ -12,12 +11,13 @@ import { localize, URI, } from '@opensumi/ide-core-browser'; +import { IWindowDialogService } from '@opensumi/ide-overlay'; import { IWorkspaceService, DEFAULT_WORKSPACE_SUFFIX_NAME } from '../common'; + +import { WorkspaceContextKey } from './workspace-contextkey'; import { workspacePreferenceSchema } from './workspace-preferences'; import { WorkspaceService } from './workspace-service'; -import { IWindowDialogService } from '@opensumi/ide-overlay'; -import { WorkspaceContextKey } from './workspace-contextkey'; @Domain(ClientAppContribution, PreferenceContribution, FsProviderContribution, CommandContribution) export class WorkspaceContribution diff --git a/packages/workspace/src/browser/workspace-service.ts b/packages/workspace/src/browser/workspace-service.ts index c8a2905a15..b003652d51 100644 --- a/packages/workspace/src/browser/workspace-service.ts +++ b/packages/workspace/src/browser/workspace-service.ts @@ -1,12 +1,6 @@ +import * as jsoncparser from 'jsonc-parser'; + import { Injectable, Autowired } from '@opensumi/di'; -import { - DEFAULT_WORKSPACE_SUFFIX_NAME, - IWorkspaceService, - WorkspaceData, - WorkspaceInput, - WORKSPACE_USER_STORAGE_FOLDER_NAME, - UNTITLED_WORKSPACE, -} from '../common'; import { Deferred, ILogger, @@ -23,12 +17,21 @@ import { IWindowService, } from '@opensumi/ide-core-browser'; import { URI, StorageProvider, IStorage, STORAGE_NAMESPACE, localize, formatLocalize } from '@opensumi/ide-core-common'; +import { Path } from '@opensumi/ide-core-common/lib/path'; import { FileStat } from '@opensumi/ide-file-service'; import { FileChangeEvent } from '@opensumi/ide-file-service/lib/common'; import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common'; + +import { + DEFAULT_WORKSPACE_SUFFIX_NAME, + IWorkspaceService, + WorkspaceData, + WorkspaceInput, + WORKSPACE_USER_STORAGE_FOLDER_NAME, + UNTITLED_WORKSPACE, +} from '../common'; + import { WorkspacePreferences } from './workspace-preferences'; -import { Path } from '@opensumi/ide-core-common/lib/path'; -import * as jsoncparser from 'jsonc-parser'; @Injectable() export class WorkspaceService implements IWorkspaceService { diff --git a/packages/workspace/src/browser/workspace-storage-service.ts b/packages/workspace/src/browser/workspace-storage-service.ts index c1230bdb6a..724f094af4 100644 --- a/packages/workspace/src/browser/workspace-storage-service.ts +++ b/packages/workspace/src/browser/workspace-storage-service.ts @@ -1,8 +1,9 @@ import { Injectable, Autowired } from '@opensumi/di'; import { GlobalBrowserStorageService } from '@opensumi/ide-core-browser/lib/services'; -import { IWorkspaceService, IWorkspaceStorageService } from '../common'; import { FileStat } from '@opensumi/ide-file-service'; +import { IWorkspaceService, IWorkspaceStorageService } from '../common'; + /* * 为存在 Browser (LocalStorage) 的数据添加命名空间 * @Deprecated diff --git a/packages/workspace/src/browser/workspace-variable-contribution.ts b/packages/workspace/src/browser/workspace-variable-contribution.ts index 7a954ddeba..5c4c1a2cef 100644 --- a/packages/workspace/src/browser/workspace-variable-contribution.ts +++ b/packages/workspace/src/browser/workspace-variable-contribution.ts @@ -1,5 +1,4 @@ import { Autowired } from '@opensumi/di'; -import { IWorkspaceService } from '../common'; import { VariableContribution, VariableRegistry, @@ -10,6 +9,8 @@ import { COMMON_COMMANDS, } from '@opensumi/ide-core-browser'; +import { IWorkspaceService } from '../common'; + @Domain(VariableContribution) export class WorkspaceVariableContribution implements VariableContribution { @Autowired(IWorkspaceService) diff --git a/packages/workspace/src/common/mocks/workspace-service.ts b/packages/workspace/src/common/mocks/workspace-service.ts index 11315825d6..41a25f2e70 100644 --- a/packages/workspace/src/common/mocks/workspace-service.ts +++ b/packages/workspace/src/common/mocks/workspace-service.ts @@ -1,6 +1,7 @@ -import { FileStat } from '@opensumi/ide-file-service'; -import { Emitter, URI, Deferred } from '@opensumi/ide-core-common'; import { Injectable } from '@opensumi/di'; +import { Emitter, URI, Deferred } from '@opensumi/ide-core-common'; +import { FileStat } from '@opensumi/ide-file-service'; + import { IWorkspaceService } from '../../common'; @Injectable() diff --git a/packages/workspace/src/common/workspace-defination.ts b/packages/workspace/src/common/workspace-defination.ts index b0b3d486a9..dcb2b76a38 100644 --- a/packages/workspace/src/common/workspace-defination.ts +++ b/packages/workspace/src/common/workspace-defination.ts @@ -1,7 +1,8 @@ -import { URI, Event } from '@opensumi/ide-core-common'; -import { FileStat } from '@opensumi/ide-file-service'; import Ajv from 'ajv'; + import { StorageService } from '@opensumi/ide-core-browser/lib/services'; +import { URI, Event } from '@opensumi/ide-core-common'; +import { FileStat } from '@opensumi/ide-file-service'; export const DEFAULT_WORKSPACE_SUFFIX_NAME = 'sumi-workspace'; export const WORKSPACE_USER_STORAGE_FOLDER_NAME = '.sumi'; diff --git a/tools/dev-tool/__tests__/mock-injector.test.ts b/tools/dev-tool/__tests__/mock-injector.test.ts index 430bacc869..7187c5b281 100644 --- a/tools/dev-tool/__tests__/mock-injector.test.ts +++ b/tools/dev-tool/__tests__/mock-injector.test.ts @@ -1,6 +1,7 @@ import { Injectable } from '@opensumi/di'; -import { MockInjector } from '../src/mock-injector'; + import { createBrowserInjector, createNodeInjector } from '../src/injector-helper'; +import { MockInjector } from '../src/mock-injector'; describe(__filename, () => { let fn1: jest.Mock; diff --git a/tools/dev-tool/src/ext-host.js b/tools/dev-tool/src/ext-host.js index 02db34bc65..39b7d8037c 100644 --- a/tools/dev-tool/src/ext-host.js +++ b/tools/dev-tool/src/ext-host.js @@ -1,6 +1,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); -const ext_process_base_1 = require('../../../packages/extension/lib/hosted/ext.process-base'); const ide_core_common_1 = require('../../../packages/core-common'); +const ext_process_base_1 = require('../../../packages/extension/lib/hosted/ext.process-base'); const builtinCommands = [ { diff --git a/tools/dev-tool/src/ext-host.ts b/tools/dev-tool/src/ext-host.ts index 42d266a44a..86b83e883f 100644 --- a/tools/dev-tool/src/ext-host.ts +++ b/tools/dev-tool/src/ext-host.ts @@ -1,5 +1,5 @@ -import { extProcessInit, IBuiltInCommand } from '@opensumi/ide-extension/lib/hosted/ext.process-base'; import { LogLevel } from '@opensumi/ide-core-common'; +import { extProcessInit, IBuiltInCommand } from '@opensumi/ide-extension/lib/hosted/ext.process-base'; const builtinCommands: IBuiltInCommand[] = [ { diff --git a/tools/dev-tool/src/injector-helper.ts b/tools/dev-tool/src/injector-helper.ts index 15a1c0cf74..ab25d78223 100644 --- a/tools/dev-tool/src/injector-helper.ts +++ b/tools/dev-tool/src/injector-helper.ts @@ -1,7 +1,8 @@ -import { ConstructorOf, ILoggerManagerClient } from '@opensumi/ide-core-common'; import { Injector, Injectable } from '@opensumi/di'; import { BrowserModule, ClientApp, getDebugLogger } from '@opensumi/ide-core-browser'; +import { ConstructorOf, ILoggerManagerClient } from '@opensumi/ide-core-common'; import { NodeModule, INodeLogger } from '@opensumi/ide-core-node'; + import { MockInjector } from './mock-injector'; import { MainLayout } from './mock-main'; diff --git a/tools/dev-tool/src/server.ts b/tools/dev-tool/src/server.ts index 8fe227bf1f..2dc18f9295 100644 --- a/tools/dev-tool/src/server.ts +++ b/tools/dev-tool/src/server.ts @@ -1,11 +1,14 @@ /* eslint-disable no-console */ import 'tsconfig-paths/register'; -import { Injector } from '@opensumi/di'; -import path from 'path'; import http from 'http'; +import path from 'path'; + import Koa from 'koa'; import KoaRouter from 'koa-router'; -import { RemoteOpenerServiceImpl } from '@opensumi/ide-remote-opener/lib/node'; + +import { Injector } from '@opensumi/di'; +import { Deferred } from '@opensumi/ide-core-common'; +import { IServerAppOpts, ServerApp, NodeModule } from '@opensumi/ide-core-node'; import { IExternalFileArgs, IExternalUrlArgs, @@ -13,8 +16,7 @@ import { RemoteOpenerClientToken, RemoteOpenerServiceToken, } from '@opensumi/ide-remote-opener/lib/common'; -import { Deferred } from '@opensumi/ide-core-common'; -import { IServerAppOpts, ServerApp, NodeModule } from '@opensumi/ide-core-node'; +import { RemoteOpenerServiceImpl } from '@opensumi/ide-remote-opener/lib/node'; export async function startServer(arg1: NodeModule[] | Partial) { const app = new Koa(); diff --git a/tools/dev-tool/src/webpack.js b/tools/dev-tool/src/webpack.js index e5c67d46d9..445fef6c7d 100644 --- a/tools/dev-tool/src/webpack.js +++ b/tools/dev-tool/src/webpack.js @@ -1,15 +1,16 @@ // tslint:disable:no-var-requires +const path = require('path'); + +const CopyPlugin = require('copy-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); +const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); +const fse = require('fs-extra'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const threadLoader = require('thread-loader'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); const webpack = require('webpack'); -const path = require('path'); -const threadLoader = require('thread-loader'); -const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const merge = require('webpack-merge'); -const fse = require('fs-extra'); threadLoader.warmup({}, ['ts-loader']); diff --git a/tools/electron/build/pack.js b/tools/electron/build/pack.js index f1286c7d69..da5fcdda51 100644 --- a/tools/electron/build/pack.js +++ b/tools/electron/build/pack.js @@ -1,5 +1,7 @@ -const electronBuilder = require('electron-builder'); const path = require('path'); + +const electronBuilder = require('electron-builder'); + const rootPackage = require('../package.json'); if (process.env.NODE_ENV !== 'production') { diff --git a/tools/electron/build/webpack.browser.config.js b/tools/electron/build/webpack.browser.config.js index 5ed64e3194..fcbe9d8c4e 100644 --- a/tools/electron/build/webpack.browser.config.js +++ b/tools/electron/build/webpack.browser.config.js @@ -1,9 +1,10 @@ // tslint:disable:no-var-requires +const path = require('path'); + +const CopyPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); -const path = require('path'); const tsConfigPath = path.join(__dirname, '../tsconfig.json'); const srcDir = path.join(__dirname, '../src/browser'); diff --git a/tools/electron/build/webpack.extension-host.config.js b/tools/electron/build/webpack.extension-host.config.js index 40ad60a7c8..d96fb8f23f 100644 --- a/tools/electron/build/webpack.extension-host.config.js +++ b/tools/electron/build/webpack.extension-host.config.js @@ -1,7 +1,8 @@ // tslint:disable:no-var-requires -const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const path = require('path'); +const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); + const tsConfigPath = path.join(__dirname, '../tsconfig.json'); const distDir = path.join(__dirname, '../app/dist/extension'); diff --git a/tools/electron/build/webpack.main.config.js b/tools/electron/build/webpack.main.config.js index 73229c6d8f..796f4dcf9a 100644 --- a/tools/electron/build/webpack.main.config.js +++ b/tools/electron/build/webpack.main.config.js @@ -1,9 +1,10 @@ // tslint:disable:no-var-requires +const path = require('path'); + +const CopyPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); -const path = require('path'); const tsConfigPath = path.join(__dirname, '../tsconfig.json'); const srcDir = path.join(__dirname, '../src/main'); diff --git a/tools/electron/build/webpack.node.config.js b/tools/electron/build/webpack.node.config.js index 06f54ec4b2..06f80a9b73 100644 --- a/tools/electron/build/webpack.node.config.js +++ b/tools/electron/build/webpack.node.config.js @@ -1,9 +1,10 @@ // tslint:disable:no-var-requires +const path = require('path'); + +const CopyPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); -const path = require('path'); const tsConfigPath = path.join(__dirname, '../tsconfig.json'); const srcDir = path.join(__dirname, '../src/node'); diff --git a/tools/electron/build/webpack.webview.config.js b/tools/electron/build/webpack.webview.config.js index 3186094b1c..35488928f6 100644 --- a/tools/electron/build/webpack.webview.config.js +++ b/tools/electron/build/webpack.webview.config.js @@ -1,8 +1,9 @@ +const path = require('path'); + +const CopyPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); -const path = require('path'); const tsConfigPath = path.join(__dirname, '../tsconfig.json'); const distDir = path.join(__dirname, '../app/dist/webview'); diff --git a/tools/electron/src/browser/app.tsx b/tools/electron/src/browser/app.tsx index 97e7cbdd9a..64d733efef 100644 --- a/tools/electron/src/browser/app.tsx +++ b/tools/electron/src/browser/app.tsx @@ -1,9 +1,8 @@ /* eslint-disable no-console */ console.time('Render'); -import { ClientApp, IClientAppOpts, electronEnv, URI } from '@opensumi/ide-core-browser'; import { Injector, Domain } from '@opensumi/di'; import { createSocketConnection } from '@opensumi/ide-connection/lib/browser'; - +import { ClientApp, IClientAppOpts, electronEnv, URI } from '@opensumi/ide-core-browser'; // 引入公共样式文件 import '@opensumi/ide-core-browser/lib/style/index.less'; // 引入本地icon,不使用cdn版本,与useCdnIcon配套使用 diff --git a/tools/electron/src/browser/index.ts b/tools/electron/src/browser/index.ts index 8bfeedf7db..b9e20515fd 100644 --- a/tools/electron/src/browser/index.ts +++ b/tools/electron/src/browser/index.ts @@ -5,58 +5,51 @@ if (!(window as any).process) { } import '@opensumi/ide-i18n'; +import { ClientAddonModule } from '@opensumi/ide-addons/lib/browser'; +import { CommentsModule } from '@opensumi/ide-comments/lib/browser'; +import { ClientCommonModule, BrowserModule, ConstructorOf } from '@opensumi/ide-core-browser'; +import { DebugModule } from '@opensumi/ide-debug/lib/browser'; +import { DecorationModule } from '@opensumi/ide-decoration/lib/browser'; +import { EditorModule } from '@opensumi/ide-editor/lib/browser'; import { ElectronBasicModule } from '@opensumi/ide-electron-basic/lib/browser'; -import { renderApp } from './app'; -import { StartupModule } from '@opensumi/ide-startup/lib/browser'; - +import { ExplorerModule } from '@opensumi/ide-explorer/lib/browser'; +// import { Terminal2Module } from '@opensumi/ide-terminal2/lib/browser'; +import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager/lib/browser'; +import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; +import { ExtensionModule } from '@opensumi/ide-extension/lib/browser'; +import { FileSchemeModule } from '@opensumi/ide-file-scheme/lib/browser'; +import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; +import { FileTreeNextModule } from '@opensumi/ide-file-tree-next/lib/browser'; +import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; +import { LogModule } from '@opensumi/ide-logs/lib/browser'; import { MainLayoutModule } from '@opensumi/ide-main-layout/lib/browser'; +import { MarkdownModule } from '@opensumi/ide-markdown'; +import { MarkersModule } from '@opensumi/ide-markers/lib/browser'; import { MenuBarModule } from '@opensumi/ide-menu-bar/lib/browser'; +import { MonacoEnhanceModule } from '@opensumi/ide-monaco-enhance/lib/browser/module'; import { MonacoModule } from '@opensumi/ide-monaco/lib/browser'; -import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; -import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; -import { EditorModule } from '@opensumi/ide-editor/lib/browser'; -import { ExplorerModule } from '@opensumi/ide-explorer/lib/browser'; -import { FileTreeNextModule } from '@opensumi/ide-file-tree-next/lib/browser'; -import { FileServiceClientModule } from '@opensumi/ide-file-service/lib/browser'; -import { StaticResourceModule } from '@opensumi/ide-static-resource/lib/browser'; -import { SearchModule } from '@opensumi/ide-search/lib/browser'; -import { FileSchemeModule } from '@opensumi/ide-file-scheme/lib/browser'; -import { OutputModule } from '@opensumi/ide-output/lib/browser'; -import { QuickOpenModule } from '@opensumi/ide-quick-open/lib/browser'; -import { ClientCommonModule, BrowserModule, ConstructorOf } from '@opensumi/ide-core-browser'; -import { ThemeModule } from '@opensumi/ide-theme/lib/browser'; - import { OpenedEditorModule } from '@opensumi/ide-opened-editor/lib/browser'; import { OutlineModule } from '@opensumi/ide-outline/lib/browser'; -import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; -import { ToolbarModule } from '@opensumi/ide-toolbar/lib/browser'; +import { OutputModule } from '@opensumi/ide-output/lib/browser'; import { OverlayModule } from '@opensumi/ide-overlay/lib/browser'; -import { ExtensionStorageModule } from '@opensumi/ide-extension-storage/lib/browser'; -import { StorageModule } from '@opensumi/ide-storage/lib/browser'; +import { PreferencesModule } from '@opensumi/ide-preferences/lib/browser'; +import { QuickOpenModule } from '@opensumi/ide-quick-open/lib/browser'; import { SCMModule } from '@opensumi/ide-scm/lib/browser'; - -import { MarkersModule } from '@opensumi/ide-markers/lib/browser'; - -// import { Terminal2Module } from '@opensumi/ide-terminal2/lib/browser'; - +import { SearchModule } from '@opensumi/ide-search/lib/browser'; +import { StartupModule } from '@opensumi/ide-startup/lib/browser'; +import { StaticResourceModule } from '@opensumi/ide-static-resource/lib/browser'; +import { StatusBarModule } from '@opensumi/ide-status-bar/lib/browser'; +import { StorageModule } from '@opensumi/ide-storage/lib/browser'; +import { TaskModule } from '@opensumi/ide-task/lib/browser'; +import { TerminalNextModule } from '@opensumi/ide-terminal-next/lib/browser'; +import { ThemeModule } from '@opensumi/ide-theme/lib/browser'; +import { ToolbarModule } from '@opensumi/ide-toolbar/lib/browser'; +import { VariableModule } from '@opensumi/ide-variable/lib/browser'; import { WebviewModule } from '@opensumi/ide-webview'; -import { MarkdownModule } from '@opensumi/ide-markdown'; - -import { LogModule } from '@opensumi/ide-logs/lib/browser'; import { WorkspaceEditModule } from '@opensumi/ide-workspace-edit/lib/browser'; -import { ExtensionModule } from '@opensumi/ide-extension/lib/browser'; -import { DecorationModule } from '@opensumi/ide-decoration/lib/browser'; -import { DebugModule } from '@opensumi/ide-debug/lib/browser'; -import { VariableModule } from '@opensumi/ide-variable/lib/browser'; -import { KeymapsModule } from '@opensumi/ide-keymaps/lib/browser'; -import { MonacoEnhanceModule } from '@opensumi/ide-monaco-enhance/lib/browser/module'; - -import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager/lib/browser'; -import { TerminalNextModule } from '@opensumi/ide-terminal-next/lib/browser'; -import { CommentsModule } from '@opensumi/ide-comments/lib/browser'; +import { WorkspaceModule } from '@opensumi/ide-workspace/lib/browser'; -import { ClientAddonModule } from '@opensumi/ide-addons/lib/browser'; -import { TaskModule } from '@opensumi/ide-task/lib/browser'; +import { renderApp } from './app'; import { customLayoutConfig } from './layout'; // import { DemoModule } from 'modules/demo'; // import { TopbarModule } from 'modules/topbar/browser'; diff --git a/tools/electron/src/extension/index.ts b/tools/electron/src/extension/index.ts index 864de80d67..dd82bb3a23 100644 --- a/tools/electron/src/extension/index.ts +++ b/tools/electron/src/extension/index.ts @@ -1,4 +1,5 @@ import { extProcessInit } from '@opensumi/ide-extension/lib/hosted/ext.process-base.js'; + import LogServiceClass from './mock-log-service'; (async () => { diff --git a/tools/electron/src/main/index.ts b/tools/electron/src/main/index.ts index b34b6a6399..cbe3bd5e78 100644 --- a/tools/electron/src/main/index.ts +++ b/tools/electron/src/main/index.ts @@ -1,9 +1,13 @@ +import { join } from 'path'; + import { app } from 'electron'; -import { ElectronMainApp } from '@opensumi/ide-core-electron-main'; + import { URI } from '@opensumi/ide-core-common'; -import { join } from 'path'; -import { MainModule } from './services'; +import { ElectronMainApp } from '@opensumi/ide-core-electron-main'; import { WebviewElectronMainModule } from '@opensumi/ide-webview/lib/electron-main'; + +import { MainModule } from './services'; + // import { ElectronMainWorkspaceModule } from '@opensumi/ide-workspace/lib/electron-main'; const getExtensionDir = () => { diff --git a/tools/electron/src/main/services/hello.ts b/tools/electron/src/main/services/hello.ts index 67e27edb65..92b0b1752c 100644 --- a/tools/electron/src/main/services/hello.ts +++ b/tools/electron/src/main/services/hello.ts @@ -1,4 +1,6 @@ /* eslint-disable no-console */ +import { IHelloService } from 'common/types'; + import { Autowired, Injectable, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { Domain } from '@opensumi/ide-core-common'; import { @@ -6,7 +8,6 @@ import { ElectronMainApiRegistry, ElectronMainContribution, } from '@opensumi/ide-core-electron-main/lib/bootstrap/types'; -import { IHelloService } from 'common/types'; @Injectable() export class HelloService extends ElectronMainApiProvider implements IHelloService { diff --git a/tools/electron/src/main/services/index.ts b/tools/electron/src/main/services/index.ts index 2cd3efc840..13260d2cd5 100644 --- a/tools/electron/src/main/services/index.ts +++ b/tools/electron/src/main/services/index.ts @@ -1,6 +1,8 @@ +import { IHelloService } from 'common/types'; + import { Autowired, Injectable, Injector, INJECTOR_TOKEN } from '@opensumi/di'; import { ElectronMainModule } from '@opensumi/ide-core-electron-main/lib/electron-main-module'; -import { IHelloService } from 'common/types'; + import { HelloContribution, HelloService } from './hello'; @Injectable() diff --git a/tools/electron/src/modules/demo/browser/demo.ts b/tools/electron/src/modules/demo/browser/demo.ts index 33c593e4e9..6845439149 100644 --- a/tools/electron/src/modules/demo/browser/demo.ts +++ b/tools/electron/src/modules/demo/browser/demo.ts @@ -2,6 +2,7 @@ import { Autowired } from '@opensumi/di'; import { ClientAppContribution } from '@opensumi/ide-core-browser'; import { Domain } from '@opensumi/ide-core-common'; import { IElectronMainApi } from '@opensumi/ide-core-common/lib/electron'; + import { IHelloService } from '../../../common/types'; interface IHelloMainService extends IElectronMainApi, IHelloService {} diff --git a/tools/electron/src/modules/demo/browser/index.ts b/tools/electron/src/modules/demo/browser/index.ts index cefd724602..10963b236f 100644 --- a/tools/electron/src/modules/demo/browser/index.ts +++ b/tools/electron/src/modules/demo/browser/index.ts @@ -1,7 +1,9 @@ import { Injectable } from '@opensumi/di'; import { createElectronMainApi } from '@opensumi/ide-core-browser'; import { ElectronBasicModule } from '@opensumi/ide-electron-basic/lib/browser'; + import { IHelloService } from '../../../common/types'; + import { DemoContribution } from './demo'; @Injectable() diff --git a/tools/electron/src/modules/topbar/browser/index.ts b/tools/electron/src/modules/topbar/browser/index.ts index 006800e945..de6010819f 100644 --- a/tools/electron/src/modules/topbar/browser/index.ts +++ b/tools/electron/src/modules/topbar/browser/index.ts @@ -1,7 +1,9 @@ import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule, Domain } from '@opensumi/ide-core-browser'; import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout'; + import { ITopbarService, TopbarNodeServerPath } from '../common'; + import { TopbarService } from './topbar.service'; import { Topbar } from './topbar.view'; diff --git a/tools/electron/src/modules/topbar/browser/topbar.service.ts b/tools/electron/src/modules/topbar/browser/topbar.service.ts index b0999a7571..f1270171e4 100644 --- a/tools/electron/src/modules/topbar/browser/topbar.service.ts +++ b/tools/electron/src/modules/topbar/browser/topbar.service.ts @@ -1,5 +1,6 @@ import { Injectable, Autowired } from '@opensumi/di'; import { Disposable } from '@opensumi/ide-core-common'; + import { ITopbarNodeServer, ITopbarService, TopbarNodeServerPath } from '../common'; @Injectable() diff --git a/tools/electron/src/modules/topbar/browser/topbar.view.tsx b/tools/electron/src/modules/topbar/browser/topbar.view.tsx index 054d4aae67..19826191d6 100644 --- a/tools/electron/src/modules/topbar/browser/topbar.view.tsx +++ b/tools/electron/src/modules/topbar/browser/topbar.view.tsx @@ -1,7 +1,9 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; -import { useInjectable, ComponentRegistryInfo } from '@opensumi/ide-core-browser'; +import React from 'react'; + import { Button, Badge } from '@opensumi/ide-components'; +import { useInjectable, ComponentRegistryInfo } from '@opensumi/ide-core-browser'; + import { ITopbarService } from '../common'; export const TopbarBadge: React.FC<{ component: ComponentRegistryInfo }> = observer( diff --git a/tools/electron/src/modules/topbar/node/index.ts b/tools/electron/src/modules/topbar/node/index.ts index 81f018807a..58855ec4c3 100644 --- a/tools/electron/src/modules/topbar/node/index.ts +++ b/tools/electron/src/modules/topbar/node/index.ts @@ -1,6 +1,8 @@ import { Provider, Injectable } from '@opensumi/di'; import { NodeModule } from '@opensumi/ide-core-node'; + import { ITopbarNodeServer, TopbarNodeServerPath } from '../common'; + import { TopbarNodeServer } from './topbar-node-server'; @Injectable() diff --git a/tools/electron/src/modules/topbar/node/topbar-node-server.ts b/tools/electron/src/modules/topbar/node/topbar-node-server.ts index 107a11f5dd..c604c34303 100644 --- a/tools/electron/src/modules/topbar/node/topbar-node-server.ts +++ b/tools/electron/src/modules/topbar/node/topbar-node-server.ts @@ -1,4 +1,5 @@ import { Injectable } from '@opensumi/di'; + import { ITopbarNodeServer } from '../common'; @Injectable() diff --git a/tools/electron/src/node/index.ts b/tools/electron/src/node/index.ts index f001d88a29..7514282045 100644 --- a/tools/electron/src/node/index.ts +++ b/tools/electron/src/node/index.ts @@ -1,21 +1,20 @@ -import { startServer } from './server'; +import { TopBarModule } from 'modules/topbar'; +import { AddonsModule } from '@opensumi/ide-addons/lib/node'; import { NodeModule, ConstructorOf } from '@opensumi/ide-core-node'; import { ServerCommonModule } from '@opensumi/ide-core-node'; +import { ExtensionModule } from '@opensumi/ide-extension'; +import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager'; +import { FileSchemeNodeModule } from '@opensumi/ide-file-scheme/lib/node'; +import { FileSearchModule } from '@opensumi/ide-file-search'; import { FileServiceModule } from '@opensumi/ide-file-service/lib/node'; - +import { LogServiceModule } from '@opensumi/ide-logs/lib/node'; import { ProcessModule } from '@opensumi/ide-process'; - -import { FileSearchModule } from '@opensumi/ide-file-search'; import { SearchModule } from '@opensumi/ide-search'; import { TerminalNodePtyModule } from '@opensumi/ide-terminal-next/lib/node'; -import { LogServiceModule } from '@opensumi/ide-logs/lib/node'; -import { ExtensionModule } from '@opensumi/ide-extension'; -import { OpenVsxExtensionManagerModule } from '@opensumi/ide-extension-manager'; -import { FileSchemeNodeModule } from '@opensumi/ide-file-scheme/lib/node'; -import { AddonsModule } from '@opensumi/ide-addons/lib/node'; -import { TopBarModule } from 'modules/topbar'; +import { startServer } from './server'; + export const CommonNodeModules: ConstructorOf[] = [ ServerCommonModule, diff --git a/tools/electron/src/node/server.ts b/tools/electron/src/node/server.ts index 94d250a65a..83715d9382 100644 --- a/tools/electron/src/node/server.ts +++ b/tools/electron/src/node/server.ts @@ -1,6 +1,8 @@ /* eslint-disable no-console */ import net from 'net'; + import yargs from 'yargs'; + import { Deferred } from '@opensumi/ide-core-common'; import { IServerAppOpts, ServerApp, NodeModule } from '@opensumi/ide-core-node'; diff --git a/tools/template/src/browser/hello-world.view.tsx b/tools/template/src/browser/hello-world.view.tsx index 45b6d47531..f7830b7bc6 100644 --- a/tools/template/src/browser/hello-world.view.tsx +++ b/tools/template/src/browser/hello-world.view.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import { observer } from 'mobx-react-lite'; +import React from 'react'; + import styles from './hello-world.module.less'; export const HelloWorld = observer(() =>

Hello world

); diff --git a/tools/template/src/browser/index.ts b/tools/template/src/browser/index.ts index dcae8c4333..8c568953ee 100644 --- a/tools/template/src/browser/index.ts +++ b/tools/template/src/browser/index.ts @@ -1,6 +1,8 @@ import React from 'react'; + import { Provider, Injectable } from '@opensumi/di'; import { BrowserModule } from '@opensumi/ide-core-browser'; + import { HelloWorld } from './hello-world.view'; @Injectable()