Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0ecbfa0f
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,发现更多精彩内容 >>
提交
0ecbfa0f
编写于
6月 25, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
explorer decoration provider refactor
fixes #50866
上级
aa8f371e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
14 deletion
+35
-14
src/vs/workbench/parts/files/common/explorerModel.ts
src/vs/workbench/parts/files/common/explorerModel.ts
+10
-7
src/vs/workbench/parts/files/electron-browser/views/explorerDecorationsProvider.ts
...les/electron-browser/views/explorerDecorationsProvider.ts
+15
-3
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
...kbench/parts/files/electron-browser/views/explorerView.ts
+10
-4
未找到文件。
src/vs/workbench/parts/files/common/explorerModel.ts
浏览文件 @
0ecbfa0f
...
...
@@ -74,11 +74,12 @@ export class ExplorerItem {
private
_isSymbolicLink
:
boolean
;
private
_isReadonly
:
boolean
;
private
children
:
Map
<
string
,
ExplorerItem
>
;
private
_isError
:
boolean
;
public
parent
:
ExplorerItem
;
public
isDirectoryResolved
:
boolean
;
constructor
(
resource
:
URI
,
public
root
:
ExplorerItem
,
isSymbolicLink
?:
boolean
,
isReadonly
?:
boolean
,
isDirectory
?:
boolean
,
name
:
string
=
resources
.
basenameOrAuthority
(
resource
),
mtime
?:
number
,
etag
?:
string
)
{
constructor
(
resource
:
URI
,
public
root
:
ExplorerItem
,
isSymbolicLink
?:
boolean
,
isReadonly
?:
boolean
,
isDirectory
?:
boolean
,
name
:
string
=
resources
.
basenameOrAuthority
(
resource
),
mtime
?:
number
,
etag
?:
string
,
isError
?:
boolean
)
{
this
.
resource
=
resource
;
this
.
_name
=
name
;
this
.
isDirectory
=
!!
isDirectory
;
...
...
@@ -86,6 +87,7 @@ export class ExplorerItem {
this
.
_isReadonly
=
!!
isReadonly
;
this
.
etag
=
etag
;
this
.
mtime
=
mtime
;
this
.
_isError
=
!!
isError
;
if
(
!
this
.
root
)
{
this
.
root
=
this
;
...
...
@@ -106,6 +108,10 @@ export class ExplorerItem {
return
this
.
_isReadonly
;
}
public
get
isError
():
boolean
{
return
this
.
_isError
;
}
public
set
isDirectory
(
value
:
boolean
)
{
if
(
value
!==
this
.
_isDirectory
)
{
this
.
_isDirectory
=
value
;
...
...
@@ -118,10 +124,6 @@ export class ExplorerItem {
}
public
get
nonexistentRoot
():
boolean
{
return
this
.
isRoot
&&
!
this
.
isDirectoryResolved
&&
this
.
isDirectory
;
}
public
get
name
():
string
{
return
this
.
_name
;
}
...
...
@@ -145,8 +147,8 @@ export class ExplorerItem {
return
this
===
this
.
root
;
}
public
static
create
(
raw
:
IFileStat
,
root
:
ExplorerItem
,
resolveTo
?:
URI
[]):
ExplorerItem
{
const
stat
=
new
ExplorerItem
(
raw
.
resource
,
root
,
raw
.
isSymbolicLink
,
raw
.
isReadonly
,
raw
.
isDirectory
,
raw
.
name
,
raw
.
mtime
,
raw
.
etag
);
public
static
create
(
raw
:
IFileStat
,
root
:
ExplorerItem
,
resolveTo
?:
URI
[]
,
isError
=
false
):
ExplorerItem
{
const
stat
=
new
ExplorerItem
(
raw
.
resource
,
root
,
raw
.
isSymbolicLink
,
raw
.
isReadonly
,
raw
.
isDirectory
,
raw
.
name
,
raw
.
mtime
,
raw
.
etag
,
isError
);
// Recursively add children if present
if
(
stat
.
isDirectory
)
{
...
...
@@ -195,6 +197,7 @@ export class ExplorerItem {
local
.
isDirectoryResolved
=
disk
.
isDirectoryResolved
;
local
.
_isSymbolicLink
=
disk
.
isSymbolicLink
;
local
.
_isReadonly
=
disk
.
isReadonly
;
local
.
_isError
=
disk
.
isError
;
// Merge Children if resolved
if
(
mergingDirectories
&&
disk
.
isDirectoryResolved
)
{
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerDecorationsProvider.ts
浏览文件 @
0ecbfa0f
...
...
@@ -12,27 +12,35 @@ import { Model } from 'vs/workbench/parts/files/common/explorerModel';
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IDecorationsProvider
,
IDecorationData
}
from
'
vs/workbench/services/decorations/browser/decorations
'
;
import
{
listInvalidItemForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IDisposable
}
from
'
vscode-xterm
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
export
class
ExplorerDecorationsProvider
implements
IDecorationsProvider
{
readonly
label
:
string
=
localize
(
'
label
'
,
"
Explorer
"
);
private
_onDidChange
=
new
Emitter
<
URI
[]
>
();
private
toDispose
:
IDisposable
[];
constructor
(
private
model
:
Model
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
)
{
contextService
.
onDidChangeWorkspaceFolders
(
e
=>
{
this
.
toDispose
=
[];
this
.
toDispose
.
push
(
contextService
.
onDidChangeWorkspaceFolders
(
e
=>
{
this
.
_onDidChange
.
fire
(
e
.
changed
.
concat
(
e
.
added
).
map
(
wf
=>
wf
.
uri
));
});
})
)
;
}
get
onDidChange
():
Event
<
URI
[]
>
{
return
this
.
_onDidChange
.
event
;
}
changed
(
uris
:
URI
[]):
void
{
this
.
_onDidChange
.
fire
(
uris
);
}
provideDecorations
(
resource
:
URI
):
IDecorationData
{
const
fileStat
=
this
.
model
.
findClosest
(
resource
);
if
(
fileStat
&&
fileStat
.
nonexistentRoot
)
{
if
(
fileStat
&&
fileStat
.
isRoot
&&
fileStat
.
isError
)
{
return
{
tooltip
:
localize
(
'
canNotResolve
'
,
"
Can not resolve workspace folder
"
),
letter
:
'
!
'
,
...
...
@@ -48,4 +56,8 @@ export class ExplorerDecorationsProvider implements IDecorationsProvider {
return
undefined
;
}
dispose
():
IDisposable
[]
{
return
dispose
(
this
.
toDispose
);
}
}
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
浏览文件 @
0ecbfa0f
...
...
@@ -78,6 +78,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
private
settings
:
object
;
private
treeContainer
:
HTMLElement
;
private
dragHandler
:
DelayedDragHandler
;
private
decorationProvider
:
ExplorerDecorationsProvider
;
private
isDisposed
:
boolean
;
constructor
(
...
...
@@ -114,7 +115,9 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
(
event
:
IConfigurationChangeEvent
)
=>
event
.
affectsConfiguration
(
FILES_EXCLUDE_CONFIG
)
);
decorationService
.
registerDecorationsProvider
(
new
ExplorerDecorationsProvider
(
this
.
model
,
contextService
));
this
.
decorationProvider
=
new
ExplorerDecorationsProvider
(
this
.
model
,
contextService
);
decorationService
.
registerDecorationsProvider
(
this
.
decorationProvider
);
this
.
disposables
.
push
(
this
.
decorationProvider
);
}
private
getFileEventsExcludes
(
root
?:
URI
):
glob
.
IExpression
{
...
...
@@ -782,7 +785,10 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
});
}
const
promise
=
this
.
resolveRoots
(
targetsToResolve
,
targetsToExpand
);
const
promise
=
this
.
resolveRoots
(
targetsToResolve
,
targetsToExpand
).
then
(
result
=>
{
this
.
decorationProvider
.
changed
(
targetsToResolve
.
map
(
t
=>
t
.
root
.
resource
));
return
result
;
});
this
.
progressService
.
showWhile
(
promise
,
this
.
partService
.
isCreated
()
?
800
:
3200
/* less ugly initial startup */
);
return
promise
;
...
...
@@ -798,7 +804,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
mtime
:
0
,
etag
:
undefined
,
isDirectory
:
true
},
root
);
},
root
,
undefined
,
true
);
const
setInputAndExpand
=
(
input
:
ExplorerItem
|
Model
,
statsToExpand
:
ExplorerItem
[])
=>
{
// Make sure to expand all folders that where expanded in the previous session
...
...
@@ -842,7 +848,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
let
delayer
=
new
Delayer
(
100
);
let
delayerPromise
:
TPromise
;
return
TPromise
.
join
(
targetsToResolve
.
map
((
target
,
index
)
=>
this
.
fileService
.
resolveFile
(
target
.
resource
,
target
.
options
)
.
then
(
result
=>
result
.
isDirectory
?
ExplorerItem
.
create
(
result
,
target
.
root
,
target
.
options
.
resolveTo
)
:
errorFileStat
(
target
.
resource
,
target
.
root
),
err
=>
errorFileStat
(
target
.
resource
,
target
.
root
))
.
then
(
result
=>
result
.
isDirectory
?
ExplorerItem
.
create
(
result
,
target
.
root
,
target
.
options
.
resolveTo
)
:
errorFileStat
(
target
.
resource
,
target
.
root
),
()
=>
errorFileStat
(
target
.
resource
,
target
.
root
))
.
then
(
modelStat
=>
{
// Subsequent refresh: Merge stat into our local model and refresh tree
if
(
index
<
this
.
model
.
roots
.
length
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录