File tree Expand file tree Collapse file tree 5 files changed +27
-4
lines changed
browser/viewParts/blockDecorations
workbench/contrib/mergeEditor/browser/view/editors Expand file tree Collapse file tree 5 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -82,10 +82,20 @@ export class BlockDecorations extends ViewPart {
82
82
block = this . blocks [ count ] = createFastDomNode ( document . createElement ( 'div' ) ) ;
83
83
this . domNode . appendChild ( block ) ;
84
84
}
85
- const top = ctx . getVerticalOffsetForLineNumber ( decoration . range . startLineNumber , true ) ;
86
- const bottom = decoration . range . isEmpty ( )
87
- ? ctx . getVerticalOffsetForLineNumber ( decoration . range . startLineNumber , false )
88
- : ctx . getVerticalOffsetAfterLineNumber ( decoration . range . endLineNumber , true ) ;
85
+
86
+ let top : number ;
87
+ let bottom : number ;
88
+
89
+ if ( decoration . options . blockIsAfterEnd ) {
90
+ // range must be empty
91
+ top = ctx . getVerticalOffsetAfterLineNumber ( decoration . range . endLineNumber , false ) ;
92
+ bottom = ctx . getVerticalOffsetAfterLineNumber ( decoration . range . endLineNumber , true ) ;
93
+ } else {
94
+ top = ctx . getVerticalOffsetForLineNumber ( decoration . range . startLineNumber , true ) ;
95
+ bottom = decoration . range . isEmpty ( )
96
+ ? ctx . getVerticalOffsetForLineNumber ( decoration . range . startLineNumber , false )
97
+ : ctx . getVerticalOffsetAfterLineNumber ( decoration . range . endLineNumber , true ) ;
98
+ }
89
99
90
100
block . setClassName ( 'blockDecorations-block ' + decoration . options . blockClassName ) ;
91
101
block . setLeft ( ctx . scrollLeft ) ;
Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ export interface IModelDecorationOptions {
92
92
*/
93
93
className ?: string | null ;
94
94
blockClassName ?: string | null ;
95
+ /**
96
+ * Indicates if this block should be rendered after the last line.
97
+ * In this case, the range must be empty and set to the last line.
98
+ */
99
+ blockIsAfterEnd ?: boolean | null ;
95
100
/**
96
101
* Message to be rendered when hovering over the glyph margin decoration.
97
102
*/
Original file line number Diff line number Diff line change @@ -2231,6 +2231,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
2231
2231
2232
2232
readonly description : string ;
2233
2233
readonly blockClassName : string | null ;
2234
+ readonly blockIsAfterEnd : boolean | null ;
2234
2235
readonly stickiness : model . TrackedRangeStickiness ;
2235
2236
readonly zIndex : number ;
2236
2237
readonly className : string | null ;
@@ -2258,6 +2259,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
2258
2259
private constructor ( options : model . IModelDecorationOptions ) {
2259
2260
this . description = options . description ;
2260
2261
this . blockClassName = options . blockClassName ? cleanClassName ( options . blockClassName ) : null ;
2262
+ this . blockIsAfterEnd = options . blockIsAfterEnd ?? null ;
2261
2263
this . stickiness = options . stickiness || model . TrackedRangeStickiness . AlwaysGrowsWhenTypingAtEdges ;
2262
2264
this . zIndex = options . zIndex || 0 ;
2263
2265
this . className = options . className ? cleanClassName ( options . className ) : null ;
Original file line number Diff line number Diff line change @@ -1488,6 +1488,11 @@ declare namespace monaco.editor {
1488
1488
*/
1489
1489
className ?: string | null ;
1490
1490
blockClassName ?: string | null ;
1491
+ /**
1492
+ * Indicates if this block should be rendered after the last line.
1493
+ * In this case, the range must be empty and set to the last line.
1494
+ */
1495
+ blockIsAfterEnd ?: boolean | null ;
1491
1496
/**
1492
1497
* Message to be rendered when hovering over the glyph margin decoration.
1493
1498
*/
Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ export class InputCodeEditorView extends CodeEditorView {
158
158
options : {
159
159
showIfCollapsed : true ,
160
160
blockClassName : blockClassNames . join ( ' ' ) ,
161
+ blockIsAfterEnd : range . startLineNumber > this . editor . getModel ( ) ! . getLineCount ( ) ,
161
162
description : 'Merge Editor' ,
162
163
minimap : {
163
164
position : MinimapPosition . Gutter ,
You can’t perform that action at this time.
0 commit comments