Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1fe73ac7
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,发现更多精彩内容 >>
提交
1fe73ac7
编写于
2月 26, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
#43216
上级
7605653d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
36 deletion
+38
-36
src/vs/platform/theme/common/themeService.ts
src/vs/platform/theme/common/themeService.ts
+8
-0
src/vs/workbench/api/node/extHostTreeViews.ts
src/vs/workbench/api/node/extHostTreeViews.ts
+8
-11
src/vs/workbench/browser/parts/views/customView.ts
src/vs/workbench/browser/parts/views/customView.ts
+17
-16
src/vs/workbench/common/views.ts
src/vs/workbench/common/views.ts
+5
-9
未找到文件。
src/vs/platform/theme/common/themeService.ts
浏览文件 @
1fe73ac7
...
...
@@ -21,6 +21,14 @@ export function themeColorFromId(id: ColorIdentifier) {
return
{
id
};
}
// theme icon
export
interface
ThemeIcon
{
readonly
id
:
string
;
}
export
const
FileThemeIcon
=
{
id
:
'
file
'
};
export
const
FolderThemeIcon
=
{
id
:
'
folder
'
};
// base themes
export
const
DARK
:
ThemeType
=
'
dark
'
;
export
const
LIGHT
:
ThemeType
=
'
light
'
;
...
...
src/vs/workbench/api/node/extHostTreeViews.ts
浏览文件 @
1fe73ac7
...
...
@@ -12,7 +12,7 @@ import { debounceEvent } from 'vs/base/common/event';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ExtHostTreeViewsShape
,
MainThreadTreeViewsShape
}
from
'
./extHost.protocol
'
;
import
{
ITreeItem
,
TreeViewItemHandleArg
,
IThemeIcon
}
from
'
vs/workbench/common/views
'
;
import
{
ITreeItem
,
TreeViewItemHandleArg
}
from
'
vs/workbench/common/views
'
;
import
{
ExtHostCommands
,
CommandsConverter
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
TreeItemCollapsibleState
,
ThemeIcon
}
from
'
vs/workbench/api/node/extHostTypes
'
;
...
...
@@ -288,6 +288,7 @@ class ExtHostTreeView<T> extends Disposable {
contextValue
:
extensionTreeItem
.
contextValue
,
icon
,
iconDark
:
this
.
getDarkIconPath
(
extensionTreeItem
)
||
icon
,
themeIcon
:
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
?
{
id
:
extensionTreeItem
.
iconPath
.
id
}
:
void
0
,
collapsibleState
:
isUndefinedOrNull
(
extensionTreeItem
.
collapsibleState
)
?
TreeItemCollapsibleState
.
None
:
extensionTreeItem
.
collapsibleState
};
...
...
@@ -315,11 +316,10 @@ class ExtHostTreeView<T> extends Disposable {
throw
new
Error
(
'
This should not be reached
'
);
}
private
getLightIconPath
(
extensionTreeItem
:
vscode
.
TreeItem
):
string
|
IThemeIcon
{
if
(
extensionTreeItem
.
iconPath
)
{
private
getLightIconPath
(
extensionTreeItem
:
vscode
.
TreeItem
):
string
{
if
(
extensionTreeItem
.
iconPath
&&
!
(
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
)
)
{
if
(
typeof
extensionTreeItem
.
iconPath
===
'
string
'
||
extensionTreeItem
.
iconPath
instanceof
URI
||
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
)
{
||
extensionTreeItem
.
iconPath
instanceof
URI
)
{
return
this
.
getIconPath
(
extensionTreeItem
.
iconPath
);
}
return
this
.
getIconPath
(
extensionTreeItem
.
iconPath
[
'
light
'
]);
...
...
@@ -327,20 +327,17 @@ class ExtHostTreeView<T> extends Disposable {
return
void
0
;
}
private
getDarkIconPath
(
extensionTreeItem
:
vscode
.
TreeItem
):
string
|
IThemeIcon
{
if
(
extensionTreeItem
.
iconPath
&&
extensionTreeItem
.
iconPath
[
'
dark
'
])
{
private
getDarkIconPath
(
extensionTreeItem
:
vscode
.
TreeItem
):
string
{
if
(
extensionTreeItem
.
iconPath
&&
!
(
extensionTreeItem
.
iconPath
instanceof
ThemeIcon
)
&&
extensionTreeItem
.
iconPath
[
'
dark
'
])
{
return
this
.
getIconPath
(
extensionTreeItem
.
iconPath
[
'
dark
'
]);
}
return
void
0
;
}
private
getIconPath
(
iconPath
:
string
|
URI
|
ThemeIcon
):
string
|
IThemeIcon
{
private
getIconPath
(
iconPath
:
string
|
URI
):
string
{
if
(
iconPath
instanceof
URI
)
{
return
iconPath
.
toString
();
}
if
(
iconPath
instanceof
ThemeIcon
)
{
return
{
id
:
iconPath
.
id
};
}
return
URI
.
file
(
iconPath
).
toString
();
}
...
...
src/vs/workbench/browser/parts/views/customView.ts
浏览文件 @
1fe73ac7
...
...
@@ -11,9 +11,9 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
$
}
from
'
vs/base/browser/builder
'
;
import
{
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
LIGHT
,
FileThemeIcon
,
FolderThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ITree
,
IDataSource
,
IRenderer
,
ContextMenuEvent
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
TreeItemCollapsibleState
,
ITreeItem
,
ITreeViewer
,
ICustomViewsService
,
ITreeViewDataProvider
,
ViewsRegistry
,
IViewDescriptor
,
TreeViewItemHandleArg
,
ICustomViewDescriptor
,
IViewsViewlet
,
FileThemeIconId
,
FolderThemeIconId
}
from
'
vs/workbench/common/views
'
;
import
{
TreeItemCollapsibleState
,
ITreeItem
,
ITreeViewer
,
ICustomViewsService
,
ITreeViewDataProvider
,
ViewsRegistry
,
IViewDescriptor
,
TreeViewItemHandleArg
,
ICustomViewDescriptor
,
IViewsViewlet
}
from
'
vs/workbench/common/views
'
;
import
{
IWorkbenchThemeService
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IProgressService2
,
ProgressLocation
}
from
'
vs/platform/progress/common/progress
'
;
...
...
@@ -447,19 +447,8 @@ class TreeRenderer implements IRenderer {
DOM
.
removeClass
(
templateData
.
label
,
'
custom-view-tree-node-item-label
'
);
DOM
.
removeClass
(
templateData
.
resourceLabel
.
element
,
'
custom-view-tree-node-item-resourceLabel
'
);
if
(
resource
&&
(
typeof
icon
!==
'
string
'
))
{
let
fileKind
=
node
.
collapsibleState
===
TreeItemCollapsibleState
.
Collapsed
||
node
.
collapsibleState
===
TreeItemCollapsibleState
.
Expanded
?
FileKind
.
FOLDER
:
FileKind
.
FILE
;
if
(
icon
&&
icon
.
id
)
{
switch
(
icon
.
id
)
{
case
FileThemeIconId
:
fileKind
=
FileKind
.
FILE
;
break
;
case
FolderThemeIconId
:
fileKind
=
FileKind
.
FOLDER
;
break
;
}
}
templateData
.
resourceLabel
.
setLabel
({
name
:
label
,
resource
},
{
fileKind
,
title
:
node
.
tooltip
});
if
(
resource
&&
!
icon
)
{
templateData
.
resourceLabel
.
setLabel
({
name
:
label
,
resource
},
{
fileKind
:
this
.
getFileKind
(
node
),
title
:
node
.
tooltip
});
DOM
.
addClass
(
templateData
.
resourceLabel
.
element
,
'
custom-view-tree-node-item-resourceLabel
'
);
}
else
{
templateData
.
label
.
textContent
=
label
;
...
...
@@ -472,6 +461,18 @@ class TreeRenderer implements IRenderer {
templateData
.
actionBar
.
push
(
this
.
menus
.
getResourceActions
(
node
),
{
icon
:
true
,
label
:
false
});
}
private
getFileKind
(
node
:
ITreeItem
):
FileKind
{
if
(
node
.
themeIcon
)
{
switch
(
node
.
themeIcon
.
id
)
{
case
FileThemeIcon
.
id
:
return
FileKind
.
FILE
;
case
FolderThemeIcon
.
id
:
return
FileKind
.
FOLDER
;
}
}
return
node
.
collapsibleState
===
TreeItemCollapsibleState
.
Collapsed
||
node
.
collapsibleState
===
TreeItemCollapsibleState
.
Expanded
?
FileKind
.
FOLDER
:
FileKind
.
FILE
;
}
public
disposeTemplate
(
tree
:
ITree
,
templateId
:
string
,
templateData
:
ITreeExplorerTemplateData
):
void
{
templateData
.
resourceLabel
.
dispose
();
templateData
.
actionBar
.
dispose
();
...
...
@@ -505,7 +506,7 @@ class TreeItemIcon extends Disposable {
const
fileIconTheme
=
this
.
themeService
.
getFileIconTheme
();
const
contributedIcon
=
this
.
themeService
.
getTheme
().
type
===
LIGHT
?
this
.
_treeItem
.
icon
:
this
.
_treeItem
.
iconDark
;
const
hasContributedIcon
=
typeof
contributedIcon
===
'
string
'
;
const
hasContributedIcon
=
!!
contributedIcon
;
const
hasChildren
=
this
.
_treeItem
.
collapsibleState
!==
TreeItemCollapsibleState
.
None
;
const
hasResource
=
!!
this
.
_treeItem
.
resourceUri
;
const
isFolder
=
hasResource
&&
hasChildren
;
...
...
src/vs/workbench/common/views.ts
浏览文件 @
1fe73ac7
...
...
@@ -13,6 +13,7 @@ import { localize } from 'vs/nls';
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
export
class
ViewLocation
{
...
...
@@ -202,13 +203,6 @@ export enum TreeItemCollapsibleState {
Expanded
=
2
}
export
const
FileThemeIconId
=
'
file
'
;
export
const
FolderThemeIconId
=
'
folder
'
;
export
interface
IThemeIcon
{
readonly
id
:
string
;
}
export
interface
ITreeItem
{
handle
:
string
;
...
...
@@ -219,9 +213,11 @@ export interface ITreeItem {
label
?:
string
;
icon
?:
string
|
IThemeIcon
;
icon
?:
string
;
iconDark
?:
string
;
iconDark
?:
string
|
I
ThemeIcon
;
themeIcon
?:
ThemeIcon
;
resourceUri
?:
UriComponents
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录