diff options
author | NiBo <nibocn@gmail.com> | 2020-05-15 10:48:03 +0800 |
---|---|---|
committer | NiBo <nibocn@gmail.com> | 2020-05-15 10:48:03 +0800 |
commit | 3b4193175ed75d099e40aad8d60033ab20b44521 (patch) | |
tree | 5fcac5ff43fd8a69aa4f99e8e248b6d80c59f9df /ale_linters | |
parent | 69d96aa9d9998a64ae7dacd700966ada6e30216f (diff) | |
download | ale-3b4193175ed75d099e40aad8d60033ab20b44521.zip |
feat(javac): Add java_javac_sourcepath variable
This variable can set multiple source code
paths, the source code path is a relative
path (relative to the project root directory)
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/java/javac.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim index 8bb52c0b..e166bea4 100644 --- a/ale_linters/java/javac.vim +++ b/ale_linters/java/javac.vim @@ -6,6 +6,7 @@ let s:classpath_sep = has('unix') ? ':' : ';' call ale#Set('java_javac_executable', 'javac') call ale#Set('java_javac_options', '') call ale#Set('java_javac_classpath', '') +call ale#Set('java_javac_sourcepath', []) function! ale_linters#java#javac#RunWithImportPaths(buffer) abort let l:command = '' @@ -79,6 +80,16 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort endif endif + let l:sourcepath_item = ale#Var(a:buffer, 'java_javac_sourcepath') + if !empty(l:sourcepath_item) + for l:sourcepath in l:sourcepath_item + let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:sourcepath) + if !empty(l:sp_path) + call add(l:sp_dirs, l:sp_path) + endif + endfor + endif + if !empty(l:sp_dirs) let l:sp_option = '-sourcepath ' \ . ale#Escape(join(l:sp_dirs, s:classpath_sep)) |