Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f7298698
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,发现更多精彩内容 >>
提交
f7298698
编写于
10月 12, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
deco - also use className for badge
上级
dcff484b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
19 deletion
+43
-19
src/vs/base/browser/ui/iconLabel/iconLabel.ts
src/vs/base/browser/ui/iconLabel/iconLabel.ts
+8
-5
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+5
-2
src/vs/workbench/services/decorations/browser/decorations.ts
src/vs/workbench/services/decorations/browser/decorations.ts
+1
-0
src/vs/workbench/services/decorations/browser/decorationsService.ts
...kbench/services/decorations/browser/decorationsService.ts
+29
-12
未找到文件。
src/vs/base/browser/ui/iconLabel/iconLabel.ts
浏览文件 @
f7298698
...
...
@@ -13,19 +13,23 @@ import uri from 'vs/base/common/uri';
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
IWorkspaceFolderProvider
,
getPathLabel
,
IUserHomeProvider
}
from
'
vs/base/common/labels
'
;
import
{
IDisposable
,
combinedDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
export
interface
IIconLabelCreationOptions
{
supportHighlights
?:
boolean
;
}
export
interface
ILabelBadgeOptions
{
letter
:
string
;
title
:
string
;
className
:
string
;
}
export
interface
IIconLabelOptions
{
title
?:
string
;
extraClasses
?:
string
[];
italic
?:
boolean
;
matches
?:
IMatch
[];
color
?:
Color
;
badge
?:
{
letter
:
string
,
title
:
string
};
badge
?:
ILabelBadgeOptions
;
}
class
FastLabelNode
{
...
...
@@ -156,8 +160,7 @@ export class IconLabel {
const
{
letter
,
title
}
=
options
.
badge
;
this
.
badgeNode
.
innerHTML
=
letter
;
this
.
badgeNode
.
title
=
title
;
this
.
badgeNode
.
style
.
backgroundColor
=
options
.
color
.
toString
();
this
.
badgeNode
.
style
.
color
=
Color
.
white
.
toString
();
dom
.
addClass
(
this
.
badgeNode
,
options
.
badge
.
className
);
dom
.
show
(
this
.
badgeNode
);
}
else
if
(
this
.
badgeNode
)
{
...
...
src/vs/workbench/browser/labels.ts
浏览文件 @
f7298698
...
...
@@ -189,8 +189,11 @@ export class ResourceLabel extends IconLabel {
);
if
(
deco
)
{
iconLabelOptions
.
extraClasses
.
push
(
deco
.
labelClasses
);
iconLabelOptions
.
color
=
this
.
options
.
fileDecorations
.
useColors
?
this
.
themeService
.
getTheme
().
getColor
(
deco
.
color
)
:
undefined
;
iconLabelOptions
.
badge
=
this
.
options
.
fileDecorations
.
useBadges
?
deco
.
letter
&&
{
letter
:
deco
.
letter
,
title
:
deco
.
tooltip
}
:
undefined
;
iconLabelOptions
.
badge
=
deco
.
letter
?
{
letter
:
deco
.
letter
,
title
:
deco
.
tooltip
,
className
:
deco
.
badgeClassName
,
}
:
undefined
;
}
}
...
...
src/vs/workbench/services/decorations/browser/decorations.ts
浏览文件 @
f7298698
...
...
@@ -22,6 +22,7 @@ export interface IResourceDecoration {
readonly
leafOnly
?:
boolean
;
labelClasses
?:
string
;
badgeClassName
?:
string
;
}
export
interface
IDecorationsProvider
{
...
...
src/vs/workbench/services/decorations/browser/decorationsService.ts
浏览文件 @
f7298698
...
...
@@ -15,7 +15,7 @@ import { LinkedList } from 'vs/base/common/linkedList';
import
{
createStyleSheet
,
createCSSRule
}
from
'
vs/base/browser/dom
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IdGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
{
listActiveSelectionForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
listActiveSelectionForeground
,
ColorIdentifier
}
from
'
vs/platform/theme/common/colorRegistry
'
;
class
FileDecorationChangeEvent
implements
IResourceDecorationChangeEvent
{
...
...
@@ -129,7 +129,7 @@ class DecorationColors {
private
readonly
_styleElement
=
createStyleSheet
();
private
readonly
_themeListener
:
IDisposable
;
private
readonly
_classNames
=
new
IdGenerator
(
'
monaco-decoration-styles-
'
);
private
readonly
_classNames2ColorIds
=
new
Map
<
string
,
string
>
();
private
readonly
_classNames2ColorIds
=
new
Map
<
string
,
[
string
,
string
]
>
();
constructor
(
@
IThemeService
private
_themeService
:
IThemeService
,
...
...
@@ -146,25 +146,42 @@ class DecorationColors {
if
(
!
decoration
||
!
decoration
.
color
)
{
return
;
}
let
className
=
this
.
_classNames2ColorIds
.
get
(
decoration
.
color
);
if
(
!
className
)
{
className
=
this
.
_classNames
.
nextId
();
this
.
_classNames2ColorIds
.
set
(
decoration
.
color
,
className
);
createCSSRule
(
`.
${
className
}
`
,
`color:
${
this
.
_themeService
.
getTheme
().
getColor
(
decoration
.
color
)}
`
,
this
.
_styleElement
);
createCSSRule
(
`.selected .
${
className
}
`
,
`color:
${
this
.
_themeService
.
getTheme
().
getColor
(
listActiveSelectionForeground
)}
`
,
this
.
_styleElement
);
const
tuple
=
this
.
_classNames2ColorIds
.
get
(
decoration
.
color
);
if
(
tuple
)
{
// from cache
decoration
.
labelClasses
=
tuple
[
0
];
decoration
.
badgeClassName
=
tuple
[
1
];
return
;
}
decoration
.
labelClasses
=
className
;
let
labelClassName
=
this
.
_classNames
.
nextId
();
let
badgeClassName
=
this
.
_classNames
.
nextId
();
this
.
_classNames2ColorIds
.
set
(
decoration
.
color
,
[
labelClassName
,
badgeClassName
]);
decoration
.
labelClasses
=
labelClassName
;
decoration
.
badgeClassName
=
badgeClassName
;
this
.
_createCssRules
(
labelClassName
,
badgeClassName
,
decoration
.
color
);
}
private
_onThemeChange
():
void
{
this
.
_styleElement
.
innerHTML
=
''
;
this
.
_classNames2ColorIds
.
forEach
((
classNam
e
,
color
)
=>
{
c
reateCSSRule
(
`.
${
className
}
`
,
`color:
${
this
.
_themeService
.
getTheme
().
getColor
(
color
)}
`
,
this
.
_styleElement
)
;
createCSSRule
(
`.selected .
${
className
}
`
,
`color:
${
this
.
_themeService
.
getTheme
().
getColor
(
listActiveSelectionForeground
)}
`
,
this
.
_styleElement
);
this
.
_classNames2ColorIds
.
forEach
((
tupl
e
,
color
)
=>
{
c
onst
[
labelClassName
,
badgeClassName
]
=
tuple
;
this
.
_createCssRules
(
labelClassName
,
badgeClassName
,
color
);
});
}
private
_createCssRules
(
labelClassName
:
string
,
badgeClassName
:
string
,
color
:
ColorIdentifier
):
void
{
const
theme
=
this
.
_themeService
.
getTheme
();
// label
createCSSRule
(
`.
${
labelClassName
}
`
,
`color:
${
theme
.
getColor
(
color
)}
`
,
this
.
_styleElement
);
createCSSRule
(
`.selected .
${
labelClassName
}
`
,
`color:
${
theme
.
getColor
(
listActiveSelectionForeground
)}
`
,
this
.
_styleElement
);
// badge
createCSSRule
(
`.
${
badgeClassName
}
`
,
`background-color:
${
theme
.
getColor
(
color
)}
; color:
${
theme
.
getColor
(
listActiveSelectionForeground
)}
;`
,
this
.
_styleElement
);
}
}
export
class
FileDecorationsService
implements
IResourceDecorationsService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录