[vim/vim] runtime(java): Fold multi-line comments with the syntax kind of &fdm (PR #15016)

4 views
Skip to first unread message

Aliaksei Budavei

unread,
Jun 15, 2024, 5:29:04 PM (12 days ago) Jun 15
to vim/vim, Subscribed

Also:

  • Restore the capability to mark as an error braces nested
    in parens with g:javaInParen.
  • Try not to fold top-level-type bodies. (Defining multiple
    package-private top level types in a single source file is
    not recommended as it can impose order among compilation
    units; so it is assumed that only one such top level type
    is usually defined.)
  • Compose ‘method header’ highlighting and block braces
    folding.
  • Do not highlight block braces whenever ‘method header’
    highlighting is requested.

This bundling of ‘method headers’ and block braces for
highlighting can be traced back to Vim v5.0; however, no
comment or documentation entry conveys any justification.
For example, it is hard to discover the connection between
block braces for while, if, etc., statements and method
body block braces. The former behaviour can be attained in,
e.g. ~/.vim/after/syntax/java.vim:

if exists("g:java_highlight_functions")
    syn clear javaBlock javaInParen
    syn match javaBlockOther "[{}]"
    syn region javaBlock transparent matchgroup=javaBlockStart
	\ start="\%(^\|^\S[^:]\+\)\@120<!{" end="}" fold
    hi def link javaBlockStart javaFuncDef
    hi def link javaBlockOther javaBlockStart

    if exists("g:java_mark_braces_in_parens_as_errors")
	syn match javaInParen contained "[{}]"
    endif
endif

Note: Read ‘a method header omitting a throws clause’ for
every ‘method header’ appellation used above.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/15016

Commit Summary

  • 07a4c3d runtime(java): Fold multi-line comments with the syntax kind of &fdm

File Changes

(53 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15016@github.com>

Aliaksei Budavei

unread,
Jun 15, 2024, 5:45:43 PM (12 days ago) Jun 15
to vim/vim, Subscribed

As I have already mentioned it elsewhere, folded lines are
always treated as opened for a syntax test when calculating
the line offsets and determining what next batch of lines to
dump to a file; hence, the generated dump files for them
exceed the required number because more lines are repeated.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15016/c2170889681@github.com>

Christian Brabandt

unread,
Jun 16, 2024, 2:42:46 AM (12 days ago) Jun 16
to vim/vim, Subscribed

thanks!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15016/c2171091441@github.com>

Christian Brabandt

unread,
Jun 16, 2024, 2:43:47 AM (12 days ago) Jun 16
to vim/vim, Subscribed

Merged #15016 into master.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15016/issue_event/13173820074@github.com>

Reply all
Reply to author
Forward
0 new messages