1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:10:06 +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
au!
if !SpaceVim#layers#lsp#check_filetype('java')
\ && !SpaceVim#layers#lsp#check_server('jdtls')
" omnifunc will be used only when no java lsp support
autocmd FileType java setlocal omnifunc=javacomplete#Complete
endif

View File

@ -18,22 +18,25 @@ call deoplete#custom#option({
\ 'nofile_complete_filetypes' : ['denite-filter'],
\ })
" java && jsp
call deoplete#custom#var('omni', 'input_patterns', {
\ 'java': [
\ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*',
\ ],
\ 'jsp': ['[^. \t0-9]\.\w*'],
\})
if g:spacevim_enable_javacomplete2_py
call deoplete#custom#option('ignore_sources', {'java': ['omni']})
call deoplete#custom#source('javacomplete2', 'mark', '')
else
call deoplete#custom#option('ignore_sources', {'java': ['javacomplete2', 'around', 'member']})
call deoplete#custom#source('omni', 'mark', '')
call deoplete#custom#source('omni', 'rank', 9999)
if !SpaceVim#layers#lsp#check_filetype('java')
\ && !SpaceVim#layers#lsp#check_server('jdtls')
" java && jsp
call deoplete#custom#var('omni', 'input_patterns', {
\ 'java': [
\ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*',
\ ],
\ 'jsp': ['[^. \t0-9]\.\w*'],
\})
if g:spacevim_enable_javacomplete2_py
call deoplete#custom#option('ignore_sources', {'java': ['omni']})
call deoplete#custom#source('javacomplete2', 'mark', '')
else
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
" sh
@ -50,11 +53,11 @@ call deoplete#custom#option('ignore_sources', {'markdown': ['tag']})
" perl
call deoplete#custom#var('omni', 'input_patterns', {
\ 'perl': [
\ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*',
\ ],
\})
\ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*',
\ ],
\})
" javascript
call deoplete#custom#option('ignore_sources', {'javascript': ['omni']})
@ -80,9 +83,9 @@ endif
" gitcommit
call deoplete#custom#var('omni', 'input_patterns', {
\ 'git-commit': [
\ '[ ]#[ 0-9a-zA-Z]*',
\ ],
\})
\ '[ ]#[ 0-9a-zA-Z]*',
\ ],
\})
call deoplete#custom#option('ignore_sources', {'gitcommit': ['neosnippet']})
@ -114,9 +117,9 @@ call deoplete#custom#option('ignore_sources', {'ocaml': ['buffer', 'around', 'om
" erlang
call deoplete#custom#var('omni', 'input_patterns', {
\ 'erlang': [
\ '[^. \t0-9]\.\w*',
\ ],
\})
\ '[^. \t0-9]\.\w*',
\ ],
\})
" c#
call deoplete#custom#option('sources', {'cs': ['omnisharp']})