✨ feat(vscode): 会话 tab 可交接对话给同事
This commit is contained in:
@@ -43,7 +43,7 @@ import {
|
||||
handoffStartedUiPatch,
|
||||
} from './handoff'
|
||||
|
||||
interface RepoCtx {
|
||||
export interface RepoCtx {
|
||||
workspaceRoot: string
|
||||
host: string
|
||||
owner: string
|
||||
@@ -52,17 +52,17 @@ interface RepoCtx {
|
||||
me: string
|
||||
}
|
||||
|
||||
function toast(panel: KanbanWebviewPanel, level: 'info' | 'success' | 'error', message: string, extra?: { id?: string, spinner?: boolean, dismissOnTimer?: number }): string {
|
||||
export function toast(panel: KanbanWebviewPanel, level: 'info' | 'success' | 'error', message: string, extra?: { id?: string, spinner?: boolean, dismissOnTimer?: number }): string {
|
||||
const id = extra?.id ?? makeNonce()
|
||||
panel.postMessage({ type: 'toast/show', id, level, message, spinner: extra?.spinner, dismissOnTimer: extra?.dismissOnTimer ?? 6000 })
|
||||
return id
|
||||
}
|
||||
|
||||
function dismiss(panel: KanbanWebviewPanel, id: string): void {
|
||||
export function dismiss(panel: KanbanWebviewPanel, id: string): void {
|
||||
panel.postMessage({ type: 'toast/dismiss', id })
|
||||
}
|
||||
|
||||
async function resolveRepoCtx(panel: KanbanWebviewPanel): Promise<RepoCtx | undefined> {
|
||||
export async function resolveRepoCtx(panel: KanbanWebviewPanel): Promise<RepoCtx | undefined> {
|
||||
const workspaceRoot = workspace.workspaceFolders?.[0]?.uri.fsPath
|
||||
if (!workspaceRoot) {
|
||||
toast(panel, 'error', '请先打开一个工作区文件夹')
|
||||
@@ -98,7 +98,7 @@ function str(v: unknown): string | undefined {
|
||||
return typeof v === 'string' && v.length > 0 ? v : undefined
|
||||
}
|
||||
|
||||
function scratchDir(prefix: string): Promise<string> {
|
||||
export function scratchDir(prefix: string): Promise<string> {
|
||||
return fsp.mkdtemp(path.join(os.tmpdir(), prefix))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user