Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6b8b6302
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,发现更多精彩内容 >>
提交
6b8b6302
编写于
11月 20, 2015
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Open a folder via navigation bar doesn't work in 0.10.0 (fixes #234)
上级
a9e69dd0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
71 addition
and
3 deletion
+71
-3
src/vs/workbench/parts/files/browser/views/explorerViewModel.ts
.../workbench/parts/files/browser/views/explorerViewModel.ts
+12
-2
src/vs/workbench/parts/files/test/browser/viewModel.test.ts
src/vs/workbench/parts/files/test/browser/viewModel.test.ts
+26
-0
src/vs/workbench/services/files/node/fileService.ts
src/vs/workbench/services/files/node/fileService.ts
+2
-1
src/vs/workbench/services/files/test/node/resolver.test.ts
src/vs/workbench/services/files/test/node/resolver.test.ts
+31
-0
未找到文件。
src/vs/workbench/parts/files/browser/views/explorerViewModel.ts
浏览文件 @
6b8b6302
...
...
@@ -6,6 +6,7 @@
import
assert
=
require
(
'
vs/base/common/assert
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
guessMimeTypes
}
from
'
vs/base/common/mime
'
;
import
{
IFileStat
}
from
'
vs/platform/files/common/files
'
;
...
...
@@ -273,7 +274,7 @@ export class FileStat implements IFileStat {
public
find
(
resource
:
URI
):
FileStat
{
// Return if path found
if
(
resource
.
toString
()
===
this
.
resource
.
toString
(
))
{
if
(
this
.
fileResourceEquals
(
resource
,
this
.
resource
))
{
return
this
;
}
...
...
@@ -285,7 +286,7 @@ export class FileStat implements IFileStat {
for
(
let
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
{
let
child
=
this
.
children
[
i
];
if
(
resource
.
toString
()
===
child
.
resource
.
toString
(
))
{
if
(
this
.
fileResourceEquals
(
resource
,
child
.
resource
))
{
return
child
;
}
...
...
@@ -296,6 +297,15 @@ export class FileStat implements IFileStat {
return
null
;
//Unable to find
}
private
fileResourceEquals
(
r1
:
URI
,
r2
:
URI
)
{
const
identityEquals
=
(
r1
.
toString
()
===
r2
.
toString
());
if
(
isLinux
||
identityEquals
)
{
return
identityEquals
;
}
return
r1
.
toString
().
toLowerCase
()
===
r2
.
toString
().
toLowerCase
();
}
}
/* A helper that can be used to show a placeholder when creating a new stat */
...
...
src/vs/workbench/parts/files/test/browser/viewModel.test.ts
浏览文件 @
6b8b6302
...
...
@@ -216,6 +216,32 @@ suite('Files - View Model', () => {
assert
.
strictEqual
(
s1
.
find
(
toResource
(
'
/
'
)),
s1
);
});
test
(
"
Find with mixed case
"
,
function
()
{
let
d
=
new
Date
().
getTime
();
let
s1
=
createStat
(
"
/
"
,
"
/
"
,
true
,
false
,
8096
,
d
,
"
text/plain
"
);
let
s2
=
createStat
(
"
/path
"
,
"
path
"
,
true
,
false
,
8096
,
d
,
"
text/plain
"
);
let
s3
=
createStat
(
"
/path/to
"
,
"
to
"
,
true
,
false
,
8096
,
d
,
"
text/plain
"
);
let
s4
=
createStat
(
"
/path/to/stat
"
,
"
stat
"
,
true
,
false
,
8096
,
d
,
"
text/plain
"
);
let
child1
=
createStat
(
"
/path/to/stat/foo
"
,
"
foo
"
,
true
,
false
,
8096
,
d
,
"
text/plain
"
);
let
child2
=
createStat
(
"
/path/to/stat/foo/bar.html
"
,
"
bar.html
"
,
false
,
false
,
8096
,
d
,
"
text/html
"
);
s1
.
addChild
(
s2
);
s2
.
addChild
(
s3
);
s3
.
addChild
(
s4
);
s4
.
addChild
(
child1
);
child1
.
addChild
(
child2
);
if
(
isLinux
)
{
// linux is case sensitive
assert
.
ok
(
!
s1
.
find
(
toResource
(
'
/path/to/stat/Foo
'
)));
assert
.
ok
(
!
s1
.
find
(
toResource
(
'
/Path/to/stat/foo/bar.html
'
)));
}
else
{
assert
.
ok
(
s1
.
find
(
toResource
(
'
/path/to/stat/Foo
'
)));
assert
.
ok
(
s1
.
find
(
toResource
(
'
/Path/to/stat/foo/bar.html
'
)));
}
});
test
(
"
Validate File Name (For Create)
"
,
function
()
{
let
d
=
new
Date
().
getTime
();
let
s
=
createStat
(
"
/path/to/stat
"
,
"
sName
"
,
true
,
true
,
8096
,
d
,
"
text/plain
"
);
...
...
src/vs/workbench/services/files/node/fileService.ts
浏览文件 @
6b8b6302
...
...
@@ -636,6 +636,7 @@ export class StatResolver {
}
return
new
TPromise
((
c
,
e
)
=>
{
// Load children
this
.
resolveChildren
(
this
.
resource
.
fsPath
,
absoluteTargetPaths
,
options
&&
options
.
resolveSingleChildDescendants
,
(
children
)
=>
{
children
=
arrays
.
coalesce
(
children
);
// we dont want those null childs (could be permission denied when reading a child)
...
...
@@ -706,7 +707,7 @@ export class StatResolver {
let
resolveFolderChildren
=
false
;
if
(
files
.
length
===
1
&&
resolveSingleChildDescendants
)
{
resolveFolderChildren
=
true
;
}
else
if
(
childCount
>
0
&&
absoluteTargetPaths
&&
absoluteTargetPaths
.
some
((
targetPath
)
=>
targetPath
.
indexOf
(
fileResource
.
fsPath
)
===
0
))
{
}
else
if
(
childCount
>
0
&&
absoluteTargetPaths
&&
absoluteTargetPaths
.
some
((
targetPath
)
=>
basePaths
.
isEqualOrParent
(
targetPath
,
fileResource
.
fsPath
)
))
{
resolveFolderChildren
=
true
;
}
...
...
src/vs/workbench/services/files/test/node/resolver.test.ts
浏览文件 @
6b8b6302
...
...
@@ -11,6 +11,7 @@ import assert = require('assert');
import
{
StatResolver
}
from
'
vs/workbench/services/files/node/fileService
'
;
import
uri
from
'
vs/base/common/uri
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
utils
=
require
(
'
vs/workbench/services/files/test/node/utils
'
);
function
create
(
relativePath
:
string
):
StatResolver
{
...
...
@@ -106,6 +107,36 @@ suite('Stat Resolver', () => {
.
done
(()
=>
done
(),
done
);
});
test
(
'
resolve directory - resolveTo single directory - mixed casing
'
,
function
(
done
:
()
=>
void
)
{
let
resolver
=
create
(
'
/
'
);
resolver
.
resolve
({
resolveTo
:
[
toResource
(
'
other/Deep
'
)]
}).
then
(
result
=>
{
assert
.
ok
(
result
);
assert
.
ok
(
result
.
children
);
assert
.
ok
(
result
.
hasChildren
);
assert
.
ok
(
result
.
isDirectory
);
let
children
=
result
.
children
;
assert
.
equal
(
children
.
length
,
4
);
let
other
=
utils
.
getByName
(
result
,
'
other
'
);
assert
.
ok
(
other
);
assert
.
ok
(
other
.
hasChildren
);
let
deep
=
utils
.
getByName
(
other
,
'
deep
'
);
if
(
isLinux
)
{
// Linux has case sensitive file system
assert
.
ok
(
deep
);
assert
.
ok
(
deep
.
hasChildren
);
assert
.
ok
(
!
deep
.
children
);
// not resolved because we got instructed to resolve other/Deep with capital D
}
else
{
assert
.
ok
(
deep
);
assert
.
ok
(
deep
.
hasChildren
);
assert
.
equal
(
deep
.
children
.
length
,
4
);
}
})
.
done
(()
=>
done
(),
done
);
});
test
(
'
resolve directory - resolveTo multiple directories
'
,
function
(
done
:
()
=>
void
)
{
let
resolver
=
create
(
'
/
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录