1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:30:05 +08:00

feat(lang#ruby): update lsp configuration for ruby

This commit is contained in:
wsdjeg 2022-05-27 16:53:18 +08:00
parent b8ae5eafa3
commit a989f9349e
2 changed files with 61 additions and 4 deletions

View File

@ -59,7 +59,30 @@
" SPC l s l send current line
" SPC l s s send selection text
" <
"
" To enable lsp support for ruby, you need to instal solargraph.
" >
" gem install --user-install solargraph
" <
" Enable the lsp layer for ruby:
" >
" [[layers]]
" name = 'lsp'
" enabled_clients = ['solargraph']
" <
" If the lsp layer is enabled for ruby, the following key bindings can
" be used:
" >
" key binding Description
" g D jump to type definition
" SPC l e rename symbol
" SPC l x show references
" SPC l h show line diagnostics
" SPC l d show document
" K show document
" SPC l w l list workspace folder
" SPC l w a add workspace folder
" SPC l w r remove workspace folder
" <
if exists('s:ruby_file_head')
@ -129,11 +152,23 @@ function! s:language_specified_mappings() abort
if SpaceVim#layers#lsp#check_filetype('ruby')
\ || SpaceVim#layers#lsp#check_server('solargraph')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
nnoremap <silent><buffer> gD :<C-u>call SpaceVim#lsp#go_to_typedef()<Cr>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
\ 'call SpaceVim#lsp#show_doc()', 'show-document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'x'],
\ 'call SpaceVim#lsp#references()', 'show-references', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
\ 'call SpaceVim#lsp#rename()', 'rename-symbol', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'h'],
\ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1)
let g:_spacevim_mappings_space.l.w = {'name' : '+Workspace'}
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'l'],
\ 'call SpaceVim#lsp#list_workspace_folder()', 'list-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'a'],
\ 'call SpaceVim#lsp#add_workspace_folder()', 'add-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'r'],
\ 'call SpaceVim#lsp#remove_workspace_folder()', 'remove-workspace-folder', 1)
endif
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],

View File

@ -4580,7 +4580,29 @@ This layer also provides REPL support for ruby, the key bindings are:
SPC l s l send current line
SPC l s s send selection text
<
To enable lsp support for ruby, you need to instal solargraph.
>
gem install --user-install solargraph
<
Enable the lsp layer for ruby:
>
[[layers]]
name = 'lsp'
enabled_clients = ['solargraph']
<
If the lsp layer is enabled for ruby, the following key bindings can be used:
>
key binding Description
g D jump to type definition
SPC l e rename symbol
SPC l x show references
SPC l h show line diagnostics
SPC l d show document
K show document
SPC l w l list workspace folder
SPC l w a add workspace folder
SPC l w r remove workspace folder
<
==============================================================================
LANG#RUST *SpaceVim-layers-lang-rust*