runtime(java): Consent to HTML tags folding in Javadoc comments
HTML tags in Javadoc comments can additionally be folded
after applying
------------------------------------------------------------
let g:html_syntax_folding = 1
set foldmethod=syntax
------------------------------------------------------------
and giving explicit consent with
------------------------------------------------------------
let g:java_consent_to_html_syntax_folding = 1
------------------------------------------------------------
Do not default to this kind of folding unless ALL start tags
and optional end tags are balanced in Javadoc comments;
otherwise, put up with creating runaway folds that break
syntax highlighting.
resolves: zzzyxwvut/java-vim#8.
closes: #17216
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim
index 8dabc5e..37b99b7 100644
--- a/runtime/syntax/java.vim
+++ b/runtime/syntax/java.vim
@@ -3,7 +3,7 @@
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
" Repository: https://github.com/zzzyxwvut/java-vim.git
-" Last Change: 2025 Mar 26
+" Last Change: 2025 Apr 28
" Please check ":help java.vim" for comments on some of the options
" available.
@@ -387,15 +387,30 @@
" Include HTML syntax coloring for Javadoc comments.
if s:with_html
try
+ if exists("g:html_syntax_folding") && !exists("g:java_consent_to_html_syntax_folding")
+ let s:html_syntax_folding_copy = g:html_syntax_folding
+ unlet g:html_syntax_folding
+ endif
+
syntax include @javaHtml syntax/html.vim
finally
unlet! b:current_syntax
+
+ if exists("s:html_syntax_folding_copy")
+ let g:html_syntax_folding = s:html_syntax_folding_copy
+ unlet s:html_syntax_folding_copy
+ endif
endtry
endif
" Include Markdown syntax coloring (v7.2.437) for Javadoc comments.
if s:with_markdown
try
+ if exists("g:html_syntax_folding") && !exists("g:java_consent_to_html_syntax_folding")
+ let s:html_syntax_folding_copy = g:html_syntax_folding
+ unlet g:html_syntax_folding
+ endif
+
syntax include @javaMarkdown syntax/markdown.vim
try
@@ -413,6 +428,11 @@
finally
unlet! b:current_syntax
+ if exists("s:html_syntax_folding_copy")
+ let g:html_syntax_folding = s:html_syntax_folding_copy
+ unlet s:html_syntax_folding_copy
+ endif
+
if exists("s:no_support")
unlet s:no_support
unlockvar s:with_markdown