import * as vscode from 'vscode' ; import { Extension } from '../extension' ; export class DefinitionProvider implements vscode . DefinitionProvider { extension : Extension ; constructor ( extension ) { this . extension = extension ; } provideDefinition ( document , position ) { 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 ) ; } } } }