✨ feat(vscode): 支持讨论评论引用与 macOS 系统级新评论桌面提醒

This commit is contained in:
cruldra committed 2026-09-29 04:23:57 +08:00
1 parent 540c212bad
commit a2c3c1f919
13 files changed
+638 -302

No files matched your search

+27 -2
View File
@@ -73,6 +73,7 @@ export class KanbanWebviewPanel {
private me: string | undefined
/** webview 已发过 issues/refresh,此后才 postMessage,避免启动时消息丢。 */
private webviewReady = false
private pendingSelectOnReady?: { issueNumber: number, tab?: 'issue' | 'chat' | 'profile' | 'sessions' | 'changes' }
private loadInFlight: Promise<void> | undefined
private lastIssuesUpdate: Extract<ExtensionToWebview, { type: 'issues/update' }> | undefined
/**
@@ -334,10 +335,10 @@ export class KanbanWebviewPanel {
this.handleActiveTerminalChanged(activated)
}
static createOrShow(context: ExtensionContext): void {
static createOrShow(context: ExtensionContext): KanbanWebviewPanel {
if (KanbanWebviewPanel.current) {
KanbanWebviewPanel.current.panel.reveal(ViewColumn.Active)
return
return KanbanWebviewPanel.current
}
const panel = window.createWebviewPanel(
KanbanWebviewPanel.viewType,
@@ -352,6 +353,20 @@ export class KanbanWebviewPanel {
},
)
KanbanWebviewPanel.current = new KanbanWebviewPanel(context, panel)
return KanbanWebviewPanel.current
}
reveal(viewColumn: ViewColumn = ViewColumn.Active): void {
this.panel.reveal(viewColumn)
}
selectIssueAndTab(issueNumber: number, tab?: 'issue' | 'chat' | 'profile' | 'sessions' | 'changes'): void {
if (this.webviewReady) {
this.postMessage({ type: 'issue/select-by-number', issueNumber, tab })
}
else {
this.pendingSelectOnReady = { issueNumber, tab }
}
}
/** Triggers a fresh load on the currently open panel, if any. */
@@ -399,6 +414,11 @@ export class KanbanWebviewPanel {
if (first && this.lastIssuesUpdate) {
this.postMessage(this.lastIssuesUpdate)
this.postMessage({ type: 'commit/has-changes', value: this.hasGitChanges })
if (this.pendingSelectOnReady) {
const { issueNumber, tab } = this.pendingSelectOnReady
this.pendingSelectOnReady = undefined
this.postMessage({ type: 'issue/select-by-number', issueNumber, tab })
}
return
}
void this.loadAndPush()
@@ -1116,6 +1136,11 @@ export class KanbanWebviewPanel {
// refresh after git events already fired) still picks up the latest
// value. Cheap — the webview discards if equal.
this.postMessage({ type: 'commit/has-changes', value: this.hasGitChanges })
if (this.pendingSelectOnReady) {
const { issueNumber, tab } = this.pendingSelectOnReady
this.pendingSelectOnReady = undefined
this.postMessage({ type: 'issue/select-by-number', issueNumber, tab })
}
}
}
catch (err) {
+1 -1
View File
@@ -64,7 +64,7 @@ export type ExtensionToWebview
| { type: 'session-handoff/pending', items: SessionHandoffPendingItem[] }
| { type: 'session-handoff/done', sessionId: string }
| { type: 'issue/append', issue: Issue, select?: boolean }
| { type: 'issue/select-by-number', issueNumber: number }
| { type: 'issue/select-by-number', issueNumber: number, tab?: 'issue' | 'chat' | 'profile' | 'sessions' | 'changes' }
| {
type: 'settings/show'
host: string