* feat(chat): render code comments as cards instead of fenced text * fix(vscode): route Add Comment to the active session editor panel * fix(chat): persist queued inline comments and tighten file-chip path matching * feat(vscode): comment on code from the editor * fix(chat): keep attached context in the message and broadcast comment removal * fix(vscode): hold every pending comment and gate both entry points on the workspace * fix(vscode): let only the owning surface decide its comment threads * fix(vscode): drop a comment removed while its delivery was still in flight * test(vscode): cover the in-flight comment removal guard * test(vscode): cover comment removal reaching every chat surface * fix(vscode): give up on a comment the chat never confirmed holding * fix(vscode): retract a comment everywhere before reporting it discarded * fix(chat): preserve queued comment cards * fix: preserve inline comment context across send paths * fix(chat): preserve command routing with context * fix(chat): keep unavailable actions on normal send path --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
18 lines
710 B
TypeScript
18 lines
710 B
TypeScript
/**
|
|
* Pure selection logic shared by the session editor panel routing
|
|
* (`*ToActivePanel` methods). Kept free of the `vscode` dependency so it can be
|
|
* unit tested in isolation.
|
|
*
|
|
* A right-click command targets the panel the user is currently in. We prefer a
|
|
* panel that is actively focused; otherwise we fall back to the panel that was
|
|
* focused most recently. The caller is responsible for confirming the returned
|
|
* id still maps to a live panel.
|
|
*/
|
|
export function pickActivePanelId(
|
|
panels: Array<{ id: string; active: boolean }>,
|
|
lastActivePanelId: string | null,
|
|
): string | null {
|
|
const active = panels.find((panel) => panel.active);
|
|
return active?.id ?? lastActivePanelId ?? null;
|
|
}
|