outline: Java enum constants are missing from java.yml
Author: michal-michalukCreated Sep 19, 2026Updated Sep 19, 2026
Summary
The bundled Java outline rules have no rule for enum_constant, so an enum's constants never reach the outline.
Evidence
- Grammar:
tree-sitter-java0.23.5src/node-types.jsondefinesenum_constant. - Schema:
schemas/java_rule.jsonlistsenum_constant. - Rules:
crates/outline/src/default_rules/java.ymlhas no rule matching it.
Current behaviour (measured on main)
For:
enum E { A, B; }the outline is:
- Enum EA and B are dropped.
Proposed fix
A member rule scoped to the Java enum item, mirroring how other languages report enum members:
id: java-enum-constant
language: Java
role: member
parentRuleIds: [java-enum]
symbolType: enumMember
rule:
all:
- kind: enum_constant
- has:
field: name
pattern: $NAME
name: $NAME
isPublic: trueI have this prepared with a test; a PR follows.
Source: ast-grep/ast-grep