-
Notifications
You must be signed in to change notification settings - Fork 323
⌘-click on link in test output doesn't go to location in file. #4089
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
Comments
@gspencergoog Hey share error in text form here |
The error text is kind of irrelevant: the error is expected, and not produced by Dart-Code (it's produced by running a unit test). It's the result of ⌘-clicking on the error location in the text that I'm concerned with. Nevertheless, here's the error text:
|
This is an unfortunate combination of a VS Code limitation and Dart/Flutter's stack trace format: When VS Code parses a I'm planning to file an issue about allowing us to have custom link detectors in places like this (as we do in the terminal), because then we could handle |
Can we change the output format for Flutter's stack traces so that VSCode (and hopefully still other IDEs) can parse the links properly? |
We discussed this a little yesterday. Changing the format may be an option, but is potentially breaking (for ex. for IntelliJ that may already parse this format) and doing so only for Flutter may leave the problem for other Dart. Being able to run custom link detectors is probably the ideal solution because we can also handle things like |
Yeah, custom link detection seems ideal. Would IntelliJ already allow custom link detection? If it does, then we can switch the output format to the hash version and custom parse it in IntelliJ, and it'll work in both places then. |
When our test framework is writing the output to a port, does it know from the port negotiation what destination plugin/version it is talking to? If so, we could customize the output format for the plugin it is talking to. |
I filed microsoft/vscode#157500 about having custom link providers in the test peek output (please add 👍 s!).
I would expect so, but @jwren might know for sure.
Possibly not reliably today, but there's no reason we couldn't pass a flag (or set an env var) to make that explicit. |
Any update on this? I wish for it every time I run a test that fails. :-) |
Unfortunately not. My request for custom link providers (microsoft/vscode#157500) was originally closed as a duplicate and only recently re-opened. I suggest we give it a little longer (I have pinged enquiring if it might be something they're likely to do soon) if not, we may want to consider going ahead with changing the output in some way to be a format VS Code already understands (which I don't think is a great solution, but perhaps we can do by just regexing in the VS Code extension at the point of sending the test output to VS Code which would minimise the impact elsewhere and avoid changing Dart/Flutter). |
I'm now rewriting these when we pass them to VS Code (for the test output - the Debug Console will remain the same). Note that this only works for However, if handling |
Turns out this is supported in VS Code, but with a I'll redo this before the release. Unlike the rewriting noted above, this will support |
With these latest changes, file:// URIs work as expected (I've also added support for "file://foo line x" which seems to come up in this output): And also (note: all that "SetMark" markup is a VS Code bug and not something we can fix directly here 😞) |
Yay! I'm so excited. |
😄 FWIW the release went out a few hours ago (to both stable and pre-release versions) so as long as VS Code has updated (and if required, you've "reloaded") you should have the fixes. Let me know if you spot any issues! |
Description
When I run a test and it fails I get output that includes the absolute path to the file and the line number and character of the failure, and while VSCode detects the
file:///
URI as a link, and I can ⌘-click on it, it either fails and gives me an error dialog that says something like "Unable to open 'menu_bar_test.dart:205:7'" because it doesn't know about a file with a filename that ends in ":205:7" (unsurprisingly), or (if I click on the other link in the output that is only the filename followed by "line 205", it doesn't go anywhere (because it's already got that file open).This issue also appears to happen on Linux, so I don't think it's macOS specific.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the cursor to jump to the referenced test file location where the error occurred.
Screenshots
Here's what the error output from the test looks like:
flutter doctor -v
The text was updated successfully, but these errors were encountered: