Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7b4d5048
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,发现更多精彩内容 >>
提交
7b4d5048
编写于
6月 29, 2017
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
findClosest
fixes #29718
上级
6d09da44
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
14 deletion
+20
-14
src/vs/workbench/parts/files/browser/fileActions.ts
src/vs/workbench/parts/files/browser/fileActions.ts
+1
-1
src/vs/workbench/parts/files/browser/views/explorerView.ts
src/vs/workbench/parts/files/browser/views/explorerView.ts
+6
-6
src/vs/workbench/parts/files/common/explorerModel.ts
src/vs/workbench/parts/files/common/explorerModel.ts
+13
-7
未找到文件。
src/vs/workbench/parts/files/browser/fileActions.ts
浏览文件 @
7b4d5048
...
...
@@ -1270,7 +1270,7 @@ export class CompareResourcesAction extends Action {
// Check if file was deleted or moved meanwhile (explorer only)
if
(
this
.
tree
)
{
const
input
:
FileStat
|
Model
=
this
.
tree
.
getInput
();
const
exists
=
input
instanceof
Model
?
input
.
find
Fir
st
(
globalResourceToCompare
)
:
input
.
find
(
globalResourceToCompare
);
const
exists
=
input
instanceof
Model
?
input
.
find
Close
st
(
globalResourceToCompare
)
:
input
.
find
(
globalResourceToCompare
);
if
(
!
exists
)
{
globalResourceToCompare
=
null
;
return
false
;
...
...
src/vs/workbench/parts/files/browser/views/explorerView.ts
浏览文件 @
7b4d5048
...
...
@@ -328,7 +328,7 @@ export class ExplorerView extends CollapsibleView {
lastActiveFileResource
=
URI
.
parse
(
this
.
settings
[
ExplorerView
.
MEMENTO_LAST_ACTIVE_FILE_RESOURCE
]);
}
if
(
lastActiveFileResource
&&
this
.
isCreated
&&
this
.
model
.
find
Fir
st
(
lastActiveFileResource
))
{
if
(
lastActiveFileResource
&&
this
.
isCreated
&&
this
.
model
.
find
Close
st
(
lastActiveFileResource
))
{
this
.
editorService
.
openEditor
({
resource
:
lastActiveFileResource
,
options
:
{
revealIfVisible
:
true
}
}).
done
(
null
,
errors
.
onUnexpectedError
);
return
refreshPromise
;
...
...
@@ -606,8 +606,8 @@ export class ExplorerView extends CollapsibleView {
}
// Compute if parent is visible and added file not yet part of it
const
parentStat
=
this
.
model
.
find
Fir
st
(
URI
.
file
(
parent
));
if
(
parentStat
&&
parentStat
.
isDirectoryResolved
&&
!
this
.
model
.
find
Fir
st
(
change
.
resource
))
{
const
parentStat
=
this
.
model
.
find
Close
st
(
URI
.
file
(
parent
));
if
(
parentStat
&&
parentStat
.
isDirectoryResolved
&&
!
this
.
model
.
find
Close
st
(
change
.
resource
))
{
return
true
;
}
...
...
@@ -624,7 +624,7 @@ export class ExplorerView extends CollapsibleView {
continue
;
// out of workspace file
}
if
(
this
.
model
.
find
Fir
st
(
del
.
resource
))
{
if
(
this
.
model
.
find
Close
st
(
del
.
resource
))
{
return
true
;
}
}
...
...
@@ -765,7 +765,7 @@ export class ExplorerView extends CollapsibleView {
// If it is a brand new tree just expand elements from memento
const
expanded
=
this
.
explorerViewer
.
getExpandedElements
();
const
statsToExpand
=
expanded
.
length
?
[
this
.
model
.
roots
[
0
]].
concat
(
expanded
)
:
targetsToExpand
.
map
(
expand
=>
this
.
model
.
find
Fir
st
(
expand
));
targetsToExpand
.
map
(
expand
=>
this
.
model
.
find
Close
st
(
expand
));
// Display roots only when there is more than 1 root
// Make sure to expand all folders that where expanded in the previous session
...
...
@@ -826,7 +826,7 @@ export class ExplorerView extends CollapsibleView {
return
TPromise
.
as
(
null
);
}
const
fileStat
=
this
.
model
.
find
Fir
st
(
resource
);
const
fileStat
=
this
.
model
.
find
Close
st
(
resource
);
if
(
fileStat
)
{
return
this
.
doSelect
(
fileStat
,
reveal
);
}
...
...
src/vs/workbench/parts/files/common/explorerModel.ts
浏览文件 @
7b4d5048
...
...
@@ -35,19 +35,25 @@ export class Model {
}
/**
* Returns a child stat from this stat that matches with the provided path.
* Returns a
n array of
child stat from this stat that matches with the provided path.
* Starts matching from the first root.
* Will return
"null" in case the child
does not exist.
* Will return
empty array in case the FileStat
does not exist.
*/
public
findAll
(
resource
:
URI
):
FileStat
[]
{
return
this
.
roots
.
map
(
root
=>
root
.
find
(
resource
)).
filter
(
stat
=>
!!
stat
);
}
public
findFirst
(
resource
:
URI
):
FileStat
{
for
(
let
root
of
this
.
roots
)
{
const
result
=
root
.
find
(
resource
);
if
(
result
)
{
return
result
;
/**
* Returns a FileStat that matches the passed resource.
* In case multiple FileStat are matching the resource (same folder opened multiple times) returns the FileStat that has the closest root.
* Will return null in case the FileStat does not exist.
*/
public
findClosest
(
resource
:
URI
):
FileStat
{
const
rootUri
=
this
.
contextService
.
getRoot
(
resource
);
if
(
rootUri
)
{
const
root
=
this
.
roots
.
filter
(
r
=>
r
.
resource
.
toString
()
===
rootUri
.
toString
()).
pop
();
if
(
root
)
{
return
root
.
find
(
resource
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录