Skip to content

Custom line heights should only affect the view line #295179

Description

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.109.3
  • OS Version: Pop!_OS 22.04

Steps to Reproduce:

  1. Use the following settings:
    {
      "editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "entity.name.type.class",
            "settings": {
              "fontSize": 3,
              "lineHeight": 2
            }
          }
        ]
      },
      "[typescript]": {
        "editor.wordWrap": "bounded",
        "editor.wordWrapColumn": 50
      },

}

2. Create a TypeScript file with the following content:
```ts
class A extends VeryLongBaseClassNameUsedToTriggerLineWrapping {}

Observe how the class name A is bigger than the rest. The line height is adjusted as well. However, this line height expands even after the line wrapping.

Other editors that support variable font sizes, only make the actual view line bigger. After line wrapping, the font size of one bigger word doesn’t increase the line height of any of the wrapped view lines. For example, this screenshot shows the behaviour in Google Docs.

Internally in VSCode, this uses Monaco decorations. Monaco decorations have the property isWholeLine. If this is set to true, the decoration is applied to the entire line instead of just the selected range. This can be used to determine if the custom line height should be applied to the entire line as well, or just to the unwrapped view line.

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions