You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Apply decoration lineHeight on all affected lines after line wrapping #249967
editor-linesIssues related to editor linesfeature-requestRequest for new features or functionalityunder-discussionIssue is under discussion for relevance, priority, approach
In #194609 I implemented support for dynamic line heights using decorations. This works perfectly for us, but there are some unhandled things that were not relevant to us. Due to a change of priorities, this PR got abandoned. Now I have to get back to it.
Recently #241218 was merged. This also adds support for dynamic line heights using decorations. It was tested against some cases I never tested against, which is great. However, the behaviour is quite different.
Hi Remco Haszing (@remcohaszing) thank you for filing the issue. I am not sure I understand what you mean by point number 1. The line heights are set per view line in the file lineHeights.ts.
For number 2, yes absolutely. This is a point we will work on and improve. We do not want to greatly change the current data structure we are using and expand on it.
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
This is what it looks like with the current line heights implementation. A decoration that affects line height and font size is applied to a small selection on line 1. The line height is applied to the entirety of the unwrapped line 1, even the parts that aren’t part of the decoration.
This is what it looks like in my original line heights implementation. The line height is applied only to the part of line 1 that’s affected by it after line wrapping.
The following example code is used for both examples:
constdark=matchMedia('(prefers-color-scheme: dark)');monaco.editor.setTheme(dark.matches ? 'vs-dark' : 'vs-light');dark.addEventListener('change',()=>{monaco.editor.setTheme(dark.matches ? 'vs-dark' : 'vs-light');});constcontent=`Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1. Line 1.Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3. Line 3.`;constmodel=monaco.editor.createModel(content,undefined,monaco.Uri.file('example.txt'));consteditor=monaco.editor.create(document.getElementById('editor'),{automaticLayout: true,autoIndent: 'none',accessibilitySupport: 'off',accessibilityPageSize: 1,autoClosingBrackets: 'never',autoClosingComments: 'never',autoClosingDelete: 'never',autoClosingOvertype: 'never',autoClosingQuotes: 'never',autoSurround: 'never',bracketPairColorization: {enabled: false},columnSelection: false,contextmenu: false,definitionLinkOpensInPeek: false,detectIndentation: false,disableLayerHinting: true,disableMonospaceOptimizations: true,fixedOverflowWidgets: false,inDiffEditor: false,largeFileOptimizations: true,linkedEditing: false,links: false,matchBrackets: 'never',parameterHints: {enabled: false},
model,minimap: {enabled: false,side: 'left',maxColumn: 5,showSlider: 'always',renderCharacters: false,scale: 100},fontFamily: 'Arial, Arimo, sans-serif, ui-sans-serif',fontLigatures: false,fontVariations: false,fontWeight: 'normal',fontSize: 14,lineHeight: 0,letterSpacing: 0,// Wrap lines at viewport widthwordWrap: 'on',// Advanced wrapping strategy - necessary to ensure line wraps with variable width fontswrappingStrategy: 'advanced',wordBreak: 'keepAll',wrappingIndent: 'none',});constbigCollection=editor.createDecorationsCollection();editor.addAction({keybindings: [monaco.KeyMod.CtrlCmd|monaco.KeyCode.KeyB],id: 'bold',label: 'Bold',run(editor){constselections=editor.getSelections();if(!selections){return;}bigCollection.set(selections.map((selection)=>({range: selection,options: {inlineClassNameAffectsLetterSpacing: true,lineHeight: 56,inlineClassName: 'big'}})));},});
.big{font-size:32px;}
For comparison, this is what it looks like in LibreOffice. Google Docs and Microsoft Word do the same.
editor-linesIssues related to editor linesfeature-requestRequest for new features or functionalityunder-discussionIssue is under discussion for relevance, priority, approach
Activity
aiday-mar commentedon Jun 2, 2025
Hi Remco Haszing (@remcohaszing) thank you for filing the issue. I am not sure I understand what you mean by point number 1. The line heights are set per view line in the file
lineHeights.ts.For number 2, yes absolutely. This is a point we will work on and improve. We do not want to greatly change the current data structure we are using and expand on it.
vs-code-engineering commentedon Jun 2, 2025
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
remcohaszing commentedon Jun 2, 2025
This is what it looks like with the current line heights implementation. A decoration that affects line height and font size is applied to a small selection on line 1. The line height is applied to the entirety of the unwrapped line 1, even the parts that aren’t part of the decoration.
This is what it looks like in my original line heights implementation. The line height is applied only to the part of line 1 that’s affected by it after line wrapping.
The following example code is used for both examples:
For comparison, this is what it looks like in LibreOffice. Google Docs and Microsoft Word do the same.
aiday-mar commentedon Jun 3, 2025
Hi thanks for the clarification. I see thanks, I will discuss this with my team.