1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 07:40:05 +08:00

Add lsp support for dart

ref: https://github.com/dart-lang/dart-vim-plugin/issues/59
This commit is contained in:
wsdjeg 2018-01-02 21:40:21 +08:00
parent 2a9033afc1
commit d9a0769477
3 changed files with 25 additions and 12 deletions

View File

@ -45,19 +45,21 @@ let s:clang_executable = 'clang'
let s:SYSTEM = SpaceVim#api#import('system')
function! SpaceVim#layers#lang#c#plugins() abort
let plugins = []
if g:spacevim_autocomplete_method ==# 'deoplete'
if s:use_libclang
call add(plugins, ['zchee/deoplete-clang'])
if !SpaceVim#layers#lsp#check_filetype('c') && !SpaceVim#layers#lsp#check_filetype('cpp')
if g:spacevim_autocomplete_method ==# 'deoplete'
if s:use_libclang
call add(plugins, ['zchee/deoplete-clang'])
else
call add(plugins, ['SpaceVim/deoplete-clang2'])
endif
elseif g:spacevim_autocomplete_method ==# 'ycm'
" no need extra plugins
elseif g:spacevim_autocomplete_method ==# 'completor'
" no need extra plugins
elseif g:spacevim_autocomplete_method ==# 'asyncomplete'
else
call add(plugins, ['SpaceVim/deoplete-clang2'])
call add(plugins, ['Rip-Rip/clang_complete'])
endif
elseif g:spacevim_autocomplete_method ==# 'ycm'
" no need extra plugins
elseif g:spacevim_autocomplete_method ==# 'completor'
" no need extra plugins
elseif g:spacevim_autocomplete_method ==# 'asyncomplete'
else
call add(plugins, ['Rip-Rip/clang_complete'])
endif
if has('nvim')
if has('python3')

View File

@ -1,7 +1,9 @@
function! SpaceVim#layers#lang#dart#plugins() abort
let plugins = []
call add(plugins, ['dart-lang/dart-vim-plugin', {'merged' : 0}])
call add(plugins, ['SpaceVim/deoplete-dart', {'merged' : 0}])
if !SpaceVim#layers#lsp#check_filetype('dart')
call add(plugins, ['SpaceVim/deoplete-dart', {'merged' : 0}])
endif
return plugins
endfunction
@ -29,4 +31,12 @@ 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('dart')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
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

View File

@ -78,6 +78,7 @@ let s:lsp_servers = {
\ 'cpp' : ['clangd'],
\ 'objc' : ['clangd'],
\ 'objcpp' : ['clangd'],
\ 'dart' : ['dart_language_server'],
\ 'go' : ['go-langserver', '-mode', 'stdio'],
\ 'rust' : ['rustup', 'run', 'nightly', 'rls'],
\ 'python' : ['pyls'],