aboutsummaryrefslogtreecommitdiff
path: root/autoload/hints
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/hints')
-rw-r--r--autoload/hints/plugins.vim27
1 files changed, 17 insertions, 10 deletions
diff --git a/autoload/hints/plugins.vim b/autoload/hints/plugins.vim
index 645b07e..7f22301 100644
--- a/autoload/hints/plugins.vim
+++ b/autoload/hints/plugins.vim
@@ -12,21 +12,28 @@ let s:java_plugin = {}
function! s:java_plugin.Before(file) dict
let self.last_line = ''
+ let self.last_indent = ''
endfunction
let s:WHITESPACE_OR_COMMENT='\(^\s*$\)\|\(^\s*//\)\|\(^\s*\*/\)'
function! s:java_plugin.TagLine(linenr, line) dict
- return v:true
- " if self.last_line =~ s:WHITESPACE_OR_COMMENT
- " \ && !(a:line =~ s:WHITESPACE_OR_COMMENT)
- " let self.last_line = a:line
- " return v:true
- " endif
- " let self.last_line = a:line
+ if self.last_line =~ s:WHITESPACE_OR_COMMENT
+ \ && !(a:line =~ s:WHITESPACE_OR_COMMENT)
+ let self.last_line = a:line
+ return v:true
+ endif
+
+ let self.last_line = a:line
+ let indent = matchlist(a:line, '^\s*')
+ let indent = len(indent) > 0 ? indent[0] : ""
+ if self.last_indent != indent
+ let self.last_indent = indent
+ return v:true
+ endif
- " return
- " \ a:line =~ '^\s*}$' ||
- " \ a:line =~ '\<\(public\|private\|protected\|class\|static\|try\|while\|for\|if\|else\|catch\)\>'
+ return
+ \ a:line =~ '^\s*}$' ||
+ \ a:line =~ '\<\(public\|private\|protected\|class\|static\|try\|while\|for\|if\|else\|catch\)\>'
endfunction
function! hints#plugins#registerFt(filetype, plugin) abort