Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
040f338d
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,发现更多精彩内容 >>
提交
040f338d
编写于
10月 06, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine service, allow to set only one decoration per type and resource
上级
b5b32087
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
20 addition
and
23 deletion
+20
-23
src/vs/workbench/parts/markers/browser/markersFileDecorations.ts
...workbench/parts/markers/browser/markersFileDecorations.ts
+6
-4
src/vs/workbench/parts/scm/electron-browser/scmFileDecorations.ts
...orkbench/parts/scm/electron-browser/scmFileDecorations.ts
+3
-3
src/vs/workbench/services/fileDecorations/browser/fileDecorations.ts
...bench/services/fileDecorations/browser/fileDecorations.ts
+2
-2
src/vs/workbench/services/fileDecorations/browser/fileDecorationsService.ts
...ervices/fileDecorations/browser/fileDecorationsService.ts
+9
-14
未找到文件。
src/vs/workbench/parts/markers/browser/markersFileDecorations.ts
浏览文件 @
040f338d
...
...
@@ -44,12 +44,14 @@ class MarkersFileDecorations implements IWorkbenchContribution {
private
_onDidChangeMarker
(
resources
:
URI
[]):
void
{
for
(
const
resource
of
resources
)
{
const
markers
=
this
.
_markerService
.
read
({
resource
});
const
markers
=
this
.
_markerService
.
read
({
resource
})
.
sort
((
a
,
b
)
=>
Severity
.
compare
(
a
.
severity
,
b
.
severity
));
if
(
!
isFalsyOrEmpty
(
markers
))
{
const
data
=
markers
.
map
(
this
.
_toFileDecorationData
,
this
);
this
.
_decorationsService
.
setFileDecoration
s
(
this
.
_type
,
resource
,
data
);
const
data
=
this
.
_toFileDecorationData
(
markers
[
0
]
);
this
.
_decorationsService
.
setFileDecoration
(
this
.
_type
,
resource
,
data
);
}
else
{
this
.
_decorationsService
.
unsetFileDecoration
s
(
this
.
_type
,
resource
);
this
.
_decorationsService
.
unsetFileDecoration
(
this
.
_type
,
resource
);
}
}
}
...
...
src/vs/workbench/parts/scm/electron-browser/scmFileDecorations.ts
浏览文件 @
040f338d
...
...
@@ -49,11 +49,11 @@ export class FileDecorations implements IWorkbenchContribution {
for
(
const
resource
of
group
.
resourceCollection
.
resources
)
{
// TODO@Joh have a better color and icon which is based
// on the resource decoration
this
.
_decorationsService
.
setFileDecoration
s
(
type
,
resource
.
sourceUri
,
[
{
this
.
_decorationsService
.
setFileDecoration
(
type
,
resource
.
sourceUri
,
{
severity
:
Severity
.
Info
,
message
:
resource
.
decorations
.
tooltip
,
color
}
]
);
});
newDecorations
.
set
(
resource
.
sourceUri
.
toString
(),
resource
.
sourceUri
);
}
...
...
@@ -61,7 +61,7 @@ export class FileDecorations implements IWorkbenchContribution {
oldDecorations
.
forEach
((
value
,
key
)
=>
{
if
(
!
newDecorations
.
has
(
key
))
{
this
.
_decorationsService
.
unsetFileDecoration
s
(
type
,
value
);
this
.
_decorationsService
.
unsetFileDecoration
(
type
,
value
);
}
});
...
...
src/vs/workbench/services/fileDecorations/browser/fileDecorations.ts
浏览文件 @
040f338d
...
...
@@ -43,9 +43,9 @@ export interface IFileDecorationsService {
registerDecorationType
(
label
:
string
):
DecorationType
;
setFileDecoration
s
(
type
:
DecorationType
,
target
:
URI
,
data
:
IFileDecorationData
[]
):
void
;
setFileDecoration
(
type
:
DecorationType
,
target
:
URI
,
data
:
IFileDecorationData
):
void
;
unsetFileDecoration
s
(
type
:
DecorationType
,
target
:
URI
):
void
;
unsetFileDecoration
(
type
:
DecorationType
,
target
:
URI
):
void
;
getDecorations
(
uri
:
URI
,
includeChildren
:
boolean
):
IFileDecoration
[];
...
...
src/vs/workbench/services/fileDecorations/browser/fileDecorationsService.ts
浏览文件 @
040f338d
...
...
@@ -9,15 +9,13 @@ import Severity from 'vs/base/common/severity';
import
Event
,
{
Emitter
,
debounceEvent
}
from
'
vs/base/common/event
'
;
import
{
IFileDecorationsService
,
IFileDecoration
,
DecorationType
,
IFileDecorationData
}
from
'
vs/workbench/services/fileDecorations/browser/fileDecorations
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
mergeSort
,
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
export
class
FileDecorationsService
implements
IFileDecorationsService
{
readonly
_serviceBrand
;
private
readonly
_onDidChangeFileDecoration
=
new
Emitter
<
URI
>
();
private
readonly
_types
=
new
Map
<
DecorationType
,
TernarySearchTree
<
IFileDecoration
[]
>>
();
private
readonly
_types
=
new
Map
<
DecorationType
,
TernarySearchTree
<
IFileDecoration
>>
();
readonly
onDidChangeFileDecoration
:
Event
<
URI
[]
>
=
debounceEvent
<
URI
,
URI
[]
>
(
this
.
_onDidChangeFileDecoration
.
event
,
...
...
@@ -44,17 +42,16 @@ export class FileDecorationsService implements IFileDecorationsService {
}
}
};
this
.
_types
.
set
(
type
,
TernarySearchTree
.
forPaths
<
IFileDecoration
[]
>
());
this
.
_types
.
set
(
type
,
TernarySearchTree
.
forPaths
<
IFileDecoration
>
());
return
type
;
}
setFileDecorations
(
type
:
DecorationType
,
target
:
URI
,
data
:
IFileDecorationData
[]):
void
{
let
decorations
=
mergeSort
(
data
.
map
(
data
=>
({
type
,
...
data
})),
FileDecorationsService
.
_compareFileDecorationsBySeverity
);
this
.
_types
.
get
(
type
).
set
(
target
.
toString
(),
decorations
);
setFileDecoration
(
type
:
DecorationType
,
target
:
URI
,
data
:
IFileDecorationData
):
void
{
this
.
_types
.
get
(
type
).
set
(
target
.
toString
(),
{
type
,
...
data
});
this
.
_onDidChangeFileDecoration
.
fire
(
target
);
}
unsetFileDecoration
s
(
type
:
DecorationType
,
target
:
URI
):
void
{
unsetFileDecoration
(
type
:
DecorationType
,
target
:
URI
):
void
{
this
.
_types
.
get
(
type
).
delete
(
target
.
toString
());
this
.
_onDidChangeFileDecoration
.
fire
(
target
);
}
...
...
@@ -76,7 +73,7 @@ export class FileDecorationsService implements IFileDecorationsService {
if
(
!
top
||
FileDecorationsService
.
_compareFileDecorationsBySeverity
(
top
,
decoration
)
>
0
)
{
top
=
decoration
;
}
return
top
.
severity
===
Severity
.
Error
;
return
top
!==
undefined
&&
top
.
severity
===
Severity
.
Error
;
});
return
top
;
}
...
...
@@ -91,13 +88,11 @@ export class FileDecorationsService implements IFileDecorationsService {
if
(
includeChildren
)
{
let
newTree
=
tree
.
findSuperstr
(
key
);
if
(
newTree
)
{
newTree
.
forEach
(([,
d
ata
])
=>
done
=
done
||
data
.
some
(
callback
));
newTree
.
forEach
(([,
d
eco
])
=>
done
=
done
||
callback
(
deco
));
}
}
else
{
let
list
=
tree
.
get
(
key
);
if
(
!
isFalsyOrEmpty
(
list
))
{
done
=
list
.
some
(
callback
);
}
let
deco
=
tree
.
get
(
key
);
done
=
done
||
deco
&&
callback
(
deco
);
}
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录