Skip to content

plugin: anchor generated top entry point on the design class#403

Merged
soronpo merged 1 commit into
mainfrom
claude/modest-mendel-7fypmi
Jun 17, 2026
Merged

plugin: anchor generated top entry point on the design class#403
soronpo merged 1 commit into
mainfrom
claude/modest-mendel-7fypmi

Conversation

@soronpo

@soronpo soronpo commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

The @top (TopAnnotPhase) generated top_<Design> entry-point object was created without a real source span on its definition tree. As a result ExtractSemanticDB recorded it only in the SemanticDB Symbols section with no Occurrences entry (the symbol name top_Foo is not textually present in the source), so Metals had no position to anchor the run/debug code lenses on and fell back to placing them at the very top of the file.

Position the generated module symbol (coord) and its definition tree on the design class's name span. Combined with the matching SemanticDB change, this makes the generated entry point appear as a definition occurrence anchored on the design class, so the run/debug lenses show up directly above the class that introduces the entry point. Using the class name (rather than the @top annotation) also keeps this working if the design no longer needs an explicit @top annotation.

Claude-Session: https://claude.ai/code/session_01Uze3nGgdwa8W2wkfoaDoHR

The `@top` (`TopAnnotPhase`) generated `top_<Design>` entry-point object was
created without a real source span on its definition tree. As a result
`ExtractSemanticDB` recorded it only in the SemanticDB `Symbols` section with
no `Occurrences` entry (the symbol name `top_Foo` is not textually present in
the source), so Metals had no position to anchor the `run`/`debug` code lenses
on and fell back to placing them at the very top of the file.

Position the generated module symbol (`coord`) and its definition tree on the
design class's name span. Combined with the matching SemanticDB change, this
makes the generated entry point appear as a definition occurrence anchored on
the design class, so the `run`/`debug` lenses show up directly above the class
that introduces the entry point. Using the class name (rather than the `@top`
annotation) also keeps this working if the design no longer needs an explicit
`@top` annotation.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Uze3nGgdwa8W2wkfoaDoHR
@soronpo soronpo merged commit 4ac8a7e into main Jun 17, 2026
1 check passed
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