Skip to content
TypeScript

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

Julius Marmingec6410d37d7ff
diff --git a/packages/shared/src/composerTrigger.test.ts b/packages/shared/src/composerTrigger.test.ts
index 50c8cd7c208..4b276385445 100644
--- a/packages/shared/src/composerTrigger.test.ts
+++ b/packages/shared/src/composerTrigger.test.ts
@@ -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", () => {
diff --git a/packages/shared/src/composerTrigger.ts b/packages/shared/src/composerTrigger.ts
index dcbdc784934..c68a9963ffa 100644
--- a/packages/shared/src/composerTrigger.ts
+++ b/packages/shared/src/composerTrigger.ts
@@ -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;