Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Error when invoked on javascript file without ".js" extension #674

Open
stupid-genius opened this issue Apr 6, 2020 · 0 comments
Open

Comments

@stupid-genius
Copy link

Using javascript-language-server with lsc in vim 8 produces an error (stderr below) if the file does not have the ".js" extension. Renaming the same file to end with the extension does not produce the error.

Steps to reproduce:

  1. open javascript file with no extension; observe that vim detects the correct file type
  2. invoke an LSP function (eg. place cursor on function reference and press SHIFT+K); observe error

In vim:
[lsc:Error] Expected source file /home/allen/Source/file to exist

stderr:

ERROR Handle textDocumentDidOpen: Error: Could not find file: '/home/allen/Source/file'.
    at getValidSourceFile (/home/allen/.bin/javascript-language-server/node_modules/typescript/lib/typescript.js:111612:23)
    at Object.getSyntacticDiagnostics (/home/allen/.bin/javascript-language-server/node_modules/typescript/lib/typescript.js:111800:52)
    at TypeScriptService._publishDiagnostics (/home/allen/.bin/javascript-language-server/lib/typescript-service.js:1244:14)
    at TypeScriptService.<anonymous> (/home/allen/.bin/javascript-language-server/lib/typescript-service.js:1205:18)
    at Generator.next (<anonymous>)
    at fulfilled (/home/allen/.bin/javascript-language-server/lib/typescript-service.js:4:58)
    at <anonymous>
ERROR Handler for textDocument/definition failed: Error: Expected source file /home/allen/Source/file to exist
    at MergeMapSubscriber.projectManager.ensureReferencedFiles.toArray.mergeMap [as project] (/home/allen/.bin/javascript-language-server/lib/typescript-service.js:260:23)
    at MergeMapSubscriber._tryNext (/home/allen/.bin/javascript-language-server/node_modules/rxjs/operators/mergeMap.js:122:27)
    at MergeMapSubscriber._next (/home/allen/.bin/javascript-language-server/node_modules/rxjs/operators/mergeMap.js:112:18)
    at MergeMapSubscriber.Subscriber.next (/home/allen/.bin/javascript-language-server/node_modules/rxjs/Subscriber.js:93:18)
    at DefaultIfEmptySubscriber._complete (/home/allen/.bin/javascript-language-server/node_modules/rxjs/operators/defaultIfEmpty.js:71:30)
    at DefaultIfEmptySubscriber.Subscriber.complete (/home/allen/.bin/javascript-language-server/node_modules/rxjs/Subscriber.js:118:18)
    at TakeLastSubscriber._complete (/home/allen/.bin/javascript-language-server/node_modules/rxjs/operators/takeLast.js:105:21)
    at TakeLastSubscriber.Subscriber.complete (/home/allen/.bin/javascript-language-server/node_modules/rxjs/Subscriber.js:118:18)
    at ScanSubscriber.Subscriber._complete (/home/allen/.bin/javascript-language-server/node_modules/rxjs/Subscriber.js:136:26)
    at ScanSubscriber.Subscriber.complete (/home/allen/.bin/javascript-language-server/node_modules/rxjs/Subscriber.js:118:18) 
Message: { method: 'textDocument/definition',
  jsonrpc: '2.0',
  id: 2,
  params: 
   { textDocument: 
      { uri: 'file:///home/allen/Source/file' },
     position: { character: 3, line: 25 } } }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant