Skip to content

chore: improve the enumeral#49

Merged
victorhqc merged 2 commits intovictorhqc:mainfrom
apitamr:main
Oct 2, 2025
Merged

chore: improve the enumeral#49
victorhqc merged 2 commits intovictorhqc:mainfrom
apitamr:main

Conversation

@apitamr
Copy link
Contributor

@apitamr apitamr commented Sep 28, 2025

Problem

When using Zed editor with Prisma files, enum values with @map annotations are not showing up in the outline/symbol tree. This makes it difficult to navigate to specific enum values, especially in large enums with descriptive mappings.

Example Issue

The following enum shows only the enum declaration (ExerciseType) in the outline, but individual enum values are not visible:

enum ExerciseType {
  TWELVE_MINUTE_RUN_METERS       @map("12 MINUTE RUN (METERS)")
  PULL_UP_ONE_MINUTE_REPS        @map("PULL-UP 1 MINUTE (REPS)")
  SIT_UP_ONE_MINUTE_REPS         @map("SIT-UP 1 MINUTE (REPS)")
  PUSH_UP_ONE_MINUTE_REPS        @map("PUSH-UP 1 MINUTE (REPS)")
  SHUTTLE_RUN_SIX_BY_TEN_SECONDS @map("SHUTTLE-RUN 6 X 10M (SECONDS)")
}

Solution

Replace the complex regex-based enumeral definition with:

enumeral: $ => seq($.identifier, optional(repeat($.attribute)))

Before

Screen.Recording.2025-09-28.at.20.15.28.mov

After

Screen.Recording.2025-09-28.at.20.18.12.mov
  • Supports attributes on enum values** - Allows Prisma enum values to have attributes like @map("old_name")
  • Reuses existing identifier rule** - More consistent with other parts of the grammar
  • Better aligned with Prisma syntax** - Enum values in Prisma can indeed have attributes

@victorhqc
Copy link
Owner

Hey! Sorry, I missed this PR, let me take a look

@victorhqc victorhqc merged commit 88919b3 into victorhqc:main Oct 2, 2025
2 checks passed
@victorhqc
Copy link
Owner

Thank you!

MrSubidubi pushed a commit to zed-extensions/prisma that referenced this pull request Oct 3, 2025
Contains [update to
Enum](victorhqc/tree-sitter-prisma#49), thanks
to @dstrygwyr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants