Make package parsing work for groovy

This commit is contained in:
Alexey Balchunas 2015-09-05 12:45:04 +07:00
parent f98c830b82
commit 06ae5e977e

View File

@ -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