Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c6c6969c
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,发现更多精彩内容 >>
提交
c6c6969c
编写于
4月 06, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use uri-tst for decorations service,
https://github.com/microsoft/vscode/issues/93368
上级
80acfa92
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
16 addition
and
16 deletion
+16
-16
src/vs/workbench/services/decorations/browser/decorationsService.ts
...kbench/services/decorations/browser/decorationsService.ts
+16
-16
未找到文件。
src/vs/workbench/services/decorations/browser/decorationsService.ts
浏览文件 @
c6c6969c
...
...
@@ -169,10 +169,10 @@ class DecorationStyles {
class
FileDecorationChangeEvent
implements
IResourceDecorationChangeEvent
{
private
readonly
_data
=
TernarySearchTree
.
for
Path
s
<
boolean
>
();
private
readonly
_data
=
TernarySearchTree
.
for
Uri
s
<
boolean
>
();
affectsResource
(
uri
:
URI
):
boolean
{
return
this
.
_data
.
get
(
uri
.
toString
())
||
this
.
_data
.
findSuperstr
(
uri
.
toString
()
)
!==
undefined
;
return
this
.
_data
.
get
(
uri
)
||
this
.
_data
.
findSuperstr
(
uri
)
!==
undefined
;
}
static
debouncer
(
last
:
FileDecorationChangeEvent
|
undefined
,
current
:
URI
|
URI
[])
{
...
...
@@ -182,11 +182,11 @@ class FileDecorationChangeEvent implements IResourceDecorationChangeEvent {
if
(
Array
.
isArray
(
current
))
{
// many
for
(
const
uri
of
current
)
{
last
.
_data
.
set
(
uri
.
toString
()
,
true
);
last
.
_data
.
set
(
uri
,
true
);
}
}
else
{
// one
last
.
_data
.
set
(
current
.
toString
()
,
true
);
last
.
_data
.
set
(
current
,
true
);
}
return
last
;
...
...
@@ -202,7 +202,7 @@ class DecorationDataRequest {
class
DecorationProviderWrapper
{
readonly
data
=
TernarySearchTree
.
for
Path
s
<
DecorationDataRequest
|
IDecorationData
|
null
>
();
readonly
data
=
TernarySearchTree
.
for
Uri
s
<
DecorationDataRequest
|
IDecorationData
|
null
>
();
private
readonly
_dispoable
:
IDisposable
;
constructor
(
...
...
@@ -234,12 +234,12 @@ class DecorationProviderWrapper {
}
knowsAbout
(
uri
:
URI
):
boolean
{
return
Boolean
(
this
.
data
.
get
(
uri
.
toString
()))
||
Boolean
(
this
.
data
.
findSuperstr
(
uri
.
toString
()
));
return
Boolean
(
this
.
data
.
get
(
uri
))
||
Boolean
(
this
.
data
.
findSuperstr
(
uri
));
}
getOrRetrieve
(
uri
:
URI
,
includeChildren
:
boolean
,
callback
:
(
data
:
IDecorationData
,
isChild
:
boolean
)
=>
void
):
void
{
const
key
=
uri
.
toString
();
let
item
=
this
.
data
.
get
(
key
);
let
item
=
this
.
data
.
get
(
uri
);
if
(
item
===
undefined
)
{
// unknown -> trigger request
...
...
@@ -253,7 +253,7 @@ class DecorationProviderWrapper {
if
(
includeChildren
)
{
// (resolved) children
const
iter
=
this
.
data
.
findSuperstr
(
key
);
const
iter
=
this
.
data
.
findSuperstr
(
uri
);
if
(
iter
)
{
for
(
let
item
=
iter
.
next
();
!
item
.
done
;
item
=
iter
.
next
())
{
if
(
item
.
value
&&
!
(
item
.
value
instanceof
DecorationDataRequest
))
{
...
...
@@ -267,10 +267,10 @@ class DecorationProviderWrapper {
private
_fetchData
(
uri
:
URI
):
IDecorationData
|
null
{
// check for pending request and cancel it
const
pendingRequest
=
this
.
data
.
get
(
uri
.
toString
()
);
const
pendingRequest
=
this
.
data
.
get
(
uri
);
if
(
pendingRequest
instanceof
DecorationDataRequest
)
{
pendingRequest
.
source
.
cancel
();
this
.
data
.
delete
(
uri
.
toString
()
);
this
.
data
.
delete
(
uri
);
}
const
source
=
new
CancellationTokenSource
();
...
...
@@ -282,23 +282,23 @@ class DecorationProviderWrapper {
}
else
{
// async -> we have a result soon
const
request
=
new
DecorationDataRequest
(
source
,
Promise
.
resolve
(
dataOrThenable
).
then
(
data
=>
{
if
(
this
.
data
.
get
(
uri
.
toString
()
)
===
request
)
{
if
(
this
.
data
.
get
(
uri
)
===
request
)
{
this
.
_keepItem
(
uri
,
data
);
}
}).
catch
(
err
=>
{
if
(
!
isPromiseCanceledError
(
err
)
&&
this
.
data
.
get
(
uri
.
toString
()
)
===
request
)
{
this
.
data
.
delete
(
uri
.
toString
()
);
if
(
!
isPromiseCanceledError
(
err
)
&&
this
.
data
.
get
(
uri
)
===
request
)
{
this
.
data
.
delete
(
uri
);
}
}));
this
.
data
.
set
(
uri
.
toString
()
,
request
);
this
.
data
.
set
(
uri
,
request
);
return
null
;
}
}
private
_keepItem
(
uri
:
URI
,
data
:
IDecorationData
|
undefined
):
IDecorationData
|
null
{
const
deco
=
data
?
data
:
null
;
const
old
=
this
.
data
.
set
(
uri
.
toString
()
,
deco
);
const
old
=
this
.
data
.
set
(
uri
,
deco
);
if
(
deco
||
old
)
{
// only fire event when something changed
this
.
_uriEmitter
.
fire
(
uri
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录