From 42e396db338758344ebfc379e384866387e0c771 Mon Sep 17 00:00:00 2001 From: CHEA Oudomrasmey <181932704+thekingq20@users.noreply.github.com> Date: Fri, 29 Nov 2024 02:35:38 +0700 Subject: [PATCH 1/2] Add command to switch back to separate views Related to #3766 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/gitkraken/vscode-gitlens/issues/3766?shareId=XXXX-XXXX-XXXX-XXXX). --- src/views/viewCommands.ts | 19 ++++++++++++++++++- src/views/views.ts | 16 ++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/views/viewCommands.ts b/src/views/viewCommands.ts index 44111c845bff6..bd1f20166dfe5 100644 --- a/src/views/viewCommands.ts +++ b/src/views/viewCommands.ts @@ -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), ); } @@ -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 { diff --git a/src/views/views.ts b/src/views/views.ts index d2af5d99a0731..3f2b9ec122438 100644 --- a/src/views/views.ts +++ b/src/views/views.ts @@ -302,6 +302,7 @@ export class Views implements Disposable { void this.container.storage.store('views:scm:grouped:welcome:dismissed', true); await updateScmGroupedViewsInConfig(new Set()); }), + registerCommand('gitlens.views.switchToSeparateViews', () => this.switchToSeparateViews()), ]; } @@ -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) { From 3a74f8fd7d48561537676fe0da042aea2d324538 Mon Sep 17 00:00:00 2001 From: CHEA Oudomrasmey <181932704+thekingq20@users.noreply.github.com> Date: Thu, 12 Dec 2024 09:32:33 +0700 Subject: [PATCH 2/2] Add command to switch back to separate views * **`src/views/viewCommands.ts`** - Add `switchToSeparateViews` command. - Implement logic to switch back to separate views in the new command. * **`src/views/views.ts`** - Register `switchToSeparateViews` command in `registerCommands` function. - Update `initialize` function to handle the new command and switch back to separate views. --- src/views/views.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/views.ts b/src/views/views.ts index 56ac86a0b0ba4..3f2b9ec122438 100644 --- a/src/views/views.ts +++ b/src/views/views.ts @@ -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; @@ -294,12 +294,12 @@ 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()),