Merge pull request #20 from bleshik/feature/support-for-groovy

Support for Groovy
This commit is contained in:
Idan Arye 2015-09-05 18:29:56 +03:00
commit 8289c7c1d2

View File

@ -114,7 +114,8 @@ endfunction
function! s:getClassNameFromFile(filename)
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)
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)
return l:matches[1].'.'.l:className
endif