Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6023aee9
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6023aee9
编写于
10月 12, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usages of IModelDecorationsChangedEvent.changedDecorations
上级
d902ab8a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
21 deletion
+30
-21
src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts
...ditor/contrib/referenceSearch/browser/referencesWidget.ts
+6
-11
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
.../workbench/parts/debug/browser/debugEditorModelManager.ts
+24
-10
未找到文件。
src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts
浏览文件 @
6023aee9
...
...
@@ -108,20 +108,15 @@ class DecorationsManager implements IDisposable {
}
private
_onDecorationChanged
(
event
:
IModelDecorationsChangedEvent
):
void
{
const
changedDecorations
=
event
.
changedDecorations
,
toRemove
:
string
[]
=
[];
const
toRemove
:
string
[]
=
[];
for
(
let
i
=
0
,
len
=
changedDecorations
.
length
;
i
<
len
;
i
++
)
{
let
reference
=
this
.
_decorations
.
get
(
changedDecorations
[
i
]);
if
(
!
reference
)
{
continue
;
}
this
.
_decorations
.
forEach
((
reference
,
decorationId
)
=>
{
const
newRange
=
this
.
_editor
.
getModel
().
getDecorationRange
(
decorationId
);
const
newRange
=
this
.
_editor
.
getModel
().
getDecorationRange
(
changedDecorations
[
i
]);
let
ignore
=
false
;
if
(
Range
.
equalsRange
(
newRange
,
reference
.
range
))
{
continue
;
return
;
}
else
if
(
Range
.
spansMultipleLines
(
newRange
))
{
ignore
=
true
;
...
...
@@ -137,11 +132,11 @@ class DecorationsManager implements IDisposable {
if
(
ignore
)
{
this
.
_decorationIgnoreSet
.
add
(
reference
.
id
);
toRemove
.
push
(
changedDecorations
[
i
]
);
toRemove
.
push
(
decorationId
);
}
else
{
reference
.
range
=
newRange
;
}
}
}
);
this
.
_editor
.
changeDecorations
((
accessor
)
=>
{
for
(
let
i
=
0
,
len
=
toRemove
.
length
;
i
<
len
;
i
++
)
{
...
...
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
浏览文件 @
6023aee9
...
...
@@ -21,7 +21,7 @@ interface IDebugEditorModelData {
toDispose
:
lifecycle
.
IDisposable
[];
breakpointDecorationIds
:
string
[];
breakpointLines
:
number
[];
breakpointDecorationsAsMap
:
Map
<
string
,
boolean
>
;
breakpointDecorationsAsMap
:
Map
<
string
,
Range
>
;
currentStackDecorations
:
string
[];
dirty
:
boolean
;
topStackFrameRange
:
Range
;
...
...
@@ -81,11 +81,12 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
const
breakpoints
=
this
.
debugService
.
getModel
().
getBreakpoints
().
filter
(
bp
=>
bp
.
uri
.
toString
()
===
modelUrlStr
);
const
currentStackDecorations
=
model
.
deltaDecorations
([],
this
.
createCallStackDecorations
(
modelUrlStr
));
const
breakPointDecorations
=
model
.
deltaDecorations
([],
this
.
createBreakpointDecorations
(
breakpoints
));
const
desiredDecorations
=
this
.
createBreakpointDecorations
(
model
,
breakpoints
);
const
breakPointDecorations
=
model
.
deltaDecorations
([],
desiredDecorations
);
const
toDispose
:
lifecycle
.
IDisposable
[]
=
[
model
.
onDidChangeDecorations
((
e
)
=>
this
.
onModelDecorationsChanged
(
modelUrlStr
,
e
))];
const
breakpointDecorationsAsMap
=
new
Map
<
string
,
boolean
>
();
breakPointDecorations
.
forEach
(
bpd
=>
breakpointDecorationsAsMap
.
set
(
bpd
,
tru
e
));
const
breakpointDecorationsAsMap
=
new
Map
<
string
,
Range
>
();
breakPointDecorations
.
forEach
(
(
decorationId
,
index
)
=>
breakpointDecorationsAsMap
.
set
(
decorationId
,
desiredDecorations
[
index
].
rang
e
));
this
.
modelDataMap
.
set
(
modelUrlStr
,
{
model
:
model
,
...
...
@@ -191,7 +192,17 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
// I have no decorations
return
;
}
if
(
!
e
.
changedDecorations
.
some
(
decorationId
=>
modelData
.
breakpointDecorationsAsMap
.
has
(
decorationId
)))
{
let
somethingChanged
=
false
;
modelData
.
breakpointDecorationsAsMap
.
forEach
((
breakpointRange
,
decorationId
)
=>
{
if
(
somethingChanged
)
{
return
;
}
const
newBreakpointRange
=
modelData
.
model
.
getDecorationRange
(
decorationId
);
if
(
newBreakpointRange
&&
!
breakpointRange
.
equalsRange
(
newBreakpointRange
))
{
somethingChanged
=
true
;
}
});
if
(
!
somethingChanged
)
{
// nothing to do, my decorations did not change.
return
;
}
...
...
@@ -254,16 +265,19 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
}
private
updateBreakpoints
(
modelData
:
IDebugEditorModelData
,
newBreakpoints
:
IBreakpoint
[]):
void
{
modelData
.
breakpointDecorationIds
=
modelData
.
model
.
deltaDecorations
(
modelData
.
breakpointDecorationIds
,
this
.
createBreakpointDecorations
(
newBreakpoints
));
const
desiredDecorations
=
this
.
createBreakpointDecorations
(
modelData
.
model
,
newBreakpoints
);
modelData
.
breakpointDecorationIds
=
modelData
.
model
.
deltaDecorations
(
modelData
.
breakpointDecorationIds
,
desiredDecorations
);
modelData
.
breakpointDecorationsAsMap
.
clear
();
modelData
.
breakpointDecorationIds
.
forEach
(
id
=>
modelData
.
breakpointDecorationsAsMap
.
set
(
id
,
tru
e
));
modelData
.
breakpointDecorationIds
.
forEach
(
(
decorationId
,
index
)
=>
modelData
.
breakpointDecorationsAsMap
.
set
(
decorationId
,
desiredDecorations
[
index
].
rang
e
));
modelData
.
breakpointLines
=
newBreakpoints
.
map
(
bp
=>
bp
.
lineNumber
);
}
private
createBreakpointDecorations
(
breakpoints
:
IBreakpoint
[]):
IModelDeltaDecoration
[]
{
private
createBreakpointDecorations
(
model
:
IModel
,
breakpoints
:
IBreakpoint
[]):
{
range
:
Range
;
options
:
IModelDecorationOptions
;
}
[]
{
return
breakpoints
.
map
((
breakpoint
)
=>
{
const
range
=
breakpoint
.
column
?
new
Range
(
breakpoint
.
lineNumber
,
breakpoint
.
column
,
breakpoint
.
lineNumber
,
breakpoint
.
column
+
1
)
:
new
Range
(
breakpoint
.
lineNumber
,
1
,
breakpoint
.
lineNumber
,
Constants
.
MAX_SAFE_SMALL_INTEGER
);
// Decoration has to have a width #20688
const
range
=
model
.
validateRange
(
breakpoint
.
column
?
new
Range
(
breakpoint
.
lineNumber
,
breakpoint
.
column
,
breakpoint
.
lineNumber
,
breakpoint
.
column
+
1
)
:
new
Range
(
breakpoint
.
lineNumber
,
1
,
breakpoint
.
lineNumber
,
Constants
.
MAX_SAFE_SMALL_INTEGER
)
// Decoration has to have a width #20688
);
return
{
options
:
this
.
getBreakpointDecorationOptions
(
breakpoint
),
range
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录