Use prettier arrow in stack traces (to highlight the line with the error) #43237
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR: the 'after'
EDIT: After testing on Windows, I've changed the arrow.
What problem were we solving?
In @phillip-kruger's recent demo of the advanced exception context, I noticed that we use an ascii-art arrow.
"Hmm," I thought. "With so many nice arrows in the unicode spec these days, why don't we use one of them instead?" With hindsight, I should have asked @phillip-kruger if he’d tried this already, but I thought “I won’t bother him with a conversation for a one-character change, I’ll just do the PR and we can discuss it there.” Then I started testing, and realised why Philip maybe opted for the ascii art. But by then it was too late, and I was invested.
There are two risks with this change:
It turns out both are a problem, but I think I got there in the end.
Cross-platform test results
MacOS
Windows
Linux
The workings-out
Character width issues
Even on a single machine, I got character-alignment problems. It turns out that fixed-width fonts do not have a consistent width for the arrows. It will presumably vary by OS, and it also varies between browser and terminal. I liked the heavy arrow ⮕, but that was subtly misaligned in the browser:
... and hopelessly misaligned in the terminal:
⟶ is nice and prominent, perfect in the console,
But terrible in the browser
In my experiments, ⇨ works in the browser:
and also the terminal
It's a bit more visible than ⇾, which also worked for me in terms of width:
Character set issues
Once I found an arrow that rendered well in both terminal and browser on Mac, we tried it on Windows, and ... no good.
So I went back to the drawing board.
How to test
Here's some text which can be pasted into a terminal to test on other OSes:
(Testing in the browser would need a build of the patch.)
Other options
For reference, here are all the arrows I considered, along with a
.
to show alignment. Only the fourth one works on Windows:⟶ .
⭢ .
⮕ .
→ .
⇨ .
⇢ .
⇾ .