Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f6d0541e
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,发现更多精彩内容 >>
未验证
提交
f6d0541e
编写于
6月 03, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add troubleshooting logs
上级
5329ea8f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
76 addition
and
8 deletion
+76
-8
src/vs/editor/common/model/editStack.ts
src/vs/editor/common/model/editStack.ts
+5
-0
src/vs/editor/common/model/textChange.ts
src/vs/editor/common/model/textChange.ts
+10
-0
src/vs/platform/undoRedo/common/undoRedoService.ts
src/vs/platform/undoRedo/common/undoRedoService.ts
+61
-8
未找到文件。
src/vs/editor/common/model/editStack.ts
浏览文件 @
f6d0541e
...
...
@@ -168,6 +168,11 @@ export class SingleModelEditStackElement implements IResourceUndoRedoElement {
this
.
_data
=
SingleModelEditStackData
.
create
(
model
,
beforeCursorState
);
}
public
toString
():
string
{
const
data
=
(
this
.
_data
instanceof
SingleModelEditStackData
?
this
.
_data
:
SingleModelEditStackData
.
deserialize
(
this
.
_data
));
return
data
.
changes
.
map
(
change
=>
change
.
toString
()).
join
(
'
,
'
);
}
public
matchesResource
(
resource
:
URI
):
boolean
{
const
uri
=
(
URI
.
isUri
(
this
.
model
)
?
this
.
model
:
this
.
model
.
uri
);
return
(
uri
.
toString
()
===
resource
.
toString
());
...
...
src/vs/editor/common/model/textChange.ts
浏览文件 @
f6d0541e
...
...
@@ -31,6 +31,16 @@ export class TextChange {
public
readonly
newText
:
string
)
{
}
public
toString
():
string
{
if
(
this
.
oldText
.
length
===
0
)
{
return
`(insert@
${
this
.
oldPosition
}
"
${
this
.
newText
}
")`
;
}
if
(
this
.
newText
.
length
===
0
)
{
return
`(delete@
${
this
.
oldPosition
}
"
${
this
.
oldText
}
")`
;
}
return
`(replace@
${
this
.
oldPosition
}
"
${
this
.
oldText
}
" with "
${
this
.
newText
}
")`
;
}
private
static
_writeStringSize
(
str
:
string
):
number
{
return
(
4
+
2
*
str
.
length
...
...
src/vs/platform/undoRedo/common/undoRedoService.ts
浏览文件 @
f6d0541e
...
...
@@ -14,6 +14,8 @@ import { Schemas } from 'vs/base/common/network';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IDisposable
,
Disposable
,
isDisposable
}
from
'
vs/base/common/lifecycle
'
;
const
DEBUG
=
false
;
function
getResourceLabel
(
resource
:
URI
):
string
{
return
resource
.
scheme
===
Schemas
.
file
?
resource
.
fsPath
:
resource
.
path
;
}
...
...
@@ -42,6 +44,10 @@ class ResourceStackElement {
public
setValid
(
isValid
:
boolean
):
void
{
this
.
isValid
=
isValid
;
}
public
toString
():
string
{
return
`[VALID]
${
this
.
actual
}
`
;
}
}
const
enum
RemovedResourceReason
{
...
...
@@ -143,6 +149,10 @@ class WorkspaceStackElement {
}
}
}
public
toString
():
string
{
return
`[VALID]
${
this
.
actual
}
`
;
}
}
type
StackElement
=
ResourceStackElement
|
WorkspaceStackElement
;
...
...
@@ -178,6 +188,18 @@ class ResourceEditStack {
this
.
versionId
++
;
}
public
toString
():
string
{
let
result
:
string
[]
=
[];
result
.
push
(
`*
${
this
.
strResource
}
:`
);
for
(
let
i
=
0
;
i
<
this
.
_past
.
length
;
i
++
)
{
result
.
push
(
` * [UNDO]
${
this
.
_past
[
i
]}
`
);
}
for
(
let
i
=
this
.
_future
.
length
-
1
;
i
>=
0
;
i
--
)
{
result
.
push
(
` * [REDO]
${
this
.
_future
[
i
]}
`
);
}
return
result
.
join
(
'
\n
'
);
}
public
flushAllElements
():
void
{
this
.
_past
=
[];
this
.
_future
=
[];
...
...
@@ -383,6 +405,16 @@ export class UndoRedoService implements IUndoRedoService {
return
resource
.
toString
();
}
private
_print
(
label
:
string
):
void
{
console
.
log
(
`------------------------------------`
);
console
.
log
(
`AFTER
${
label
}
: `
);
let
str
:
string
[]
=
[];
for
(
const
element
of
this
.
_editStacks
)
{
str
.
push
(
element
[
1
].
toString
());
}
console
.
log
(
str
.
join
(
'
\n
'
));
}
public
pushElement
(
element
:
IUndoRedoElement
):
void
{
if
(
element
.
type
===
UndoRedoElementType
.
Resource
)
{
const
resourceLabel
=
getResourceLabel
(
element
.
resource
);
...
...
@@ -410,6 +442,9 @@ export class UndoRedoService implements IUndoRedoService {
this
.
_pushElement
(
new
WorkspaceStackElement
(
element
,
resourceLabels
,
strResources
));
}
}
if
(
DEBUG
)
{
this
.
_print
(
'
pushElement
'
);
}
}
private
_pushElement
(
element
:
StackElement
):
void
{
...
...
@@ -487,6 +522,9 @@ export class UndoRedoService implements IUndoRedoService {
editStack
.
dispose
();
this
.
_editStacks
.
delete
(
strResource
);
}
if
(
DEBUG
)
{
this
.
_print
(
'
removeElements
'
);
}
}
public
setElementsValidFlag
(
resource
:
URI
,
isValid
:
boolean
,
filter
:
(
element
:
IUndoRedoElement
)
=>
boolean
):
void
{
...
...
@@ -495,6 +533,9 @@ export class UndoRedoService implements IUndoRedoService {
const
editStack
=
this
.
_editStacks
.
get
(
strResource
)
!
;
editStack
.
setElementsValidFlag
(
isValid
,
filter
);
}
if
(
DEBUG
)
{
this
.
_print
(
'
setElementsValidFlag
'
);
}
}
public
hasElements
(
resource
:
URI
):
boolean
{
...
...
@@ -774,10 +815,16 @@ export class UndoRedoService implements IUndoRedoService {
return
;
}
if
(
element
.
type
===
UndoRedoElementType
.
Workspace
)
{
return
this
.
_workspaceUndo
(
strResource
,
element
);
}
else
{
return
this
.
_resourceUndo
(
editStack
,
element
);
try
{
if
(
element
.
type
===
UndoRedoElementType
.
Workspace
)
{
return
this
.
_workspaceUndo
(
strResource
,
element
);
}
else
{
return
this
.
_resourceUndo
(
editStack
,
element
);
}
}
finally
{
if
(
DEBUG
)
{
this
.
_print
(
'
undo
'
);
}
}
}
...
...
@@ -903,10 +950,16 @@ export class UndoRedoService implements IUndoRedoService {
return
;
}
if
(
element
.
type
===
UndoRedoElementType
.
Workspace
)
{
return
this
.
_workspaceRedo
(
strResource
,
element
);
}
else
{
return
this
.
_resourceRedo
(
editStack
,
element
);
try
{
if
(
element
.
type
===
UndoRedoElementType
.
Workspace
)
{
return
this
.
_workspaceRedo
(
strResource
,
element
);
}
else
{
return
this
.
_resourceRedo
(
editStack
,
element
);
}
}
finally
{
if
(
DEBUG
)
{
this
.
_print
(
'
redo
'
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录