Switch to double quotes and reformat codebase with Biome

This commit is contained in:
Mohamed Boudra
2026-03-21 20:22:15 +07:00
parent ab40786882
commit f6579dbeb4
805 changed files with 38132 additions and 40175 deletions
@@ -1,48 +1,48 @@
export interface FileMentionRange {
start: number
end: number
query: string
start: number;
end: number;
query: string;
}
interface FindActiveFileMentionInput {
text: string
cursorIndex: number
text: string;
cursorIndex: number;
}
interface ApplyFileMentionReplacementInput {
text: string
mention: FileMentionRange
relativePath: string
text: string;
mention: FileMentionRange;
relativePath: string;
}
const INVALID_MENTION_QUERY_CHARS = /[\s\n\r\t"']/
const INVALID_MENTION_QUERY_CHARS = /[\s\n\r\t"']/;
export function findActiveFileMention(input: FindActiveFileMentionInput): FileMentionRange | null {
const clampedCursor = Math.max(0, Math.min(input.cursorIndex, input.text.length))
const beforeCursor = input.text.slice(0, clampedCursor)
const clampedCursor = Math.max(0, Math.min(input.cursorIndex, input.text.length));
const beforeCursor = input.text.slice(0, clampedCursor);
for (
let atIndex = beforeCursor.lastIndexOf('@');
let atIndex = beforeCursor.lastIndexOf("@");
atIndex >= 0;
atIndex = beforeCursor.lastIndexOf('@', atIndex - 1)
atIndex = beforeCursor.lastIndexOf("@", atIndex - 1)
) {
const query = beforeCursor.slice(atIndex + 1)
const query = beforeCursor.slice(atIndex + 1);
if (INVALID_MENTION_QUERY_CHARS.test(query)) {
continue
continue;
}
return {
start: atIndex,
end: clampedCursor,
query,
}
};
}
return null
return null;
}
export function applyFileMentionReplacement(input: ApplyFileMentionReplacementInput): string {
const safePath = input.relativePath.replace(/"/g, '\\"')
const before = input.text.slice(0, input.mention.start)
const after = input.text.slice(input.mention.end)
return `${before}"${safePath}"${after}`
const safePath = input.relativePath.replace(/"/g, '\\"');
const before = input.text.slice(0, input.mention.start);
const after = input.text.slice(input.mention.end);
return `${before}"${safePath}"${after}`;
}