Skip to content

Commit e75ffd7

Browse files
committed
Adds multi-instance support to Focus & Timeline
1 parent 0ca0a0f commit e75ffd7

5 files changed

Lines changed: 37 additions & 4 deletions

File tree

package.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2475,15 +2475,36 @@
24752475
}
24762476
}
24772477
},
2478+
{
2479+
"id": "focus",
2480+
"title": "Focus View",
2481+
"order": 106,
2482+
"properties": {
2483+
"gitlens.focus.experimental.allowMultipleInstances": {
2484+
"type": "boolean",
2485+
"default": false,
2486+
"markdownDescription": "Specifies whether to allow opening multiple instances of the _Focus View_",
2487+
"scope": "window",
2488+
"order": 10
2489+
}
2490+
}
2491+
},
24782492
{
24792493
"id": "visual-history",
24802494
"title": "Visual File History",
24812495
"order": 106,
24822496
"properties": {
2497+
"gitlens.visualHistory.experimental.allowMultipleInstances": {
2498+
"type": "boolean",
2499+
"default": false,
2500+
"markdownDescription": "Specifies whether to allow opening multiple instances of the _Visual File History_ in the editor area",
2501+
"scope": "window",
2502+
"order": 10
2503+
},
24832504
"gitlens.visualHistory.queryLimit": {
24842505
"type": "number",
24852506
"default": 20,
2486-
"markdownDescription": "Specifies the limit on the how many commits can be queried for statistics in the Visual File History, because of rate limits. Only applies to virtual workspaces.",
2507+
"markdownDescription": "Specifies the limit on the how many commits can be queried for statistics in the _Visual File History_, because of rate limits. Only applies to virtual workspaces.",
24872508
"scope": "window"
24882509
}
24892510
}

src/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export interface Config {
6868
readonly fileAnnotations: {
6969
readonly command: string | null;
7070
};
71+
readonly focus: {
72+
readonly experimental: {
73+
allowMultipleInstances: boolean;
74+
};
75+
};
7176
readonly gitCommands: {
7277
readonly closeOnFocusOut: boolean;
7378
readonly search: {
@@ -192,6 +197,9 @@ export interface Config {
192197
};
193198
readonly visualHistory: {
194199
readonly queryLimit: number;
200+
readonly experimental: {
201+
allowMultipleInstances: boolean;
202+
};
195203
};
196204
readonly worktrees: {
197205
readonly defaultLocation: string | null;

src/plus/webviews/focus/registration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { Disposable, ViewColumn } from 'vscode';
22
import { Commands } from '../../../constants';
33
import { registerCommand } from '../../../system/command';
4+
import { configuration } from '../../../system/configuration';
45
import type { WebviewPanelsProxy, WebviewsController } from '../../../webviews/webviewsController';
56
import type { State } from './protocol';
67

78
export function registerFocusWebviewPanel(controller: WebviewsController) {
89
return controller.registerWebviewPanel<State>(
9-
{ id: Commands.ShowFocusPage },
10+
{ id: Commands.ShowFocusPage, options: { preserveInstance: false } },
1011
{
1112
id: 'gitlens.focus',
1213
fileName: 'focus.html',
@@ -20,6 +21,7 @@ export function registerFocusWebviewPanel(controller: WebviewsController) {
2021
retainContextWhenHidden: true,
2122
enableFindWidget: true,
2223
},
24+
allowMultipleInstances: configuration.get('focus.experimental.allowMultipleInstances'),
2325
},
2426
async (container, host) => {
2527
const { FocusWebviewProvider } = await import(/* webpackChunkName: "focus" */ './focusWebview');

src/plus/webviews/timeline/registration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { Disposable, ViewColumn } from 'vscode';
22
import { Commands } from '../../../constants';
33
import { registerCommand } from '../../../system/command';
4+
import { configuration } from '../../../system/configuration';
45
import type { WebviewPanelsProxy, WebviewsController } from '../../../webviews/webviewsController';
56
import type { State } from './protocol';
67

78
export function registerTimelineWebviewPanel(controller: WebviewsController) {
89
return controller.registerWebviewPanel<State>(
9-
{ id: Commands.ShowTimelinePage },
10+
{ id: Commands.ShowTimelinePage, options: { preserveInstance: false } },
1011
{
1112
id: 'gitlens.timeline',
1213
fileName: 'timeline.html',
@@ -20,6 +21,7 @@ export function registerTimelineWebviewPanel(controller: WebviewsController) {
2021
retainContextWhenHidden: false,
2122
enableFindWidget: false,
2223
},
24+
allowMultipleInstances: configuration.get('visualHistory.experimental.allowMultipleInstances'),
2325
},
2426
async (container, host) => {
2527
const { TimelineWebviewProvider } = await import(/* webpackChunkName: "timeline" */ './timelineWebview');

src/plus/webviews/timeline/timelineWebview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class TimelineWebviewProvider implements WebviewProvider<State> {
138138

139139
void executeCommand<WebviewPanelShowCommandArgs>(
140140
Commands.ShowTimelinePage,
141-
{ _type: 'WebviewPanelShowOptions' },
141+
{ _type: 'WebviewPanelShowOptions', preserveInstance: true },
142142
this._context.uri,
143143
);
144144
},

0 commit comments

Comments
 (0)