-
Couldn't load subscription status.
- Fork 0
Description
Go-to-definition broken with new DSL
Problem
With the new DSL implementation, IDE go-to-definition functionality is broken for environment field access. When clicking go-to-definition on env.stats.reads, it navigates to the macro internal definition instead of the actual field definition location in the environment block.
Current Behavior
# Clicking go-to-definition on env.stats.reads here:
on_message :get_stats do
[
{:reply, {:stats, env.stats.reads, env.stats.writes, env.stats.deletes}}
]
endTakes you to macro internals instead of:
env do
field :store, default: %{}, type: :map
field :stats, default: %{reads: 0, writes: 0, deletes: 0}, type: :map
field :access_counts, default: %{}, type: :map
endExpected Behavior
Go-to-definition should navigate to the field definition location in the environment block where the field is declared.
Proposed Solution
Implement a Field Registry Approach using module attributes:
Key Benefits:
- Improved go-to-definition - better than current macros
- Lighter weight - no full struct generation overhead
- Source tracking - maintains field location metadata
Implementation Details:
- Create
FieldRegistry.exto track field locations and provide better macro hygiene - Store field metadata at compile-time
- Generate helper macros that point to actual field definition locations
- Provide better IDE support without full TypedStruct generation overhead
This approach would maintain field location metadata and generate helper macros that preserve source location information for proper IDE navigation.