Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e42a46ab
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,发现更多精彩内容 >>
提交
e42a46ab
编写于
9月 17, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Notebook document content options.
上级
d45d4ca3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
23 addition
and
13 deletion
+23
-13
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+16
-12
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+1
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-0
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+1
-1
src/vs/workbench/api/common/extHostNotebookDocument.ts
src/vs/workbench/api/common/extHostNotebookDocument.ts
+2
-0
src/vs/workbench/test/browser/api/extHostNotebook.test.ts
src/vs/workbench/test/browser/api/extHostNotebook.test.ts
+1
-0
src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts
...ch/test/browser/api/extHostNotebookConcatDocument.test.ts
+1
-0
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
e42a46ab
...
@@ -1367,6 +1367,20 @@ declare module 'vscode' {
...
@@ -1367,6 +1367,20 @@ declare module 'vscode' {
runState
?:
NotebookRunState
;
runState
?:
NotebookRunState
;
}
}
export
interface
NotebookDocumentContentOptions
{
/**
* Controls if outputs change will trigger notebook document content change and if it will be used in the diff editor
* Default to false. If the content provider doesn't persisit the outputs in the file document, this should be set to true.
*/
transientOutputs
:
boolean
;
/**
* Controls if a meetadata property change will trigger notebook document content change and if it will be used in the diff editor
* Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true.
*/
transientMetadata
:
{
[
K
in
keyof
NotebookCellMetadata
]?:
boolean
};
}
export
interface
NotebookDocument
{
export
interface
NotebookDocument
{
readonly
uri
:
Uri
;
readonly
uri
:
Uri
;
readonly
version
:
number
;
readonly
version
:
number
;
...
@@ -1375,6 +1389,7 @@ declare module 'vscode' {
...
@@ -1375,6 +1389,7 @@ declare module 'vscode' {
readonly
isDirty
:
boolean
;
readonly
isDirty
:
boolean
;
readonly
isUntitled
:
boolean
;
readonly
isUntitled
:
boolean
;
readonly
cells
:
ReadonlyArray
<
NotebookCell
>
;
readonly
cells
:
ReadonlyArray
<
NotebookCell
>
;
readonly
contentOptions
:
NotebookDocumentContentOptions
;
languages
:
string
[];
languages
:
string
[];
metadata
:
NotebookDocumentMetadata
;
metadata
:
NotebookDocumentMetadata
;
}
}
...
@@ -1781,18 +1796,7 @@ declare module 'vscode' {
...
@@ -1781,18 +1796,7 @@ declare module 'vscode' {
export
function
registerNotebookContentProvider
(
export
function
registerNotebookContentProvider
(
notebookType
:
string
,
notebookType
:
string
,
provider
:
NotebookContentProvider
,
provider
:
NotebookContentProvider
,
options
?:
{
options
?:
NotebookDocumentContentOptions
&
{
/**
* Controls if outputs change will trigger notebook document content change and if it will be used in the diff editor
* Default to false. If the content provider doesn't persisit the outputs in the file document, this should be set to true.
*/
transientOutputs
:
boolean
;
/**
* Controls if a meetadata property change will trigger notebook document content change and if it will be used in the diff editor
* Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true.
*/
transientMetadata
:
{
[
K
in
keyof
NotebookCellMetadata
]?:
boolean
};
/**
/**
* Not ready for production or development use yet.
* Not ready for production or development use yet.
*/
*/
...
...
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
e42a46ab
...
@@ -105,6 +105,7 @@ class DocumentAndEditorState {
...
@@ -105,6 +105,7 @@ class DocumentAndEditorState {
outputs
:
cell
.
outputs
,
outputs
:
cell
.
outputs
,
metadata
:
cell
.
metadata
metadata
:
cell
.
metadata
})),
})),
contentOptions
:
e
.
transientOptions
,
// attachedEditor: editorId ? {
// attachedEditor: editorId ? {
// id: editorId,
// id: editorId,
// selections: document.textModel.selections
// selections: document.textModel.selections
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
e42a46ab
...
@@ -1667,6 +1667,7 @@ export interface INotebookModelAddedData {
...
@@ -1667,6 +1667,7 @@ export interface INotebookModelAddedData {
viewType
:
string
;
viewType
:
string
;
metadata
?:
NotebookDocumentMetadata
;
metadata
?:
NotebookDocumentMetadata
;
attachedEditor
?:
{
id
:
string
;
selections
:
number
[];
visibleRanges
:
ICellRange
[]
}
attachedEditor
?:
{
id
:
string
;
selections
:
number
[];
visibleRanges
:
ICellRange
[]
}
contentOptions
:
{
transientOutputs
:
boolean
;
transientMetadata
:
TransientMetadata
;
}
}
}
export
interface
INotebookEditorAddData
{
export
interface
INotebookEditorAddData
{
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
e42a46ab
...
@@ -729,7 +729,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
...
@@ -729,7 +729,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
emitDocumentMetadataChange
(
event
:
vscode
.
NotebookDocumentMetadataChangeEvent
):
void
{
emitDocumentMetadataChange
(
event
:
vscode
.
NotebookDocumentMetadataChangeEvent
):
void
{
that
.
_onDidChangeNotebookDocumentMetadata
.
fire
(
event
);
that
.
_onDidChangeNotebookDocumentMetadata
.
fire
(
event
);
}
}
},
viewType
,
{
...
notebookDocumentMetadataDefaults
,
...
modelData
.
metadata
},
uri
,
storageRoot
);
},
viewType
,
modelData
.
contentOptions
,
{
...
notebookDocumentMetadataDefaults
,
...
modelData
.
metadata
},
uri
,
storageRoot
);
document
.
acceptModelChanged
({
document
.
acceptModelChanged
({
versionId
:
modelData
.
versionId
,
versionId
:
modelData
.
versionId
,
...
...
src/vs/workbench/api/common/extHostNotebookDocument.ts
浏览文件 @
e42a46ab
...
@@ -236,6 +236,7 @@ export class ExtHostNotebookDocument extends Disposable {
...
@@ -236,6 +236,7 @@ export class ExtHostNotebookDocument extends Disposable {
private
readonly
_mainThreadBulkEdits
:
MainThreadBulkEditsShape
,
private
readonly
_mainThreadBulkEdits
:
MainThreadBulkEditsShape
,
private
readonly
_emitter
:
INotebookEventEmitter
,
private
readonly
_emitter
:
INotebookEventEmitter
,
private
readonly
_viewType
:
string
,
private
readonly
_viewType
:
string
,
private
readonly
_contentOptions
:
vscode
.
NotebookDocumentContentOptions
,
metadata
:
Required
<
vscode
.
NotebookDocumentMetadata
>
,
metadata
:
Required
<
vscode
.
NotebookDocumentMetadata
>
,
public
readonly
uri
:
URI
,
public
readonly
uri
:
URI
,
private
readonly
_storagePath
:
URI
|
undefined
private
readonly
_storagePath
:
URI
|
undefined
...
@@ -301,6 +302,7 @@ export class ExtHostNotebookDocument extends Disposable {
...
@@ -301,6 +302,7 @@ export class ExtHostNotebookDocument extends Disposable {
set
languages
(
value
:
string
[])
{
that
.
_trySetLanguages
(
value
);
},
set
languages
(
value
:
string
[])
{
that
.
_trySetLanguages
(
value
);
},
get
metadata
()
{
return
that
.
_metadata
;
},
get
metadata
()
{
return
that
.
_metadata
;
},
set
metadata
(
value
:
Required
<
vscode
.
NotebookDocumentMetadata
>
)
{
that
.
_updateMetadata
(
value
);
},
set
metadata
(
value
:
Required
<
vscode
.
NotebookDocumentMetadata
>
)
{
that
.
_updateMetadata
(
value
);
},
get
contentOptions
()
{
return
that
.
_contentOptions
;
}
});
});
}
}
return
this
.
_notebook
;
return
this
.
_notebook
;
...
...
src/vs/workbench/test/browser/api/extHostNotebook.test.ts
浏览文件 @
e42a46ab
...
@@ -77,6 +77,7 @@ suite('NotebookCell#Document', function () {
...
@@ -77,6 +77,7 @@ suite('NotebookCell#Document', function () {
cellKind
:
CellKind
.
Code
,
cellKind
:
CellKind
.
Code
,
outputs
:
[],
outputs
:
[],
}],
}],
contentOptions
:
{
transientMetadata
:
{},
transientOutputs
:
false
}
}],
}],
addedEditors
:
[{
addedEditors
:
[{
documentUri
:
notebookUri
,
documentUri
:
notebookUri
,
...
...
src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts
浏览文件 @
e42a46ab
...
@@ -68,6 +68,7 @@ suite('NotebookConcatDocument', function () {
...
@@ -68,6 +68,7 @@ suite('NotebookConcatDocument', function () {
cellKind
:
CellKind
.
Markdown
,
cellKind
:
CellKind
.
Markdown
,
outputs
:
[],
outputs
:
[],
}],
}],
contentOptions
:
{
transientOutputs
:
false
,
transientMetadata
:
{}
},
versionId
:
0
versionId
:
0
}],
}],
addedEditors
:
[
addedEditors
:
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录