File tree Expand file tree Collapse file tree 1 file changed +24
-10
lines changed
src/integrations/workspace Expand file tree Collapse file tree 1 file changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -60,21 +60,35 @@ class WorkspaceTracker {
6060
6161 this . disposables . push ( watcher )
6262
63- this . disposables . push ( vscode . window . tabGroups . onDidChangeTabs ( ( ) => this . workspaceDidReset ( ) ) )
63+ // Listen for tab changes and call workspaceDidUpdate directly
64+ this . disposables . push (
65+ vscode . window . tabGroups . onDidChangeTabs ( ( ) => {
66+ // Reset if workspace path has changed
67+ if ( this . prevWorkSpacePath !== this . cwd ) {
68+ this . workspaceDidReset ( )
69+ } else {
70+ // Otherwise just update
71+ this . workspaceDidUpdate ( )
72+ }
73+ } ) ,
74+ )
6475 }
6576
6677 private getOpenedTabsInfo ( ) {
67- return vscode . window . tabGroups . all . flatMap ( ( group ) =>
68- group . tabs
69- . filter ( ( tab ) => tab . input instanceof vscode . TabInputText )
70- . map ( ( tab ) => {
71- const path = ( tab . input as vscode . TabInputText ) . uri . fsPath
72- return {
78+ return vscode . window . tabGroups . all . reduce (
79+ ( acc , group ) => {
80+ const groupTabs = group . tabs
81+ . filter ( ( tab ) => tab . input instanceof vscode . TabInputText )
82+ . map ( ( tab ) => ( {
7383 label : tab . label ,
7484 isActive : tab . isActive ,
75- path : toRelativePath ( path , this . cwd || "" ) ,
76- }
77- } ) ,
85+ path : toRelativePath ( ( tab . input as vscode . TabInputText ) . uri . fsPath , this . cwd || "" ) ,
86+ } ) )
87+
88+ groupTabs . forEach ( ( tab ) => ( tab . isActive ? acc . unshift ( tab ) : acc . push ( tab ) ) )
89+ return acc
90+ } ,
91+ [ ] as Array < { label : string ; isActive : boolean ; path : string } > ,
7892 )
7993 }
8094
You can’t perform that action at this time.
0 commit comments