mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 12:50:04 +08:00
fix(java): disable neomake when lsp enabled
This commit is contained in:
parent
5f519c99c9
commit
8513066ee1
@ -33,6 +33,7 @@
|
|||||||
" ''
|
" ''
|
||||||
" ]
|
" ]
|
||||||
" <
|
" <
|
||||||
|
" 4. `enabled_linters`: Set the enabled linters for java, default is `['javac']`.
|
||||||
" @subsection Mappings
|
" @subsection Mappings
|
||||||
" >
|
" >
|
||||||
" Import key bindings:
|
" Import key bindings:
|
||||||
@ -129,6 +130,7 @@ let s:java_file_head = [
|
|||||||
\ ''
|
\ ''
|
||||||
\ ]
|
\ ]
|
||||||
let s:java_interpreter = 'java'
|
let s:java_interpreter = 'java'
|
||||||
|
let s:enabled_linters = ['javac']
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#java#plugins() abort
|
function! SpaceVim#layers#lang#java#plugins() abort
|
||||||
let plugins = []
|
let plugins = []
|
||||||
@ -149,8 +151,19 @@ function! SpaceVim#layers#lang#java#config() abort
|
|||||||
call add(g:spacevim_project_rooter_patterns, 'build.gradle')
|
call add(g:spacevim_project_rooter_patterns, 'build.gradle')
|
||||||
|
|
||||||
" for neomake
|
" for neomake
|
||||||
"
|
" neomake will be disabled when lsp is enabled for java.
|
||||||
|
if SpaceVim#layers#lsp#check_filetype('java')
|
||||||
|
\ || SpaceVim#layers#lsp#check_server('jdtls')
|
||||||
|
let g:neomake_java_enabled_makers = []
|
||||||
|
else
|
||||||
|
if g:spacevim_lint_engine ==# 'neomake'
|
||||||
let g:neomake_java_javac_options = ['-J-Duser.language=en']
|
let g:neomake_java_javac_options = ['-J-Duser.language=en']
|
||||||
|
let g:neomake_java_enabled_makers = s:enabled_linters
|
||||||
|
for lint in g:neomake_java_enabled_makers
|
||||||
|
let g:neomake_java_{lint}_remove_invalid_entries = 1
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" defined JDTLS_HOME
|
" defined JDTLS_HOME
|
||||||
|
|
||||||
@ -159,6 +172,7 @@ function! SpaceVim#layers#lang#java#config() abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if SpaceVim#layers#lsp#check_filetype('java')
|
if SpaceVim#layers#lsp#check_filetype('java')
|
||||||
|
\ || SpaceVim#layers#lsp#check_server('jdtls')
|
||||||
call SpaceVim#mapping#gd#add('java', function('SpaceVim#lsp#go_to_def'))
|
call SpaceVim#mapping#gd#add('java', function('SpaceVim#lsp#go_to_def'))
|
||||||
else
|
else
|
||||||
call SpaceVim#mapping#gd#add('java', function('s:go_to_def'))
|
call SpaceVim#mapping#gd#add('java', function('s:go_to_def'))
|
||||||
@ -332,6 +346,7 @@ function! s:language_specified_mappings() abort
|
|||||||
\ 'send selection and keep code buffer focused', 1)
|
\ 'send selection and keep code buffer focused', 1)
|
||||||
|
|
||||||
if SpaceVim#layers#lsp#check_filetype('java')
|
if SpaceVim#layers#lsp#check_filetype('java')
|
||||||
|
\ || SpaceVim#layers#lsp#check_server('jdtls')
|
||||||
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
||||||
|
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
||||||
@ -367,6 +382,7 @@ function! SpaceVim#layers#lang#java#set_variable(var) abort
|
|||||||
let s:java_formatter_jar = get(a:var,
|
let s:java_formatter_jar = get(a:var,
|
||||||
\ 'java_formatter_jar',
|
\ 'java_formatter_jar',
|
||||||
\ s:java_formatter_jar)
|
\ s:java_formatter_jar)
|
||||||
|
let s:enabled_linters = get(a:var, 'enabled_linters', s:enabled_linters)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" vim:set et sw=2 cc=80:
|
" vim:set et sw=2 cc=80:
|
||||||
|
@ -267,7 +267,7 @@ endfunction
|
|||||||
|
|
||||||
function! SpaceVim#layers#lsp#check_filetype(ft) abort
|
function! SpaceVim#layers#lsp#check_filetype(ft) abort
|
||||||
if s:use_nvim_lsp
|
if s:use_nvim_lsp
|
||||||
return 1
|
return 0
|
||||||
else
|
else
|
||||||
return index(s:enabled_fts, a:ft) != -1
|
return index(s:enabled_fts, a:ft) != -1
|
||||||
endif
|
endif
|
||||||
|
@ -3513,6 +3513,8 @@ LAYER OPTIONS
|
|||||||
''
|
''
|
||||||
]
|
]
|
||||||
<
|
<
|
||||||
|
4. `enabled_linters`: Set the enabled linters for java, default is
|
||||||
|
`['javac']`.
|
||||||
MAPPINGS
|
MAPPINGS
|
||||||
|
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user