Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6d0783e5
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,发现更多精彩内容 >>
提交
6d0783e5
编写于
9月 03, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
inline delegates
上级
25b2e70d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
31 deletion
+19
-31
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
...kbench/contrib/notebook/common/model/notebookTextModel.ts
+19
-31
未找到文件。
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
浏览文件 @
6d0783e5
...
@@ -286,9 +286,9 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -286,9 +286,9 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
});
});
this
.
_operationManager
.
pushEditOperation
(
new
SpliceCellsEdit
(
this
.
uri
,
undoDiff
,
{
this
.
_operationManager
.
pushEditOperation
(
new
SpliceCellsEdit
(
this
.
uri
,
undoDiff
,
{
insertCell
:
this
.
_insertCellDelegate
.
bind
(
this
)
,
insertCell
:
(
index
,
cell
)
=>
{
this
.
_insertNewCell
(
index
,
[
cell
],
true
);
}
,
deleteCell
:
this
.
_deleteCellDelegate
.
bind
(
this
)
,
deleteCell
:
(
index
)
=>
{
this
.
_removeCell
(
index
,
1
,
true
);
}
,
emitSelections
:
this
.
_emitSelectionsDelegate
.
bind
(
this
)
emitSelections
:
(
selections
)
=>
{
this
.
_emitSelections
.
fire
(
selections
);
}
},
undefined
,
undefined
));
},
undefined
,
undefined
));
this
.
_onDidChangeCells
.
fire
({
synchronous
:
synchronous
,
splices
:
diffs
});
this
.
_onDidChangeCells
.
fire
({
synchronous
:
synchronous
,
splices
:
diffs
});
...
@@ -421,7 +421,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -421,7 +421,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
return
;
return
;
}
}
insertNewCell
(
index
:
number
,
cells
:
NotebookCellTextModel
[],
synchronous
:
boolean
):
void
{
private
_
insertNewCell
(
index
:
number
,
cells
:
NotebookCellTextModel
[],
synchronous
:
boolean
):
void
{
this
.
_isUntitled
=
false
;
this
.
_isUntitled
=
false
;
for
(
let
i
=
0
;
i
<
cells
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cells
.
length
;
i
++
)
{
...
@@ -465,7 +465,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -465,7 +465,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
return
;
return
;
}
}
removeCell
(
index
:
number
,
count
:
number
,
synchronous
:
boolean
)
{
private
_
removeCell
(
index
:
number
,
count
:
number
,
synchronous
:
boolean
)
{
this
.
_isUntitled
=
false
;
this
.
_isUntitled
=
false
;
for
(
let
i
=
index
;
i
<
index
+
count
;
i
++
)
{
for
(
let
i
=
index
;
i
<
index
+
count
;
i
++
)
{
...
@@ -581,7 +581,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -581,7 +581,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
}
}
this
.
changeCellMetadata
(
cell
.
handle
,
newMetadata
,
false
);
this
.
changeCellMetadata
(
cell
.
handle
,
newMetadata
,
false
);
},
},
emitSelections
:
this
.
_emitSelectionsDelegate
.
bind
(
this
)
emitSelections
:
(
selections
)
=>
{
this
.
_emitSelections
.
fire
(
selections
);
}
}));
}));
}
}
cell
.
metadata
=
metadata
;
cell
.
metadata
=
metadata
;
...
@@ -617,31 +617,19 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -617,31 +617,19 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
//#region Notebook Text Model Edit API
//#region Notebook Text Model Edit API
private
_insertCellDelegate
(
insertIndex
:
number
,
insertCell
:
NotebookCellTextModel
)
{
this
.
insertNewCell
(
insertIndex
,
[
insertCell
],
true
);
}
private
_deleteCellDelegate
(
deleteIndex
:
number
)
{
this
.
removeCell
(
deleteIndex
,
1
,
true
);
}
private
_emitSelectionsDelegate
(
selections
:
number
[])
{
this
.
_emitSelections
.
fire
(
selections
);
}
createCell2
(
index
:
number
,
source
:
string
,
language
:
string
,
type
:
CellKind
,
metadata
:
NotebookCellMetadata
|
undefined
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
{
createCell2
(
index
:
number
,
source
:
string
,
language
:
string
,
type
:
CellKind
,
metadata
:
NotebookCellMetadata
|
undefined
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
{
const
cell
=
this
.
createCellTextModel
(
source
,
language
,
type
,
[],
metadata
);
const
cell
=
this
.
createCellTextModel
(
source
,
language
,
type
,
[],
metadata
);
if
(
pushUndoStop
)
{
if
(
pushUndoStop
)
{
this
.
_operationManager
.
pushEditOperation
(
new
InsertCellEdit
(
this
.
uri
,
index
,
cell
,
{
this
.
_operationManager
.
pushEditOperation
(
new
InsertCellEdit
(
this
.
uri
,
index
,
cell
,
{
insertCell
:
this
.
_insertCellDelegate
.
bind
(
this
)
,
insertCell
:
(
index
,
cell
)
=>
{
this
.
_insertNewCell
(
index
,
[
cell
],
true
);
}
,
deleteCell
:
this
.
_deleteCellDelegate
.
bind
(
this
)
,
deleteCell
:
(
index
)
=>
{
this
.
_removeCell
(
index
,
1
,
true
);
}
,
emitSelections
:
this
.
_emitSelectionsDelegate
.
bind
(
this
)
emitSelections
:
(
selections
)
=>
{
this
.
_emitSelections
.
fire
(
selections
);
}
},
beforeSelections
,
endSelections
));
},
beforeSelections
,
endSelections
));
}
}
this
.
insertNewCell
(
index
,
[
cell
],
synchronous
);
this
.
_
insertNewCell
(
index
,
[
cell
],
synchronous
);
if
(
endSelections
)
{
if
(
endSelections
)
{
this
.
_emitSelections
.
fire
(
endSelections
);
this
.
_emitSelections
.
fire
(
endSelections
);
...
@@ -652,26 +640,26 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -652,26 +640,26 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
insertCell2
(
index
:
number
,
cell
:
NotebookCellTextModel
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
):
void
{
insertCell2
(
index
:
number
,
cell
:
NotebookCellTextModel
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
):
void
{
if
(
pushUndoStop
)
{
if
(
pushUndoStop
)
{
this
.
_operationManager
.
pushEditOperation
(
new
InsertCellEdit
(
this
.
uri
,
index
,
cell
,
{
this
.
_operationManager
.
pushEditOperation
(
new
InsertCellEdit
(
this
.
uri
,
index
,
cell
,
{
insertCell
:
this
.
_insertCellDelegate
.
bind
(
this
)
,
insertCell
:
(
index
,
cell
)
=>
{
this
.
_insertNewCell
(
index
,
[
cell
],
true
);
}
,
deleteCell
:
this
.
_deleteCellDelegate
.
bind
(
this
)
,
deleteCell
:
(
index
)
=>
{
this
.
_removeCell
(
index
,
1
,
true
);
}
,
emitSelections
:
this
.
_emitSelectionsDelegate
.
bind
(
this
)
emitSelections
:
(
selections
)
=>
{
this
.
_emitSelections
.
fire
(
selections
);
}
},
undefined
,
undefined
));
},
undefined
,
undefined
));
}
}
this
.
insertNewCell
(
index
,
[
cell
],
synchronous
);
this
.
_
insertNewCell
(
index
,
[
cell
],
synchronous
);
}
}
deleteCell2
(
index
:
number
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
{
deleteCell2
(
index
:
number
,
synchronous
:
boolean
,
pushUndoStop
:
boolean
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
{
const
cell
=
this
.
cells
[
index
];
const
cell
=
this
.
cells
[
index
];
if
(
pushUndoStop
)
{
if
(
pushUndoStop
)
{
this
.
_operationManager
.
pushEditOperation
(
new
DeleteCellEdit
(
this
.
uri
,
index
,
cell
,
{
this
.
_operationManager
.
pushEditOperation
(
new
DeleteCellEdit
(
this
.
uri
,
index
,
cell
,
{
insertCell
:
this
.
_insertCellDelegate
.
bind
(
this
)
,
insertCell
:
(
index
,
cell
)
=>
{
this
.
_insertNewCell
(
index
,
[
cell
],
true
);
}
,
deleteCell
:
this
.
_deleteCellDelegate
.
bind
(
this
)
,
deleteCell
:
(
index
)
=>
{
this
.
_removeCell
(
index
,
1
,
true
);
}
,
emitSelections
:
this
.
_emitSelectionsDelegate
.
bind
(
this
)
emitSelections
:
(
selections
)
=>
{
this
.
_emitSelections
.
fire
(
selections
);
}
},
beforeSelections
,
endSelections
));
},
beforeSelections
,
endSelections
));
}
}
this
.
removeCell
(
index
,
1
,
synchronous
);
this
.
_
removeCell
(
index
,
1
,
synchronous
);
if
(
endSelections
)
{
if
(
endSelections
)
{
this
.
_emitSelections
.
fire
(
endSelections
);
this
.
_emitSelections
.
fire
(
endSelections
);
}
}
...
@@ -684,7 +672,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
...
@@ -684,7 +672,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
moveCell
:
(
fromIndex
:
number
,
length
:
number
,
toIndex
:
number
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
=>
{
moveCell
:
(
fromIndex
:
number
,
length
:
number
,
toIndex
:
number
,
beforeSelections
:
number
[]
|
undefined
,
endSelections
:
number
[]
|
undefined
)
=>
{
this
.
moveCellToIdx2
(
fromIndex
,
length
,
toIndex
,
true
,
false
,
beforeSelections
,
endSelections
);
this
.
moveCellToIdx2
(
fromIndex
,
length
,
toIndex
,
true
,
false
,
beforeSelections
,
endSelections
);
},
},
emitSelections
:
this
.
_emitSelectionsDelegate
.
bind
(
this
)
emitSelections
:
(
selections
)
=>
{
this
.
_emitSelections
.
fire
(
selections
);
}
},
beforeSelections
,
endSelections
));
},
beforeSelections
,
endSelections
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录