javascript-typescript-langserver icon indicating copy to clipboard operation
javascript-typescript-langserver copied to clipboard

textDocument/definition returns git:// uris

Open tomv564 opened this issue 8 years ago • 4 comments

Go to definition on any symbol from an imported package (eg. ts.nodeModuleNameResolver):

LSP: request 5: textDocument/definition 
LSP: got json:  {"jsonrpc":"2.0","id":5,"result":[{"uri":"git://github.com/Microsoft/TypeScript?v2.3.4#lib/typescript.d.ts"

Not sure if VS Code handles this, but a reference to a local path where the package is installed should work on any editor.

tomv564 avatar Sep 10 '17 09:09 tomv564

This is only for TypeScript library files. Could use a local URI if installed.

felixfbecker avatar Sep 10 '17 21:09 felixfbecker

Under what condition could the logic in https://github.com/sourcegraph/javascript-typescript-langserver/blob/2391d4a9b97808a901fff33adbfd9f14c5a1f473/src/symbols.ts#L39 be changed to return a file:// uri?

Removing the check fixes jump-to-definition to ts.nodeModuleNameResolver, but knowing it only affects the Typescript API this is not a huge priority (fine with closing)

tomv564 avatar Oct 24 '17 21:10 tomv564

If the definition is available locally in node_modules on the client's machine it can return a file:// URI to that. If it is only found in the node_modules of the language server though that would be tricky because the language server can run on a different host (e.g. inside a container) so the file:// URI would be wrong on the client.

felixfbecker avatar Oct 24 '17 21:10 felixfbecker

I'm noticing this too. My current workflow is to lookup definition and then look at URL outputted by javascript-typescript-langserver to know which file to open locally. After having opened the file once the definition lookup works like one would think it would.

sQVe avatar Sep 25 '18 12:09 sQVe