typescript-language-server / typescript-language-server

TypeScript & JavaScript Language Server

Home Page:https://www.npmjs.com/package/typescript-language-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toResource incorrectly calls URI.parse on zipfile:// resources

michael-withington-simplisafe opened this issue · comments

toTsFilePath and toResource both have the same comment:

 // Yarn v2+ hooks tsserver and sends `zipfile:` URIs for Vim. Keep as-is.
 // Example: zipfile:///foo/bar/baz.zip::path/to/module

however, toTsFilePath correctly returns the URL without doing anything, and toResource calls URI.parse on it, causing it to break and not be able to load the resource.

return URI.parse(filepath);

@rchl want me to open a PR with the bug-fix?

I think that a proper fix would require quite some work given how now things are expected to be URI. If you have some simple fix then it would probably not work in all cases.

I've looked into it a bit but so far haven't come up with satisfying solution.