@opensumi/ide-core-browser 2.21.13 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/application-state-service.d.ts +1 -1
- package/lib/application/application-state-service.d.ts.map +1 -1
- package/lib/application/application-state-service.js.map +1 -1
- package/lib/application/application.service.js.map +1 -1
- package/lib/authentication/authentication.contribution.js.map +1 -1
- package/lib/authentication/authentication.service.js.map +1 -1
- package/lib/bootstrap/app.d.ts +2 -35
- package/lib/bootstrap/app.d.ts.map +1 -1
- package/lib/bootstrap/app.interface.d.ts +39 -0
- package/lib/bootstrap/app.interface.d.ts.map +1 -0
- package/lib/bootstrap/app.interface.js +3 -0
- package/lib/bootstrap/app.interface.js.map +1 -0
- package/lib/bootstrap/app.js +8 -8
- package/lib/bootstrap/app.js.map +1 -1
- package/lib/bootstrap/app.view.d.ts +1 -1
- package/lib/bootstrap/app.view.d.ts.map +1 -1
- package/lib/bootstrap/connection.d.ts +1 -1
- package/lib/bootstrap/connection.d.ts.map +1 -1
- package/lib/bootstrap/connection.js +4 -4
- package/lib/bootstrap/connection.js.map +1 -1
- package/lib/bootstrap/index.d.ts +1 -1
- package/lib/bootstrap/index.d.ts.map +1 -1
- package/lib/bootstrap/index.js +1 -1
- package/lib/bootstrap/index.js.map +1 -1
- package/lib/bootstrap/inner-providers.js +1 -1
- package/lib/bootstrap/inner-providers.js.map +1 -1
- package/lib/bootstrap/lifecycle.service.js.map +1 -1
- package/lib/browser-module.js.map +1 -1
- package/lib/common/common.command.d.ts +24 -1
- package/lib/common/common.command.d.ts.map +1 -1
- package/lib/common/common.command.js +42 -6
- package/lib/common/common.command.js.map +1 -1
- package/lib/common/common.contribution.js.map +1 -1
- package/lib/common/common.module.js.map +1 -1
- package/lib/common/common.storage.js.map +1 -1
- package/lib/components/actions/index.d.ts +2 -2
- package/lib/components/actions/index.d.ts.map +1 -1
- package/lib/components/actions/index.js +2 -22
- package/lib/components/actions/index.js.map +1 -1
- package/lib/components/index.d.ts +0 -4
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +0 -4
- package/lib/components/index.js.map +1 -1
- package/lib/components/layout/box-panel.d.ts +1 -1
- package/lib/components/layout/box-panel.d.ts.map +1 -1
- package/lib/components/layout/split-panel.d.ts +17 -1
- package/lib/components/layout/split-panel.d.ts.map +1 -1
- package/lib/components/layout/split-panel.js +16 -16
- package/lib/components/layout/split-panel.js.map +1 -1
- package/lib/components/layout/split-panel.service.js.map +1 -1
- package/lib/components/progressbar/index.d.ts +2 -2
- package/lib/components/progressbar/index.d.ts.map +1 -1
- package/lib/components/progressbar/index.js +2 -10
- package/lib/components/progressbar/index.js.map +1 -1
- package/lib/contextkey/resource.d.ts +1 -1
- package/lib/contextkey/resource.d.ts.map +1 -1
- package/lib/contextkey/search.d.ts +24 -0
- package/lib/contextkey/search.d.ts.map +1 -0
- package/lib/contextkey/search.js +29 -0
- package/lib/contextkey/search.js.map +1 -0
- package/lib/contextkey/testing.d.ts +1 -0
- package/lib/contextkey/testing.d.ts.map +1 -1
- package/lib/contextkey/testing.js +2 -1
- package/lib/contextkey/testing.js.map +1 -1
- package/lib/core-preferences.d.ts +4 -3
- package/lib/core-preferences.d.ts.map +1 -1
- package/lib/core-preferences.js +2 -2
- package/lib/core-preferences.js.map +1 -1
- package/lib/dom/index.d.ts +1 -1
- package/lib/dom/index.d.ts.map +1 -1
- package/lib/encoding-registry.js.map +1 -1
- package/lib/extensions/extensions-point.service.js.map +1 -1
- package/lib/file-decoration.d.ts +10 -0
- package/lib/file-decoration.d.ts.map +1 -0
- package/lib/file-decoration.js +3 -0
- package/lib/file-decoration.js.map +1 -0
- package/lib/hash-calculate/hash-calculate.contribution.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/keybinding/keybinding.js.map +1 -1
- package/lib/keyboard/keyboard-layout-provider.d.ts +2 -2
- package/lib/keyboard/keyboard-layout-provider.d.ts.map +1 -1
- package/lib/keyboard/keyboard-layout-provider.js +13 -13
- package/lib/keyboard/keyboard-layout-provider.js.map +1 -1
- package/lib/keyboard/keyboard-layout-service.js.map +1 -1
- package/lib/keyboard/keys.d.ts +2 -2
- package/lib/keyboard/keys.d.ts.map +1 -1
- package/lib/keyboard/layouts/_.contribution.js +3 -3
- package/lib/keyboard/layouts/_.contribution.js.map +1 -1
- package/lib/layout/accordion/tab-bar-toolbar.js.map +1 -1
- package/lib/layout/accordion/view-context-key.registry.js.map +1 -1
- package/lib/layout/layout-hooks.d.ts +1 -1
- package/lib/layout/layout-hooks.d.ts.map +1 -1
- package/lib/layout/layout-state.js.map +1 -1
- package/lib/layout/layout.interface.d.ts +1 -1
- package/lib/layout/layout.interface.d.ts.map +1 -1
- package/lib/layout/layout.js.map +1 -1
- package/lib/logger/browser-logger.js.map +1 -1
- package/lib/markdown/index.d.ts +1 -1
- package/lib/markdown/index.d.ts.map +1 -1
- package/lib/markdown/index.js +4 -31
- package/lib/markdown/index.js.map +1 -1
- package/lib/menu/next/base.d.ts +4 -4
- package/lib/menu/next/base.d.ts.map +1 -1
- package/lib/menu/next/base.js.map +1 -1
- package/lib/menu/next/ctxmenu-service.js +10 -10
- package/lib/menu/next/ctxmenu-service.js.map +1 -1
- package/lib/menu/next/menu-service.js +6 -6
- package/lib/menu/next/menu-service.js.map +1 -1
- package/lib/menu/next/menu.contrib.interface.d.ts +16 -15
- package/lib/menu/next/menu.contrib.interface.d.ts.map +1 -1
- package/lib/menu/next/menu.contrib.interface.js.map +1 -1
- package/lib/menu/next/menu.interface.d.ts +2 -2
- package/lib/menu/next/menu.interface.d.ts.map +1 -1
- package/lib/menu/next/menu.interface.js.map +1 -1
- package/lib/menu/next/menubar-service.js +10 -10
- package/lib/menu/next/menubar-service.js.map +1 -1
- package/lib/menu/next/renderer/ctxmenu/browser.js.map +1 -1
- package/lib/menu/next/renderer/ctxmenu/electron.js.map +1 -1
- package/lib/menu/next/toolbar-action.service.d.ts +1 -1
- package/lib/menu/next/toolbar-action.service.d.ts.map +1 -1
- package/lib/menu/next/toolbar-action.service.js.map +1 -1
- package/lib/monaco/index.d.ts +7 -3
- package/lib/monaco/index.d.ts.map +1 -1
- package/lib/monaco/index.js.map +1 -1
- package/lib/monaco/merge-editor-widget.d.ts +53 -0
- package/lib/monaco/merge-editor-widget.d.ts.map +1 -0
- package/lib/monaco/merge-editor-widget.js +107 -0
- package/lib/monaco/merge-editor-widget.js.map +1 -0
- package/lib/opener/command-opener.js.map +1 -1
- package/lib/opener/default-opener.js.map +1 -1
- package/lib/opener/http-opener.js.map +1 -1
- package/lib/opener/opener.contribution.js.map +1 -1
- package/lib/opener/opener.service.js.map +1 -1
- package/lib/preferences/early-preferences.js +4 -4
- package/lib/preferences/early-preferences.js.map +1 -1
- package/lib/preferences/preference-configurations.js +1 -1
- package/lib/preferences/preference-configurations.js.map +1 -1
- package/lib/preferences/preference-contribution.d.ts +1 -2
- package/lib/preferences/preference-contribution.d.ts.map +1 -1
- package/lib/preferences/preference-contribution.js +26 -22
- package/lib/preferences/preference-contribution.js.map +1 -1
- package/lib/preferences/preference-provider.js.map +1 -1
- package/lib/preferences/preference-proxy.d.ts +2 -3
- package/lib/preferences/preference-proxy.d.ts.map +1 -1
- package/lib/preferences/preference-proxy.js.map +1 -1
- package/lib/preferences/preference-service.d.ts +1 -0
- package/lib/preferences/preference-service.d.ts.map +1 -1
- package/lib/preferences/preference-service.js +48 -3
- package/lib/preferences/preference-service.js.map +1 -1
- package/lib/preferences/settings.d.ts +44 -5
- package/lib/preferences/settings.d.ts.map +1 -1
- package/lib/preferences/settings.js.map +1 -1
- package/lib/preferences/types.d.ts +8 -1
- package/lib/preferences/types.d.ts.map +1 -1
- package/lib/preferences/types.js.map +1 -1
- package/lib/progress/progress-bar.d.ts +4 -1
- package/lib/progress/progress-bar.d.ts.map +1 -1
- package/lib/progress/progress-bar.js +11 -4
- package/lib/progress/progress-bar.js.map +1 -1
- package/lib/progress/progress-indicator.js.map +1 -1
- package/lib/progress/progress.service.js +6 -6
- package/lib/progress/progress.service.js.map +1 -1
- package/lib/quick-open/index.d.ts +1 -1
- package/lib/quick-open/index.d.ts.map +1 -1
- package/lib/quick-open/index.js.map +1 -1
- package/lib/quick-open/recent-files.js.map +1 -1
- package/lib/raw-context-key.d.ts +1 -1
- package/lib/raw-context-key.d.ts.map +1 -1
- package/lib/raw-context-key.js +4 -4
- package/lib/raw-context-key.js.map +1 -1
- package/lib/react-hooks/useThrottleFn/index.d.ts +13 -0
- package/lib/react-hooks/useThrottleFn/index.d.ts.map +1 -0
- package/lib/react-hooks/useThrottleFn/index.js +20 -0
- package/lib/react-hooks/useThrottleFn/index.js.map +1 -0
- package/lib/react-providers/config-provider.d.ts +6 -0
- package/lib/react-providers/config-provider.d.ts.map +1 -1
- package/lib/react-providers/config-provider.js.map +1 -1
- package/lib/react-providers/slot.d.ts +2 -2
- package/lib/react-providers/slot.d.ts.map +1 -1
- package/lib/services/clipboard.service.d.ts +1 -0
- package/lib/services/clipboard.service.d.ts.map +1 -1
- package/lib/services/clipboard.service.js +17 -30
- package/lib/services/clipboard.service.js.map +1 -1
- package/lib/services/credentials-service.js.map +1 -1
- package/lib/services/crypto-service.js.map +1 -1
- package/lib/services/external-uri.service.js.map +1 -1
- package/lib/services/label-service.js.map +1 -1
- package/lib/services/storage-service.d.ts +1 -0
- package/lib/services/storage-service.d.ts.map +1 -1
- package/lib/services/storage-service.js +13 -2
- package/lib/services/storage-service.js.map +1 -1
- package/lib/style/icon/icon.d.ts +3 -2
- package/lib/style/icon/icon.d.ts.map +1 -1
- package/lib/style/icon/icon.js +5 -1
- package/lib/style/icon/icon.js.map +1 -1
- package/lib/style/icon/ide-iconfont.d.ts +1 -1
- package/lib/style/icon/ide-iconfont.d.ts.map +1 -1
- package/lib/style/icon/ide-iconfont.js +1 -1
- package/lib/style/icon/ide-iconfont.js.map +1 -1
- package/lib/style/icon/index.less +13 -0
- package/lib/toolbar/components/button.js +12 -12
- package/lib/toolbar/components/button.js.map +1 -1
- package/lib/toolbar/toolbar.popover.registry.js.map +1 -1
- package/lib/toolbar/toolbar.registry.d.ts +1 -1
- package/lib/toolbar/toolbar.registry.d.ts.map +1 -1
- package/lib/toolbar/toolbar.registry.js.map +1 -1
- package/lib/toolbar/types.d.ts +1 -1
- package/lib/toolbar/types.d.ts.map +1 -1
- package/lib/utils/json.d.ts +5 -5
- package/lib/utils/json.d.ts.map +1 -1
- package/lib/utils/label.d.ts.map +1 -1
- package/lib/utils/label.js +16 -9
- package/lib/utils/label.js.map +1 -1
- package/lib/utils/parse.d.ts +2 -1
- package/lib/utils/parse.d.ts.map +1 -1
- package/lib/utils/parse.js +10 -1
- package/lib/utils/parse.js.map +1 -1
- package/lib/variable/variable.d.ts +1 -1
- package/lib/variable/variable.d.ts.map +1 -1
- package/lib/variable/variable.js.map +1 -1
- package/lib/window/window.service.js.map +1 -1
- package/package.json +9 -11
- package/src/application/application-state-service.ts +54 -0
- package/src/application/application.service.ts +51 -0
- package/src/application/index.ts +2 -0
- package/src/authentication/authentication.contribution.ts +35 -0
- package/src/authentication/authentication.service.ts +517 -0
- package/src/bootstrap/app.interface.ts +46 -0
- package/src/bootstrap/app.ts +710 -0
- package/src/bootstrap/app.view.tsx +88 -0
- package/src/bootstrap/connection.ts +116 -0
- package/src/bootstrap/index.ts +3 -0
- package/src/bootstrap/inner-providers.ts +297 -0
- package/src/bootstrap/lifecycle.service.ts +19 -0
- package/src/browser-module.ts +24 -0
- package/src/common/common.command.ts +1018 -0
- package/src/common/common.contribution.ts +343 -0
- package/src/common/common.define.ts +55 -0
- package/src/common/common.module.ts +33 -0
- package/src/common/common.storage.ts +22 -0
- package/src/common/container-id.ts +12 -0
- package/src/common/index.ts +4 -0
- package/src/components/actions/index.tsx +486 -0
- package/src/components/actions/placements.ts +47 -0
- package/src/components/actions/styles.module.less +144 -0
- package/src/components/badge/index.tsx +1 -0
- package/src/components/index.ts +22 -0
- package/src/components/layout/box-panel.tsx +88 -0
- package/src/components/layout/default-layout.tsx +61 -0
- package/src/components/layout/index.ts +4 -0
- package/src/components/layout/layout.ts +80 -0
- package/src/components/layout/split-panel.service.ts +56 -0
- package/src/components/layout/split-panel.tsx +315 -0
- package/src/components/layout/styles.module.less +21 -0
- package/src/components/loading/index.ts +1 -0
- package/src/components/loading/loading.less +14 -0
- package/src/components/loading/loading.view.tsx +7 -0
- package/src/components/loading/media/loading-dark.svg +52 -0
- package/src/components/loading/media/loading-hc.svg +52 -0
- package/src/components/loading/media/loading.svg +52 -0
- package/src/components/popover/styles.module.less +81 -0
- package/src/components/portal/index.tsx +13 -0
- package/src/components/progressbar/index.tsx +3 -0
- package/src/components/resize/resize.module.less +78 -0
- package/src/components/resize/resize.tsx +663 -0
- package/src/components/select/index.tsx +12 -0
- package/src/components/select/styles.less +6 -0
- package/src/context-key.ts +48 -0
- package/src/contextkey/dialog.ts +3 -0
- package/src/contextkey/explorer.ts +26 -0
- package/src/contextkey/index.ts +6 -0
- package/src/contextkey/outline.ts +4 -0
- package/src/contextkey/resource.ts +61 -0
- package/src/contextkey/search.ts +30 -0
- package/src/contextkey/terminal.ts +7 -0
- package/src/contextkey/testing.ts +9 -0
- package/src/contextkey/workspace.ts +7 -0
- package/src/core-preferences.ts +318 -0
- package/src/dom/index.ts +176 -0
- package/src/encoding-registry.ts +83 -0
- package/src/extensions/extensions-point.service.ts +78 -0
- package/src/extensions/index.ts +3 -0
- package/src/extensions/schema/browserViews.ts +96 -0
- package/src/extensions/schema/menu.ts +245 -0
- package/src/extensions/schema/opensumiExtensionPackageSchema.ts +12 -0
- package/src/extensions/schema/toolbar.ts +338 -0
- package/src/extensions/schema/vscodeExtensionPackageSchema.ts +330 -0
- package/src/file-decoration.ts +10 -0
- package/src/fs/index.ts +12 -0
- package/src/hash-calculate/hash-calculate.contribution.ts +19 -0
- package/src/index.ts +42 -0
- package/src/keybinding/index.ts +1 -0
- package/src/keybinding/keybinding.ts +908 -0
- package/src/keyboard/index.ts +3 -0
- package/src/keyboard/keyboard-layout-provider.ts +412 -0
- package/src/keyboard/keyboard-layout-service.ts +449 -0
- package/src/keyboard/keys.ts +748 -0
- package/src/keyboard/layouts/_.contribution.ts +24 -0
- package/src/keyboard/layouts/cz.win.ts +168 -0
- package/src/keyboard/layouts/de-swiss.win.ts +168 -0
- package/src/keyboard/layouts/de.darwin.ts +131 -0
- package/src/keyboard/layouts/de.linux.ts +186 -0
- package/src/keyboard/layouts/de.win.ts +168 -0
- package/src/keyboard/layouts/dk.win.ts +168 -0
- package/src/keyboard/layouts/dvorak.darwin.ts +131 -0
- package/src/keyboard/layouts/en-belgian.win.ts +168 -0
- package/src/keyboard/layouts/en-ext.darwin.ts +131 -0
- package/src/keyboard/layouts/en-in.win.ts +168 -0
- package/src/keyboard/layouts/en-intl.darwin.ts +131 -0
- package/src/keyboard/layouts/en-intl.win.ts +168 -0
- package/src/keyboard/layouts/en-uk.darwin.ts +131 -0
- package/src/keyboard/layouts/en-uk.win.ts +168 -0
- package/src/keyboard/layouts/en.darwin.ts +139 -0
- package/src/keyboard/layouts/en.linux.ts +186 -0
- package/src/keyboard/layouts/en.win.ts +173 -0
- package/src/keyboard/layouts/es-latin.win.ts +168 -0
- package/src/keyboard/layouts/es.darwin.ts +131 -0
- package/src/keyboard/layouts/es.linux.ts +186 -0
- package/src/keyboard/layouts/es.win.ts +168 -0
- package/src/keyboard/layouts/fr.darwin.ts +131 -0
- package/src/keyboard/layouts/fr.linux.ts +186 -0
- package/src/keyboard/layouts/fr.win.ts +168 -0
- package/src/keyboard/layouts/hu.win.ts +168 -0
- package/src/keyboard/layouts/it.darwin.ts +131 -0
- package/src/keyboard/layouts/it.win.ts +168 -0
- package/src/keyboard/layouts/jp-roman.darwin.ts +131 -0
- package/src/keyboard/layouts/jp.darwin.ts +131 -0
- package/src/keyboard/layouts/ko.darwin.ts +131 -0
- package/src/keyboard/layouts/layout.contribution.darwin.ts +23 -0
- package/src/keyboard/layouts/layout.contribution.linux.ts +12 -0
- package/src/keyboard/layouts/layout.contribution.ts +9 -0
- package/src/keyboard/layouts/layout.contribution.win.ts +29 -0
- package/src/keyboard/layouts/no.win.ts +168 -0
- package/src/keyboard/layouts/pl.darwin.ts +131 -0
- package/src/keyboard/layouts/pl.win.ts +168 -0
- package/src/keyboard/layouts/pt-br.win.ts +169 -0
- package/src/keyboard/layouts/pt.darwin.ts +131 -0
- package/src/keyboard/layouts/pt.win.ts +168 -0
- package/src/keyboard/layouts/ru.darwin.ts +131 -0
- package/src/keyboard/layouts/ru.linux.ts +186 -0
- package/src/keyboard/layouts/ru.win.ts +168 -0
- package/src/keyboard/layouts/sv.darwin.ts +131 -0
- package/src/keyboard/layouts/sv.win.ts +168 -0
- package/src/keyboard/layouts/thai.win.ts +168 -0
- package/src/keyboard/layouts/tr.win.ts +168 -0
- package/src/keyboard/layouts/zh-hans.darwin.ts +131 -0
- package/src/layout/accordion/tab-bar-toolbar.tsx +59 -0
- package/src/layout/accordion/view-context-key.registry.ts +34 -0
- package/src/layout/constants.ts +7 -0
- package/src/layout/index.ts +5 -0
- package/src/layout/layout-hooks.ts +70 -0
- package/src/layout/layout-state.ts +107 -0
- package/src/layout/layout.interface.ts +101 -0
- package/src/layout/layout.ts +80 -0
- package/src/layout/view-id.ts +18 -0
- package/src/logger/browser-logger.ts +51 -0
- package/src/logger/index.ts +1 -0
- package/src/markdown/index.tsx +30 -0
- package/src/menu/next/base.ts +513 -0
- package/src/menu/next/ctxmenu-service.ts +188 -0
- package/src/menu/next/index.ts +10 -0
- package/src/menu/next/menu-id.ts +86 -0
- package/src/menu/next/menu-service.ts +252 -0
- package/src/menu/next/menu-util.ts +77 -0
- package/src/menu/next/menu.contrib.interface.ts +79 -0
- package/src/menu/next/menu.interface.ts +253 -0
- package/src/menu/next/menubar-service.ts +211 -0
- package/src/menu/next/renderer/ctxmenu/base.ts +18 -0
- package/src/menu/next/renderer/ctxmenu/browser.ts +45 -0
- package/src/menu/next/renderer/ctxmenu/electron.ts +207 -0
- package/src/menu/next/toolbar-action.service.ts +132 -0
- package/src/monaco/index.ts +136 -0
- package/src/monaco/merge-editor-widget.ts +159 -0
- package/src/opener/command-opener.ts +42 -0
- package/src/opener/default-opener.ts +31 -0
- package/src/opener/http-opener.ts +25 -0
- package/src/opener/index.ts +19 -0
- package/src/opener/opener.contribution.ts +57 -0
- package/src/opener/opener.service.ts +66 -0
- package/src/preferences/early-preferences.ts +117 -0
- package/src/preferences/index.ts +9 -0
- package/src/preferences/preference-configurations.ts +77 -0
- package/src/preferences/preference-contribution.ts +397 -0
- package/src/preferences/preference-provider.ts +414 -0
- package/src/preferences/preference-proxy.ts +291 -0
- package/src/preferences/preference-scope.ts +3 -0
- package/src/preferences/preference-service.ts +621 -0
- package/src/preferences/settings.ts +90 -0
- package/src/preferences/types.ts +119 -0
- package/src/progress/index.ts +58 -0
- package/src/progress/progress-bar.tsx +34 -0
- package/src/progress/progress-indicator.ts +90 -0
- package/src/progress/progress.module.less +46 -0
- package/src/progress/progress.service.tsx +429 -0
- package/src/quick-open/index.ts +655 -0
- package/src/quick-open/recent-files.ts +68 -0
- package/src/raw-context-key.ts +116 -0
- package/src/react-hooks/event.tsx +80 -0
- package/src/react-hooks/hot-key.tsx +58 -0
- package/src/react-hooks/index.ts +3 -0
- package/src/react-hooks/injectable-hooks.tsx +35 -0
- package/src/react-hooks/portal-hooks.tsx +38 -0
- package/src/react-hooks/useThrottleFn/index.ts +34 -0
- package/src/react-providers/config-provider.tsx +269 -0
- package/src/react-providers/index.tsx +2 -0
- package/src/react-providers/slot.module.less +19 -0
- package/src/react-providers/slot.tsx +242 -0
- package/src/services/clipboard.service.ts +92 -0
- package/src/services/credentials-service.ts +91 -0
- package/src/services/crypto-service.ts +23 -0
- package/src/services/external-uri.service.ts +68 -0
- package/src/services/index.ts +7 -0
- package/src/services/label-service.ts +386 -0
- package/src/services/status-bar-service.ts +108 -0
- package/src/services/storage-service.ts +201 -0
- package/src/style/codicons/README.md +22 -0
- package/src/style/codicons/codicon-animations.css +15 -0
- package/src/style/codicons/generator.js +15 -0
- package/src/style/entry.less +25 -0
- package/src/style/icon/fileicons/file-default.svg +1 -0
- package/src/style/icon/fileicons/folder-default.svg +1 -0
- package/src/style/icon/fileicons.less +20 -0
- package/src/style/icon/icon.ts +547 -0
- package/src/style/icon/ide-iconfont.ts +13 -0
- package/src/style/icon/index.less +67 -0
- package/src/style/icon/seti.woff +0 -0
- package/src/style/icon/symbol-icons/boolean-dark.svg +3 -0
- package/src/style/icon/symbol-icons/boolean-light.svg +3 -0
- package/src/style/icon/symbol-icons/class-dark.svg +3 -0
- package/src/style/icon/symbol-icons/class-light.svg +3 -0
- package/src/style/icon/symbol-icons/constant-dark.svg +4 -0
- package/src/style/icon/symbol-icons/constant-light.svg +4 -0
- package/src/style/icon/symbol-icons/enumerator-dark.svg +3 -0
- package/src/style/icon/symbol-icons/enumerator-item-dark.svg +3 -0
- package/src/style/icon/symbol-icons/enumerator-item-light.svg +3 -0
- package/src/style/icon/symbol-icons/enumerator-light.svg +3 -0
- package/src/style/icon/symbol-icons/event-dark.svg +3 -0
- package/src/style/icon/symbol-icons/event-light.svg +3 -0
- package/src/style/icon/symbol-icons/field-dark.svg +3 -0
- package/src/style/icon/symbol-icons/field-light.svg +3 -0
- package/src/style/icon/symbol-icons/file-dark.svg +3 -0
- package/src/style/icon/symbol-icons/file-light.svg +3 -0
- package/src/style/icon/symbol-icons/indexer-dark.svg +3 -0
- package/src/style/icon/symbol-icons/indexer-light.svg +3 -0
- package/src/style/icon/symbol-icons/interface-dark.svg +3 -0
- package/src/style/icon/symbol-icons/interface-light.svg +3 -0
- package/src/style/icon/symbol-icons/keyword-dark.svg +3 -0
- package/src/style/icon/symbol-icons/keyword-light.svg +3 -0
- package/src/style/icon/symbol-icons/method-dark.svg +3 -0
- package/src/style/icon/symbol-icons/method-light.svg +3 -0
- package/src/style/icon/symbol-icons/namespace-dark.svg +3 -0
- package/src/style/icon/symbol-icons/namespace-light.svg +3 -0
- package/src/style/icon/symbol-icons/numeric-dark.svg +3 -0
- package/src/style/icon/symbol-icons/numeric-light.svg +3 -0
- package/src/style/icon/symbol-icons/operator-dark.svg +3 -0
- package/src/style/icon/symbol-icons/operator-light.svg +3 -0
- package/src/style/icon/symbol-icons/property-dark.svg +3 -0
- package/src/style/icon/symbol-icons/property-light.svg +3 -0
- package/src/style/icon/symbol-icons/snippet-dark.svg +3 -0
- package/src/style/icon/symbol-icons/snippet-light.svg +3 -0
- package/src/style/icon/symbol-icons/string-dark.svg +3 -0
- package/src/style/icon/symbol-icons/string-light.svg +3 -0
- package/src/style/icon/symbol-icons/structure-dark.svg +3 -0
- package/src/style/icon/symbol-icons/structure-light.svg +3 -0
- package/src/style/icon/symbol-icons/symbol-icons.css +284 -0
- package/src/style/icon/symbol-icons/template-dark.svg +3 -0
- package/src/style/icon/symbol-icons/template-light.svg +3 -0
- package/src/style/icon/symbol-icons/variable-dark.svg +3 -0
- package/src/style/icon/symbol-icons/variable-light.svg +3 -0
- package/src/style/icon.less +8 -0
- package/src/style/index.less +14 -0
- package/src/style/monaco-override.less +116 -0
- package/src/style/normalize.less +92 -0
- package/src/style/octicons/octicons-cdn.css +720 -0
- package/src/style/octicons/octicons.css +714 -0
- package/src/style/octicons/octicons.html +1882 -0
- package/src/style/octicons/octicons.svg +582 -0
- package/src/style/octicons/octicons.ttf +0 -0
- package/src/style/override.less +97 -0
- package/src/style/toolbar.less +199 -0
- package/src/style/utilities.less +8 -0
- package/src/style/variable.less +8 -0
- package/src/terminal/index.ts +7 -0
- package/src/toolbar/components/auto-complete.tsx +0 -0
- package/src/toolbar/components/button.tsx +440 -0
- package/src/toolbar/components/index.ts +2 -0
- package/src/toolbar/components/select.tsx +189 -0
- package/src/toolbar/index.ts +3 -0
- package/src/toolbar/toolbar.popover.registry.ts +32 -0
- package/src/toolbar/toolbar.registry.ts +352 -0
- package/src/toolbar/toolbar.tsx +710 -0
- package/src/toolbar/types.ts +383 -0
- package/src/utils/create-overlay.tsx +53 -0
- package/src/utils/electron.ts +92 -0
- package/src/utils/env.ts +26 -0
- package/src/utils/icon.ts +13 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/json.ts +251 -0
- package/src/utils/label.tsx +36 -0
- package/src/utils/parse.ts +82 -0
- package/src/utils/react-hooks.ts +118 -0
- package/src/variable/index.ts +1 -0
- package/src/variable/variable.ts +84 -0
- package/src/window/index.ts +34 -0
- package/src/window/window.service.ts +100 -0
- package/lib/components/progressbar/styles.module.less +0 -31
- package/lib/components/recycle-tree/index.d.ts +0 -2
- package/lib/components/recycle-tree/index.d.ts.map +0 -1
- package/lib/components/recycle-tree/index.js +0 -5
- package/lib/components/recycle-tree/index.js.map +0 -1
- package/lib/components/recycle-tree/recycle-tree.view.d.ts +0 -82
- package/lib/components/recycle-tree/recycle-tree.view.d.ts.map +0 -1
- package/lib/components/recycle-tree/recycle-tree.view.js +0 -188
- package/lib/components/recycle-tree/recycle-tree.view.js.map +0 -1
- package/lib/components/scroll/index.d.ts +0 -68
- package/lib/components/scroll/index.d.ts.map +0 -1
- package/lib/components/scroll/index.js +0 -279
- package/lib/components/scroll/index.js.map +0 -1
- package/lib/components/scroll/scroll.module.less +0 -108
- package/lib/components/scrollbar/index.d.ts +0 -2
- package/lib/components/scrollbar/index.d.ts.map +0 -1
- package/lib/components/scrollbar/index.js +0 -5
- package/lib/components/scrollbar/index.js.map +0 -1
- package/lib/components/scrollbar/scrollbar.less +0 -36
- package/lib/components/scrollbar/scrollbar.view.d.ts +0 -7
- package/lib/components/scrollbar/scrollbar.view.d.ts.map +0 -1
- package/lib/components/scrollbar/scrollbar.view.js +0 -11
- package/lib/components/scrollbar/scrollbar.view.js.map +0 -1
- package/lib/components/tree/index.d.ts +0 -4
- package/lib/components/tree/index.d.ts.map +0 -1
- package/lib/components/tree/index.js +0 -7
- package/lib/components/tree/index.js.map +0 -1
- package/lib/components/tree/tree-node.view.d.ts +0 -26
- package/lib/components/tree/tree-node.view.d.ts.map +0 -1
- package/lib/components/tree/tree-node.view.js +0 -350
- package/lib/components/tree/tree-node.view.js.map +0 -1
- package/lib/components/tree/tree.module.less +0 -296
- package/lib/components/tree/tree.view.d.ts +0 -132
- package/lib/components/tree/tree.view.d.ts.map +0 -1
- package/lib/components/tree/tree.view.js +0 -238
- package/lib/components/tree/tree.view.js.map +0 -1
- package/lib/tree/index.d.ts +0 -4
- package/lib/tree/index.d.ts.map +0 -1
- package/lib/tree/index.js +0 -7
- package/lib/tree/index.js.map +0 -1
- package/lib/tree/tree-expansion.d.ts +0 -16
- package/lib/tree/tree-expansion.d.ts.map +0 -1
- package/lib/tree/tree-expansion.js +0 -20
- package/lib/tree/tree-expansion.js.map +0 -1
- package/lib/tree/tree-selection.d.ts +0 -48
- package/lib/tree/tree-selection.d.ts.map +0 -1
- package/lib/tree/tree-selection.js +0 -64
- package/lib/tree/tree-selection.js.map +0 -1
- package/lib/tree/tree.d.ts +0 -195
- package/lib/tree/tree.d.ts.map +0 -1
- package/lib/tree/tree.js +0 -108
- package/lib/tree/tree.js.map +0 -1
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* editor.main 包含了所有 monaco 自带的编辑器相关核心功能以及 contributes
|
|
3
|
+
* 并且 editor.main 也包含对 editor.all 的导入
|
|
4
|
+
*/
|
|
5
|
+
import '@opensumi/monaco-editor-core/esm/vs/editor/editor.main';
|
|
6
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
7
|
+
|
|
8
|
+
import { Injector } from '@opensumi/di';
|
|
9
|
+
import { RPCMessageConnection } from '@opensumi/ide-connection';
|
|
10
|
+
import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser';
|
|
11
|
+
import {
|
|
12
|
+
CommandRegistry,
|
|
13
|
+
isOSX,
|
|
14
|
+
ContributionProvider,
|
|
15
|
+
MaybePromise,
|
|
16
|
+
createContributionProvider,
|
|
17
|
+
StorageProvider,
|
|
18
|
+
DefaultStorageProvider,
|
|
19
|
+
StorageResolverContribution,
|
|
20
|
+
ILoggerManagerClient,
|
|
21
|
+
SupportLogNamespace,
|
|
22
|
+
ILogServiceClient,
|
|
23
|
+
getDebugLogger,
|
|
24
|
+
isElectronRenderer,
|
|
25
|
+
setLanguageId,
|
|
26
|
+
IReporterService,
|
|
27
|
+
REPORT_NAME,
|
|
28
|
+
IEventBus,
|
|
29
|
+
asExtensionCandidate,
|
|
30
|
+
IApplicationService,
|
|
31
|
+
IDisposable,
|
|
32
|
+
Deferred,
|
|
33
|
+
isUndefined,
|
|
34
|
+
GeneralSettingsId,
|
|
35
|
+
UrlProvider,
|
|
36
|
+
LifeCyclePhase,
|
|
37
|
+
AppLifeCycleServiceToken,
|
|
38
|
+
IAppLifeCycleService,
|
|
39
|
+
} from '@opensumi/ide-core-common';
|
|
40
|
+
import {
|
|
41
|
+
DEFAULT_APPLICATION_DESKTOP_HOST,
|
|
42
|
+
DEFAULT_APPLICATION_NAME,
|
|
43
|
+
DEFAULT_APPLICATION_WEB_HOST,
|
|
44
|
+
DEFAULT_URI_SCHEME,
|
|
45
|
+
} from '@opensumi/ide-core-common/lib/const/application';
|
|
46
|
+
import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron';
|
|
47
|
+
|
|
48
|
+
import { createElectronClientConnection } from '..';
|
|
49
|
+
import { ClientAppStateService } from '../application';
|
|
50
|
+
import { BrowserModule, IClientApp } from '../browser-module';
|
|
51
|
+
import { ClientAppContribution } from '../common';
|
|
52
|
+
import { CorePreferences } from '../core-preferences';
|
|
53
|
+
import { injectCorePreferences } from '../core-preferences';
|
|
54
|
+
import { KeybindingRegistry, KeybindingService, NO_KEYBINDING_NAME } from '../keybinding';
|
|
55
|
+
import { RenderedEvent } from '../layout/layout.interface';
|
|
56
|
+
import { MenuRegistryImpl, IMenuRegistry } from '../menu/next/base';
|
|
57
|
+
import {
|
|
58
|
+
PreferenceProviderProvider,
|
|
59
|
+
injectPreferenceSchemaProvider,
|
|
60
|
+
injectPreferenceConfigurations,
|
|
61
|
+
PreferenceScope,
|
|
62
|
+
PreferenceProvider,
|
|
63
|
+
PreferenceService,
|
|
64
|
+
PreferenceServiceImpl,
|
|
65
|
+
getPreferenceLanguageId,
|
|
66
|
+
registerLocalStorageProvider,
|
|
67
|
+
} from '../preferences';
|
|
68
|
+
import { AppConfig } from '../react-providers/config-provider';
|
|
69
|
+
import { DEFAULT_CDN_ICON, IDE_OCTICONS_CN_CSS, IDE_CODICONS_CN_CSS, updateIconMap } from '../style/icon/icon';
|
|
70
|
+
import { electronEnv } from '../utils';
|
|
71
|
+
|
|
72
|
+
import { IClientAppOpts, IconInfo, IconMap, IPreferences, LayoutConfig, ModuleConstructor } from './app.interface';
|
|
73
|
+
import { renderClientApp, IAppRenderer } from './app.view';
|
|
74
|
+
import { createClientConnection2, bindConnectionService } from './connection';
|
|
75
|
+
import { injectInnerProviders } from './inner-providers';
|
|
76
|
+
|
|
77
|
+
// 添加resize observer polyfill
|
|
78
|
+
if (typeof (window as any).ResizeObserver === 'undefined') {
|
|
79
|
+
(window as any).ResizeObserver = ResizeObserver;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export class ClientApp implements IClientApp, IDisposable {
|
|
83
|
+
/**
|
|
84
|
+
* 应用是否完成初始化
|
|
85
|
+
*/
|
|
86
|
+
appInitialized: Deferred<void> = new Deferred();
|
|
87
|
+
|
|
88
|
+
browserModules: BrowserModule[] = [];
|
|
89
|
+
|
|
90
|
+
modules: ModuleConstructor[];
|
|
91
|
+
|
|
92
|
+
injector: Injector;
|
|
93
|
+
|
|
94
|
+
logger: ILogServiceClient;
|
|
95
|
+
|
|
96
|
+
connectionPath: UrlProvider;
|
|
97
|
+
|
|
98
|
+
connectionProtocols?: string[];
|
|
99
|
+
|
|
100
|
+
keybindingRegistry: KeybindingRegistry;
|
|
101
|
+
|
|
102
|
+
keybindingService: KeybindingService;
|
|
103
|
+
|
|
104
|
+
config: AppConfig;
|
|
105
|
+
|
|
106
|
+
contributionsProvider: ContributionProvider<ClientAppContribution>;
|
|
107
|
+
|
|
108
|
+
commandRegistry: CommandRegistry;
|
|
109
|
+
|
|
110
|
+
// 这里将 onStart contribution 方法放到 MenuRegistryImpl 上了
|
|
111
|
+
nextMenuRegistry: MenuRegistryImpl;
|
|
112
|
+
|
|
113
|
+
stateService: ClientAppStateService;
|
|
114
|
+
|
|
115
|
+
constructor(opts: IClientAppOpts) {
|
|
116
|
+
const {
|
|
117
|
+
modules,
|
|
118
|
+
contributions,
|
|
119
|
+
modulesInstances,
|
|
120
|
+
connectionPath,
|
|
121
|
+
connectionProtocols,
|
|
122
|
+
iconStyleSheets,
|
|
123
|
+
useCdnIcon,
|
|
124
|
+
editorBackgroundImage,
|
|
125
|
+
defaultPreferences,
|
|
126
|
+
allowSetDocumentTitleFollowWorkspaceDir = true,
|
|
127
|
+
devtools = false, // if not set, disable devtools support as default
|
|
128
|
+
...restOpts // rest part 为 AppConfig
|
|
129
|
+
} = opts;
|
|
130
|
+
|
|
131
|
+
this.initEarlyPreference(opts.workspaceDir || '');
|
|
132
|
+
setLanguageId(getPreferenceLanguageId(defaultPreferences));
|
|
133
|
+
this.injector = opts.injector || new Injector();
|
|
134
|
+
this.modules = modules;
|
|
135
|
+
this.modules.forEach((m) => this.resolveModuleDeps(m));
|
|
136
|
+
// moduleInstance必须第一个是layout模块
|
|
137
|
+
this.browserModules = opts.modulesInstances || [];
|
|
138
|
+
const isDesktop = opts.isElectronRenderer || isElectronRenderer();
|
|
139
|
+
this.config = {
|
|
140
|
+
appName: DEFAULT_APPLICATION_NAME,
|
|
141
|
+
appHost: isDesktop ? DEFAULT_APPLICATION_DESKTOP_HOST : DEFAULT_APPLICATION_WEB_HOST,
|
|
142
|
+
appRoot: isUndefined(opts.appRoot) ? (isDesktop ? electronEnv.appPath : '') : opts.appRoot,
|
|
143
|
+
uriScheme: DEFAULT_URI_SCHEME,
|
|
144
|
+
// 如果通过 config 传入了 appName 及 uriScheme,则优先使用
|
|
145
|
+
...restOpts,
|
|
146
|
+
// 一些转换和 typo 修复
|
|
147
|
+
isElectronRenderer: isDesktop,
|
|
148
|
+
workspaceDir: opts.workspaceDir || '',
|
|
149
|
+
extensionDir:
|
|
150
|
+
opts.extensionDir || (opts.isElectronRenderer || isDesktop ? electronEnv.metadata?.extensionDir : ''),
|
|
151
|
+
injector: this.injector,
|
|
152
|
+
wsPath: opts.wsPath || `ws://${window.location.hostname}:8000`,
|
|
153
|
+
layoutConfig: opts.layoutConfig as LayoutConfig,
|
|
154
|
+
editorBackgroundImage: opts.editorBackgroundImage || editorBackgroundImage,
|
|
155
|
+
allowSetDocumentTitleFollowWorkspaceDir,
|
|
156
|
+
devtools,
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
if (devtools) {
|
|
160
|
+
// set a global so the opensumi devtools can identify that
|
|
161
|
+
// the current page is powered by opensumi core
|
|
162
|
+
window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__ = {};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (this.config.isElectronRenderer && electronEnv.metadata?.extensionDevelopmentHost) {
|
|
166
|
+
this.config.extensionDevelopmentHost = electronEnv.metadata.extensionDevelopmentHost;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (opts.extensionDevelopmentPath) {
|
|
170
|
+
this.config.extensionCandidate = (this.config.extensionCandidate || []).concat(
|
|
171
|
+
Array.isArray(opts.extensionDevelopmentPath)
|
|
172
|
+
? opts.extensionDevelopmentPath.map((e) => asExtensionCandidate(e, true))
|
|
173
|
+
: [asExtensionCandidate(opts.extensionDevelopmentPath, true)],
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
this.config.extensionDevelopmentHost = !!opts.extensionDevelopmentPath;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 旧方案兼容, 把electron.metadata.extensionCandidate提前注入appConfig的对应配置中
|
|
180
|
+
if (this.config.isElectronRenderer && electronEnv.metadata?.extensionCandidate) {
|
|
181
|
+
this.config.extensionCandidate = (this.config.extensionCandidate || []).concat(
|
|
182
|
+
electronEnv.metadata.extensionCandidate || [],
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
this.connectionPath = connectionPath || `${this.config.wsPath}/service`;
|
|
187
|
+
this.connectionProtocols = connectionProtocols;
|
|
188
|
+
this.initBaseProvider();
|
|
189
|
+
this.initFields();
|
|
190
|
+
this.appendIconStyleSheets(iconStyleSheets, useCdnIcon);
|
|
191
|
+
this.createBrowserModules(defaultPreferences);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private _inComposition = false;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* 将被依赖但未被加入modules的模块加入到待加载模块最后
|
|
198
|
+
*/
|
|
199
|
+
public resolveModuleDeps(moduleConstructor: ModuleConstructor) {
|
|
200
|
+
const dependencies = Reflect.getMetadata('dependencies', moduleConstructor) as [];
|
|
201
|
+
if (dependencies) {
|
|
202
|
+
dependencies.forEach((dep) => {
|
|
203
|
+
if (this.modules.indexOf(dep) === -1) {
|
|
204
|
+
this.modules.push(dep);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
get lifeCycleService(): IAppLifeCycleService {
|
|
211
|
+
return this.injector.get(AppLifeCycleServiceToken);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* LifeCycle
|
|
216
|
+
* 1. Prepare
|
|
217
|
+
* 2. Initialize
|
|
218
|
+
* 3. Starting
|
|
219
|
+
* 4. Ready
|
|
220
|
+
*/
|
|
221
|
+
public async start(
|
|
222
|
+
container: HTMLElement | IAppRenderer,
|
|
223
|
+
type?: 'electron' | 'web',
|
|
224
|
+
connection?: RPCMessageConnection,
|
|
225
|
+
): Promise<void> {
|
|
226
|
+
const reporterService: IReporterService = this.injector.get(IReporterService);
|
|
227
|
+
const measureReporter = reporterService.time(REPORT_NAME.MEASURE);
|
|
228
|
+
|
|
229
|
+
this.lifeCycleService.phase = LifeCyclePhase.Prepare;
|
|
230
|
+
|
|
231
|
+
if (connection) {
|
|
232
|
+
await bindConnectionService(this.injector, this.modules, connection);
|
|
233
|
+
} else {
|
|
234
|
+
if (type === 'electron') {
|
|
235
|
+
await bindConnectionService(this.injector, this.modules, createElectronClientConnection());
|
|
236
|
+
} else if (type === 'web') {
|
|
237
|
+
await createClientConnection2(
|
|
238
|
+
this.injector,
|
|
239
|
+
this.modules,
|
|
240
|
+
this.connectionPath,
|
|
241
|
+
() => {
|
|
242
|
+
this.onReconnectContributions();
|
|
243
|
+
},
|
|
244
|
+
this.connectionProtocols,
|
|
245
|
+
this.config.clientId,
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
this.logger = this.getLogger();
|
|
249
|
+
// 回写需要用到打点的 Logger 的地方
|
|
250
|
+
this.injector.get(WSChannelHandler).replaceLogger(this.logger);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
measureReporter.timeEnd('ClientApp.createConnection');
|
|
254
|
+
|
|
255
|
+
this.logger = this.getLogger();
|
|
256
|
+
this.stateService.state = 'client_connected';
|
|
257
|
+
this.registerEventListeners();
|
|
258
|
+
// 在 connect 之后立即初始化数据,保证其它 module 能同步获取数据
|
|
259
|
+
await this.injector.get(IApplicationService).initializeData();
|
|
260
|
+
|
|
261
|
+
// 在 contributions 执行完 onStart 上报一次耗时
|
|
262
|
+
await this.measure('Contributions.start', () => this.startContributions(container));
|
|
263
|
+
this.stateService.state = 'started_contributions';
|
|
264
|
+
this.stateService.state = 'ready';
|
|
265
|
+
|
|
266
|
+
this.lifeCycleService.phase = LifeCyclePhase.Ready;
|
|
267
|
+
measureReporter.timeEnd('Framework.ready');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private getLogger() {
|
|
271
|
+
if (this.logger) {
|
|
272
|
+
return this.logger;
|
|
273
|
+
}
|
|
274
|
+
this.logger = this.injector.get(ILoggerManagerClient).getLogger(SupportLogNamespace.Browser);
|
|
275
|
+
return this.logger;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private onReconnectContributions() {
|
|
279
|
+
const contributions = this.contributions;
|
|
280
|
+
|
|
281
|
+
for (const contribution of contributions) {
|
|
282
|
+
if (contribution.onReconnect) {
|
|
283
|
+
contribution.onReconnect(this);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 给 injector 初始化默认的 Providers
|
|
290
|
+
*/
|
|
291
|
+
private initBaseProvider() {
|
|
292
|
+
this.injector.addProviders({ token: IClientApp, useValue: this });
|
|
293
|
+
this.injector.addProviders({ token: AppConfig, useValue: this.config });
|
|
294
|
+
injectInnerProviders(this.injector);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* 从 injector 里获得实例
|
|
299
|
+
*/
|
|
300
|
+
private initFields() {
|
|
301
|
+
this.contributionsProvider = this.injector.get(ClientAppContribution);
|
|
302
|
+
this.commandRegistry = this.injector.get(CommandRegistry);
|
|
303
|
+
this.keybindingRegistry = this.injector.get(KeybindingRegistry);
|
|
304
|
+
this.keybindingService = this.injector.get(KeybindingService);
|
|
305
|
+
this.stateService = this.injector.get(ClientAppStateService);
|
|
306
|
+
this.nextMenuRegistry = this.injector.get(IMenuRegistry);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
private createBrowserModules(defaultPreferences?: IPreferences) {
|
|
310
|
+
const injector = this.injector;
|
|
311
|
+
|
|
312
|
+
for (const Constructor of this.modules) {
|
|
313
|
+
const instance = injector.get(Constructor);
|
|
314
|
+
this.browserModules.push(instance);
|
|
315
|
+
|
|
316
|
+
if (instance.providers) {
|
|
317
|
+
this.injector.addProviders(...instance.providers);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (instance.preferences) {
|
|
321
|
+
instance.preferences(this.injector);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
injectCorePreferences(this.injector);
|
|
326
|
+
|
|
327
|
+
// 注册PreferenceService
|
|
328
|
+
this.injectPreferenceService(this.injector, defaultPreferences);
|
|
329
|
+
|
|
330
|
+
// 注册存储服务
|
|
331
|
+
this.injectStorageProvider(this.injector);
|
|
332
|
+
|
|
333
|
+
for (const instance of this.browserModules) {
|
|
334
|
+
if (instance.contributionProvider) {
|
|
335
|
+
if (Array.isArray(instance.contributionProvider)) {
|
|
336
|
+
for (const contributionProvider of instance.contributionProvider) {
|
|
337
|
+
createContributionProvider(this.injector, contributionProvider);
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
createContributionProvider(this.injector, instance.contributionProvider);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
get contributions(): ClientAppContribution[] {
|
|
347
|
+
return this.contributionsProvider.getContributions();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
protected async startContributions(container) {
|
|
351
|
+
// 先渲染 layout,模块视图的时序由layout控制
|
|
352
|
+
await this.measure('RenderApp.render', () => this.renderApp(container));
|
|
353
|
+
|
|
354
|
+
this.lifeCycleService.phase = LifeCyclePhase.Initialize;
|
|
355
|
+
await this.measure('Contributions.initialize', () => this.initializeContributions());
|
|
356
|
+
|
|
357
|
+
// 初始化命令、快捷键与菜单
|
|
358
|
+
await this.initializeCoreRegistry();
|
|
359
|
+
|
|
360
|
+
// 核心模块初始化完毕
|
|
361
|
+
this.stateService.state = 'core_module_initialized';
|
|
362
|
+
|
|
363
|
+
this.lifeCycleService.phase = LifeCyclePhase.Starting;
|
|
364
|
+
await this.measure('Contributions.onStart', () => this.onStartContributions());
|
|
365
|
+
|
|
366
|
+
await this.runContributionsPhase(this.contributions, 'onDidStart');
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* 初始化核心模板
|
|
371
|
+
*/
|
|
372
|
+
private async initializeCoreRegistry() {
|
|
373
|
+
this.commandRegistry.initialize();
|
|
374
|
+
await this.keybindingRegistry.initialize();
|
|
375
|
+
this.nextMenuRegistry.initialize();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* run contribution#initialize
|
|
380
|
+
*/
|
|
381
|
+
private async initializeContributions() {
|
|
382
|
+
await this.runContributionsPhase(this.contributions, 'initialize');
|
|
383
|
+
this.appInitialized.resolve();
|
|
384
|
+
|
|
385
|
+
this.logger.verbose('contributions.initialize done');
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* run contribution#onStart
|
|
390
|
+
*/
|
|
391
|
+
private async onStartContributions() {
|
|
392
|
+
await this.runContributionsPhase(this.contributions, 'onStart');
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
private async runContributionsPhase(contributions: ClientAppContribution[], phaseName: keyof ClientAppContribution) {
|
|
396
|
+
return await Promise.all(
|
|
397
|
+
contributions.map((contribution) => this.contributionPhaseRunner(contribution, phaseName)),
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
private async contributionPhaseRunner(contribution: ClientAppContribution, phaseName: keyof ClientAppContribution) {
|
|
402
|
+
const phase = contribution[phaseName];
|
|
403
|
+
if (typeof phase === 'function') {
|
|
404
|
+
try {
|
|
405
|
+
const uid = contribution.constructor.name + '.' + phaseName;
|
|
406
|
+
return await this.measure(uid, () => phase.call(contribution, this));
|
|
407
|
+
} catch (error) {
|
|
408
|
+
this.logger.error(`Could not run contribution#${phaseName}`, error);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
private async renderApp(container: HTMLElement | IAppRenderer) {
|
|
414
|
+
await renderClientApp(this, container);
|
|
415
|
+
|
|
416
|
+
const eventBus = this.injector.get(IEventBus);
|
|
417
|
+
eventBus.fire(new RenderedEvent());
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
protected async measure<T>(name: string, fn: () => MaybePromise<T>): Promise<T> {
|
|
421
|
+
const reporterService: IReporterService = this.injector.get(IReporterService);
|
|
422
|
+
const measureReporter = reporterService.time(REPORT_NAME.MEASURE);
|
|
423
|
+
const result = await fn();
|
|
424
|
+
measureReporter.timeEnd(name);
|
|
425
|
+
return result;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* `beforeunload` listener implementation
|
|
430
|
+
*/
|
|
431
|
+
protected preventStop(): boolean {
|
|
432
|
+
// 获取corePreferences配置判断是否弹出确认框
|
|
433
|
+
const corePreferences = this.injector.get(CorePreferences);
|
|
434
|
+
const confirmExit = corePreferences['application.confirmExit'];
|
|
435
|
+
if (confirmExit === 'never') {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
for (const contribution of this.contributions) {
|
|
439
|
+
if (contribution.onWillStop) {
|
|
440
|
+
try {
|
|
441
|
+
const res = contribution.onWillStop(this);
|
|
442
|
+
if (res) {
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
} catch (e) {
|
|
446
|
+
getDebugLogger().error(e);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return confirmExit === 'always';
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* electron 退出询问
|
|
455
|
+
*/
|
|
456
|
+
protected async preventStopElectron(): Promise<boolean> {
|
|
457
|
+
// 获取corePreferences配置判断是否弹出确认框
|
|
458
|
+
const corePreferences = this.injector.get(CorePreferences);
|
|
459
|
+
const confirmExit = corePreferences['application.confirmExit'];
|
|
460
|
+
if (confirmExit === 'never') {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
for (const contribution of this.contributions) {
|
|
464
|
+
if (contribution.onWillStop) {
|
|
465
|
+
try {
|
|
466
|
+
const res = await contribution.onWillStop(this);
|
|
467
|
+
if (res) {
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
} catch (e) {
|
|
471
|
+
getDebugLogger().error(e);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Stop the frontend application contributions. This is called when the window is unloaded.
|
|
480
|
+
*/
|
|
481
|
+
protected stopContributions(): void {
|
|
482
|
+
for (const contribution of this.contributions) {
|
|
483
|
+
if (contribution.onStop) {
|
|
484
|
+
try {
|
|
485
|
+
contribution.onStop(this);
|
|
486
|
+
} catch (error) {
|
|
487
|
+
this.logger.error('Could not stop contribution', error);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
protected async stopContributionsElectron(): Promise<void> {
|
|
494
|
+
const promises: Array<Promise<void>> = [];
|
|
495
|
+
for (const contribution of this.contributions) {
|
|
496
|
+
if (contribution.onStop) {
|
|
497
|
+
promises.push(
|
|
498
|
+
(async () => {
|
|
499
|
+
try {
|
|
500
|
+
await contribution.onStop!(this);
|
|
501
|
+
} catch (error) {
|
|
502
|
+
this.logger.error('Could not stop contribution', error);
|
|
503
|
+
}
|
|
504
|
+
})(),
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
await Promise.all(promises);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* 注册全局事件监听
|
|
513
|
+
*/
|
|
514
|
+
protected registerEventListeners(): void {
|
|
515
|
+
window.addEventListener('beforeunload', this._handleBeforeUpload);
|
|
516
|
+
window.addEventListener('unload', this._handleUnload);
|
|
517
|
+
|
|
518
|
+
window.addEventListener('resize', this._handleResize);
|
|
519
|
+
// 处理中文输入回退时可能出现多个光标问题
|
|
520
|
+
// https://github.com/eclipse-theia/theia/pull/6673
|
|
521
|
+
window.addEventListener('compositionstart', this._handleCompositionstart);
|
|
522
|
+
window.addEventListener('compositionend', this._handleCompositionend);
|
|
523
|
+
window.addEventListener('keydown', this._handleKeydown, true);
|
|
524
|
+
window.addEventListener('keyup', this._handleKeyup, true);
|
|
525
|
+
|
|
526
|
+
if (isOSX) {
|
|
527
|
+
document.body.addEventListener('wheel', this._handleWheel, { passive: false });
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
injectPreferenceService(injector: Injector, defaultPreferences?: IPreferences): void {
|
|
532
|
+
const preferencesProviderFactory = () => (scope: PreferenceScope) => {
|
|
533
|
+
const provider: PreferenceProvider = injector.get(PreferenceProvider, { tag: scope });
|
|
534
|
+
provider.asScope(scope);
|
|
535
|
+
return provider;
|
|
536
|
+
};
|
|
537
|
+
injectPreferenceConfigurations(injector);
|
|
538
|
+
|
|
539
|
+
injectPreferenceSchemaProvider(injector);
|
|
540
|
+
|
|
541
|
+
// 用于获取不同scope下的PreferenceProvider
|
|
542
|
+
injector.addProviders(
|
|
543
|
+
{
|
|
544
|
+
token: PreferenceProviderProvider,
|
|
545
|
+
useFactory: preferencesProviderFactory,
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
token: PreferenceService,
|
|
549
|
+
useClass: PreferenceServiceImpl,
|
|
550
|
+
},
|
|
551
|
+
);
|
|
552
|
+
// 设置默认配置
|
|
553
|
+
if (defaultPreferences) {
|
|
554
|
+
const providerFactory: PreferenceProviderProvider = injector.get(PreferenceProviderProvider);
|
|
555
|
+
const defaultPreference: PreferenceProvider = providerFactory(PreferenceScope.Default);
|
|
556
|
+
for (const key of Object.keys(defaultPreferences)) {
|
|
557
|
+
defaultPreference.setPreference(key, defaultPreferences[key]);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
injectStorageProvider(injector: Injector) {
|
|
563
|
+
injector.addProviders({
|
|
564
|
+
token: DefaultStorageProvider,
|
|
565
|
+
useClass: DefaultStorageProvider,
|
|
566
|
+
});
|
|
567
|
+
injector.addProviders({
|
|
568
|
+
token: StorageProvider,
|
|
569
|
+
useFactory: () => (storageId) => injector.get(DefaultStorageProvider).get(storageId),
|
|
570
|
+
});
|
|
571
|
+
createContributionProvider(injector, StorageResolverContribution);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* 通知上层需要刷新浏览器
|
|
576
|
+
* @param forcedReload 当取值为 true 时,将强制浏览器从服务器重新获取当前页面资源,而不是从浏览器的缓存中读取,如果取值为 false 或不传该参数时,浏览器则可能会从缓存中读取当前页面。
|
|
577
|
+
*/
|
|
578
|
+
fireOnReload(forcedReload = false) {
|
|
579
|
+
// 默认调用 location reload
|
|
580
|
+
// @ts-ignore
|
|
581
|
+
window.location.reload(forcedReload);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
protected appendIconStyleSheets(iconInfos?: IconInfo[], useCdnIcon?: boolean) {
|
|
585
|
+
const iconPaths: string[] = useCdnIcon ? [DEFAULT_CDN_ICON, IDE_OCTICONS_CN_CSS, IDE_CODICONS_CN_CSS] : [];
|
|
586
|
+
if (iconInfos && iconInfos.length) {
|
|
587
|
+
iconInfos.forEach((info) => {
|
|
588
|
+
this.updateIconMap(info.prefix, info.iconMap);
|
|
589
|
+
iconPaths.push(info.cssPath);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
for (const path of iconPaths) {
|
|
593
|
+
const link = document.createElement('link');
|
|
594
|
+
link.setAttribute('rel', 'stylesheet');
|
|
595
|
+
link.setAttribute('href', path);
|
|
596
|
+
document.getElementsByTagName('head')[0].appendChild(link);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
protected updateIconMap(prefix: string, iconMap: IconMap) {
|
|
601
|
+
if (prefix === 'kaitian-icon kticon-') {
|
|
602
|
+
this.logger.error(
|
|
603
|
+
`The icon prefix '${prefix}' conflicts with the built-in icon, please check the icon configuration.`,
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
updateIconMap(prefix, iconMap);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
protected initEarlyPreference(workspaceDir: string) {
|
|
610
|
+
registerLocalStorageProvider(GeneralSettingsId.Theme, workspaceDir);
|
|
611
|
+
registerLocalStorageProvider(GeneralSettingsId.Icon, workspaceDir);
|
|
612
|
+
registerLocalStorageProvider(GeneralSettingsId.Language, workspaceDir);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
public async dispose() {
|
|
616
|
+
window.removeEventListener('beforeunload', this._handleBeforeUpload);
|
|
617
|
+
window.removeEventListener('unload', this._handleUnload);
|
|
618
|
+
window.removeEventListener('resize', this._handleResize);
|
|
619
|
+
window.removeEventListener('compositionstart', this._handleCompositionstart);
|
|
620
|
+
window.removeEventListener('compositionend', this._handleCompositionend);
|
|
621
|
+
window.removeEventListener('keydown', this._handleKeydown, true);
|
|
622
|
+
if (isOSX) {
|
|
623
|
+
document.body.removeEventListener('wheel', this._handleWheel);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
this.disposeSideEffect();
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
private disposeSideEffect() {
|
|
630
|
+
for (const contribution of this.contributions) {
|
|
631
|
+
if (contribution.onDisposeSideEffects) {
|
|
632
|
+
try {
|
|
633
|
+
contribution.onDisposeSideEffects(this);
|
|
634
|
+
} catch (error) {
|
|
635
|
+
this.logger.error('Could not dispose contribution', error);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
private _handleBeforeUpload = (event: BeforeUnloadEvent) => {
|
|
642
|
+
// 浏览器关闭事件前
|
|
643
|
+
if (this.config.isElectronRenderer) {
|
|
644
|
+
if (this.stateService.state === 'electron_confirmed_close') {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
// 在electron上,先直接prevent, 然后进入ask环节
|
|
648
|
+
event.returnValue = '';
|
|
649
|
+
event.preventDefault();
|
|
650
|
+
if (this.stateService.state !== 'electron_asking_close') {
|
|
651
|
+
this.stateService.state = 'electron_asking_close';
|
|
652
|
+
this.preventStopElectron().then((res) => {
|
|
653
|
+
if (res) {
|
|
654
|
+
this.stateService.state = 'ready';
|
|
655
|
+
} else {
|
|
656
|
+
return this.stopContributionsElectron().then(() => {
|
|
657
|
+
this.stateService.state = 'electron_confirmed_close';
|
|
658
|
+
const electronLifeCycle: IElectronMainLifeCycleService = this.injector.get(IElectronMainLifeCycleService);
|
|
659
|
+
// 在下一个 event loop 执行,否则可能导致第一次无法关闭。
|
|
660
|
+
setTimeout(() => {
|
|
661
|
+
electronLifeCycle.closeWindow(electronEnv.currentWindowId);
|
|
662
|
+
}, 0);
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
} else {
|
|
668
|
+
// 为了避免不必要的弹窗,如果页面并没有发生交互浏览器可能不会展示在 beforeunload 事件中引发的弹框,甚至可能即使发生交互了也直接不显示。
|
|
669
|
+
if (this.preventStop()) {
|
|
670
|
+
(event || window.event).returnValue = true;
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
private _handleUnload = () => {
|
|
677
|
+
// 浏览器关闭事件
|
|
678
|
+
this.stateService.state = 'closing_window';
|
|
679
|
+
if (!this.config.isElectronRenderer) {
|
|
680
|
+
this.disposeSideEffect();
|
|
681
|
+
this.stopContributions();
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
private _handleResize = () => {
|
|
686
|
+
// 浏览器resize事件
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
private _handleKeydown = (event: any) => {
|
|
690
|
+
if (event && event.target!.name !== NO_KEYBINDING_NAME && !this._inComposition) {
|
|
691
|
+
this.keybindingService.run(event);
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
private _handleKeyup = (event: any) => {
|
|
696
|
+
this.keybindingService.resolveModifierKey(event);
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
private _handleCompositionstart = () => {
|
|
700
|
+
this._inComposition = true;
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
private _handleCompositionend = () => {
|
|
704
|
+
this._inComposition = false;
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
private _handleWheel = () => {
|
|
708
|
+
// 屏蔽在OSX系统浏览器中由于滚动导致的前进后退事件
|
|
709
|
+
};
|
|
710
|
+
}
|