runtime(java): Fold adjacent "import" declarations

Also, distinguish (by abbreviating their names) and manage
foldable kinds of syntax items: blocks of code ("b"), plain
comments ("c"), Javadoc comments ("d"), adjacent "import"
declarations ("i").  Fold all qualifying items by default;
otherwise, do not fold items of explicitly delisted kinds.
For example,
------------------------------------------------------------
	let g:java_ignore_folding = "bcdi"
------------------------------------------------------------

Resolves zzzyxwvut/java-vim#12.

closes: #18492

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Aliaksei Budavei
2025-10-08 16:45:28 +00:00
committed by Christian Brabandt
parent 97d1255558
commit 143686b3c4
22 changed files with 438 additions and 258 deletions

View File

@ -2214,14 +2214,17 @@ Note that these three variables are maintained in the HTML syntax file.
Numbers and strings can be recognized in non-Javadoc comments with >
:let g:java_comment_strings = 1
When 'foldmethod' is set to "syntax", blocks of code and multi-line comments
will be folded. No text is usually written in the first line of a multi-line
comment, making folded contents of Javadoc comments less informative with the
default 'foldtext' value; you may opt for showing the contents of a second
line for any comments written in this way, and showing the contents of a first
line otherwise, with >
When 'foldmethod' is set to "syntax", multi-line blocks of code ("b"), plain
comments ("c"), Javadoc comments ("d"), and adjacent "import" declarations
("i") will be folded by default. Syntax items of any supported kind will
remain NOT foldable when its abbreviated name is delisted with >
:let g:java_ignore_folding = "bcdi"
No text is usually written in the first line of a multi-line comment, making
folded contents of Javadoc comments less informative with the default
'foldtext' value; you may opt for showing the contents of a second line for
any comments written in this way, and showing the contents of a first line
otherwise, with >
:let g:java_foldtext_show_first_or_second_line = 1
HTML tags in Javadoc comments can additionally be folded by following the
instructions listed under |html-folding| and giving explicit consent with >
:let g:java_consent_to_html_syntax_folding = 1