-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use local typescript version #136
Comments
You can use |
This project have no idea of typescript specific knowledge. Beside the approach mentioned by DeltaEvo, you can use local vimrc in each project dir, or specify the language server programmatically in your vimrc. (From a user's perspective, I don't think you will need to have different versions of typescript. The |
@autozimu that is definitely not the case. Differing versions of typescript (even by a minor version) give different errors with the same source code. Perhaps you didn't know but typescript does not follow semver (microsoft/TypeScript#14116). An older version of typescript may miss complex errors that newer versions catch, and code that compiles successfully with newer versions of typescript may throw errors in an older version due to weaker type inference in the older versions. Ultimately you want your language server to correspond with the typescript version listed in your package.json. @autozimu @DeltaEvo This may be something you want to think about putting into LanguageClient-neovim. It's a feature built into VS Code, the tide tsserver plugin for emacs, the built-in typescript layer for spacemacs, and the tsuquyomi tsserver plugin for vim. It's not critical but it means that the errors inside vim will not match those output by your build when your typescript versions are off. Really what you need is a way to specify a relative path from project root, whether that's finding the project.json, tsconfig, or even a new file of your choosing. I think even using a method like @DeltaEvo mentioned would be fine, but expecting users to figure that out is asking a bit much. I'd expect an example repo or just a blurb on the readme.md or wiki. Another option would be to make separate language server plugins for LanguageClient-neovim instead of a simple configuration path to handle things like this. Spawning a new .vimrc for every typescript project is also way too cumbersome, its easier to just live with the false errors, or use a more specialized tsserver plugin. |
I guess the main issue is that tsserver is included in every npm typescript package but the sourcegraph wrapper that implements the language server protocol does not. Now that I'm thinking it over, I think this would have to be implemented by sourcegraph. |
I understand the situation. The problem is that is this project doesn't use tsc directly. There is
There is no direct connection between In my opinion, this issue should/could be addressed gracefullly in @DeltaEvo approach could be an alternative, while I don't know if it is possible to map the versions of |
Yes, you got it. |
@rsimp you can use https://www.npmjs.com/package/ts-language-server and these settings let g:LanguageClient_serverCommands = {
\ 'typescript': ['~/.vim/langservers/typescript-language-server', '--stdio', '--tsserver-path', 'node_modules/.bin/tsserver']
\ } ts-language-server act as a proxy for tsserver but it dosen't suport much requests https://github.com/prabirshrestha/typescript-language-server/issues |
With multiple typescript projects there is a need to use a typescript server version that corresponds with what's installed in the project.json. Is there a configuration to use a project tsserver and not a global one?
The text was updated successfully, but these errors were encountered: