дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
The agent composer is now a CodeMirror editor: the text stays plain and is what's sent, while @ file references are drawn as chips (icon, name, lines) that move and delete as one piece, open on click and preview on hover; Backspace after a chip opens it as text. Quotes show as blocks, and sent messages get the same chips and quote blocks. The @ completion lists open editors first, highlights matches and shows the folder; the focused editor's file is offered above the text, a pasted project path becomes a reference, and dropping files shows a hint. Lines copied from an editor paste as a reference, terminal output as a terminal block, and code blocks show as cards. The reference trimming regex avoids lookbehind for WebKit before 16.4.
20 рядки
847 B
TypeScript
20 рядки
847 B
TypeScript
/**
|
|
* Where the text last copied in the IDE came from (an editor's lines, a terminal), so a paste
|
|
* of the same text can say so: the agent composer turns it into a reference or a terminal block.
|
|
*/
|
|
export type CopySource = { kind: "file"; path: string; from: number; to: number } | { kind: "terminal"; title: string };
|
|
|
|
const normalize = (text: string) => text.replace(/\r\n?/g, "\n").replace(/\s+$/, "");
|
|
|
|
let last: { text: string; source: CopySource } | null = null;
|
|
|
|
export function noteCopySource(text: string, source: CopySource) {
|
|
const normalized = normalize(text);
|
|
last = normalized ? { text: normalized, source } : null;
|
|
}
|
|
|
|
/** The source of `text` when it is what was last copied in the IDE. */
|
|
export function copySourceOf(text: string): CopySource | null {
|
|
return last && last.text === normalize(text) ? last.source : null;
|
|
}
|