langium
langium copied to clipboard
Use 'Go to type definition' to switch to the generated AST type declaration
When you are in the grammar and want to know how the type looks like in the ast.ts
file, we could use Go to implementation
of the LSP.
Especially when you need to know inferred types or maybe container information, this could be nice.
We can simply search for a line starting with export interface ABC
or export type ABC
in ast.ts
.
Go to implementation
seems to be the best match. But if there is a better action for this idea, choose the better one.
@Lotes If one want to re-use one of LSP services, maybe Goto Type Definition would match your case better?
True, I was not aware of this action.
Rethinking about this... When doing "Go to type definition" on a grammar rule (definition or usage), I would expect the editor to navigate to either the rule definition if the type is inferred or the type declaration. But we could say something similar about "Go to implementation": If you do that on a type, one could expect the editor to navigate to a grammar rule that uses that type. So maybe a custom command is the better choice to avoid confusion.
Shamelessly voting for this ... I spend an embarrassingly large amount of time jumping between usage, definition and then searching the ast.