Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8e1a2546
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,发现更多精彩内容 >>
提交
8e1a2546
编写于
11月 18, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editors
💄
上级
8252d8af
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
20 deletion
+16
-20
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+1
-2
src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
...rkbench/contrib/files/browser/fileActions.contribution.ts
+3
-2
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+10
-14
src/vs/workbench/services/editor/common/editorService.ts
src/vs/workbench/services/editor/common/editorService.ts
+1
-1
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+1
-1
未找到文件。
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
8e1a2546
...
...
@@ -646,8 +646,7 @@ export abstract class BaseCloseAllAction extends Action {
let
saveOrRevert
:
boolean
;
if
(
confirm
===
ConfirmResult
.
DONT_SAVE
)
{
await
this
.
editorService
.
revertAll
({
soft
:
true
});
saveOrRevert
=
true
;
saveOrRevert
=
await
this
.
editorService
.
revertAll
({
soft
:
true
});
}
else
{
saveOrRevert
=
await
this
.
editorService
.
saveAll
({
reason
:
SaveReason
.
EXPLICIT
,
includeUntitled
:
true
});
}
...
...
src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
浏览文件 @
8e1a2546
...
...
@@ -26,7 +26,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
WorkspaceFolderCountContext
,
IsWebContext
}
from
'
vs/workbench/browser/contextkeys
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
OpenFileFolderAction
,
OpenFileAction
,
OpenFolderAction
,
OpenWorkspaceAction
}
from
'
vs/workbench/browser/actions/workspaceActions
'
;
import
{
ActiveEditorIsSaveableContext
,
DirtyWorkingCopiesContext
}
from
'
vs/workbench/common/editor
'
;
import
{
ActiveEditorIsSaveableContext
,
DirtyWorkingCopiesContext
,
ActiveEditorContext
}
from
'
vs/workbench/common/editor
'
;
import
{
SidebarFocusContext
}
from
'
vs/workbench/common/viewlet
'
;
import
{
registerAndGetAmdImageURL
}
from
'
vs/base/common/amd
'
;
...
...
@@ -590,7 +590,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
command
:
{
id
:
SAVE_FILE_AS_COMMAND_ID
,
title
:
nls
.
localize
({
key
:
'
miSaveAs
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Save &&As...
"
),
precondition
:
ContextKeyExpr
.
or
(
ActiveEditorIsSaveableContext
,
ContextKeyExpr
.
and
(
ExplorerViewletVisibleContext
,
SidebarFocusContext
))
// ActiveEditorContext is not 100% correct, but we lack a context for indicating "Save As..." support
precondition
:
ContextKeyExpr
.
or
(
ActiveEditorContext
,
ContextKeyExpr
.
and
(
ExplorerViewletVisibleContext
,
SidebarFocusContext
))
},
order
:
2
});
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
8e1a2546
...
...
@@ -712,31 +712,27 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
saveAll
(
options
?:
ISaveAllEditorsOptions
):
Promise
<
boolean
>
{
// Save each editor in MRU order
const
editors
:
IEditorIdentifier
[]
=
[];
this
.
forEachDirtySaveableEditor
(
!!
options
?.
includeUntitled
,
({
groupId
,
editor
})
=>
editors
.
push
({
groupId
,
editor
}));
return
this
.
save
(
editors
,
options
);
return
this
.
save
(
this
.
getSaveableEditors
(
!!
options
?.
includeUntitled
),
options
);
}
async
revertAll
(
options
?:
IRevertOptions
):
Promise
<
void
>
{
// Revert each editor in MRU order
const
reverts
:
Promise
<
boolean
>
[]
=
[];
this
.
forEachDirtySaveableEditor
(
true
/* include untitled */
,
({
editor
})
=>
reverts
.
push
(
editor
.
revert
(
options
)));
async
revertAll
(
options
?:
IRevertOptions
):
Promise
<
boolean
>
{
const
result
=
await
Promise
.
all
(
this
.
getSaveableEditors
(
true
/* include untitled */
).
map
(
async
({
editor
})
=>
editor
.
revert
(
options
)));
await
Promise
.
all
(
revert
s
);
return
result
.
every
(
success
=>
!!
succes
s
);
}
private
forEachDirtySaveableEditor
(
includeUntitled
:
boolean
,
callback
:
(
editor
:
IEditorIdentifier
)
=>
void
):
void
{
private
getSaveableEditors
(
includeUntitled
:
boolean
):
IEditorIdentifier
[]
{
const
editors
:
IEditorIdentifier
[]
=
[];
for
(
const
group
of
this
.
editorGroupService
.
getGroups
(
GroupsOrder
.
MOST_RECENTLY_ACTIVE
))
{
for
(
const
editor
of
group
.
getEditors
(
EditorsOrder
.
MOST_RECENTLY_ACTIVE
))
{
if
(
editor
.
isDirty
()
&&
!
editor
.
isReadonly
()
&&
(
!
editor
.
isUntitled
()
||
includeUntitled
))
{
callback
({
groupId
:
group
.
id
,
editor
});
editors
.
push
({
groupId
:
group
.
id
,
editor
});
}
}
}
return
editors
;
}
//#endregion
...
...
src/vs/workbench/services/editor/common/editorService.ts
浏览文件 @
8e1a2546
...
...
@@ -215,5 +215,5 @@ export interface IEditorService {
/**
* Reverts all editors.
*/
revertAll
(
options
?:
IRevertOptions
):
Promise
<
void
>
;
revertAll
(
options
?:
IRevertOptions
):
Promise
<
boolean
>
;
}
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
8e1a2546
...
...
@@ -930,7 +930,7 @@ export class TestEditorService implements EditorServiceImpl {
throw
new
Error
(
'
Method not implemented.
'
);
}
revertAll
(
options
?:
IRevertOptions
):
Promise
<
void
>
{
revertAll
(
options
?:
IRevertOptions
):
Promise
<
boolean
>
{
throw
new
Error
(
'
Method not implemented.
'
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录