feat(language-server): add tag folding and linked editing

This commit is contained in:
2026-08-18 21:10:57 +05:30
parent bd0c1317ff
commit d9e8f5be82
5 changed files with 149 additions and 2 deletions
@@ -3,6 +3,7 @@ import {
htmlCompletions,
htmlFoldingRanges,
htmlHover,
htmlLinkedEditingRanges,
htmlTagComplete,
} from "../src/html-service.ts";
@@ -172,3 +173,25 @@ test("merging ranks WRNexus entries above HTML and drops exact collisions", () =
const sorted = [...merged].sort((a, b) => (a.sortText ?? "").localeCompare(b.sortText ?? ""));
expect(sorted[0]!.label).toBe("Card");
});
test("linked editing returns both the opening and closing tag names", () => {
const text = `page A {
view {
<div>x</div>
}
}
`;
const ranges = htmlLinkedEditingRanges(doc(text), positionOf(text, "<di"));
expect(ranges).not.toBeNull();
expect(ranges).toHaveLength(2);
});
test("linked editing returns null outside a view block", () => {
const text = `page A {
functions {
function go() { }
}
}
`;
expect(htmlLinkedEditingRanges(doc(text), positionOf(text, "func"))).toBeNull();
});