refactor(shared): remove unused mention path serializer (#9990)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-05 00:18:51 -07:00
1 parent aca2afc0b5
commit c6410d37d7
2 files changed
+1 -24

No files matched your search

+1 -15
View File
@@ -1,20 +1,6 @@
import { describe, expect, it } from "vite-plus/test";
import { serializeComposerFileLink, serializeComposerMentionPath } from "./composerTrigger.ts";
describe("serializeComposerMentionPath", () => {
it("keeps simple mention paths unquoted", () => {
expect(serializeComposerMentionPath("src/index.ts")).toBe("src/index.ts");
});
it("quotes mention paths containing whitespace", () => {
expect(serializeComposerMentionPath("docs/My File.md")).toBe('"docs/My File.md"');
});
it("escapes quoted mention path content", () => {
expect(serializeComposerMentionPath('docs/My "File".md')).toBe('"docs/My \\"File\\".md"');
});
});
import { serializeComposerFileLink } from "./composerTrigger.ts";
describe("serializeComposerFileLink", () => {
it("uses the basename as the markdown label", () => {
-9
View File
@@ -8,15 +8,6 @@ export interface ComposerTrigger {
rangeEnd: number;
}
const SIMPLE_MENTION_PATH_REGEX = /^[^\s@"\\]+$/;
export function serializeComposerMentionPath(path: string): string {
if (SIMPLE_MENTION_PATH_REGEX.test(path)) {
return path;
}
return `"${path.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
}
function composerFileLinkBasename(path: string): string {
const separatorIndex = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
return separatorIndex >= 0 ? path.slice(separatorIndex + 1) : path;