Skip to content

Commit

Permalink
[Java] Add support for module imports (#4037)
Browse files Browse the repository at this point in the history
Implements JEP 476, shipped with Java 23+

see: https://openjdk.org/jeps/476
  • Loading branch information
deathaxe committed Sep 20, 2024
1 parent 9f4d776 commit e2e7139
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Java/Java.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,19 @@ contexts:
- include: immediately-pop

import-modifier:
- match: module{{break}}
scope: keyword.declaration.module.java
set: import-module
- match: static{{break}}
scope: storage.modifier.java
set: import-static
- match: (?=\S)
set: type-import

import-module:
- include: entity-module
- include: else-pop

import-static:
- match: (?=\S)
set: static-import
Expand Down
11 changes: 11 additions & 0 deletions Java/tests/syntax_test_java.java
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,17 @@
// ^ punctuation.accessor.dot.java
// ^^^ entity.name.import.java

import module java.desktop;
//^^^^^^^^^^^^ meta.import.java - meta.path
// ^^^^^^^^^^^^ meta.import.java meta.path.java
// ^ - meta.import - meta.path
//^^^^ keyword.declaration.import.java
// ^^^^^^ keyword.declaration.module.java
// ^^^^ variable.namespace.java
// ^ punctuation.accessor.dot.java
// ^^^^^^^ entity.name.namespace.module.java
// ^ punctuation.terminator.java

/******************************************************************************
* Class Declaration Tests
* https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1
Expand Down

0 comments on commit e2e7139

Please sign in to comment.