"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefinitionProvider = void 0;
const vscode = require("vscode");
class DefinitionProvider {
    constructor(extension) {
        this.extension = extension;
    }
    provideDefinition(document, position) {
        // a cite key is an @ symbol followed by word characters (letters or numbers)
        const keyRange = document.getWordRangeAtPosition(position, /(?<=@)\w+/);
        if (keyRange) {
            const citeKey = document.getText(keyRange);
            const cite = this.extension.completer.citation.getEntry(citeKey);
            if (cite) {
                return new vscode.Location(vscode.Uri.file(cite.file), cite.position);
            }
        }
    }
}
exports.DefinitionProvider = DefinitionProvider;
//# sourceMappingURL=definition.js.map