import * as vscode from "vscode" ; import { UI5Plugin } from "../../UI5Plugin" ; import { JSDefinitionProvider } from "../providers/definitions/js/JSDefinitionProvider" ; import { XMLDefinitionProvider } from "../providers/definitions/xml/XMLDefinitionProvider" ; export class DefinitionProviderRegistrator { static register ( ) { const definitionProviderDisposable = vscode . languages . registerDefinitionProvider ( { language : "javascript" , scheme : "file" } , { provideDefinition ( document , position ) { return JSDefinitionProvider . getPositionAndUriOfCurrentVariableDefinition ( document , position , false ) ; } } ) ; const typeDefinitionProviderDisposable = vscode . languages . registerTypeDefinitionProvider ( { language : "javascript" , scheme : "file" } , { provideTypeDefinition ( document , position ) { return JSDefinitionProvider . getPositionAndUriOfCurrentVariableDefinition ( document , position , true ) ; } } ) ; const XMLDefinitionProviderDisposable = vscode . languages . registerDefinitionProvider ( { language : "xml" , scheme : "file" } , { provideDefinition ( document , position ) { return XMLDefinitionProvider . provideDefinitionsFor ( document , position ) ; } } ) ; UI5Plugin . getInstance ( ) . addDisposable ( definitionProviderDisposable ) ; UI5Plugin . getInstance ( ) . addDisposable ( typeDefinitionProviderDisposable ) ; UI5Plugin . getInstance ( ) . addDisposable ( XMLDefinitionProviderDisposable ) ; } }