feat(language-server): add tag folding and linked editing
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user