|
1 | | -import { IApplicationService, URI, ClientAppContribution, localize, CommandContribution, KeybindingContribution, TabBarToolbarContribution, FILE_COMMANDS, CommandRegistry, CommandService, SEARCH_COMMANDS, IElectronNativeDialogService, ToolbarRegistry, KeybindingRegistry, IWindowService, IClipboardService, PreferenceService, formatLocalize, OS, isElectronRenderer, WORKSPACE_COMMANDS } from '@opensumi/ide-core-browser'; |
| 1 | +import { IApplicationService, URI, ClientAppContribution, localize, CommandContribution, KeybindingContribution, TabBarToolbarContribution, FILE_COMMANDS, CommandRegistry, CommandService, SEARCH_COMMANDS, IElectronNativeDialogService, ToolbarRegistry, KeybindingRegistry, IWindowService, IClipboardService, PreferenceService, formatLocalize, OS, isElectronRenderer, WORKSPACE_COMMANDS, AppConfig } from '@opensumi/ide-core-browser'; |
2 | 2 | import { Domain } from '@opensumi/ide-core-common/lib/di-helper'; |
3 | 3 | import { Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di'; |
4 | 4 | import { FileTreeService } from './file-tree.service'; |
5 | 5 | import { IMainLayoutService, IViewsRegistry, MainLayoutContribution } from '@opensumi/ide-main-layout'; |
6 | 6 | import { ExplorerContainerId } from '@opensumi/ide-explorer/lib/browser/explorer-contribution'; |
7 | | -import { KAITIAN_MULTI_WORKSPACE_EXT, IWorkspaceService, UNTITLED_WORKSPACE } from '@opensumi/ide-workspace'; |
| 7 | +import { DEFAULT_WORKSPACE_SUFFIX_NAME, IWorkspaceService, UNTITLED_WORKSPACE } from '@opensumi/ide-workspace'; |
8 | 8 | import { FileTree } from './file-tree'; |
9 | 9 | import { SymlinkDecorationsProvider } from './symlink-file-decoration'; |
10 | 10 | import { IDecorationsService } from '@opensumi/ide-decoration'; |
@@ -63,8 +63,15 @@ export class FileTreeContribution implements MenuContribution, CommandContributi |
63 | 63 | @Autowired(IApplicationService) |
64 | 64 | private readonly appService: IApplicationService; |
65 | 65 |
|
| 66 | + @Autowired(AppConfig) |
| 67 | + private readonly appConfig: AppConfig; |
| 68 | + |
66 | 69 | private isRendered = false; |
67 | 70 |
|
| 71 | + get workspaceSuffixName() { |
| 72 | + return this.appConfig.workspaceSuffixName || DEFAULT_WORKSPACE_SUFFIX_NAME; |
| 73 | + } |
| 74 | + |
68 | 75 | initialize() { |
69 | 76 | // 等待排除配置初始化结束后再初始化文件树 |
70 | 77 | this.workspaceService.initFileServiceExclude().then(() => { |
@@ -122,7 +129,7 @@ export class FileTreeContribution implements MenuContribution, CommandContributi |
122 | 129 | const uri = new URI(workspace.uri); |
123 | 130 | resourceTitle = uri.displayName; |
124 | 131 | if (!workspace.isDirectory && |
125 | | - (resourceTitle.endsWith(`.${KAITIAN_MULTI_WORKSPACE_EXT}`))) { |
| 132 | + (resourceTitle.endsWith(`.${this.workspaceSuffixName}`))) { |
126 | 133 | resourceTitle = resourceTitle.slice(0, resourceTitle.lastIndexOf('.')); |
127 | 134 | if (resourceTitle === UNTITLED_WORKSPACE) { |
128 | 135 | return localize('file.workspace.defaultTip'); |
@@ -639,7 +646,7 @@ export class FileTreeContribution implements MenuContribution, CommandContributi |
639 | 646 | ], |
640 | 647 | filters: [{ |
641 | 648 | name: localize('workspace.openWorkspaceTitle'), |
642 | | - extensions: [KAITIAN_MULTI_WORKSPACE_EXT], |
| 649 | + extensions: [this.workspaceSuffixName], |
643 | 650 | }], |
644 | 651 | }).then((paths) => { |
645 | 652 | if (paths && paths.length > 0) { |
|
0 commit comments