Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to switch back to separate views #3812

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/views/viewCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ export class ViewCommands implements Disposable {
'gitlens.views.setResultsCommitsFilterOff',
n => this.setResultsCommitsFilter(n, false),
this,
),
),
registerViewCommand('gitlens.views.switchToSeparateViews', this.switchToSeparateViews, this),
);
}

Expand Down Expand Up @@ -1623,6 +1624,22 @@ export class ViewCommands implements Disposable {

void node.triggerChange(true);
}

@log()
private async switchToSeparateViews() {
await configuration.updateEffective('views.scm.grouped.views', {
commits: false,
branches: false,
remotes: false,
stashes: false,
tags: false,
worktrees: false,
contributors: false,
repositories: false,
searchAndCompare: false,
launchpad: false,
});
}
}

async function copyNode(type: ClipboardType, active: ViewNode | undefined, selection: ViewNode[]): Promise<void> {
Expand Down
22 changes: 19 additions & 3 deletions src/views/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class Views implements Disposable {
set lastSelectedScmGroupedView(type: GroupableTreeViewTypes | undefined) {
this._lastSelectedScmGroupedView = type;
void setContext('gitlens:views:scm:grouped:view', type);
void this.container.storage.storeWorkspace('views:scm:grouped:selected', type).catch();
void this.container.storage.storeWorkspace('views:scm:grouped:selected', type);
}

private _scmGroupedView: ScmGroupedView | undefined;
Expand Down Expand Up @@ -294,14 +294,15 @@ export class Views implements Disposable {

registerCommand('gitlens.views.scm.grouped.welcome.dismiss', () => {
this._welcomeDismissed = true;
void this.container.storage.store('views:scm:grouped:welcome:dismissed', true).catch();
void this.container.storage.store('views:scm:grouped:welcome:dismissed', true);
this.updateScmGroupedViewsRegistration();
}),
registerCommand('gitlens.views.scm.grouped.welcome.restore', async () => {
this._welcomeDismissed = true;
void this.container.storage.store('views:scm:grouped:welcome:dismissed', true).catch();
void this.container.storage.store('views:scm:grouped:welcome:dismissed', true);
await updateScmGroupedViewsInConfig(new Set());
}),
registerCommand('gitlens.views.switchToSeparateViews', () => this.switchToSeparateViews()),
];
}

Expand Down Expand Up @@ -841,6 +842,21 @@ export class Views implements Disposable {
return void executeCoreCommand(`gitlens.views.scm.grouped.focus`);
}
}

private async switchToSeparateViews() {
await configuration.updateEffective('views.scm.grouped.views', {
commits: false,
branches: false,
remotes: false,
stashes: false,
tags: false,
worktrees: false,
contributors: false,
repositories: false,
searchAndCompare: false,
launchpad: false,
});
}
}

function getGroupedViews(cfg: Record<GroupableTreeViewTypes, boolean>) {
Expand Down