Vscode: Option to disable font ligatures in strings

Created on 11 Feb 2018  路  9Comments  路  Source: microsoft/vscode

Sometimes you have to list a bunch of characters in a string containing a regular expression and you don't want the characters to merge in order to more easily read the expression.

feature-request font-rendering

Most helpful comment

I just ran across something similar while writing an extension, realizing that I don't want ligatures for certain language types (i.e. a machine generated output file). The ability to enable or disable ligatures by file type or by TextMate token type in a .color-theme.json or language-configuration.json file would be really nice!

All 9 comments

Have you tried "editor.fontLigatures": false?

The idea is that I don't want to disable them entirely - only in strings with something like "editor.fontLigatures.inStrings": false.

The example below is in PHP, however it should work the same way in other languages too.

image

I just ran across something similar while writing an extension, realizing that I don't want ligatures for certain language types (i.e. a machine generated output file). The ability to enable or disable ligatures by file type or by TextMate token type in a .color-theme.json or language-configuration.json file would be really nice!

I ran into a similar need, i think it would be awesome to be able to selectively enable certain sequences in a font ligature (maybe make it configurable by language?) I don't like that I have to accept every possible sequence a font editor can dream up just because I checked the box to enable them. For example (F#): ->, >>=, |> and <| would all be handy to have, but I don't like how >= and <= render and would like to keep them as they are without ligatures.

Maybe this feature could be a more general "ligature control" option.

Font ligatures look bad in PHP. The solution I came to was turning off font ligatures for PHP only in settings.json:

{
  "editor.fontLigatures": true,
  "[php]": {
    "editor.fontLigatures": false
  }
}

It could be done via command palette "Preferences: Configure Language Specific Settings".

The same is true for me. I love the ligatures for code but it'd be nice to be able to selectively disable ligatures for certain sections (strings, comments) to avoid stuff like this:

image

@adam-becker I believe this is not actually possible depending on the font, based on talking to the Iosevka author. The way their ligatures work is you set 'liga' on, 'HSKL' on for haskell for example (note calt is off). However, I think it might be a thing in Fira Code since they have their ligatures as stylistic sets that may be able to be individually enabled; I do not use Fira Code, however.

@lf- it's unfortunate if it can't be disabled for specific characters. I had to turn off ligatures entirely since they're currently more trouble than they're worth.

@lf- it's unfortunate if it can't be disabled for specific characters. I had to turn off ligatures entirely since they're currently more trouble than they're worth.

Understandable! Talking to your font maintainers or getting into font hacking yourself and editing the undesired one out are pretty much the only options in the current font rendering systems for disabling ligatures (i.e. I don't believe this is a Code or web related problem).

Was this page helpful?
0 / 5 - 0 ratings