@@ -3,11 +3,11 @@ import { findChildContainingExactPosition } from './utils'
33import { join } from 'path-browserify'
44import { ModuleDeclaration } from 'typescript'
55
6- export default ( proxy : ts . LanguageService , info : ts . server . PluginCreateInfo , c : GetConfig ) => {
6+ export default ( proxy : ts . LanguageService , languageService : ts . LanguageService , languageServiceHost : ts . LanguageServiceHost , c : GetConfig ) => {
77 proxy . getDefinitionAndBoundSpan = ( fileName , position ) => {
8- const prior = info . languageService . getDefinitionAndBoundSpan ( fileName , position )
8+ const prior = languageService . getDefinitionAndBoundSpan ( fileName , position )
99 if ( ! prior ) {
10- const program = info . languageService . getProgram ( ) !
10+ const program = languageService . getProgram ( ) !
1111 const sourceFile = program . getSourceFile ( fileName ) !
1212 const node = findChildContainingExactPosition ( sourceFile , position )
1313 if ( node && ts . isStringLiteral ( node ) ) {
@@ -18,7 +18,7 @@ export default (proxy: ts.LanguageService, info: ts.server.PluginCreateInfo, c:
1818 }
1919 if ( c ( 'enableFileDefinitions' ) && [ './' , '../' ] . some ( str => node . text . startsWith ( str ) ) ) {
2020 const file = join ( fileName , '..' , node . text )
21- if ( info . languageServiceHost . fileExists ?.( file ) ) {
21+ if ( languageServiceHost . fileExists ?.( file ) ) {
2222 return {
2323 textSpan,
2424 definitions : [
@@ -115,7 +115,7 @@ export default (proxy: ts.LanguageService, info: ts.server.PluginCreateInfo, c:
115115 firstDef . fileName . endsWith ( '.d.ts' )
116116 ) {
117117 const jsFileName = `${ firstDef . fileName . slice ( 0 , - '.d.ts' . length ) } .js`
118- const isJsFileExist = info . languageServiceHost . fileExists ?.( jsFileName )
118+ const isJsFileExist = languageServiceHost . fileExists ?.( jsFileName )
119119 if ( isJsFileExist ) prior . definitions = [ { ...firstDef , fileName : jsFileName } ]
120120 }
121121 if ( c ( 'miscDefinitionImprovement' ) && prior . definitions ) {
@@ -126,7 +126,7 @@ export default (proxy: ts.LanguageService, info: ts.server.PluginCreateInfo, c:
126126 // filter out css modules index definition
127127 if ( containerName === 'classes' && containerKind === undefined && rest [ 'isAmbient' ] && kind === 'index' && name === '__index' ) {
128128 // ensure we don't filter out something important?
129- const nodeAtDefinition = findChildContainingExactPosition ( info . languageService . getProgram ( ) ! . getSourceFile ( fileName ) ! , textSpan . start )
129+ const nodeAtDefinition = findChildContainingExactPosition ( languageService . getProgram ( ) ! . getSourceFile ( fileName ) ! , textSpan . start )
130130 let moduleDeclaration : ModuleDeclaration | undefined
131131 ts . findAncestor ( nodeAtDefinition , node => {
132132 if ( ts . isModuleDeclaration ( node ) ) {
0 commit comments