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

fix(javalsp): disable omni source when lsp enabled

This commit is contained in:
wsdjeg 2023-03-29 13:17:26 +08:00
parent 423e83e479
commit 5f519c99c9
2 changed files with 31 additions and 27 deletions

View File

@ -166,6 +166,7 @@ function! SpaceVim#layers#lang#java#config() abort
augroup SpaceVim_lang_java augroup SpaceVim_lang_java
au! au!
if !SpaceVim#layers#lsp#check_filetype('java') if !SpaceVim#layers#lsp#check_filetype('java')
\ && !SpaceVim#layers#lsp#check_server('jdtls')
" omnifunc will be used only when no java lsp support " omnifunc will be used only when no java lsp support
autocmd FileType java setlocal omnifunc=javacomplete#Complete autocmd FileType java setlocal omnifunc=javacomplete#Complete
endif endif

View File

@ -18,8 +18,10 @@ call deoplete#custom#option({
\ 'nofile_complete_filetypes' : ['denite-filter'], \ 'nofile_complete_filetypes' : ['denite-filter'],
\ }) \ })
" java && jsp if !SpaceVim#layers#lsp#check_filetype('java')
call deoplete#custom#var('omni', 'input_patterns', { \ && !SpaceVim#layers#lsp#check_server('jdtls')
" java && jsp
call deoplete#custom#var('omni', 'input_patterns', {
\ 'java': [ \ 'java': [
\ '[^. \t0-9]\.\w*', \ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*', \ '[^. \t0-9]\->\w*',
@ -27,13 +29,14 @@ call deoplete#custom#var('omni', 'input_patterns', {
\ ], \ ],
\ 'jsp': ['[^. \t0-9]\.\w*'], \ 'jsp': ['[^. \t0-9]\.\w*'],
\}) \})
if g:spacevim_enable_javacomplete2_py if g:spacevim_enable_javacomplete2_py
call deoplete#custom#option('ignore_sources', {'java': ['omni']}) call deoplete#custom#option('ignore_sources', {'java': ['omni']})
call deoplete#custom#source('javacomplete2', 'mark', '') call deoplete#custom#source('javacomplete2', 'mark', '')
else else
call deoplete#custom#option('ignore_sources', {'java': ['javacomplete2', 'around', 'member']}) call deoplete#custom#option('ignore_sources', {'java': ['javacomplete2', 'around', 'member']})
call deoplete#custom#source('omni', 'mark', '') call deoplete#custom#source('omni', 'mark', '')
call deoplete#custom#source('omni', 'rank', 9999) call deoplete#custom#source('omni', 'rank', 9999)
endif
endif endif
" sh " sh