Open Zezombye opened 2 years ago
/assign @hediet
does it take up that many resources to highlight them?
The resource constraint is only one reason why this message is shown.
The other reason is that if a document uses that many invisible characters, this is probably done intentionally and it would be counter-productive to highlight every single occurence (which seems to be the case in your screenshot).
What is your use-case?
Finding out, in a French translation file for a game, which strings are used where (and exact matching is important). In French, "official" typography requires the use of non-breaking spaces (the bane of my existence) in some places, and the translators sometimes put them, sometimes don't.
So I wanted to find the id of the string "Equipe 1" where there is a nbsp (there are multiple matches for this string, some having a normal space, some having a nbsp), so I ctrl-f "Equipe" and look at which ones have a highlighted space, but since none of them was highlighted I thought there wasn't any nbsp, and that the file wasn't correct. In the end I had to copy paste a nbsp from internet to successfully search it, but I was confused, especially since the banner has a button to disable unicode highlighting when no highlighting is done :p
I think even if it is done intentionally, it will always be beneficial to highlight every occurrence (it's always nice to know when spaces aren't really spaces). Else, the banner should specify that no highlighting is being done at all.
Maybe a checkbox in the banner would work nicely. The checkbox would toggle a setting like "editor.unicodeHighlighting.highlightWhenBannerIsShown", which is disabled by default.
That would be nice yes, and also disable the banner if checked.
Also I absolutely love this feature, I no longer have to highlight some random space to find out wacky spaces :D
@hediet we should bring this banner to the ux sync as we've only reserved the banner for vscode.dev and workspace trust and already have other patterns for altering the user of errors/warnings in the editor
The highlight limit appears to be hard-coded at 1000 characters. Anything more than that and the banner appears. Would be nice to be able to change a default value of 1000 up or down in settings.json.
Unicode highlighting behaves normally when there are few special characters:
However, when there are too many characters, vscode just gives up and does not highlight any:
Would it be possible to configure the limit before it gives up (does it take up that many resources to highlight them? in my test file there are 5337, syntax highlighting doesn't give up), and also to add an option to not have that popup so that I don't have to click the "x" each time?
Thanks :)