Improve complex type mismatch errors #5164
abs0luty
started this conversation in
Ideas & suggestions
Replies: 1 comment
-
|
I find the first 2 quite hard to read, but the third one is interesting. Do we know of a character that we would be able to use safely? I don't think LSP specifies any particular way that diagnostic text must be handled |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Currently I'm working on #5062 to address #4578. When I first implemented the new diagnostics, I received feedback about wrapping in IDE settings:
In the discussion for the PR I shared a few different ways we might present complex type‑mismatch errors more clearly. The main options I've been looking at other than the one showed above are:
Single error message with bullet points: instead of aligning caret markers under the original type expression, we would list each mismatch below a single message, e.g.:
This approach avoids tricky alignment issues and wraps better in narrow views.
Separate error messages for each argument: here we would emit a distinct error for each mismatched argument, showing only the problematic slice of the type each time.
Manual width control: by adding zero‑width spaces or breaking long type expressions into smaller lines ourselves, we can keep the caret markers aligned even when the type is lengthy.
Each option has trade‑offs in terms of readability and how well it works across different settings (terminal, VSCode, Zed, etc.). Before I go further, I’d really appreciate feedback from anyone following this PR: Which of these approaches do you think we should adopt for complex type‑mismatch errors? Are there other ideas we should explore?
Beta Was this translation helpful? Give feedback.
All reactions