如何为 Visual Studio Code 设置字体连字?

Kol*_*a6b 10 fonts ligature visual-studio-code

我正在使用这两行为我的 VSCode 设置字体连字。

"editor.fontFamily": "'Fira Code'",
"editor.fontLigatures": true,
Run Code Online (Sandbox Code Playgroud)

但它看起来仍然和以前一样。

我试图禁用所有已安装的扩展程序,但没有奏效。

这是我的完整设置:

{
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "Material Theme Darker High Contrast",
  "editor.formatOnSave": true,
  "explorer.confirmDelete": false,
  "editor.suggestSelection": "first",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "window.zoomLevel": 0,
  "editor.fontSize": 16, //!=
  "editor.fontFamily": "'Fira Code'",
  "editor.fontLigatures": true,
  "explorer.confirmDragAndDrop": false
}
Run Code Online (Sandbox Code Playgroud)

我想要功能齐全的字体连字,如本页所示:我希望它看起来如何。相反,我获得了一些字体的基本文本。

Ahm*_*ais 34

第 1 步安装Fira 代码。

第 2 步:在 VSCode 设置中设置字体:

"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
Run Code Online (Sandbox Code Playgroud)

第 3 步:重新启动/重新加载 VSCode。

就是这样。


GiM*_*GiM 7

从 VS Code 1.40 开始,editor.fontLigatrues支持字符串设置,这对于支持不同风格集的字体非常有用:

IE:

  • "editor.fontLigatures": "'ss09', 'zero', 'onum'",
  • "editor.fontLigatures": "'ss01'",

您可以在此处阅读有关功能标签的更多信息(但支持取决于相关字体):

https://learn.microsoft.com/en-us/typography/opentype/spec/featuretags


apo*_*llo 5

您的电脑中似乎没有安装 Fira 字体。如果您使用的是 MacOS,请按照此步骤操作。

打开终端并运行这些命令。

brew tap homebrew/cask-fonts
brew cask install font-fira-code
Run Code Online (Sandbox Code Playgroud)

并尝试重新启动 VsCode。

或者,如果您使用其他操作系统(Windows 或 Linux),请按照此步骤操作。 https://github.com/tonsky/FiraCode/wiki/Installing

希望这会有所帮助。

  • 无需使用或安装brew。只需获取 TTF https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-Retina.ttf (2认同)