mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 01:09:56 +08:00
perf(lsp): use notify api to display workspace
This commit is contained in:
parent
68a3f4e203
commit
634ea0a34f
@ -145,6 +145,28 @@ function! s:language_specified_mappings() abort
|
|||||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
|
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
|
||||||
\ 'call SpaceVim#plugins#repl#send("selection")',
|
\ 'call SpaceVim#plugins#repl#send("selection")',
|
||||||
\ 'send selection and keep code buffer focused', 1)
|
\ 'send selection and keep code buffer focused', 1)
|
||||||
|
if SpaceVim#layers#lsp#check_filetype('lua')
|
||||||
|
\ || SpaceVim#layers#lsp#check_server('lua_ls')
|
||||||
|
\ || SpaceVim#layers#lsp#check_server('sumneko_lua')
|
||||||
|
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#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#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
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#lua#health() abort
|
function! SpaceVim#layers#lang#lua#health() abort
|
||||||
|
@ -15,6 +15,7 @@ endif
|
|||||||
|
|
||||||
let s:NVIM_VERSION = SpaceVim#api#import('neovim#version')
|
let s:NVIM_VERSION = SpaceVim#api#import('neovim#version')
|
||||||
let s:box = SpaceVim#api#import('unicode#box')
|
let s:box = SpaceVim#api#import('unicode#box')
|
||||||
|
let s:NOTI = SpaceVim#api#import('notify')
|
||||||
|
|
||||||
if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0')
|
if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0')
|
||||||
" use neovim built-in lsp
|
" use neovim built-in lsp
|
||||||
@ -56,7 +57,7 @@ if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0
|
|||||||
let workspace = luaeval('vim.lsp.buf.list_workspace_folders()')
|
let workspace = luaeval('vim.lsp.buf.list_workspace_folders()')
|
||||||
let bw = max(map(deepcopy(workspace), 'strwidth(v:val)')) + 5
|
let bw = max(map(deepcopy(workspace), 'strwidth(v:val)')) + 5
|
||||||
let box = s:box.drawing_box(workspace, 1, 1, bw, {'align' : 'left'})
|
let box = s:box.drawing_box(workspace, 1, 1, bw, {'align' : 'left'})
|
||||||
echo join(box, "\n")
|
call s:NOTI.notify(join(box, "\n"))
|
||||||
endfunction
|
endfunction
|
||||||
function! SpaceVim#lsp#add_workspace_folder() abort
|
function! SpaceVim#lsp#add_workspace_folder() abort
|
||||||
lua vim.lsp.buf.add_workspace_folder()
|
lua vim.lsp.buf.add_workspace_folder()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user