Improve diagnostic messages
- Dominant language
- Rust
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### What should be done?
The current tree-sitter-based parsing has limitations for producing useful diagnostics, diagnostics have several shortcomings that make it hard for users to understand and fix their code:
- **Generic "syntax error" messages** - there is no detail about what actually went wrong. We should have say things like "expected `end` to close `if` block" or "unknown instruction `pushh`".
- **Wrong line highlighted** - in some cases the error span points to the wrong line, making it confusing to locate the actual problem.
- **Misleading error for unresolved imports** - when an import cannot be resolved, the error shown is "callee stack effects are indeterminate" instead of something like "unresolved import: module `foo::bar` not found".
- **Missing `end` not detected** - missing `end` for `if`, `while`, `repeat`, `proc`, etc. produces a generic syntax error instead of a targeted message like "missing `end` to close `proc` started on line N".
- **No unused/missing import warnings** — unused imports and calls to non-imported modules are not flagged.
- **No typo suggestions** — no "did you mean X?" when an instruction or module name is misspelled.
### How should it be done?
Once the new MASM parser (https://github.com/0xMiden/miden-vm/pull/2907) lands, replace the tree-sitter-based parsing with it and map richer error output to LSP diagnostics.
### When is this task done?
Many of these improvements are blocked on or will be simplified by the new MASM parser designed for IDE use — see [0xMiden/miden-vm#2907](https://github.com/0xMiden/miden-vm/pull/2907).
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.