diff options
-rw-r--r-- | runtime/doc/syntax.txt | 16 | ||||
-rw-r--r-- | runtime/syntax/java.vim | 10 |
2 files changed, 16 insertions, 10 deletions
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 4d301bcb80..f7a8940a52 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1574,11 +1574,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" @@ -1590,10 +1590,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 diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 4beeaad224..9c4964db71 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: 2024 Jun 22 +" Last Change: 2024 Jul 23 " Please check :help java.vim for comments on some of the options available. @@ -260,7 +260,7 @@ if exists("java_space_errors") endif endif -exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*:"he=e-1' +exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*::\@!"he=e-1' syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaLabelDefault,javaLabelVarType,javaLabelWhenClause syn region javaLabelRegion transparent matchgroup=javaLabel start="\<default\>\%(\s*\%(:\|->\)\)\@=" matchgroup=NONE end=":\|->" oneline " Consider grouped _default_ _case_ labels, i.e. @@ -497,8 +497,12 @@ syn match javaParenError "\]" hi def link javaParenError javaError -" Lambda expressions (JLS-17, §15.27). +" Lambda expressions (JLS-17, §15.27) and method references (JLS-17, +" §15.13). if exists("java_highlight_functions") + syn match javaMethodRef ":::\@!" + hi def link javaMethodRef javaFuncDef + if exists("java_highlight_signature") let s:ff.LambdaDef = s:ff.LeftConstant else |