neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 059a9e62547e1fb4dc915da258b24844a6bfcd54
parent cd230be9189b8c8645610d86752711b38a52c711
Author: Christian Clason <c.clason@uni-graz.at>
Date:   Sat, 21 Sep 2024 10:26:54 +0200

vim-patch:50423ab: runtime(java): Optionally recognise _module_ import declarations

Define "g:java_syntax_previews" and include number 476 in
its list to enable this recognition:
------------------------------------------------------------
        let g:java_syntax_previews = [476]
------------------------------------------------------------

Reference:
https://openjdk.org/jeps/476

closes: vim/vim#15709

https://github.com/vim/vim/commit/50423ab8086c6e51b86548de77d79db8542ae317

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>

Diffstat:
Mruntime/doc/syntax.txt | 3++-
Mruntime/syntax/java.vim | 9++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt @@ -1704,11 +1704,12 @@ cycles for such a feature to become either integrated into the platform or withdrawn from this effort. To cater for early adopters, there is optional support in Vim for syntax related preview features that are implemented. You can request it by specifying a list of preview feature numbers as follows: > - :let g:java_syntax_previews = [455] + :let g:java_syntax_previews = [455, 476] The supported JEP numbers are to be drawn from this table: `430`: String Templates [JDK 21] `455`: Primitive types in Patterns, instanceof, and switch + `476`: Module Import Declarations Note that as soon as the particular preview feature will have been integrated into the Java platform, its entry will be removed from the table and related diff --git 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 Sep 18 +" Last Change: 2024 Sep 19 " Please check :help java.vim for comments on some of the options available. @@ -92,6 +92,13 @@ syn keyword javaTypedef this super syn keyword javaOperator new instanceof syn match javaOperator "\<var\>\%(\s*(\)\@!" +if s:ff.IsRequestedPreviewFeature(476) + " Module imports can be used in any source file. + syn match javaExternal "\<import\s\+module\>" contains=javaModuleImport + syn keyword javaModuleImport contained module + hi def link javaModuleImport Statement +endif + " Since the yield statement, which could take a parenthesised operand, " and _qualified_ yield methods get along within the switch block " (JLS-17, ยง3.8), it seems futile to make a region definition for this