What
The Language Server Protocol (LSP) defines the protocol used between an editor or IDE and a language server that provides language features like auto complete, go to definition, find all references etc.
The idea behind the Language Server Protocol (LSP) is to standardize the protocol for how such servers and development tools communicate. This way, a single Language Server can be re-used in multiple development tools, which in turn can support multiple languages with minimal effort.
How
Microsoft currently maintains a parallel list of language server implementations in the core LSP repository.
Application
use ccls
Installation
1 | brew install ccls rapidjson |
Confiuguration
ccls
for vim, use vim-plug
vim plugin manager.
1 | function! BuildTABNine(info) |
use command :PlugInstall
Install tabnine-vim
modify TabNine.toml
1 | command = "ccls" |
Bear
Install Bear
1 | git clone https://github.com/rizsotto/Bear.git |
make sure libear.so
in LD_LIBRARY_PATH
ERROR: ld.so: object ‘/lib/x86_64-linux-gnu/libear.so’ from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
libear.so
copy 32-bit library to /usr/lib/i386-linux-gnu/
or /usr/lib32
then copy 64-bit library to /usr/lib/x86_64-linux-gnu/
.[^6]
Execute bear this way and get Compilation Database json:
1 | bear -l libear.so make_cmd |
Reference
- https://microsoft.github.io/language-server-protocol/
- https://microsoft.github.io/language-server-protocol/implementors/servers/
- https://langserver.org/
- https://github.com/MaskRay/ccls
- https://github.com/rizsotto/Bear
- https://github.com/rizsotto/Bear/issues/134#issuecomment-246750848
- https://tabnine.com/
- https://tabnine.com/semantic