Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ac4de7bb
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,发现更多精彩内容 >>
提交
ac4de7bb
编写于
8月 24, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add NotebookEditorCellEdit#replaceOutputs,
https://github.com/microsoft/vscode/issues/105283
上级
bc9f2577
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
40 addition
and
6 deletion
+40
-6
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+2
-0
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+1
-1
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+9
-0
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
...workbench/contrib/notebook/browser/notebookServiceImpl.ts
+10
-0
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
...kbench/contrib/notebook/common/model/notebookTextModel.ts
+7
-2
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+11
-3
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
ac4de7bb
...
...
@@ -1357,6 +1357,8 @@ declare module 'vscode' {
replaceCells
(
from
:
number
,
to
:
number
,
cells
:
NotebookCellData
[]):
void
;
replaceOutputs
(
index
:
number
,
outputs
:
CellOutput
[]):
void
;
/** @deprecated */
insert
(
index
:
number
,
content
:
string
|
string
[],
language
:
string
,
type
:
CellKind
,
outputs
:
CellOutput
[],
metadata
:
NotebookCellMetadata
|
undefined
):
void
;
/** @deprecated */
...
...
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
ac4de7bb
...
...
@@ -560,7 +560,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
if
(
textModel
)
{
this
.
_notebookService
.
transformSpliceOutputs
(
textModel
,
splices
);
textModel
.
$
spliceNotebookCellOutputs
(
cellHandle
,
splices
);
textModel
.
spliceNotebookCellOutputs
(
cellHandle
,
splices
);
}
}
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
ac4de7bb
...
...
@@ -511,6 +511,15 @@ export class NotebookEditorCellEditBuilder implements vscode.NotebookEditorCellE
}
}
replaceOutputs
(
index
:
number
,
outputs
:
vscode
.
CellOutput
[]):
void
{
this
.
_throwIfFinalized
();
this
.
_collectedEdits
.
push
({
editType
:
CellEditType
.
Output
,
index
,
outputs
:
outputs
.
map
(
output
=>
addIdToOutput
(
output
))
});
}
replaceCells
(
from
:
number
,
to
:
number
,
cells
:
vscode
.
NotebookCellData
[]):
void
{
this
.
_throwIfFinalized
();
...
...
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
浏览文件 @
ac4de7bb
...
...
@@ -733,6 +733,16 @@ export class NotebookService extends Disposable implements INotebookService, ICu
}
});
});
}
else
if
(
edit
.
editType
===
CellEditType
.
Output
)
{
edit
.
outputs
.
map
((
output
)
=>
{
if
(
output
.
outputKind
===
CellOutputKind
.
Rich
)
{
const
ret
=
this
.
_transformMimeTypes
(
output
,
output
.
outputId
,
textModel
.
metadata
.
displayOrder
as
string
[]
||
[]);
const
orderedMimeTypes
=
ret
.
orderedMimeTypes
!
;
const
pickedMimeTypeIndex
=
ret
.
pickedMimeTypeIndex
!
;
output
.
pickedMimeTypeIndex
=
pickedMimeTypeIndex
;
output
.
orderedMimeTypes
=
orderedMimeTypes
;
}
});
}
});
}
...
...
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
浏览文件 @
ac4de7bb
...
...
@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
NotebookCellTextModel
}
from
'
vs/workbench/contrib/notebook/common/model/notebookCellTextModel
'
;
import
{
INotebookTextModel
,
NotebookCellOutputsSplice
,
NotebookCellTextModelSplice
,
NotebookDocumentMetadata
,
NotebookCellMetadata
,
ICellEditOperation
,
CellEditType
,
CellUri
,
ICellInsertEdit
,
NotebookCellsChangedEvent
,
CellKind
,
IProcessedOutput
,
notebookDocumentMetadataDefaults
,
diff
,
ICellDeleteEdit
,
NotebookCellsChangeType
,
ICellDto2
,
IMainCellDto
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
INotebookTextModel
,
NotebookCellOutputsSplice
,
NotebookCellTextModelSplice
,
NotebookDocumentMetadata
,
NotebookCellMetadata
,
ICellEditOperation
,
CellEditType
,
CellUri
,
ICellInsertEdit
,
NotebookCellsChangedEvent
,
CellKind
,
IProcessedOutput
,
notebookDocumentMetadataDefaults
,
diff
,
ICellDeleteEdit
,
NotebookCellsChangeType
,
ICellDto2
,
IMainCellDto
,
ICellOutputEdit
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
ITextSnapshot
}
from
'
vs/editor/common/model
'
;
import
{
IUndoRedoService
,
UndoRedoElementType
,
IUndoRedoElement
,
IResourceUndoRedoElement
}
from
'
vs/platform/undoRedo/common/undoRedo
'
;
import
{
InsertCellEdit
,
DeleteCellEdit
,
MoveCellEdit
,
SpliceCellsEdit
}
from
'
vs/workbench/contrib/notebook/common/model/cellEdit
'
;
...
...
@@ -279,6 +279,11 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
case
CellEditType
.
Delete
:
this
.
removeCell
(
operations
[
i
].
index
,
operations
[
i
].
end
-
operations
[
i
].
start
,
false
);
break
;
case
CellEditType
.
Output
:
//TODO@joh,@rebornix no event, no undo stop (?)
const
cell
=
this
.
cells
[
operations
[
i
].
index
];
this
.
spliceNotebookCellOutputs
(
cell
.
handle
,
[[
0
,
cell
.
outputs
.
length
,
(
<
ICellOutputEdit
>
operations
[
i
]).
outputs
]]);
break
;
}
}
...
...
@@ -493,7 +498,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
}
// TODO@rebornix should this trigger content change event?
$
spliceNotebookCellOutputs
(
cellHandle
:
number
,
splices
:
NotebookCellOutputsSplice
[]):
void
{
spliceNotebookCellOutputs
(
cellHandle
:
number
,
splices
:
NotebookCellOutputsSplice
[]):
void
{
const
cell
=
this
.
_mapping
.
get
(
cellHandle
);
cell
?.
spliceNotebookCellOutputs
(
splices
);
}
...
...
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
浏览文件 @
ac4de7bb
...
...
@@ -398,9 +398,11 @@ export interface NotebookCellsChangeMetadataEvent {
}
export
type
NotebookCellsChangedEvent
=
NotebookCellsInitializeEvent
|
NotebookCellsModelChangedEvent
|
NotebookCellsModelMoveEvent
|
NotebookCellClearOutputEvent
|
NotebookCellsClearOutputEvent
|
NotebookCellsChangeLanguageEvent
|
NotebookCellsChangeMetadataEvent
;
export
enum
CellEditType
{
export
const
enum
CellEditType
{
Insert
=
1
,
Delete
=
2
Delete
=
2
,
Output
=
3
,
}
export
interface
ICellDto2
{
...
...
@@ -423,7 +425,13 @@ export interface ICellDeleteEdit {
count
:
number
;
}
export
type
ICellEditOperation
=
ICellInsertEdit
|
ICellDeleteEdit
;
export
interface
ICellOutputEdit
{
editType
:
CellEditType
.
Output
;
index
:
number
,
outputs
:
IProcessedOutput
[]
}
export
type
ICellEditOperation
=
ICellInsertEdit
|
ICellDeleteEdit
|
ICellOutputEdit
;
export
interface
INotebookEditData
{
documentVersionId
:
number
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录