@@ -13,45 +13,36 @@ import { SearchAndCompareView } from './searchAndCompareView';
1313import { StashesView } from './stashesView' ;
1414import { TagsView } from './tagsView' ;
1515import type { TreeViewByType } from './viewBase' ;
16+ import type { Views } from './views' ;
1617import { WorktreesView } from './worktreesView' ;
1718
18- let lastView : GroupableTreeViewTypes | undefined ;
19- export function getLastView ( ) : GroupableTreeViewTypes | undefined ;
20- export function getLastView ( defaultType : GroupableTreeViewTypes ) : GroupableTreeViewTypes ;
21- export function getLastView ( defaultType ?: GroupableTreeViewTypes ) {
22- return lastView ?? defaultType ;
23- }
24-
25- export function setLastView ( type : GroupableTreeViewTypes | undefined ) {
26- lastView = type ;
27- }
28-
29- export class GroupedView implements Disposable {
19+ export class ScmGroupedView implements Disposable {
3020 private _disposable : Disposable ;
3121 private _view : TreeViewByType [ GroupableTreeViewTypes ] | undefined ;
3222
3323 constructor (
3424 private readonly container : Container ,
25+ private views : Views ,
3526 private readonly included : GroupableTreeViewTypes [ ] ,
3627 ) {
3728 this . _disposable = Disposable . from (
38- registerCommand ( 'gitlens.views.grouped.refresh' , ( ) => {
29+ registerCommand ( 'gitlens.views.scm. grouped.refresh' , ( ) => {
3930 if ( this . _view == null ) return ;
4031
4132 executeCommand ( `gitlens.views.${ this . _view . type } .refresh` as Commands ) ;
4233 } ) ,
43- registerCommand ( 'gitlens.views.grouped.branches' , ( ) => this . setView ( 'branches' ) ) ,
44- registerCommand ( 'gitlens.views.grouped.commits' , ( ) => this . setView ( 'commits' ) ) ,
45- registerCommand ( 'gitlens.views.grouped.contributors' , ( ) => this . setView ( 'contributors' ) ) ,
46- registerCommand ( 'gitlens.views.grouped.remotes' , ( ) => this . setView ( 'remotes' ) ) ,
47- registerCommand ( 'gitlens.views.grouped.repositories' , ( ) => this . setView ( 'repositories' ) ) ,
48- registerCommand ( 'gitlens.views.grouped.searchAndCompare' , ( ) => this . setView ( 'searchAndCompare' ) ) ,
49- registerCommand ( 'gitlens.views.grouped.stashes' , ( ) => this . setView ( 'stashes' ) ) ,
50- registerCommand ( 'gitlens.views.grouped.tags' , ( ) => this . setView ( 'tags' ) ) ,
51- registerCommand ( 'gitlens.views.grouped.worktrees' , ( ) => this . setView ( 'worktrees' ) ) ,
34+ registerCommand ( 'gitlens.views.scm. grouped.branches' , ( ) => this . setView ( 'branches' ) ) ,
35+ registerCommand ( 'gitlens.views.scm. grouped.commits' , ( ) => this . setView ( 'commits' ) ) ,
36+ registerCommand ( 'gitlens.views.scm. grouped.contributors' , ( ) => this . setView ( 'contributors' ) ) ,
37+ registerCommand ( 'gitlens.views.scm. grouped.remotes' , ( ) => this . setView ( 'remotes' ) ) ,
38+ registerCommand ( 'gitlens.views.scm. grouped.repositories' , ( ) => this . setView ( 'repositories' ) ) ,
39+ registerCommand ( 'gitlens.views.scm. grouped.searchAndCompare' , ( ) => this . setView ( 'searchAndCompare' ) ) ,
40+ registerCommand ( 'gitlens.views.scm. grouped.stashes' , ( ) => this . setView ( 'stashes' ) ) ,
41+ registerCommand ( 'gitlens.views.scm. grouped.tags' , ( ) => this . setView ( 'tags' ) ) ,
42+ registerCommand ( 'gitlens.views.scm. grouped.worktrees' , ( ) => this . setView ( 'worktrees' ) ) ,
5243 ) ;
5344
54- this . _view = this . setView ( getLastView ( this . included [ 0 ] ) ) ;
45+ this . _view = this . setView ( this . views . lastSelectedScmGroupedView ! ) ;
5546 }
5647
5748 dispose ( ) {
@@ -63,11 +54,11 @@ export class GroupedView implements Disposable {
6354 if ( ! this . included . includes ( type ) ) {
6455 type = this . included [ 0 ] as T ;
6556 }
66- setLastView ( type ) ;
57+ this . views . lastSelectedScmGroupedView = type ;
6758
6859 if ( this . _view ?. type === type ) return this . _view as TreeViewByType [ T ] ;
6960
70- void setContext ( 'gitlens:views:grouped:view' , type ) ;
61+ void setContext ( 'gitlens:views:scm: grouped:view' , type ) ;
7162 this . _view ?. dispose ( ) ;
7263
7364 this . _view = this . getView ( type ) ;
0 commit comments