1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:40:03 +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,22 +18,25 @@ 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': [ " java && jsp
\ '[^. \t0-9]\.\w*', call deoplete#custom#var('omni', 'input_patterns', {
\ '[^. \t0-9]\->\w*', \ 'java': [
\ '[^. \t0-9]\::\w*', \ '[^. \t0-9]\.\w*',
\ ], \ '[^. \t0-9]\->\w*',
\ 'jsp': ['[^. \t0-9]\.\w*'], \ '[^. \t0-9]\::\w*',
\}) \ ],
if g:spacevim_enable_javacomplete2_py \ 'jsp': ['[^. \t0-9]\.\w*'],
call deoplete#custom#option('ignore_sources', {'java': ['omni']}) \})
call deoplete#custom#source('javacomplete2', 'mark', '') if g:spacevim_enable_javacomplete2_py
else call deoplete#custom#option('ignore_sources', {'java': ['omni']})
call deoplete#custom#option('ignore_sources', {'java': ['javacomplete2', 'around', 'member']}) call deoplete#custom#source('javacomplete2', 'mark', '')
call deoplete#custom#source('omni', 'mark', '') else
call deoplete#custom#source('omni', 'rank', 9999) call deoplete#custom#option('ignore_sources', {'java': ['javacomplete2', 'around', 'member']})
call deoplete#custom#source('omni', 'mark', '')
call deoplete#custom#source('omni', 'rank', 9999)
endif
endif endif
" sh " sh
@ -50,11 +53,11 @@ call deoplete#custom#option('ignore_sources', {'markdown': ['tag']})
" perl " perl
call deoplete#custom#var('omni', 'input_patterns', { call deoplete#custom#var('omni', 'input_patterns', {
\ 'perl': [ \ 'perl': [
\ '[^. \t0-9]\.\w*', \ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*', \ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*', \ '[^. \t0-9]\::\w*',
\ ], \ ],
\}) \})
" javascript " javascript
call deoplete#custom#option('ignore_sources', {'javascript': ['omni']}) call deoplete#custom#option('ignore_sources', {'javascript': ['omni']})
@ -80,9 +83,9 @@ endif
" gitcommit " gitcommit
call deoplete#custom#var('omni', 'input_patterns', { call deoplete#custom#var('omni', 'input_patterns', {
\ 'git-commit': [ \ 'git-commit': [
\ '[ ]#[ 0-9a-zA-Z]*', \ '[ ]#[ 0-9a-zA-Z]*',
\ ], \ ],
\}) \})
call deoplete#custom#option('ignore_sources', {'gitcommit': ['neosnippet']}) call deoplete#custom#option('ignore_sources', {'gitcommit': ['neosnippet']})
@ -114,9 +117,9 @@ call deoplete#custom#option('ignore_sources', {'ocaml': ['buffer', 'around', 'om
" erlang " erlang
call deoplete#custom#var('omni', 'input_patterns', { call deoplete#custom#var('omni', 'input_patterns', {
\ 'erlang': [ \ 'erlang': [
\ '[^. \t0-9]\.\w*', \ '[^. \t0-9]\.\w*',
\ ], \ ],
\}) \})
" c# " c#
call deoplete#custom#option('sources', {'cs': ['omnisharp']}) call deoplete#custom#option('sources', {'cs': ['omnisharp']})