import { getWordAtPosition } from "../cli/definition.js";
import { findAllOccurrences, occurrenceToRange } from "./util.js";
export function handleReferences(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) => ({
        uri: doc.uri,
        range: occurrenceToRange(occ),
    }));
}
