-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[red-knot] Improve mdtest output #14213
Conversation
b81bb68
to
3130870
Compare
|
f0658db
to
079b603
Compare
079b603
to
5908de8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love how long the file path prefix for every error message is now, but if this is what's required to make them clickable in more editors, I guess it's worth it? I don't use the clickability myself. Don't really see a better solution, other than moving the mdtest files to some shorter path relative to workspace root.
It's probably possible to only include the file name in the test name if there is no header? Though it also doesn't bother me to always include it.
On the whole I don't have super strong preferences here so you could wait for a review from Micha, who probably has more opinions. But this looks fine to me.
I don't use the clickability inside my IDE much either, but what I do do is run tests from a terminal window outside of my IDE. I'm finding it consistently annoying right now that I can't copy and paste the path directly from the mdtest output so that I can instantly open the Markdown file in question in a new text-editor window. So while I agree that some output lines are now very long with this PR, this would be quite a big quality-of-life improvement for me.
I'm sure it is possible. I looked into it quickly, and it seemed more fiddly than I expected, though, and it didn't seem to me to be important enough for me to spend a lot of time on it. This was easy to do, and seemed like an improvement on the status quo. |
We could use OSC 8 hyperlinks to potentially have the best of both worlds? We can keep the file path in the output short and provide the full path (including the line number) as a hyperlink. The problem is that there is no standardized format for "open file F at line L in [your editor of choice]". Some applications solve this by making the hyperlink format customizable. If this doesn't sound too over-engineered, we could maybe provide 2-3 common formats (and a fallback to simple Example for VS Code (adapt the
Example with basic
|
I've been pretty annoyed by the links not being clickable for the few tests I wrote. That's why I find this a huge improvement. IMO, the ultimate solution is to use a multiline representation to render the diagnostics, so that the file names no longer stand out that much |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get rid of these entirely, because I believe it's possible to have a Markdown test file that doesn't have any # headings in it, which I believe would result in an empty title if we got rid of the path from the title entirely.
Could we only show the filename if the title is empty or change the test framework so that it defaults to the filename if the test has no explicit title?
Reduce the indentation of the line-by-line error reports from 4 spaces to 2. I'm not wild about getting rid of these entirely for the reasons I gave in
This might be a problem for accessibility reasons. I'm still leaning towards removing them entirely but I can also do this when we rework our diagnostics ;)
Thanks
I already answered this in #14213 (comment) ;-) I'm sure it's possible, but didn't want to spend too much time on it
This could be great!! I'll merge this as-is for now, though, as I think we're aligned that, even though the output still isn't ideal, this is probably a strict improvement on the status quo :-) This feels like it could be pursued as a followup |
Summary
Helps with #13875. Changes made:
crates/red_knot_python_semantic/resources/mdtest
. I didn't get rid of these entirely, because I believe it's possible to have a Markdown test file that doesn't have any#
headings in it, which I believe would result in an empty title if we got rid of the path from the title entirely.Previous output:
Screenshot
New output:
Screenshot
Diff to achieve these demo test failures:
Test Plan
cargo test