feat(language-server): add tag folding and linked editing
This commit is contained in:
@@ -19,7 +19,13 @@ import {
|
||||
htmlToWrn,
|
||||
type TextDocument,
|
||||
} from "./index.ts";
|
||||
import { htmlCompletions, htmlHover, mergeCompletions } from "./html-service.ts";
|
||||
import {
|
||||
htmlCompletions,
|
||||
htmlFoldingRanges,
|
||||
htmlHover,
|
||||
htmlLinkedEditingRanges,
|
||||
mergeCompletions,
|
||||
} from "./html-service.ts";
|
||||
import { clearHtmlRegionCache } from "./html-regions.ts";
|
||||
|
||||
type JsonRpc = { jsonrpc?: string; id?: number | string; method?: string; params?: any };
|
||||
@@ -117,6 +123,8 @@ async function handle(message: JsonRpc): Promise<void> {
|
||||
triggerCharacters: ["<", "@", ":", ".", " ", "=", '"', "/"],
|
||||
},
|
||||
hoverProvider: true,
|
||||
foldingRangeProvider: true,
|
||||
linkedEditingRangeProvider: true,
|
||||
definitionProvider: true,
|
||||
referencesProvider: true,
|
||||
renameProvider: { prepareProvider: true },
|
||||
@@ -223,6 +231,17 @@ async function handle(message: JsonRpc): Promise<void> {
|
||||
result(message.id, html ?? (document ? hover(document, params.position) : null));
|
||||
break;
|
||||
}
|
||||
case "textDocument/foldingRange": {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
result(message.id, document ? htmlFoldingRanges(document) : []);
|
||||
break;
|
||||
}
|
||||
case "textDocument/linkedEditingRange": {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
const ranges = document ? htmlLinkedEditingRanges(document, params.position) : null;
|
||||
result(message.id, ranges ? { ranges } : null);
|
||||
break;
|
||||
}
|
||||
case "textDocument/definition": {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
result(message.id, document ? definitionLocation(document, params.position) : null);
|
||||
|
||||
Reference in New Issue
Block a user