Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3c7dce57
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3c7dce57
编写于
5月 27, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polish
上级
5397d400
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
22 deletion
+13
-22
src/vs/workbench/parts/files/browser/views/explorerView.ts
src/vs/workbench/parts/files/browser/views/explorerView.ts
+13
-22
未找到文件。
src/vs/workbench/parts/files/browser/views/explorerView.ts
浏览文件 @
3c7dce57
...
...
@@ -115,16 +115,10 @@ export class ExplorerView extends CollapsibleViewletView {
public
getActions
():
IAction
[]
{
const
actions
:
Action
[]
=
[];
// New File
actions
.
push
(
this
.
instantiationService
.
createInstance
(
NewFileAction
,
this
.
getViewer
(),
null
));
// New Folder
actions
.
push
(
this
.
instantiationService
.
createInstance
(
NewFileAction
,
this
.
getViewer
(),
null
));
actions
.
push
(
this
.
instantiationService
.
createInstance
(
NewFolderAction
,
this
.
getViewer
(),
null
));
// Refresh
actions
.
push
(
this
.
instantiationService
.
createInstance
(
RefreshViewExplorerAction
,
this
,
'
explorer-action refresh-explorer
'
));
// Collapse
actions
.
push
(
this
.
instantiationService
.
createInstance
(
CollapseAction
,
this
.
getViewer
(),
true
,
'
explorer-action collapse-explorer
'
));
// Set Order
...
...
@@ -263,7 +257,7 @@ export class ExplorerView extends CollapsibleViewletView {
if
(
lastActiveFileResource
&&
root
&&
root
.
find
(
lastActiveFileResource
))
{
let
editorInput
=
this
.
instantiationService
.
createInstance
(
FileEditorInput
,
lastActiveFileResource
,
void
0
,
void
0
);
this
.
o
penEditor
(
editorInput
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
activateOrO
penEditor
(
editorInput
).
done
(
null
,
errors
.
onUnexpectedError
);
return
refreshPromise
;
}
...
...
@@ -281,11 +275,11 @@ export class ExplorerView extends CollapsibleViewletView {
if
(
stat
&&
!
stat
.
isDirectory
)
{
let
editorInput
=
this
.
instantiationService
.
createInstance
(
FileEditorInput
,
stat
.
resource
,
stat
.
mime
,
void
0
);
this
.
o
penEditor
(
editorInput
,
keepFocus
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
activateOrO
penEditor
(
editorInput
,
keepFocus
).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
private
o
penEditor
(
input
:
FileEditorInput
,
keepFocus
?:
boolean
):
TPromise
<
IEditor
>
{
private
activateOrO
penEditor
(
input
:
FileEditorInput
,
keepFocus
?:
boolean
):
TPromise
<
IEditor
>
{
// First try to find if input already visible
let
editors
=
this
.
editorService
.
getVisibleEditors
();
...
...
@@ -355,6 +349,7 @@ export class ExplorerView extends CollapsibleViewletView {
public
getOptimalWidth
():
number
{
let
parentNode
=
this
.
explorerViewer
.
getHTMLElement
();
let
childNodes
=
[].
slice
.
call
(
parentNode
.
querySelectorAll
(
'
.explorer-item-label > a
'
));
return
DOM
.
getLargestChildWidth
(
parentNode
,
childNodes
);
}
...
...
@@ -387,8 +382,7 @@ export class ExplorerView extends CollapsibleViewletView {
// Open new file in editor (pinned)
if
(
!
childElement
.
isDirectory
)
{
let
editorInput
=
this
.
instantiationService
.
createInstance
(
FileEditorInput
,
childElement
.
resource
,
childElement
.
mime
,
void
0
);
return
this
.
editorService
.
openEditor
(
editorInput
,
EditorOptions
.
create
({
pinned
:
true
}));
return
this
.
editorService
.
openEditor
({
resource
:
childElement
.
resource
,
options
:
{
pinned
:
true
}
});
}
});
});
...
...
@@ -497,10 +491,7 @@ export class ExplorerView extends CollapsibleViewletView {
// Open it (pinned)
if
(
parentElement
)
{
this
.
explorerViewer
.
refresh
(
parentElement
).
then
(()
=>
{
let
editorInput
=
this
.
instantiationService
.
createInstance
(
FileEditorInput
,
importedElement
.
resource
,
importedElement
.
mime
,
void
0
);
return
this
.
editorService
.
openEditor
(
editorInput
,
EditorOptions
.
create
({
pinned
:
true
}));
}).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
explorerViewer
.
refresh
(
parentElement
).
then
(()
=>
this
.
editorService
.
openEditor
({
resource
:
importedElement
.
resource
,
options
:
{
pinned
:
true
}
})).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
...
...
@@ -598,7 +589,7 @@ export class ExplorerView extends CollapsibleViewletView {
}
private
filterToAddRemovedOnWorkspacePath
(
e
:
FileChangesEvent
,
fn
:
(
change
:
IFileChange
,
workspacePathSegments
:
string
[])
=>
boolean
):
FileChangesEvent
{
return
new
FileChangesEvent
(
e
.
changes
.
filter
(
(
change
)
=>
{
return
new
FileChangesEvent
(
e
.
changes
.
filter
(
change
=>
{
if
(
change
.
type
===
FileChangeType
.
UPDATED
)
{
return
false
;
// we only want added / removed
}
...
...
@@ -688,7 +679,7 @@ export class ExplorerView extends CollapsibleViewletView {
// Load Root Stat with given target path configured
let
options
:
IResolveFileOptions
=
{
resolveTo
:
targetsToResolve
};
let
promise
=
this
.
fileService
.
resolveFile
(
this
.
workspace
.
resource
,
options
).
then
(
(
stat
:
IFileStat
)
=>
{
let
promise
=
this
.
fileService
.
resolveFile
(
this
.
workspace
.
resource
,
options
).
then
(
stat
=>
{
let
explorerPromise
:
TPromise
<
void
>
;
// Convert to model
...
...
@@ -779,7 +770,7 @@ export class ExplorerView extends CollapsibleViewletView {
// Stat needs to be resolved first and then revealed
let
options
:
IResolveFileOptions
=
{
resolveTo
:
[
resource
]
};
return
this
.
fileService
.
resolveFile
(
this
.
workspace
.
resource
,
options
).
then
(
(
stat
:
IFileStat
)
=>
{
return
this
.
fileService
.
resolveFile
(
this
.
workspace
.
resource
,
options
).
then
(
stat
=>
{
// Convert to model
let
modelStat
=
FileStat
.
create
(
stat
,
options
.
resolveTo
);
...
...
@@ -788,14 +779,14 @@ export class ExplorerView extends CollapsibleViewletView {
FileStat
.
mergeLocalWithDisk
(
modelStat
,
root
);
// Select and Reveal
return
this
.
explorerViewer
.
refresh
(
root
).
then
(()
=>
{
return
this
.
doSelect
(
root
.
find
(
resource
),
reveal
);
});
return
this
.
explorerViewer
.
refresh
(
root
).
then
(()
=>
this
.
doSelect
(
root
.
find
(
resource
),
reveal
));
},
(
e
:
any
)
=>
this
.
messageService
.
show
(
Severity
.
Error
,
e
));
}
private
hasSelection
(
resource
:
URI
):
FileStat
{
let
currentSelection
:
FileStat
[]
=
this
.
explorerViewer
.
getSelection
();
for
(
let
i
=
0
;
i
<
currentSelection
.
length
;
i
++
)
{
if
(
currentSelection
[
i
].
resource
.
toString
()
===
resource
.
toString
())
{
return
currentSelection
[
i
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录