Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
10c7db89
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,发现更多精彩内容 >>
未验证
提交
10c7db89
编写于
9月 16, 2020
作者:
A
Alex Ross
提交者:
GitHub
9月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add color to ThemeIcon (#106491)
Part of #103120
上级
c6cada99
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
4 deletion
+31
-4
src/vs/platform/theme/common/themeService.ts
src/vs/platform/theme/common/themeService.ts
+2
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+9
-0
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+1
-0
src/vs/workbench/api/common/extHostTreeViews.ts
src/vs/workbench/api/common/extHostTreeViews.ts
+9
-2
src/vs/workbench/api/common/extHostTypes.ts
src/vs/workbench/api/common/extHostTypes.ts
+7
-1
src/vs/workbench/contrib/views/browser/treeView.ts
src/vs/workbench/contrib/views/browser/treeView.ts
+3
-0
未找到文件。
src/vs/platform/theme/common/themeService.ts
浏览文件 @
10c7db89
...
...
@@ -25,10 +25,11 @@ export function themeColorFromId(id: ColorIdentifier) {
// theme icon
export
interface
ThemeIcon
{
readonly
id
:
string
;
readonly
themeColor
?:
ThemeColor
;
}
export
namespace
ThemeIcon
{
export
function
isThemeIcon
(
obj
:
any
):
obj
is
ThemeIcon
{
export
function
isThemeIcon
(
obj
:
any
):
obj
is
ThemeIcon
|
{
id
:
string
}
{
return
obj
&&
typeof
obj
===
'
object
'
&&
typeof
(
<
ThemeIcon
>
obj
).
id
===
'
string
'
;
}
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
10c7db89
...
...
@@ -2266,6 +2266,15 @@ declare module 'vscode' {
*/
description
?:
string
|
undefined
;
}
//#endregion
//#region https://github.com/microsoft/vscode/issues/103120 @alexr00
export
class
ThemeIcon2
extends
ThemeIcon
{
/**
* Returns a new `ThemeIcon` that will use the specified `ThemeColor`
* @param color The `ThemeColor` to use for the icon.
*/
with
(
color
:
ThemeColor
):
ThemeIcon2
;
}
//#endregion
}
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
10c7db89
...
...
@@ -1123,6 +1123,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
TextEditorSelectionChangeKind
:
extHostTypes
.
TextEditorSelectionChangeKind
,
ThemeColor
:
extHostTypes
.
ThemeColor
,
ThemeIcon
:
extHostTypes
.
ThemeIcon
,
ThemeIcon2
:
extHostTypes
.
ThemeIcon
,
TreeItem
:
extHostTypes
.
TreeItem
,
TreeItem2
:
extHostTypes
.
TreeItem
,
TreeItemCollapsibleState
:
extHostTypes
.
TreeItemCollapsibleState
,
...
...
src/vs/workbench/api/common/extHostTreeViews.ts
浏览文件 @
10c7db89
...
...
@@ -556,7 +556,7 @@ class ExtHostTreeView<T> extends Disposable {
const
disposable
=
new
DisposableStore
();
const
handle
=
this
.
createHandle
(
element
,
extensionTreeItem
,
parent
);
const
icon
=
this
.
getLightIconPath
(
extensionTreeItem
);
const
item
=
{
const
item
:
ITreeItem
=
{
handle
,
parentHandle
:
parent
?
parent
.
item
.
handle
:
undefined
,
label
:
toTreeItemLabel
(
extensionTreeItem
.
label
,
this
.
extension
),
...
...
@@ -567,7 +567,7 @@ class ExtHostTreeView<T> extends Disposable {
contextValue
:
extensionTreeItem
.
contextValue
,
icon
,
iconDark
:
this
.
getDarkIconPath
(
extensionTreeItem
)
||
icon
,
themeIcon
:
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
?
{
id
:
extensionTreeItem
.
iconPath
.
id
}
:
undefined
,
themeIcon
:
this
.
getThemeIcon
(
extensionTreeItem
)
,
collapsibleState
:
isUndefinedOrNull
(
extensionTreeItem
.
collapsibleState
)
?
TreeItemCollapsibleState
.
None
:
extensionTreeItem
.
collapsibleState
,
accessibilityInformation
:
extensionTreeItem
.
accessibilityInformation
};
...
...
@@ -581,6 +581,13 @@ class ExtHostTreeView<T> extends Disposable {
};
}
private
getThemeIcon
(
extensionTreeItem
:
vscode
.
TreeItem2
):
ThemeIcon
|
undefined
{
if
((
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
)
&&
extensionTreeItem
.
iconPath
.
themeColor
)
{
checkProposedApiEnabled
(
this
.
extension
);
}
return
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
?
extensionTreeItem
.
iconPath
:
undefined
;
}
private
createHandle
(
element
:
T
,
{
id
,
label
,
resourceUri
}:
vscode
.
TreeItem
,
parent
:
TreeNode
|
Root
,
returnFirst
?:
boolean
):
TreeItemHandle
{
if
(
id
)
{
return
`
${
ExtHostTreeView
.
ID_HANDLE_PREFIX
}
/
${
id
}
`
;
...
...
src/vs/workbench/api/common/extHostTypes.ts
浏览文件 @
10c7db89
...
...
@@ -2172,9 +2172,15 @@ export class ThemeIcon {
static
Folder
:
ThemeIcon
;
readonly
id
:
string
;
readonly
themeColor
?:
ThemeColor
;
constructor
(
id
:
string
)
{
constructor
(
id
:
string
,
color
?:
ThemeColor
)
{
this
.
id
=
id
;
this
.
themeColor
=
color
;
}
with
(
color
:
ThemeColor
):
ThemeIcon
{
return
new
ThemeIcon
(
this
.
id
,
color
);
}
}
ThemeIcon
.
File
=
new
ThemeIcon
(
'
file
'
);
...
...
src/vs/workbench/contrib/views/browser/treeView.ts
浏览文件 @
10c7db89
...
...
@@ -806,6 +806,9 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
let
iconClass
:
string
|
undefined
;
if
(
node
.
themeIcon
&&
!
this
.
isFileKindThemeIcon
(
node
.
themeIcon
))
{
iconClass
=
ThemeIcon
.
asClassName
(
node
.
themeIcon
);
if
(
node
.
themeIcon
.
themeColor
)
{
templateData
.
icon
.
style
.
color
=
this
.
themeService
.
getColorTheme
().
getColor
(
node
.
themeIcon
.
themeColor
.
id
)?.
toString
()
??
''
;
}
}
templateData
.
icon
.
className
=
iconClass
?
`custom-view-tree-node-item-icon
${
iconClass
}
`
:
''
;
templateData
.
icon
.
style
.
backgroundImage
=
''
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录