import { SymbolKind } from "vscode-languageserver-protocol";
function locToRange(loc) {
    return {
        start: { line: loc.line, character: loc.col },
        end: { line: loc.line, character: loc.col },
    };
}
export function getDocumentSymbols(program) {
    const symbols = [];
    for (const node of program.nodes) {
        if (node.type === "function" && node.loc) {
            symbols.push({
                name: node.functionName,
                kind: SymbolKind.Function,
                range: locToRange(node.loc),
                selectionRange: locToRange(node.loc),
            });
        }
        else if (node.type === "graphNode" && node.loc) {
            symbols.push({
                name: node.nodeName,
                kind: SymbolKind.Module,
                range: locToRange(node.loc),
                selectionRange: locToRange(node.loc),
            });
        }
        else if (node.type === "typeAlias" && node.loc) {
            symbols.push({
                name: node.aliasName,
                kind: SymbolKind.TypeParameter,
                range: locToRange(node.loc),
                selectionRange: locToRange(node.loc),
            });
        }
    }
    return symbols;
}
