import { DocumentHighlightKind, } from "vscode-languageserver-protocol";
import { getWordAtPosition } from "../cli/definition.js";
import { findAllOccurrences, occurrenceToRange } from "./util.js";
export function handleDocumentHighlight(params, doc) {
    const source = doc.getText();
    const word = getWordAtPosition(source, params.position.line, params.position.character);
    if (!word)
        return [];
    return findAllOccurrences(source, word).map((occ) => ({
        range: occurrenceToRange(occ),
        kind: DocumentHighlightKind.Text,
    }));
}
