File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import { initDockView } from './dock';
1515import { setupVEnv } from './venv' ;
1616import { initAPI } from './api' ;
1717import { openWorkspaceProjectsWebview } from './webviews/project' ;
18- import { initProjectTree } from './project/tree' ;
18+ import { initProjectTree , setCurrentSelectedBspItem } from './project/tree' ;
1919import { DecorationProvider } from './project/fileDecorationProvider' ;
2020import { getCurrentProjectInWorkspace } from './webviews/project' ;
2121import { initCurrentProject } from './project/cmd' ;
@@ -73,6 +73,8 @@ export async function activate(context: vscode.ExtensionContext) {
7373 DecorationProvider . getInstance ( ) . markFile ( vscode . Uri . file ( currentProject ) ) ;
7474 // 初始化当前项目到 cmd.ts 的 _currentProject 变量
7575 initCurrentProject ( currentProject ) ;
76+ // 初始化当前选中的BSP项目,以便后续切换时能正确移除标记
77+ setCurrentSelectedBspItem ( currentProject ) ;
7678 }
7779 }
7880 }
Original file line number Diff line number Diff line change @@ -18,6 +18,17 @@ let currentSelectedBspItem: ProjectTreeItem | null = null;
1818// 添加树视图刷新事件发射器
1919let _onDidChangeTreeData : vscode . EventEmitter < ProjectTreeItem | undefined > | null = null ;
2020
21+ // 设置当前选中的BSP项目(用于初始化时设置)
22+ export function setCurrentSelectedBspItem ( fn : string ) {
23+ // Create a minimal ProjectTreeItem for tracking
24+ currentSelectedBspItem = new ProjectTreeItem (
25+ path . basename ( fn ) ,
26+ vscode . TreeItemCollapsibleState . None ,
27+ 'project_bsp' ,
28+ fn
29+ ) ;
30+ }
31+
2132export class ProjectTreeItem extends vscode . TreeItem {
2233 children : ProjectTreeItem [ ] ;
2334 fn : string = '' ;
You can’t perform that action at this time.
0 commit comments