File: java.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (26 lines) | stat: -rw-r--r-- 697 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
" Author: Horacio Sanson https://github.com/hsanson
" Description: Functions for integrating with Java tools

" Find the nearest dir contining a gradle or pom file and assume it
" the root of a java app.
function! ale#java#FindProjectRoot(buffer) abort
    let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer)

    if !empty(l:gradle_root)
        return l:gradle_root
    endif

    let l:maven_pom_file = ale#path#FindNearestFile(a:buffer, 'pom.xml')

    if !empty(l:maven_pom_file)
        return fnamemodify(l:maven_pom_file, ':h')
    endif

    let l:ant_root = ale#ant#FindProjectRoot(a:buffer)

    if !empty(l:ant_root)
        return l:ant_root
    endif

    return ''
endfunction