|
331 | 331 | <!-- 文件夹内全局搜索 --> |
332 | 332 | <SearchPanel v-if="showSearch && rootDir" :root-dir="rootDir" :extra-roots="extraRoots" :scope="searchScope" @open="openSearchResult" @replaced="reloadAffectedFiles" @close="showSearch = false"/> |
333 | 333 |
|
| 334 | + <WorkspaceManager v-if="showWorkspaces" :root-dir="rootDir" :extra-roots="extraRoots" @open="openWorkspace" @close="showWorkspaces = false"/> |
| 335 | + |
334 | 336 | <!-- 快速打开文件 --> |
335 | 337 | <QuickOpen v-if="showQuickOpen && rootDir" |
336 | 338 | :root-dir="rootDir" |
@@ -591,6 +593,7 @@ import {useDebug} from './composables/useDebug' |
591 | 593 | import AiAssistant from './components/AiAssistant.vue' |
592 | 594 | import InlineGenerate from './components/InlineGenerate.vue' |
593 | 595 | import SearchPanel from './components/SearchPanel.vue' |
| 596 | +import WorkspaceManager from './components/WorkspaceManager.vue' |
594 | 597 | import {useTheme, type AppTheme} from './composables/useTheme' |
595 | 598 | import Modal from './ui/Modal.vue' |
596 | 599 | import Button from './ui/Button.vue' |
@@ -754,7 +757,15 @@ const rootDir = ref<string | null>(null) |
754 | 757 | const {copyPermalink, openPermalink, openRepoOnWeb} = useGitPermalink(rootDir, currentFilePath, cursorInfo) |
755 | 758 |
|
756 | 759 | // 多根工作区:额外挂载的文件夹(Git/搜索仍走主根 rootDir) |
757 | | -const {extraRoots, addWorkspaceFolder, removeWorkspaceFolder, resetExtraRoots} = useWorkspaceRoots(rootDir) |
| 760 | +const {extraRoots, addWorkspaceFolder, removeWorkspaceFolder, resetExtraRoots, setExtraRoots} = useWorkspaceRoots(rootDir) |
| 761 | +
|
| 762 | +// 命名工作区:保存/打开一组根 |
| 763 | +const showWorkspaces = ref(false) |
| 764 | +const openWorkspace = (ws: {rootDir: string; extraRoots: string[]}) => { |
| 765 | + showWorkspaces.value = false |
| 766 | + openFolderPath(ws.rootDir) // 设主根并清空额外根 |
| 767 | + setExtraRoots(ws.extraRoots) // 再恢复该工作区的额外根 |
| 768 | +} |
758 | 769 | const sidebarVisible = ref(kvGet('sidebar-visible') === 'true') |
759 | 770 | // 专注模式:隐藏顶部工具栏/运行输入/侧栏/状态栏,沉浸编辑 |
760 | 771 | const zenMode = ref(false) |
@@ -2231,7 +2242,7 @@ const isOverlayOpen = () => |
2231 | 2242 | || showHistory.value || showViewer.value || showRunPrompt.value |
2232 | 2243 | || showQuickOpen.value || showGenerate.value || showSearch.value |
2233 | 2244 | || showCommandPalette.value || showDiff.value || showGoToLine.value || showOutline.value || showSnippets.value |
2234 | | - || applyPreview.value != null || clipboardDiff.value != null |
| 2245 | + || applyPreview.value != null || clipboardDiff.value != null || showWorkspaces.value |
2235 | 2246 |
|
2236 | 2247 | // 全局快捷键(绑定可在设置中自定义) |
2237 | 2248 | const {matchAction: matchShortcut, reload: reloadShortcuts, getBinding, formatCombo} = useShortcuts() |
@@ -2291,6 +2302,7 @@ const paletteCommands = computed<PaletteCommand[]>(() => [ |
2291 | 2302 | {id: 'formatOnSave', label: formatOnSave.value ? t('command.formatOnSaveOff') : t('command.formatOnSaveOn'), icon: Save, run: () => toggleFormatOnSave()}, |
2292 | 2303 | {id: 'open', label: t('command.open'), icon: FolderOpen, hint: hintOf('open'), run: () => handleOpenFileClick()}, |
2293 | 2304 | {id: 'openFolder', label: t('command.openFolder'), icon: FolderOpen, run: () => openFolder()}, |
| 2305 | + {id: 'workspaces', label: t('command.workspaces'), icon: FolderOpen, run: () => { showWorkspaces.value = true }}, |
2294 | 2306 | {id: 'save', label: t('command.save'), icon: Save, hint: hintOf('save'), run: () => handleSave()}, |
2295 | 2307 | {id: 'saveAs', label: t('command.saveAs'), icon: Save, hint: hintOf('saveAs'), run: () => saveFileAs()}, |
2296 | 2308 | {id: 'newTab', label: t('command.newTab'), icon: Plus, hint: hintOf('newTab'), run: () => handleNewTab()}, |
|
0 commit comments