Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
83d8cbea
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,发现更多精彩内容 >>
提交
83d8cbea
编写于
10月 02, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revisit file filter usage in quick open (fixes #34958)
上级
e34982ae
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
13 deletion
+29
-13
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+19
-5
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+10
-8
未找到文件。
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
83d8cbea
...
...
@@ -54,7 +54,7 @@ import { attachQuickOpenStyler } from 'vs/platform/theme/common/styler';
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ITree
,
IActionProvider
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
BaseActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
FileKind
}
from
'
vs/platform/files/common/files
'
;
import
{
FileKind
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
const
HELP_PREFIX
=
'
?
'
;
...
...
@@ -1168,7 +1168,8 @@ class EditorHistoryHandler {
constructor
(
@
IHistoryService
private
historyService
:
IHistoryService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IFileService
private
fileService
:
IFileService
)
{
}
...
...
@@ -1189,7 +1190,7 @@ class EditorHistoryHandler {
history
.
forEach
(
input
=>
{
let
resource
:
URI
;
if
(
input
instanceof
EditorInput
)
{
resource
=
toResource
(
input
,
{
filter
:
[
'
file
'
,
'
untitled
'
]
}
);
resource
=
resourceForEditorHistory
(
input
,
this
.
fileService
);
}
else
{
resource
=
(
input
as
IResourceInput
).
resource
;
}
...
...
@@ -1245,14 +1246,15 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IFileService
private
fileService
:
IFileService
)
{
super
(
editorService
);
this
.
input
=
input
;
if
(
input
instanceof
EditorInput
)
{
this
.
resource
=
toResource
(
input
,
{
filter
:
[
'
file
'
,
'
untitled
'
]
}
);
this
.
resource
=
resourceForEditorHistory
(
input
,
fileService
);
this
.
label
=
input
.
getName
();
this
.
description
=
input
.
getDescription
();
this
.
dirty
=
input
.
isDirty
();
...
...
@@ -1317,6 +1319,18 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
}
}
function
resourceForEditorHistory
(
input
:
EditorInput
,
fileService
:
IFileService
):
URI
{
const
resource
=
toResource
(
input
);
// For the editor history we only prefer resources that are either untitled or
// can be handled by the file service which indicates they are editable resources.
if
(
resource
&&
(
fileService
.
canHandleResource
(
resource
)
||
resource
.
scheme
===
'
untitled
'
))
{
return
resource
;
}
return
void
0
;
}
export
class
RemoveFromEditorHistoryAction
extends
Action
{
public
static
ID
=
'
workbench.action.removeFromEditorHistory
'
;
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
83d8cbea
...
...
@@ -245,12 +245,13 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
// Track closing of pinned editor to support to reopen closed editors
if
(
event
.
pinned
)
{
const
file
=
toResource
(
event
.
editor
,
{
filter
:
'
file
'
});
// we only support files to reopen
if
(
file
)
{
const
resource
=
toResource
(
event
.
editor
);
const
supportsReopen
=
resource
&&
this
.
fileService
.
canHandleResource
(
resource
);
// we only support file'ish things to reopen
if
(
supportsReopen
)
{
// Remove all inputs matching and add as last recently closed
this
.
removeFromRecentlyClosedFiles
(
event
.
editor
);
this
.
recentlyClosedFiles
.
push
({
resource
:
file
,
index
:
event
.
index
});
this
.
recentlyClosedFiles
.
push
({
resource
,
index
:
event
.
index
});
// Bounding
if
(
this
.
recentlyClosedFiles
.
length
>
HistoryService
.
MAX_RECENTLY_CLOSED_EDITORS
)
{
...
...
@@ -591,9 +592,10 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
private
preferResourceInput
(
input
:
IEditorInput
):
IEditorInput
|
IResourceInput
{
const
file
=
toResource
(
input
,
{
filter
:
'
file
'
});
if
(
file
)
{
return
{
resource
:
file
};
const
resource
=
toResource
(
input
);
const
preferResourceInput
=
resource
&&
this
.
fileService
.
canHandleResource
(
resource
);
// file'ish things prefer resources
if
(
preferResourceInput
)
{
return
{
resource
};
}
return
input
;
...
...
@@ -678,9 +680,9 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
if
(
arg2
instanceof
EditorInput
)
{
const
file
=
toResource
(
arg2
,
{
filter
:
'
file
'
}
);
const
resource
=
toResource
(
arg2
);
return
file
&&
fil
e
.
toString
()
===
resource
.
toString
();
return
resource
&&
this
.
fileService
.
canHandleResource
(
resource
)
&&
resourc
e
.
toString
()
===
resource
.
toString
();
}
const
resourceInput
=
arg2
as
IResourceInput
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录