VimPlugin: lsp: Difference between revisions
From wikinotes
(6 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
= Configuration = | = Configuration = | ||
<blockquote> | <blockquote> | ||
* install an lsp (ex. <code>pacman -S gopls</code> | == Language Install == | ||
<blockquote> | |||
=== Vanilla === | |||
<blockquote> | |||
* install an lsp using your OS (ex. <code>pacman -S gopls</code> | |||
* enable lsp (ex. <code>lua require('lspconfig').gopls.setup{on_attach = custom_lsp_attach}</code>) | * enable lsp (ex. <code>lua require('lspconfig').gopls.setup{on_attach = custom_lsp_attach}</code>) | ||
</blockquote><!-- Vanilla --> | |||
=== lspconfig === | |||
<blockquote> | |||
[[VimPlugin: nvim-lspconfig]] contains several pre-made LSP configurations.<br> | |||
You'll still need to install the LSP provider. | |||
</blockquote><!-- lspconfig --> | |||
=== Mason === | |||
<blockquote> | |||
[[VimPlugin: mason]] can automate installing LSPs.<br> | |||
Use the <code>:Mason</code> command to see installed. | |||
</blockquote><!-- Mason --> | |||
</blockquote><!-- Language Install --> | |||
== Disable Inline Linter Errors == | |||
<blockquote> | |||
<syntaxhighlight lang="lua"> | |||
# neovim 6+ | |||
vim.diagnostic.config({virtual_text = false}) | |||
# old way | |||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( | |||
vim.lsp.diagnostic.on_publish_diagnostics, { | |||
virtual_text = false | |||
} | |||
) | |||
</syntaxhighlight> | |||
</blockquote><!-- Disable Inline Messages --> | |||
Note that [[VimPlugin: Ale]] also has inline diagnostics. | |||
</blockquote><!-- Configuration --> | </blockquote><!-- Configuration --> |
Latest revision as of 23:22, 6 February 2023
Neovim's builtin lsp client.
Documentation
:h lsp
https://neovim.io/doc/user/lsp.html avail lsp's https://microsoft.github.io/language-server-protocol/implementors/servers/
Configuration
Language Install
Vanilla
- install an lsp using your OS (ex.
pacman -S gopls
- enable lsp (ex.
lua require('lspconfig').gopls.setup{on_attach = custom_lsp_attach}
)lspconfig
VimPlugin: nvim-lspconfig contains several pre-made LSP configurations.
You'll still need to install the LSP provider.Mason
VimPlugin: mason can automate installing LSPs.
Use the:Mason
command to see installed.Disable Inline Linter Errors
# neovim 6+ vim.diagnostic.config({virtual_text = false}) # old way vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false } )Note that VimPlugin: Ale also has inline diagnostics.