✨ feat(vscode): 设置可关新开终端分屏
This commit is contained in:
1 parent
7463113170
commit
ffae9ce2b8
11 files changed
+66
-7
No files matched your search
@@ -932,6 +932,7 @@ export class KanbanWebviewPanel {
|
||||
worktreePreRemoveScript: s.worktreePreRemoveScript,
|
||||
implTabPreCreateScript: s.implTabPreCreateScript,
|
||||
implTabPostCloseScript: s.implTabPostCloseScript,
|
||||
splitNewTerminals: s.splitNewTerminals,
|
||||
conflictResolutionProfilePath: s.conflictResolutionProfilePath,
|
||||
commitProfilePath: await getEffectiveCommitProfilePath(this.context),
|
||||
prDiffSummaryProfilePath: await getEffectivePrDiffSummaryProfilePath(this.context),
|
||||
@@ -1010,6 +1011,7 @@ export class KanbanWebviewPanel {
|
||||
worktreePreRemoveScript: s.worktreePreRemoveScript,
|
||||
implTabPreCreateScript: s.implTabPreCreateScript,
|
||||
implTabPostCloseScript: s.implTabPostCloseScript,
|
||||
splitNewTerminals: s.splitNewTerminals,
|
||||
conflictResolutionProfilePath: s.conflictResolutionProfilePath,
|
||||
commitProfilePath: await getEffectiveCommitProfilePath(this.context),
|
||||
prDiffSummaryProfilePath: await getEffectivePrDiffSummaryProfilePath(this.context),
|
||||
|
||||
@@ -38,6 +38,7 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
|
||||
worktreePreRemoveScript: string
|
||||
implTabPreCreateScript: string
|
||||
implTabPostCloseScript: string
|
||||
splitNewTerminals: boolean
|
||||
conflictResolutionProfilePath: string
|
||||
commitProfilePath: string
|
||||
prDiffSummaryProfilePath: string
|
||||
@@ -116,6 +117,7 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
|
||||
worktreePreRemoveScript: trimmedPreRemove,
|
||||
implTabPreCreateScript: trimmedImplPre,
|
||||
implTabPostCloseScript: trimmedImplPost,
|
||||
splitNewTerminals: payload.splitNewTerminals,
|
||||
conflictResolutionProfilePath: trimmedConflictProfile,
|
||||
commitProfilePath: trimmedCommitProfile,
|
||||
prDiffSummaryProfilePath: trimmedPrDiffSummaryProfile,
|
||||
@@ -144,6 +146,7 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
|
||||
worktreePreRemoveScript: trimmedPreRemove,
|
||||
implTabPreCreateScript: trimmedImplPre,
|
||||
implTabPostCloseScript: trimmedImplPost,
|
||||
splitNewTerminals: payload.splitNewTerminals,
|
||||
conflictResolutionProfilePath: trimmedConflictProfile,
|
||||
commitProfilePath: trimmedCommitProfile,
|
||||
prDiffSummaryProfilePath: trimmedPrDiffSummaryProfile,
|
||||
@@ -249,6 +252,7 @@ export async function handleEditSettingsRequest(panel: KanbanWebviewPanel): Prom
|
||||
worktreePreRemoveScript: s.worktreePreRemoveScript,
|
||||
implTabPreCreateScript: s.implTabPreCreateScript,
|
||||
implTabPostCloseScript: s.implTabPostCloseScript,
|
||||
splitNewTerminals: s.splitNewTerminals,
|
||||
conflictResolutionProfilePath: s.conflictResolutionProfilePath,
|
||||
commitProfilePath,
|
||||
prDiffSummaryProfilePath,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { terminalEditorColumn } from '../terminalColumn'
|
||||
|
||||
describe('terminalEditorColumn', () => {
|
||||
it('分屏 → 右侧第 2 栏', () => {
|
||||
expect(terminalEditorColumn(true)).toBe(2)
|
||||
})
|
||||
it('不分屏 → 当前栏(只加标签)', () => {
|
||||
expect(terminalEditorColumn(false)).toBe(-1)
|
||||
})
|
||||
})
|
||||
@@ -4,16 +4,14 @@ import type {
|
||||
} from 'vscode'
|
||||
import type { Issue } from '../../gitea/types'
|
||||
import type { KanbanWebviewPanel } from '../KanbanPanel'
|
||||
import { ViewColumn, window } from 'vscode'
|
||||
import { window } from 'vscode'
|
||||
import { logger } from '../../logging/logger'
|
||||
import { getSettings } from '../../settings/store'
|
||||
import { terminalEditorColumn } from '../terminalColumn'
|
||||
|
||||
export function resolveTerminalLocation(panel: KanbanWebviewPanel | null, preserveFocus: boolean): TerminalEditorLocationOptions {
|
||||
void panel
|
||||
// Pin all plugin-managed terminals to editor group 2 (right side of the
|
||||
// kanban panel in column 1). VS Code creates the group on demand if it
|
||||
// doesn't exist yet, and stacks new terminals as tabs in that group when
|
||||
// it does — exactly what we want, no manual scan of existing tabs needed.
|
||||
return { viewColumn: ViewColumn.Two, preserveFocus }
|
||||
const split = panel ? getSettings(panel.context).splitNewTerminals : true
|
||||
return { viewColumn: terminalEditorColumn(split), preserveFocus }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,6 +84,7 @@ export type ExtensionToWebview
|
||||
worktreePreRemoveScript: string
|
||||
implTabPreCreateScript: string
|
||||
implTabPostCloseScript: string
|
||||
splitNewTerminals: boolean
|
||||
conflictResolutionProfilePath: string
|
||||
commitProfilePath: string
|
||||
prDiffSummaryProfilePath: string
|
||||
@@ -162,6 +163,7 @@ export type WebviewToExtension
|
||||
worktreePreRemoveScript: string
|
||||
implTabPreCreateScript: string
|
||||
implTabPostCloseScript: string
|
||||
splitNewTerminals: boolean
|
||||
conflictResolutionProfilePath: string
|
||||
commitProfilePath: string
|
||||
prDiffSummaryProfilePath: string
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 会话终端落在编辑区哪一栏。
|
||||
* 数值对齐 VS Code ViewColumn:2 = Two(右侧分屏),-1 = Active(当前栏只加标签)。
|
||||
*/
|
||||
export function terminalEditorColumn(split: boolean): 2 | -1 {
|
||||
return split ? 2 : -1
|
||||
}
|
||||
Reference in new issue
Block a user