Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e922713e
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e922713e
编写于
10月 25, 2021
作者:
H
Henning Dieterichs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #135726 by properly skipping unbalanced bracket pairs when rendering bracket pair guides.
上级
f1343b2a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
15 deletion
+26
-15
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+26
-15
未找到文件。
src/vs/editor/common/model/textModel.ts
浏览文件 @
e922713e
...
@@ -3098,9 +3098,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
...
@@ -3098,9 +3098,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
endLineNumber
,
endLineNumber
,
this
.
getLineMaxColumn
(
endLineNumber
)
this
.
getLineMaxColumn
(
endLineNumber
)
)
)
)
);
// Exclude bracket pairs that are not balanced.
.
filter
(
b
=>
b
.
closingBracketRange
!==
undefined
);
let
activeBracketPairRange
:
Range
|
undefined
=
undefined
;
let
activeBracketPairRange
:
Range
|
undefined
=
undefined
;
if
(
activePosition
&&
bracketPairs
.
length
>
0
)
{
if
(
activePosition
&&
bracketPairs
.
length
>
0
)
{
...
@@ -3136,7 +3134,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
...
@@ -3136,7 +3134,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
visibleEndColumn
:
number
,
visibleEndColumn
:
number
,
bracketPair
:
BracketPairInfo
,
bracketPair
:
BracketPairInfo
,
renderHorizontalEndLineAtTheBottom
:
boolean
renderHorizontalEndLineAtTheBottom
:
boolean
}
>
();
}
|
null
>
();
const
nextGuides
=
new
Array
<
model
.
IndentGuide
>
();
const
nextGuides
=
new
Array
<
model
.
IndentGuide
>
();
const
colorProvider
=
new
BracketPairGuidesClassNames
();
const
colorProvider
=
new
BracketPairGuidesClassNames
();
...
@@ -3169,19 +3167,30 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
...
@@ -3169,19 +3167,30 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
// TODO: Consider indentation when computing guideVisibleColumn
// TODO: Consider indentation when computing guideVisibleColumn
const
start
=
pair
.
openingBracketRange
.
getStartPosition
();
const
start
=
pair
.
openingBracketRange
.
getStartPosition
();
const
end
=
(
pair
.
closingBracketRange
?.
getStartPosition
()
??
pair
.
range
.
getEndPosition
());
const
end
=
(
pair
.
closingBracketRange
?.
getStartPosition
()
??
pair
.
range
.
getEndPosition
());
activeGuides
[
pair
.
nestingLevel
]
=
{
nestingLevel
:
pair
.
nestingLevel
,
guideVisibleColumn
,
if
(
pair
.
closingBracketRange
===
undefined
)
{
start
,
// Don't show guides for bracket pairs that are not balanced.
visibleStartColumn
:
this
.
getVisibleColumnFromPosition
(
start
),
// See #135125.
end
,
activeGuides
[
pair
.
nestingLevel
]
=
null
;
visibleEndColumn
:
this
.
getVisibleColumnFromPosition
(
end
),
}
else
{
bracketPair
:
pair
,
activeGuides
[
pair
.
nestingLevel
]
=
{
renderHorizontalEndLineAtTheBottom
nestingLevel
:
pair
.
nestingLevel
,
};
guideVisibleColumn
,
start
,
visibleStartColumn
:
this
.
getVisibleColumnFromPosition
(
start
),
end
,
visibleEndColumn
:
this
.
getVisibleColumnFromPosition
(
end
),
bracketPair
:
pair
,
renderHorizontalEndLineAtTheBottom
};
}
}
}
for
(
const
line
of
activeGuides
)
{
for
(
const
line
of
activeGuides
)
{
if
(
!
line
)
{
continue
;
}
const
isActive
=
activeBracketPairRange
&&
line
.
bracketPair
.
range
.
equalsRange
(
activeBracketPairRange
);
const
isActive
=
activeBracketPairRange
&&
line
.
bracketPair
.
range
.
equalsRange
(
activeBracketPairRange
);
const
className
=
const
className
=
...
@@ -3214,7 +3223,9 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
...
@@ -3214,7 +3223,9 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
// Going backwards, so the last guide potentially replaces others
// Going backwards, so the last guide potentially replaces others
for
(
let
i
=
activeGuides
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
activeGuides
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
line
=
activeGuides
[
i
];
const
line
=
activeGuides
[
i
];
if
(
!
line
)
{
continue
;
}
const
isActive
=
options
.
highlightActive
&&
activeBracketPairRange
&&
const
isActive
=
options
.
highlightActive
&&
activeBracketPairRange
&&
line
.
bracketPair
.
range
.
equalsRange
(
activeBracketPairRange
);
line
.
bracketPair
.
range
.
equalsRange
(
activeBracketPairRange
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录