Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
25b2e70d
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,发现更多精彩内容 >>
提交
25b2e70d
编写于
9月 03, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reduce _onDidChangeCells
上级
759ead4d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
17 deletion
+14
-17
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
...kbench/contrib/notebook/common/model/notebookTextModel.ts
+14
-17
未找到文件。
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
浏览文件 @
25b2e70d
...
...
@@ -112,6 +112,10 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
private
readonly
_onWillDispose
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onWillDispose
:
Event
<
void
>
=
this
.
_onWillDispose
.
event
;
private
_dirty
=
false
;
protected
readonly
_onDidChangeDirty
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDidChangeDirty
=
this
.
_onDidChangeDirty
.
event
;
private
readonly
_onDidChangeCells
=
this
.
_register
(
new
Emitter
<
{
synchronous
:
boolean
,
splices
:
NotebookCellTextModelSplice
[]
}
>
());
get
onDidChangeCells
()
{
return
this
.
_onDidChangeCells
.
event
;
}
private
readonly
_emitSelections
=
this
.
_register
(
new
Emitter
<
number
[]
>
());
...
...
@@ -147,10 +151,6 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
return
this
.
_versionId
;
}
private
_dirty
=
false
;
protected
readonly
_onDidChangeDirty
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDidChangeDirty
=
this
.
_onDidChangeDirty
.
event
;
private
_operationManager
:
NotebookOperationManager
;
constructor
(
...
...
@@ -421,7 +421,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
return
;
}
insertNewCell
(
index
:
number
,
cells
:
NotebookCellTextModel
[]):
void
{
insertNewCell
(
index
:
number
,
cells
:
NotebookCellTextModel
[]
,
synchronous
:
boolean
):
void
{
this
.
_isUntitled
=
false
;
for
(
let
i
=
0
;
i
<
cells
.
length
;
i
++
)
{
...
...
@@ -460,10 +460,12 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
]]
});
this
.
_onDidChangeCells
.
fire
({
synchronous
:
synchronous
,
splices
:
[[
index
,
0
,
cells
]]
});
return
;
}
removeCell
(
index
:
number
,
count
:
number
)
{
removeCell
(
index
:
number
,
count
:
number
,
synchronous
:
boolean
)
{
this
.
_isUntitled
=
false
;
for
(
let
i
=
index
;
i
<
index
+
count
;
i
++
)
{
...
...
@@ -477,6 +479,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_increaseVersionId
();
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
versionId
:
this
.
_versionId
,
changes
:
[[
index
,
count
,
[]]]
});
this
.
_onDidChangeCells
.
fire
({
synchronous
:
synchronous
,
splices
:
[[
index
,
1
,
[]]]
});
}
moveCellToIdx
(
index
:
number
,
length
:
number
,
newIdx
:
number
)
{
...
...
@@ -615,13 +618,11 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
//#region Notebook Text Model Edit API
private
_insertCellDelegate
(
insertIndex
:
number
,
insertCell
:
NotebookCellTextModel
)
{
this
.
insertNewCell
(
insertIndex
,
[
insertCell
]);
this
.
_onDidChangeCells
.
fire
({
synchronous
:
true
,
splices
:
[[
insertIndex
,
0
,
[
insertCell
]]]
});
this
.
insertNewCell
(
insertIndex
,
[
insertCell
],
true
);
}
private
_deleteCellDelegate
(
deleteIndex
:
number
)
{
this
.
removeCell
(
deleteIndex
,
1
);
this
.
_onDidChangeCells
.
fire
({
synchronous
:
true
,
splices
:
[[
deleteIndex
,
1
,
[]]]
});
this
.
removeCell
(
deleteIndex
,
1
,
true
);
}
private
_emitSelectionsDelegate
(
selections
:
number
[])
{
...
...
@@ -640,9 +641,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
}
this
.
insertNewCell
(
index
,
[
cell
]);
this
.
_onDidChangeCells
.
fire
({
synchronous
,
splices
:
[[
index
,
0
,
[
cell
]]]
});
this
.
insertNewCell
(
index
,
[
cell
],
synchronous
);
if
(
endSelections
)
{
this
.
_emitSelections
.
fire
(
endSelections
);
...
...
@@ -659,8 +658,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
},
undefined
,
undefined
));
}
this
.
insertNewCell
(
index
,
[
cell
]);
this
.
_onDidChangeCells
.
fire
({
synchronous
:
synchronous
,
splices
:
[[
index
,
0
,
[
cell
]]]
});
this
.
insertNewCell
(
index
,
[
cell
],
synchronous
);
}
deleteCell2
(
index
:
number
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
{
...
...
@@ -673,8 +671,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
},
beforeSelections
,
endSelections
));
}
this
.
removeCell
(
index
,
1
);
this
.
_onDidChangeCells
.
fire
({
synchronous
:
synchronous
,
splices
:
[[
index
,
1
,
[]]]
});
this
.
removeCell
(
index
,
1
,
synchronous
);
if
(
endSelections
)
{
this
.
_emitSelections
.
fire
(
endSelections
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录