Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3f2c8900
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3f2c8900
编写于
3月 08, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
explorer better expand to
上级
2d4fcf14
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
25 deletion
+33
-25
src/vs/workbench/contrib/files/browser/views/explorerView.ts
src/vs/workbench/contrib/files/browser/views/explorerView.ts
+27
-19
src/vs/workbench/contrib/files/common/explorerService.ts
src/vs/workbench/contrib/files/common/explorerService.ts
+5
-5
src/vs/workbench/contrib/files/common/files.ts
src/vs/workbench/contrib/files/common/files.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/files/browser/views/explorerView.ts
浏览文件 @
3f2c8900
...
...
@@ -6,7 +6,6 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
perf
from
'
vs/base/common/performance
'
;
import
{
sequence
}
from
'
vs/base/common/async
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
IFilesConfiguration
,
ExplorerFolderContext
,
FilesExplorerFocusedContext
,
ExplorerFocusedContext
,
ExplorerRootContext
,
ExplorerResourceReadonlyContext
,
IExplorerService
,
ExplorerResourceCut
}
from
'
vs/workbench/contrib/files/common/files
'
;
...
...
@@ -49,6 +48,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
isEqualOrParent
}
from
'
vs/base/common/resources
'
;
export
class
ExplorerView
extends
ViewletPanel
{
static
readonly
ID
:
string
=
'
workbench.explorer.fileView
'
;
...
...
@@ -188,7 +188,7 @@ export class ExplorerView extends ViewletPanel {
this
.
tree
.
domFocus
();
}
}));
this
.
disposables
.
push
(
this
.
explorerService
.
onDidSelect
Item
(
e
=>
this
.
onSelectItem
(
e
.
item
,
e
.
reveal
)));
this
.
disposables
.
push
(
this
.
explorerService
.
onDidSelect
Resource
(
e
=>
this
.
onSelectResource
(
e
.
resource
,
e
.
reveal
)));
this
.
disposables
.
push
(
this
.
explorerService
.
onDidCopyItems
(
e
=>
this
.
onCopyItems
(
e
.
items
,
e
.
cut
,
e
.
previouslyCutItems
)));
// Update configuration
...
...
@@ -507,27 +507,35 @@ export class ExplorerView extends ViewletPanel {
return
toResource
(
input
,
{
supportSideBySide
:
true
});
}
private
onSelect
Item
(
fileStat
:
ExplorerItem
,
reveal
=
this
.
autoReveal
):
Promise
<
void
>
{
if
(
!
fileStat
||
!
this
.
isBodyVisible
()
||
this
.
tree
.
getInput
()
===
fileStat
)
{
return
Promise
.
resolve
(
undefined
)
;
private
onSelect
Resource
(
resource
:
URI
,
reveal
=
this
.
autoReveal
):
void
{
if
(
!
resource
||
!
this
.
isBodyVisible
()
)
{
return
;
}
// Expand all stats in the parent chain
const
toExpand
:
ExplorerItem
[]
=
[];
let
parent
=
fileStat
.
parent
;
while
(
parent
)
{
toExpand
.
push
(
parent
);
parent
=
parent
.
parent
;
}
return
sequence
(
toExpand
.
reverse
().
map
(
s
=>
()
=>
this
.
tree
.
expand
(
s
))).
then
(()
=>
{
if
(
reveal
)
{
this
.
tree
.
reveal
(
fileStat
,
0.5
);
}
const
root
=
this
.
explorerService
.
roots
.
filter
(
r
=>
isEqualOrParent
(
resource
,
r
.
resource
)).
pop
();
if
(
root
)
{
const
traverse
=
async
(
item
:
ExplorerItem
)
=>
{
if
(
item
.
resource
.
toString
()
===
resource
.
toString
())
{
if
(
reveal
)
{
this
.
tree
.
reveal
(
item
,
0.5
);
}
this
.
tree
.
setFocus
([
fileStat
]);
this
.
tree
.
setSelection
([
fileStat
]);
});
this
.
tree
.
setFocus
([
item
]);
this
.
tree
.
setSelection
([
item
]);
}
else
{
await
this
.
tree
.
expand
(
item
);
let
found
=
false
;
item
.
children
.
forEach
(
async
child
=>
{
if
(
!
found
&&
isEqualOrParent
(
resource
,
child
.
resource
))
{
found
=
true
;
await
traverse
(
child
);
}
});
}
};
traverse
(
root
);
}
}
private
onCopyItems
(
stats
:
ExplorerItem
[],
cut
:
boolean
,
previousCut
:
ExplorerItem
[]):
void
{
...
...
src/vs/workbench/contrib/files/common/explorerService.ts
浏览文件 @
3f2c8900
...
...
@@ -34,7 +34,7 @@ export class ExplorerService implements IExplorerService {
private
_onDidChangeRoots
=
new
Emitter
<
void
>
();
private
_onDidChangeItem
=
new
Emitter
<
ExplorerItem
|
undefined
>
();
private
_onDidChangeEditable
=
new
Emitter
<
ExplorerItem
>
();
private
_onDidSelect
Item
=
new
Emitter
<
{
item
?:
ExplorerItem
,
reveal
?:
boolean
}
>
();
private
_onDidSelect
Resource
=
new
Emitter
<
{
resource
?:
URI
,
reveal
?:
boolean
}
>
();
private
_onDidCopyItems
=
new
Emitter
<
{
items
:
ExplorerItem
[],
cut
:
boolean
,
previouslyCutItems
:
ExplorerItem
[]
|
undefined
}
>
();
private
disposables
:
IDisposable
[]
=
[];
private
editable
:
{
stat
:
ExplorerItem
,
data
:
IEditableData
}
|
undefined
;
...
...
@@ -68,8 +68,8 @@ export class ExplorerService implements IExplorerService {
return
this
.
_onDidChangeEditable
.
event
;
}
get
onDidSelect
Item
():
Event
<
{
item
?:
ExplorerItem
,
reveal
?:
boolean
}
>
{
return
this
.
_onDidSelect
Item
.
event
;
get
onDidSelect
Resource
():
Event
<
{
resource
?:
URI
,
reveal
?:
boolean
}
>
{
return
this
.
_onDidSelect
Resource
.
event
;
}
get
onDidCopyItems
():
Event
<
{
items
:
ExplorerItem
[],
cut
:
boolean
,
previouslyCutItems
:
ExplorerItem
[]
|
undefined
}
>
{
...
...
@@ -142,7 +142,7 @@ export class ExplorerService implements IExplorerService {
select
(
resource
:
URI
,
reveal
?:
boolean
):
Promise
<
void
>
{
const
fileStat
=
this
.
findClosest
(
resource
);
if
(
fileStat
)
{
this
.
_onDidSelect
Item
.
fire
({
item
:
fileStat
,
reveal
});
this
.
_onDidSelect
Resource
.
fire
({
resource
:
fileStat
.
resource
,
reveal
});
return
Promise
.
resolve
(
undefined
);
}
...
...
@@ -161,7 +161,7 @@ export class ExplorerService implements IExplorerService {
this
.
_onDidChangeItem
.
fire
(
item
?
item
.
parent
:
undefined
);
// Select and Reveal
this
.
_onDidSelect
Item
.
fire
({
item
:
item
||
undefined
,
reveal
});
this
.
_onDidSelect
Resource
.
fire
({
resource
:
item
?
item
.
resource
:
undefined
,
reveal
});
},
()
=>
{
root
.
isError
=
true
;
this
.
_onDidChangeItem
.
fire
(
root
);
...
...
src/vs/workbench/contrib/files/common/files.ts
浏览文件 @
3f2c8900
...
...
@@ -44,7 +44,7 @@ export interface IExplorerService {
readonly
onDidChangeRoots
:
Event
<
void
>
;
readonly
onDidChangeItem
:
Event
<
ExplorerItem
|
undefined
>
;
readonly
onDidChangeEditable
:
Event
<
ExplorerItem
>
;
readonly
onDidSelect
Item
:
Event
<
{
item
?:
ExplorerItem
,
reveal
?:
boolean
}
>
;
readonly
onDidSelect
Resource
:
Event
<
{
resource
?:
URI
,
reveal
?:
boolean
}
>
;
readonly
onDidCopyItems
:
Event
<
{
items
:
ExplorerItem
[],
cut
:
boolean
,
previouslyCutItems
:
ExplorerItem
[]
|
undefined
}
>
;
setEditable
(
stat
:
ExplorerItem
,
data
:
IEditableData
|
null
):
void
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录