Avimitin / nvim

Useful, maintainable, multi-language supported neovim configuration.
https://avimitin.github.io/nvim
Apache License 2.0
273 stars 48 forks source link

How to get typescript errors? #49

Closed nexxeln closed 2 years ago

nexxeln commented 2 years ago

Hi, I'm really new to neovim so please forgive me if this is a dumb issue.

I want to get proper typescript autocomplete and errors, so I wanted to add the typescript LSP.

This is my custom.lua

custom.lua

I'm still not getting the autocomplete and typescript errors in .ts and .tsx files. I would appreciate it if you could tell me what I'm doing wrong and guide me through the process of installing a LSP.

Avimitin commented 2 years ago

Oh, in the latest commit I removed the lsp-installer plugin because it is untrusted. So you will need to first install the tsserver yourself, then open the editor.

nexxeln commented 2 years ago

Thank you for the quick reply.

I think I have it installed. I had run this command.

npm install -g typescript-language-server typescript
Avimitin commented 2 years ago

Can you run command :LspInfo and see what's happening?

nexxeln commented 2 years ago

LspInfo

It says its not a command.

Avimitin commented 2 years ago

Can you run command :PackerStatus and use / key to find if the nvim-lspconfig plugin is loaded or not

nexxeln commented 2 years ago

It isn't loading Not loaded

Avimitin commented 2 years ago

I know what's happening, the .tsx file is recognized as typescriptreact filetype. So typescript filetype won't work. However their are some issue still needs to be fixed, please wait.

Avimitin commented 2 years ago

So the solution is here: you need to add { "typescriptreact", "tsserver" } into the lang field. This is because neovim recognize file with .tsx extension as typescriptreact filetype. This will lead to a issue that the treesitter plugin don't know what is typescriptreact. So I try to alias them in commit https://github.com/Avimitin/nvim/commit/445d79dae8c63e938c3f2eaa1e6d270dfd400dc4. Please sync the fork and pull the latest commit to make thing works.

Oh, btw, please run :PackerCompile after you make changes.

nexxeln commented 2 years ago

Got it working! Thanks so much

working

And thank you for the great config!