Top Related Projects
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Quickstart configs for Nvim LSP
async language server protocol plugin for vim and neovim
Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
Quick Overview
LanguageClient-neovim is a Language Server Protocol (LSP) support plugin for Neovim and Vim. It provides IDE-like features such as auto-completion, go-to-definition, and real-time diagnostics by integrating with language servers for various programming languages.
Pros
- Supports a wide range of programming languages through LSP
- Integrates seamlessly with Neovim and Vim
- Provides advanced features like auto-completion, linting, and code navigation
- Highly configurable and extensible
Cons
- Requires separate installation of language servers for each programming language
- Can be complex to set up and configure for beginners
- May have performance issues with large projects or certain language servers
- Documentation could be more comprehensive and user-friendly
Getting Started
To get started with LanguageClient-neovim:
- Install the plugin using your preferred plugin manager. For example, with vim-plug:
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh'}
- Configure the plugin in your Neovim/Vim configuration file:
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['javascript-typescript-stdio'],
\ 'python': ['pyls'],
\ }
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
-
Install the necessary language servers for your programming languages.
-
Restart Neovim/Vim and open a file to start using the LSP features.
Competitor Comparisons
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Pros of coc.nvim
- Faster and more responsive due to its asynchronous nature
- Extensive ecosystem with a wide range of language servers and extensions
- Better out-of-the-box experience with minimal configuration required
Cons of coc.nvim
- Heavier resource usage, especially for larger projects
- Requires Node.js as a dependency, which may not be ideal for all users
Code Comparison
LanguageClient-neovim configuration:
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['javascript-typescript-stdio'],
\ }
coc.nvim configuration:
let g:coc_global_extensions = [
\ 'coc-tsserver',
\ 'coc-rust-analyzer',
\ ]
Both projects aim to provide Language Server Protocol (LSP) support for Neovim, but coc.nvim offers a more comprehensive solution with its extension system and broader language support. LanguageClient-neovim is lighter and more focused on core LSP functionality, which may be preferable for users who want a simpler setup or have limited system resources. The choice between the two largely depends on individual needs and preferences regarding features, performance, and ecosystem.
Quickstart configs for Nvim LSP
Pros of nvim-lspconfig
- Native integration with Neovim's built-in LSP client
- Simpler configuration process for many language servers
- Actively maintained and developed alongside Neovim
Cons of nvim-lspconfig
- May require additional plugins for full functionality (e.g., autocompletion)
- Less extensive documentation compared to LanguageClient-neovim
Code Comparison
LanguageClient-neovim configuration:
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['javascript-typescript-stdio'],
\ }
nvim-lspconfig configuration:
require'lspconfig'.rust_analyzer.setup{}
require'lspconfig'.tsserver.setup{}
Summary
nvim-lspconfig offers tighter integration with Neovim's native LSP client, resulting in a more streamlined setup process for many language servers. It benefits from active development alongside Neovim itself. However, it may require additional plugins for complete functionality and has less extensive documentation compared to LanguageClient-neovim.
LanguageClient-neovim, while not as tightly integrated, provides a more comprehensive out-of-the-box experience and more detailed documentation. It may be easier for users transitioning from Vim or those who prefer a more traditional plugin approach.
The choice between the two largely depends on personal preference, specific use cases, and comfort with Neovim's built-in LSP capabilities.
async language server protocol plugin for vim and neovim
Pros of vim-lsp
- Written in pure VimScript, making it more portable and easier to install
- Supports a wider range of Vim versions, including older ones
- More actively maintained with frequent updates and bug fixes
Cons of vim-lsp
- May have slightly slower performance due to being written in VimScript
- Less extensive documentation compared to LanguageClient-neovim
- Requires additional plugins for some features that LanguageClient-neovim includes out-of-the-box
Code Comparison
LanguageClient-neovim configuration:
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['javascript-typescript-stdio'],
\ }
vim-lsp configuration:
if executable('rls')
au User lsp_setup call lsp#register_server({
\ 'name': 'rls',
\ 'cmd': {server_info->['rustup', 'run', 'stable', 'rls']},
\ 'whitelist': ['rust'],
\ })
endif
Both plugins aim to provide Language Server Protocol (LSP) support for Vim and Neovim. LanguageClient-neovim is written in Rust with a focus on performance, while vim-lsp is written in pure VimScript for better compatibility. The choice between them depends on your specific needs, Vim version, and preference for native performance versus wider compatibility.
Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
Pros of ALE
- Broader language support with linting and fixing capabilities
- Asynchronous execution, reducing impact on editor performance
- Integrates with various linters and fixers out-of-the-box
Cons of ALE
- Less comprehensive Language Server Protocol (LSP) support
- May require more configuration for advanced language features
- Can be more resource-intensive due to multiple linter integrations
Code Comparison
LanguageClient-neovim configuration:
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['javascript-typescript-stdio'],
\ }
ALE configuration:
let g:ale_linters = {
\ 'rust': ['analyzer'],
\ 'javascript': ['eslint'],
\ }
let g:ale_fixers = {
\ 'javascript': ['prettier', 'eslint'],
\ }
LanguageClient-neovim focuses on LSP integration, providing a more streamlined setup for language servers. ALE offers a wider range of linting and fixing options, but may require more detailed configuration for specific language features. LanguageClient-neovim is generally more suited for developers primarily using LSP-supported languages, while ALE caters to a broader range of languages and linting needs.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
For legacy python implementation, see branch master.
LanguageClient-neovim
Language Server Protocol support for vim and neovim.
More recordings at Updates, screenshots & GIFs.
Features
- Non-blocking asynchronous calls.
- Sensible completion.
Integrated well with deoplete or
ncm2, or MUcomplete.
Or simply with vim built-in
omnifunc
. - Realtime diagnostics/compiler/lint message.
- Rename.
- Hover/Get identifier info.
- Goto definition.
- Goto reference locations.
- Workspace/Document symbols query.
- Formatting.
- Code Action/Quick Fix.
Quick Start
Using vim-plug
:
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" (Optional) Multi-entry selection UI.
Plug 'junegunn/fzf'
Example configuration
" Required for operations modifying multiple buffers like rename.
set hidden
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'],
\ 'javascript.jsx': ['tcp://127.0.0.1:2089'],
\ 'python': ['/usr/local/bin/pyls'],
\ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'],
\ }
" note that if you are using Plug mapping you should not use `noremap` mappings.
nmap <F5> <Plug>(lcn-menu)
" Or map each action separately
nmap <silent>K <Plug>(lcn-hover)
nmap <silent> gd <Plug>(lcn-definition)
nmap <silent> <F2> <Plug>(lcn-rename)
Run command nvim +PlugInstall +UpdateRemotePlugins +qa
in shell to install
this plugin. Install corresponding language servers. Restart neovim/vim and
language services will be available right away. Happy hacking!
Mappings
LanguageClient-neovim defines various Plug mappings, see :help LanguageClientMappings
for a full
list and an example configuration.
Install
Language Servers
Note, you will also need language server(s) to take advantages of this plugin. To find list of language server implementations and how to install them, please see http://langserver.org and/or https://microsoft.github.io/language-server-protocol/implementors/servers/.
Documentation
Top Related Projects
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Quickstart configs for Nvim LSP
async language server protocol plugin for vim and neovim
Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot