Neovim setup with LSP formatting & linting
hello, I am trying to set up the fmt & linting using nvim-lspconfig with neovim
Anyone know how i set it so that I format using the deno.json file?
here is a link to my dotfiles
GitHub
dotfiles/environments/WyatSoule/common/nvim at master · DustinMEast...
Files used to set a system up with my preferred applications and configuration. - DustinMEastway/dotfiles
10 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your message, I can provide some general advice on setting up formatting with Deno in Neovim using
nvim-lspconfig
.
To configure Neovim to format your code using the settings from a deno.json
file, you would typically need to ensure that the Deno language server is properly set up in your Neovim configuration. This usually involves adding a configuration block for Deno in your init.vim
or init.lua
file, depending on which configuration language you are using.
Here's an example of how you might set up the Deno language server in Lua:
This configuration tells the Deno language server to use the deno.json
or deno.jsonc
file in the root of your project to configure the Deno runtime.
Please note that this advice is not based on the Deno documentation, and you should double-check the accuracy of this advice. Additionally, since I don't have access to external links, I cannot review your dotfiles directly. Make sure to consult the nvim-lspconfig
documentation and the Deno manual for more detailed instructions on integrating Deno with Neovim's LSP.I find the setup easy with coc.nvim along with coc-deno extension. I Personally found it a bit challenging, so I skipped
nvim-lspconfig
. But if you want to try coc
, here's a short reference on how to set it up ->.GitHub
GitHub - neoclide/coc.nvim: Nodejs extension host for vim & neovim,...
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers. - neoclide/coc.nvim
GitHub
GitHub - fannheyward/coc-deno: Deno extension for coc.nvim
Deno extension for coc.nvim. Contribute to fannheyward/coc-deno development by creating an account on GitHub.
awesome! thank you. I was able to get it with my
nvim-lspconfig
but it is still giving some issues so i will probably either convert over to coc, or I will check out biomejshttps://github.com/hasundue/dotlua/blob/main/lua%2Frc%2Flspconfig%2Finit.lua#L29-L37
My config with nvim-lspconfig fyi
GitHub
dotlua/lua/rc/lspconfig/init.lua at main · hasundue/dotlua
Chiezo's Neovim configuration. Contribute to hasundue/dotlua development by creating an account on GitHub.
I'm currently going through the same process of trying to figure out why deno isn't formatting with lspconfig. What was your solution?
I will send it to in here this afternoon. Works well now.
Install conform then add your deno formatter to ft by file type and enable format on save
I guess I need to learn the overlap between NVIM's LSP and it's ability to format (like with ESLint) and trying to minimize the number of plugins I need to have installed and configured when they do much the same thing
What are you talking about?
It appears that you don't even know how neovim works.
Listen to me, do yourself a favour and start reading documentation
:h lspconfig
is a good start.
ESLint is not a formatter - it's a linter.
If you just want to quickly get up and running, add denols to your list of servers in your lspconfig, making sure that deno.enable
and deno.lint
are both set to true. Next, add this plugin https://github.com/stevearc/conform.nvim and include the following in its setup options:
Actually, I don't even think you need to include the configuration for js and ts since denols will run those for you and conform automatically handles lsp formatters if you have lsp_fallback
enabled.this looks similar to what i have
@rowvir, i completely forgot. here is the repo
https://github.com/wsoule/config.nvim
check out these files (i have not looked over this in a while, so dont mind the bad code
https://github.com/wsoule/config.nvim/blob/main/lua/custom/plugins/lsp.lua
https://github.com/wsoule/config.nvim/blob/main/lua/custom/plugins/format.lua
https://github.com/wsoule/config.nvim/blob/main/lua/custom/plugins/lint.lua
GitHub
GitHub - wsoule/config.nvim
Contribute to wsoule/config.nvim development by creating an account on GitHub.
GitHub
config.nvim/lua/custom/plugins/lsp.lua at main · wsoule/config.nvim
Contribute to wsoule/config.nvim development by creating an account on GitHub.
GitHub
config.nvim/lua/custom/plugins/format.lua at main · wsoule/config.n...
Contribute to wsoule/config.nvim development by creating an account on GitHub.
GitHub
config.nvim/lua/custom/plugins/lint.lua at main · wsoule/config.nvim
Contribute to wsoule/config.nvim development by creating an account on GitHub.