runtime(java): Optionally highlight the :: token for method references

This token will be highlighted, similar to the arrow of
lambda expressions, whenever "g:java_highlight_functions" is
defined.

Also:

- Improve the recognition of _switch-case_ labels
  (D-Cysteine).
- Remove insignificant empty statements in syntax test
  files.

closes: #15322

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.13
https://github.com/fleiner/vim/pull/1

Co-authored-by: D-Cysteine <54219287+D-Cysteine@users.noreply.github.com>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Aliaksei Budavei
2024-07-24 20:15:15 +02:00
committed by Christian Brabandt
parent df77c8ad39
commit e73e5b889b
41 changed files with 855 additions and 37 deletions

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 9.1. Last change: 2024 Jul 16
*syntax.txt* For Vim version 9.1. Last change: 2024 Jul 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2046,11 +2046,11 @@ use the following: >
:let java_highlight_java_io=1
Check the javaid.vim file for a list of all the packages that are supported.
Function names are not highlighted, as the way to find functions depends on
how you write Java code. The syntax file knows two possible ways to highlight
headers of function declarations:
Headers of indented function declarations can be highlighted (along with parts
of lambda expressions and method reference expressions), but it depends on how
you write Java code. Two formats are recognized:
If you write function declarations that are consistently indented by either
1) If you write function declarations that are consistently indented by either
a tab, or a space . . . or eight space character(s), you may want to set >
:let java_highlight_functions="indent"
:let java_highlight_functions="indent1"
@ -2062,10 +2062,12 @@ a tab, or a space . . . or eight space character(s), you may want to set >
:let java_highlight_functions="indent7"
:let java_highlight_functions="indent8"
Note that in terms of 'shiftwidth', this is the leftmost step of indentation.
However, if you follow the Java guidelines about how functions and classes are
supposed to be named (with respect to upper- and lowercase) and there is any
amount of indentation, you may want to set >
2) However, if you follow the Java guidelines about how functions and types
are supposed to be named (with respect to upper- and lowercase) and there is
any amount of indentation, you may want to set >
:let java_highlight_functions="style"
In addition, you can combine any value of "java_highlight_functions" with >
:let java_highlight_signature=1
to have the name of a function with its parameter list parens distinctly