import { TextDocuments , Location , TextDocumentIdentifier , Position , CompletionItem } from 'vscode-languageserver' ; import { LSRegistry } from './lib/ts-service' ; import { Project } from '@lifeart/ember-language-server' ; interface Registry extends LSRegistry { component : { [ componentName ] : string [ ] ; } ; service : { [ serviceName ] : string [ ] ; } ; routePath : { [ routePath ] : string [ ] ; } ; } interface Command { command : string ; arguments : any [ ] ; } export interface Server { getRegistry ( projectRoot ) : Registry ; onExecute ( command ) : any ; getUsages ( normalizedName ) : string [ ] ; documents : TextDocuments < any > ; } interface BaseAPIParams { server : Server ; textDocument : TextDocumentIdentifier ; position : Position ; } interface ExtendedAPIParams extends BaseAPIParams { focusPath : any ; type : 'script' | 'template' ; } interface ReferenceFunctionParams extends BaseAPIParams { results : Location [ ] ; } export interface CompletionFunctionParams extends ExtendedAPIParams { results : CompletionItem [ ] ; } export interface DefinitionFunctionParams extends ExtendedAPIParams { results : Location [ ] ; } type ReferenceResolveFunction = ( root : string , params : ReferenceFunctionParams ) => Promise < Location [ ] > ; type CompletionResolveFunction = ( root : string , params : CompletionFunctionParams ) => Promise < CompletionItem [ ] | null > ; type DefinitionResolveFunction = ( root : string , params : DefinitionFunctionParams ) => Promise < Location [ ] > ; type InitCallback = ( server : Server , project : Project ) => void ; export interface AddonAPI { onReference ? : undefined | ReferenceResolveFunction ; onComplete : undefined | CompletionResolveFunction ; onDefinition : undefined | DefinitionResolveFunction ; onInit : undefined | InitCallback ; }