Add vim-lsc

Martino Pilia 2019-04-24 20:38:52 +02:00 committed by Fangrui Song
parent a66ece42f2
commit 120fcdf745
3 changed files with 33 additions and 1 deletions

@ -13,7 +13,7 @@
- Atom IDE: [atom-ide-ccls] - Atom IDE: [atom-ide-ccls]
- Emacs: [eglot] [emacs-ccls] - Emacs: [eglot] [emacs-ccls]
- (Neo)Vim: [coc.nvim] [ale] [LanguageClient-neovim] [vim-lsp] - (Neo)Vim: [coc.nvim] [ale] [LanguageClient-neovim] [vim-lsp] [vim-lsc]
- VSCode: [vscode-ccls] - VSCode: [vscode-ccls]
- Monaco Editor: [monaco-editor] - Monaco Editor: [monaco-editor]
@ -30,5 +30,6 @@ https://github.com/MaskRay/ccls/wiki/FAQ#definitions and following sections.
[LanguageClient-neovim]: https://github.com/autozimu/LanguageClient-neovim [LanguageClient-neovim]: https://github.com/autozimu/LanguageClient-neovim
[lsp-mode]: https://github.com/emacs-lsp/lsp-mode [lsp-mode]: https://github.com/emacs-lsp/lsp-mode
[vim-lsp]: https://github.com/prabirshrestha/vim-lsp [vim-lsp]: https://github.com/prabirshrestha/vim-lsp
[vim-lsc]: https://github.com/natebosch/vim-lsc
[vscode-ccls]: https://github.com/MaskRay/vscode-ccls [vscode-ccls]: https://github.com/MaskRay/vscode-ccls
[monaco-editor]: https://github.com/MaskRay/ccls/wiki/Monaco-Editor [monaco-editor]: https://github.com/MaskRay/ccls/wiki/Monaco-Editor

@ -10,6 +10,7 @@
+ [[coc.nvim]] + [[coc.nvim]]
+ [[LanguageClient-neovim]] + [[LanguageClient-neovim]]
+ [[vim-lsp]] + [[vim-lsp]]
+ [[vim-lsc]]
- [[Visual Studio Code]] - [[Visual Studio Code]]
- [[Monaco Editor | https://github.com/MaskRay/ccls/wiki/Monaco-Editor]] - [[Monaco Editor | https://github.com/MaskRay/ccls/wiki/Monaco-Editor]]
* [[Project Setup]] * [[Project Setup]]

30
vim-lsc.md Normal file

@ -0,0 +1,30 @@
Install [vim-lsc](https://github.com/natebosch/vim-lsc) according to the instructions in its README.
Configure ccls as the language server (example for `cpp`, do similarly for other filetypes, as needed):
```viml
let g:lsc_server_commands = {
\ 'cpp': {
\ 'command': 'ccls',
\ 'message_hooks': {
\ 'initialize': {
\ 'initializationOptions': {'cache': {'directory': '/tmp/ccls/cache'}},
\ 'rootUri': {m, p -> lsc#uri#documentUri(fnamemodify(findfile('compile_commands.json', expand('%:p') . ';'), ':p:h'))}
\ },
\ },
\ },
\}
```
If the [compilation database](https://github.com/MaskRay/ccls/wiki/compile_commands.json) is correctly set, then things should work (e.g. reference highlight of the symbol under the cursor should be visible). See `|lsc-commands|` for the list of all available commands.
Default mappings are provided out-of-the-box (see `|lsc-default-map|`). To set custom mappings, change the values in `|g:lsc_auto_map|`, e.g.:
```viml
let g:lsc_auto_map = {
\ 'GoToDefinition': '<M-d>',
\ 'FindReferences': '<M-r>',
\}
```
(optionally add `'defaults': v:true` to keep default values for other mappings that are not redefined).