Last active
November 20, 2019 22:36
-
-
Save Amar1729/49221cee3b9fc48fa3033893757d4473 to your computer and use it in GitHub Desktop.
extend neomake's gradle classpath with javacomplete2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" -*- vim -*- | |
" FILE: neomake_java_helper.vim | |
" Function to help (neomake)[https://github.com/neomake/neomake/] find the | |
" gradle classpath. | |
" Uses (javacomplete2)[https://github.com/artur-shaik/vim-javacomplete2] | |
" to find and set the classpath. | |
function! s:GetBasePath() | |
return substitute(g:JavaComplete_GradlePath, 'build.gradle', 'src/main/java', '') | |
endfunction | |
function! FixNeomakeGradle() | |
if exists('g:JavaComplete_PluginLoaded') && exists('g:JavaComplete_ProjectKey') | |
if javacomplete#classpath#gradle#IfGradle() | |
" extend classpath manually | |
let l:path = javacomplete#util#GetBase("classpath" . g:FILE_SEP) . g:JavaComplete_ProjectKey | |
let l:javac_classpath = readfile(l:path) | |
let g:neomake_java_javac_classpath = s:GetBasePath() . ":" . l:javac_classpath[0] | |
endif | |
endif | |
endfunction | |
au BufEnter * :call FixNeomakeGradle() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
related neomake issue: neomake/neomake#1971
Easiest to drop this script in
~/.vim/after/ftplugin/java
so it only applies toFileType java
buffers.