Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2b179bff
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,发现更多精彩内容 >>
未验证
提交
2b179bff
编写于
12月 02, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract `_undo`, `_redo`
上级
0ac5e952
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
12 deletion
+24
-12
src/vs/platform/undoRedo/common/undoRedoService.ts
src/vs/platform/undoRedo/common/undoRedoService.ts
+24
-12
未找到文件。
src/vs/platform/undoRedo/common/undoRedoService.ts
浏览文件 @
2b179bff
...
...
@@ -811,7 +811,7 @@ export class UndoRedoService implements IUndoRedoService {
if
(
element
.
canSplit
())
{
this
.
_splitPastWorkspaceElement
(
element
,
ignoreResources
);
this
.
_notificationService
.
info
(
message
);
return
new
WorkspaceVerificationError
(
this
.
undo
(
strResource
));
return
new
WorkspaceVerificationError
(
this
.
_
undo
(
strResource
));
}
else
{
// Cannot safely split this workspace element => flush all undo/redo stacks
for
(
const
strResource
of
element
.
strResources
)
{
...
...
@@ -959,7 +959,7 @@ export class UndoRedoService implements IUndoRedoService {
if
(
result
.
choice
===
1
)
{
// choice: undo this file
this
.
_splitPastWorkspaceElement
(
element
,
null
);
return
this
.
undo
(
strResource
);
return
this
.
_
undo
(
strResource
);
}
// choice: undo in all files
...
...
@@ -1044,16 +1044,22 @@ export class UndoRedoService implements IUndoRedoService {
const
[,
matchedStrResource
]
=
this
.
_findClosestUndoElementInGroup
(
groupId
);
if
(
matchedStrResource
)
{
return
this
.
undo
(
matchedStrResource
);
return
this
.
_
undo
(
matchedStrResource
);
}
}
public
undo
(
resourceOrSource
:
URI
|
UndoRedoSource
|
string
):
Promise
<
void
>
|
void
{
public
undo
(
resourceOrSource
:
URI
|
UndoRedoSource
):
Promise
<
void
>
|
void
{
if
(
resourceOrSource
instanceof
UndoRedoSource
)
{
const
[,
matchedStrResource
]
=
this
.
_findClosestUndoElementWithSource
(
resourceOrSource
.
id
);
return
matchedStrResource
?
this
.
undo
(
matchedStrResource
)
:
undefined
;
return
matchedStrResource
?
this
.
_
undo
(
matchedStrResource
)
:
undefined
;
}
const
strResource
=
typeof
resourceOrSource
===
'
string
'
?
resourceOrSource
:
this
.
getUriComparisonKey
(
resourceOrSource
);
if
(
typeof
resourceOrSource
===
'
string
'
)
{
return
this
.
_undo
(
resourceOrSource
);
}
return
this
.
_undo
(
this
.
getUriComparisonKey
(
resourceOrSource
));
}
private
_undo
(
strResource
:
string
):
Promise
<
void
>
|
void
{
if
(
!
this
.
_editStacks
.
has
(
strResource
))
{
return
;
}
...
...
@@ -1069,7 +1075,7 @@ export class UndoRedoService implements IUndoRedoService {
const
[
matchedElement
,
matchedStrResource
]
=
this
.
_findClosestUndoElementInGroup
(
element
.
groupId
);
if
(
element
!==
matchedElement
&&
matchedStrResource
)
{
// there is an element in the same group that should be undone before this one
return
this
.
undo
(
matchedStrResource
);
return
this
.
_
undo
(
matchedStrResource
);
}
}
...
...
@@ -1128,7 +1134,7 @@ export class UndoRedoService implements IUndoRedoService {
if
(
element
.
canSplit
())
{
this
.
_splitFutureWorkspaceElement
(
element
,
ignoreResources
);
this
.
_notificationService
.
info
(
message
);
return
new
WorkspaceVerificationError
(
this
.
redo
(
strResource
));
return
new
WorkspaceVerificationError
(
this
.
_
redo
(
strResource
));
}
else
{
// Cannot safely split this workspace element => flush all undo/redo stacks
for
(
const
strResource
of
element
.
strResources
)
{
...
...
@@ -1300,16 +1306,22 @@ export class UndoRedoService implements IUndoRedoService {
const
[,
matchedStrResource
]
=
this
.
_findClosestRedoElementInGroup
(
groupId
);
if
(
matchedStrResource
)
{
return
this
.
redo
(
matchedStrResource
);
return
this
.
_
redo
(
matchedStrResource
);
}
}
public
redo
(
resourceOrSource
:
URI
|
UndoRedoSource
|
string
):
Promise
<
void
>
|
void
{
if
(
resourceOrSource
instanceof
UndoRedoSource
)
{
const
[,
matchedStrResource
]
=
this
.
_findClosestRedoElementWithSource
(
resourceOrSource
.
id
);
return
matchedStrResource
?
this
.
redo
(
matchedStrResource
)
:
undefined
;
return
matchedStrResource
?
this
.
_
redo
(
matchedStrResource
)
:
undefined
;
}
const
strResource
=
typeof
resourceOrSource
===
'
string
'
?
resourceOrSource
:
this
.
getUriComparisonKey
(
resourceOrSource
);
if
(
typeof
resourceOrSource
===
'
string
'
)
{
return
this
.
_redo
(
resourceOrSource
);
}
return
this
.
_redo
(
this
.
getUriComparisonKey
(
resourceOrSource
));
}
private
_redo
(
strResource
:
string
):
Promise
<
void
>
|
void
{
if
(
!
this
.
_editStacks
.
has
(
strResource
))
{
return
;
}
...
...
@@ -1325,7 +1337,7 @@ export class UndoRedoService implements IUndoRedoService {
const
[
matchedElement
,
matchedStrResource
]
=
this
.
_findClosestRedoElementInGroup
(
element
.
groupId
);
if
(
element
!==
matchedElement
&&
matchedStrResource
)
{
// there is an element in the same group that should be redone before this one
return
this
.
redo
(
matchedStrResource
);
return
this
.
_
redo
(
matchedStrResource
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录