microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.67k stars 29.44k forks source link

Support variable line heights in the editor #147067

Open hediet opened 2 years ago

hediet commented 2 years ago

This would allow to use larger font sizes for markdown headers.

usernamehw commented 2 years ago

@hediet Is this issue for TextMate grammar or editor decorations or both?

Grammar makes sense for markdown headers but editor decorations would be great too. For example, adding an image decoration (bigger than one line) without a webview (like code inset #85682).

hediet commented 2 years ago

It is not clear yet what mechanism will be used for that.

How would you add that image if you could set the line height? By using css?

usernamehw commented 2 years ago

It's already supported, the image is just very small (1 line).

In decoration options after.contentIconPath


Hmmm, actually it renders the full image ignoring width & height

window.activeTextEditor?.setDecorations(window.createTextEditorDecorationType({
    after: {
        contentIconPath: Uri.parse('https://random.imagecdn.app/500/150'),
        margin: '0 20ch',
        height: '2ch',
        width: '2ch',
    },
}), [new Range(0, 0, 0, 0)]);
yume-chan commented 2 years ago

Another use case would be shrinking empty lines #66468

Visual Studio has an extension (by Microsoft) to do that. https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.SyntacticLineCompression2022

folcik commented 1 year ago

+1 on this Decorations can already modify the font size/font family/line height of a portion of text, but none of those changes render properly without the line height being variable. Use cases for this include:

MrScottyTay commented 1 year ago

+1 Trying to migrate over to VS Code and the shrink empty lines extension for Visual Studio was amazing