From eefa2f0b6a979e858aac4ae95d8627d0d84a135b Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 2 Oct 2019 22:06:11 +0800 Subject: [PATCH] Add lsp support for crystal (#3108) --- autoload/SpaceVim/layers/lang/crystal.vim | 9 +++++++++ autoload/SpaceVim/layers/lsp.vim | 1 + docs/cn/layers/language-server-protocol.md | 1 + docs/layers/language-server-protocol.md | 1 + 4 files changed, 12 insertions(+) diff --git a/autoload/SpaceVim/layers/lang/crystal.vim b/autoload/SpaceVim/layers/lang/crystal.vim index 24de4b105..0e31c0992 100644 --- a/autoload/SpaceVim/layers/lang/crystal.vim +++ b/autoload/SpaceVim/layers/lang/crystal.vim @@ -40,5 +40,14 @@ function! s:language_specified_mappings() abort call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'], \ 'call SpaceVim#plugins#repl#send("selection")', \ 'send selection and keep code buffer focused', 1) + + if SpaceVim#layers#lsp#check_filetype('crystal') + nnoremap K :call SpaceVim#lsp#show_doc() + + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], + \ 'call SpaceVim#lsp#show_doc()', 'show_document', 1) + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], + \ 'call SpaceVim#lsp#rename()', 'rename symbol', 1) + endif endfunction diff --git a/autoload/SpaceVim/layers/lsp.vim b/autoload/SpaceVim/layers/lsp.vim index 807b21ead..989060ceb 100644 --- a/autoload/SpaceVim/layers/lsp.vim +++ b/autoload/SpaceVim/layers/lsp.vim @@ -119,6 +119,7 @@ let s:lsp_servers = { \ 'php' : ['php', g:spacevim_plugin_bundle_dir . 'repos/github.com/felixfbecker/php-language-server/bin/php-language-server.php'], \ 'purescript' : ['purescript-language-server', '--stdio'], \ 'python' : ['pyls'], + \ 'crystal' : ['scry'], \ 'rust' : ['rustup', 'run', 'nightly', 'rls'], \ 'scala' : ['metals-vim'], \ 'sh' : ['bash-language-server', 'start'], diff --git a/docs/cn/layers/language-server-protocol.md b/docs/cn/layers/language-server-protocol.md index cdbc939b5..be3e3badb 100644 --- a/docs/cn/layers/language-server-protocol.md +++ b/docs/cn/layers/language-server-protocol.md @@ -131,6 +131,7 @@ gem install solargraph | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `c` | `['clangd']` | | `cpp` | `['clangd']` | +| `crystal` | `['scry']` | | `css` | `['css-languageserver', '--stdio']` | | `dart` | `['dart_language_server']` | | `go` | `['go-langserver', '-mode', 'stdio']` | diff --git a/docs/layers/language-server-protocol.md b/docs/layers/language-server-protocol.md index 72aae5b32..f3e4081f6 100644 --- a/docs/layers/language-server-protocol.md +++ b/docs/layers/language-server-protocol.md @@ -144,6 +144,7 @@ default language server commands: | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `c` | `['clangd']` | | `cpp` | `['clangd']` | +| `crystal` | `['scry']` | | `css` | `['css-languageserver', '--stdio']` | | `dart` | `['dart_language_server']` | | `go` | `['go-langserver', '-mode', 'stdio']` |