Repository: vscode
Issue: Make the limit on non-ASCII characters used to disable their highlighting configurable
Labels: feature-request,unicode-highlight

The highlighting of non-ASCII characters enabled by `"editor.unicodeHighlight.nonBasicASCII": true` is switched off whenever the number (or proportion? it's unclear) of non-ASCII characters in the document exceeds a threshold. A banner is then displayed, but the banner does not provide any opportunity to turn the highlighting on again.

#147888 rightly objected to this, but was closed because of some disagreement in which the reporter falsely asserted that the primary motivation for showing non-ASCII characters is not security.

Of course it's a security feature, and was announced and documented as such. That is partly *why* I want it *always* turned on, for all documents. I work on security-critical software and I'm well aware of the primary purpose of the setting. It was unhelpful to close that issue just because the reporter misunderstood that, when their actual request &mdash;to be able to have the highlighting always switched on&mdash; was entirely reasonable.

If the banner gave the option to keep the highlighting on, I'd still find it annoying and want to avoid displaying it at all, but it wouldn't be interfering with my work, which is what the current behaviour is doing.

The argument for why the current behaviour is okay and why #147888 was closed, seemed to assume that the *only* use of this feature should be to spot a small number of non-ASCII characters in an almost completely ASCII file.

There are at least two important use-cases that this assumption is missing:
* Code isn't just written in English. It's common to have non-English strings, identifiers, and/or comments while still wanting to be able to see which characters are ASCII and which are not. This also applies to localization files.
* This setting is *also* extremely useful for files, even those written in English, where the use of non-ASCII characters is intentional. For example, in documentation files I often use non-breaking spaces and hyphens, and “curly” quotes. Often these are mixed with markup and LaTeX code that has to use ASCII spaces, hyphens, and quotes. Being able to clearly see the difference was incredibly useful and was increasing my productivity. Until, that is, I ran into this wall that arbitrarily switches the feature off for some files, even though I explicitly told VS Code to always turn it on.

Having other use cases for seeing non-ASCII characters doesn't in any way conflict with the view of this highlighting as primarily a security feature. On the contrary, deliberately using non-ASCII characters doesn't make it any less important to detect their malicious use in the same file. If you were never intending to use non-ASCII characters at all, you'd want to prohibit them (which is probably best done with a `git` hook and/or in CI), not just make them visible.

The assertion that it's necessary to stop highlighting these characters for performance reasons seems unsupported. I've never seen any performance problem due to this feature when the number of non-ASCII chars was just below the limit. I don't object to the current behaviour being the default, although see no reason for the limit to be set as low as it is. But I don't care as long as I can configure it.