mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 22:03:45 +00:00
Enable more biome lints and fix things
This commit is contained in:
parent
9c18439c4d
commit
d5fd685901
57 changed files with 151 additions and 199 deletions
|
|
@ -202,7 +202,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
const isSlashCommand = prefix.startsWith("/") && beforePrefix.trim() === "" && !prefix.slice(1).includes("/");
|
||||
if (isSlashCommand) {
|
||||
// This is a command name completion
|
||||
const newLine = beforePrefix + "/" + item.value + " " + afterCursor;
|
||||
const newLine = `${beforePrefix}/${item.value} ${afterCursor}`;
|
||||
const newLines = [...lines];
|
||||
newLines[cursorLine] = newLine;
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
// Check if we're completing a file attachment (prefix starts with "@")
|
||||
if (prefix.startsWith("@")) {
|
||||
// This is a file attachment completion
|
||||
const newLine = beforePrefix + item.value + " " + afterCursor;
|
||||
const newLine = `${beforePrefix + item.value} ${afterCursor}`;
|
||||
const newLines = [...lines];
|
||||
newLines[cursorLine] = newLine;
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
if (path.startsWith("~/")) {
|
||||
const expandedPath = join(homedir(), path.slice(2));
|
||||
// Preserve trailing slash if original path had one
|
||||
return path.endsWith("/") && !expandedPath.endsWith("/") ? expandedPath + "/" : expandedPath;
|
||||
return path.endsWith("/") && !expandedPath.endsWith("/") ? `${expandedPath}/` : expandedPath;
|
||||
} else if (path === "~") {
|
||||
return homedir();
|
||||
}
|
||||
|
|
@ -387,20 +387,20 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
if (isAtPrefix) {
|
||||
const pathWithoutAt = expandedPrefix;
|
||||
if (pathWithoutAt.endsWith("/")) {
|
||||
relativePath = "@" + pathWithoutAt + name;
|
||||
relativePath = `@${pathWithoutAt}${name}`;
|
||||
} else if (pathWithoutAt.includes("/")) {
|
||||
if (pathWithoutAt.startsWith("~/")) {
|
||||
const homeRelativeDir = pathWithoutAt.slice(2); // Remove ~/
|
||||
const dir = dirname(homeRelativeDir);
|
||||
relativePath = "@~/" + (dir === "." ? name : join(dir, name));
|
||||
relativePath = `@~/${dir === "." ? name : join(dir, name)}`;
|
||||
} else {
|
||||
relativePath = "@" + join(dirname(pathWithoutAt), name);
|
||||
relativePath = `@${join(dirname(pathWithoutAt), name)}`;
|
||||
}
|
||||
} else {
|
||||
if (pathWithoutAt.startsWith("~")) {
|
||||
relativePath = "@~/" + name;
|
||||
relativePath = `@~/${name}`;
|
||||
} else {
|
||||
relativePath = "@" + name;
|
||||
relativePath = `@${name}`;
|
||||
}
|
||||
}
|
||||
} else if (prefix.endsWith("/")) {
|
||||
|
|
@ -411,14 +411,14 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
if (prefix.startsWith("~/")) {
|
||||
const homeRelativeDir = prefix.slice(2); // Remove ~/
|
||||
const dir = dirname(homeRelativeDir);
|
||||
relativePath = "~/" + (dir === "." ? name : join(dir, name));
|
||||
relativePath = `~/${dir === "." ? name : join(dir, name)}`;
|
||||
} else if (prefix.startsWith("/")) {
|
||||
// Absolute path - construct properly
|
||||
const dir = dirname(prefix);
|
||||
if (dir === "/") {
|
||||
relativePath = "/" + name;
|
||||
relativePath = `/${name}`;
|
||||
} else {
|
||||
relativePath = dir + "/" + name;
|
||||
relativePath = `${dir}/${name}`;
|
||||
}
|
||||
} else {
|
||||
relativePath = join(dirname(prefix), name);
|
||||
|
|
@ -426,14 +426,14 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
} else {
|
||||
// For standalone entries, preserve ~/ if original prefix was ~/
|
||||
if (prefix.startsWith("~")) {
|
||||
relativePath = "~/" + name;
|
||||
relativePath = `~/${name}`;
|
||||
} else {
|
||||
relativePath = name;
|
||||
}
|
||||
}
|
||||
|
||||
suggestions.push({
|
||||
value: isDirectory ? relativePath + "/" : relativePath,
|
||||
value: isDirectory ? `${relativePath}/` : relativePath,
|
||||
label: name,
|
||||
description: isDirectory ? "directory" : "file",
|
||||
});
|
||||
|
|
@ -449,7 +449,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
});
|
||||
|
||||
return suggestions;
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
// Directory doesn't exist or not accessible
|
||||
return [];
|
||||
}
|
||||
|
|
@ -509,7 +509,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|||
const entryName = basename(pathWithoutSlash);
|
||||
|
||||
suggestions.push({
|
||||
value: "@" + entryPath,
|
||||
value: `@${entryPath}`,
|
||||
label: entryName + (isDirectory ? "/" : ""),
|
||||
description: pathWithoutSlash,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1310,10 +1310,6 @@ https://github.com/EsotericSoftware/spine-runtimes/actions/runs/19536643416/job/
|
|||
// Always create new SelectList to ensure update
|
||||
this.autocompleteList = new SelectList(suggestions.items, 5, this.theme.selectList);
|
||||
} else {
|
||||
// No matches - check if we're still in a valid context before cancelling
|
||||
const currentLine = this.state.lines[this.state.cursorLine] || "";
|
||||
const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
|
||||
|
||||
this.cancelAutocomplete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ export class Markdown implements Component {
|
|||
switch (token.type) {
|
||||
case "heading": {
|
||||
const headingLevel = token.depth;
|
||||
const headingPrefix = "#".repeat(headingLevel) + " ";
|
||||
const headingPrefix = `${"#".repeat(headingLevel)} `;
|
||||
const headingText = this.renderInlineTokens(token.tokens || []);
|
||||
let styledHeading: string;
|
||||
if (headingLevel === 1) {
|
||||
|
|
@ -263,17 +263,17 @@ export class Markdown implements Component {
|
|||
}
|
||||
|
||||
case "code": {
|
||||
lines.push(this.theme.codeBlockBorder("```" + (token.lang || "")));
|
||||
lines.push(this.theme.codeBlockBorder(`\`\`\`${token.lang || ""}`));
|
||||
if (this.theme.highlightCode) {
|
||||
const highlightedLines = this.theme.highlightCode(token.text, token.lang);
|
||||
for (const hlLine of highlightedLines) {
|
||||
lines.push(" " + hlLine);
|
||||
lines.push(` ${hlLine}`);
|
||||
}
|
||||
} else {
|
||||
// Split code by newlines and style each line
|
||||
const codeLines = token.text.split("\n");
|
||||
for (const codeLine of codeLines) {
|
||||
lines.push(" " + this.theme.codeBlock(codeLine));
|
||||
lines.push(` ${this.theme.codeBlock(codeLine)}`);
|
||||
}
|
||||
}
|
||||
lines.push(this.theme.codeBlockBorder("```"));
|
||||
|
|
@ -443,7 +443,7 @@ export class Markdown implements Component {
|
|||
lines.push(line);
|
||||
} else {
|
||||
// Regular content - add parent indent + 2 spaces for continuation
|
||||
lines.push(indent + " " + line);
|
||||
lines.push(`${indent} ${line}`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -478,16 +478,16 @@ export class Markdown implements Component {
|
|||
lines.push(text);
|
||||
} else if (token.type === "code") {
|
||||
// Code block in list item
|
||||
lines.push(this.theme.codeBlockBorder("```" + (token.lang || "")));
|
||||
lines.push(this.theme.codeBlockBorder(`\`\`\`${token.lang || ""}`));
|
||||
if (this.theme.highlightCode) {
|
||||
const highlightedLines = this.theme.highlightCode(token.text, token.lang);
|
||||
for (const hlLine of highlightedLines) {
|
||||
lines.push(" " + hlLine);
|
||||
lines.push(` ${hlLine}`);
|
||||
}
|
||||
} else {
|
||||
const codeLines = token.text.split("\n");
|
||||
for (const codeLine of codeLines) {
|
||||
lines.push(" " + this.theme.codeBlock(codeLine));
|
||||
lines.push(` ${this.theme.codeBlock(codeLine)}`);
|
||||
}
|
||||
}
|
||||
lines.push(this.theme.codeBlockBorder("```"));
|
||||
|
|
@ -587,7 +587,7 @@ export class Markdown implements Component {
|
|||
|
||||
// Render top border
|
||||
const topBorderCells = columnWidths.map((w) => "─".repeat(w));
|
||||
lines.push("┌─" + topBorderCells.join("─┬─") + "─┐");
|
||||
lines.push(`┌─${topBorderCells.join("─┬─")}─┐`);
|
||||
|
||||
// Render header with wrapping
|
||||
const headerCellLines: string[][] = token.header.map((cell, i) => {
|
||||
|
|
@ -602,12 +602,12 @@ export class Markdown implements Component {
|
|||
const padded = text + " ".repeat(Math.max(0, columnWidths[colIdx] - visibleWidth(text)));
|
||||
return this.theme.bold(padded);
|
||||
});
|
||||
lines.push("│ " + rowParts.join(" │ ") + " │");
|
||||
lines.push(`│ ${rowParts.join(" │ ")} │`);
|
||||
}
|
||||
|
||||
// Render separator
|
||||
const separatorCells = columnWidths.map((w) => "─".repeat(w));
|
||||
lines.push("├─" + separatorCells.join("─┼─") + "─┤");
|
||||
lines.push(`├─${separatorCells.join("─┼─")}─┤`);
|
||||
|
||||
// Render rows with wrapping
|
||||
for (const row of token.rows) {
|
||||
|
|
@ -622,13 +622,13 @@ export class Markdown implements Component {
|
|||
const text = cellLines[lineIdx] || "";
|
||||
return text + " ".repeat(Math.max(0, columnWidths[colIdx] - visibleWidth(text)));
|
||||
});
|
||||
lines.push("│ " + rowParts.join(" │ ") + " │");
|
||||
lines.push(`│ ${rowParts.join(" │ ")} │`);
|
||||
}
|
||||
}
|
||||
|
||||
// Render bottom border
|
||||
const bottomBorderCells = columnWidths.map((w) => "─".repeat(w));
|
||||
lines.push("└─" + bottomBorderCells.join("─┴─") + "─┘");
|
||||
lines.push(`└─${bottomBorderCells.join("─┴─")}─┘`);
|
||||
|
||||
lines.push(""); // Add spacing after table
|
||||
return lines;
|
||||
|
|
|
|||
|
|
@ -90,16 +90,16 @@ export class SelectList implements Component {
|
|||
if (remainingWidth > 10) {
|
||||
const truncatedDesc = truncateToWidth(item.description, remainingWidth, "");
|
||||
// Apply selectedText to entire line content
|
||||
line = this.theme.selectedText("→ " + truncatedValue + spacing + truncatedDesc);
|
||||
line = this.theme.selectedText(`→ ${truncatedValue}${spacing}${truncatedDesc}`);
|
||||
} else {
|
||||
// Not enough space for description
|
||||
const maxWidth = width - prefixWidth - 2;
|
||||
line = this.theme.selectedText("→ " + truncateToWidth(displayValue, maxWidth, ""));
|
||||
line = this.theme.selectedText(`→ ${truncateToWidth(displayValue, maxWidth, "")}`);
|
||||
}
|
||||
} else {
|
||||
// No description or not enough width
|
||||
const maxWidth = width - prefixWidth - 2;
|
||||
line = this.theme.selectedText("→ " + truncateToWidth(displayValue, maxWidth, ""));
|
||||
line = this.theme.selectedText(`→ ${truncateToWidth(displayValue, maxWidth, "")}`);
|
||||
}
|
||||
} else {
|
||||
const displayValue = item.label || item.value;
|
||||
|
|
|
|||
|
|
@ -565,5 +565,5 @@ export function truncateToWidth(text: string, maxWidth: number, ellipsis: string
|
|||
}
|
||||
|
||||
// Add reset code before ellipsis to prevent styling leaking into it
|
||||
return result + "\x1b[0m" + ellipsis;
|
||||
return `${result}\x1b[0m${ellipsis}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue