diff options
Diffstat (limited to 'src/vs/editor/common/model/guidesTextModelPart.ts')
-rw-r--r-- | src/vs/editor/common/model/guidesTextModelPart.ts | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/vs/editor/common/model/guidesTextModelPart.ts b/src/vs/editor/common/model/guidesTextModelPart.ts index 488ee8e79d4..9e7937f7ad6 100644 --- a/src/vs/editor/common/model/guidesTextModelPart.ts +++ b/src/vs/editor/common/model/guidesTextModelPart.ts @@ -343,6 +343,10 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod ---- */ + if (!pair.closingBracketRange) { + continue; + } + const isActive = activeBracketPairRange && pair.range.equalsRange(activeBracketPairRange); if (!isActive && !options.includeInactive) { @@ -357,9 +361,7 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod const start = pair.openingBracketRange.getStartPosition(); - const end = - pair.closingBracketRange?.getStartPosition() ?? - pair.range.getEndPosition(); + const end = pair.closingBracketRange.getStartPosition(); const horizontalGuides = options.horizontalGuides === HorizontalGuidesState.Enabled || (options.horizontalGuides === HorizontalGuidesState.EnabledForActive && isActive); @@ -388,16 +390,16 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod const guideVisibleColumn = Math.min(startVisibleColumn, endVisibleColumn, pair.minVisibleColumnIndentation + 1); let renderHorizontalEndLineAtTheBottom = false; - if (pair.closingBracketRange) { - const firstNonWsIndex = strings.firstNonWhitespaceIndex( - this.textModel.getLineContent( - pair.closingBracketRange.startLineNumber - ) - ); - const hasTextBeforeClosingBracket = firstNonWsIndex < pair.closingBracketRange.startColumn - 1; - if (hasTextBeforeClosingBracket) { - renderHorizontalEndLineAtTheBottom = true; - } + + + const firstNonWsIndex = strings.firstNonWhitespaceIndex( + this.textModel.getLineContent( + pair.closingBracketRange.startLineNumber + ) + ); + const hasTextBeforeClosingBracket = firstNonWsIndex < pair.closingBracketRange.startColumn - 1; + if (hasTextBeforeClosingBracket) { + renderHorizontalEndLineAtTheBottom = true; } @@ -414,7 +416,6 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod className, null, l === start.lineNumber ? start.column : -1, - // TODO: Investigate if this is correct l === end.lineNumber ? end.column : -1 ) ); |