Make package parsing work for groovy
This commit is contained in:
parent
f98c830b82
commit
06ae5e977e
@ -114,7 +114,8 @@ endfunction
|
|||||||
function! s:getClassNameFromFile(filename)
|
function! s:getClassNameFromFile(filename)
|
||||||
let l:className=fnamemodify(a:filename,':t:r') " Get only the name of the file, without path or extension
|
let l:className=fnamemodify(a:filename,':t:r') " Get only the name of the file, without path or extension
|
||||||
for l:line in readfile(a:filename)
|
for l:line in readfile(a:filename)
|
||||||
let l:matches=matchlist(l:line,'\vpackage\s+(%(\w|\.)+)\s*;')
|
" trailing ; is optional to make it work for groovy as well
|
||||||
|
let l:matches=matchlist(l:line,'\vpackage\s+(%(\w|\.)+)\s*;?')
|
||||||
if 1<len(l:matches)
|
if 1<len(l:matches)
|
||||||
return l:matches[1].'.'.l:className
|
return l:matches[1].'.'.l:className
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user