Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
03acd225
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,发现更多精彩内容 >>
提交
03acd225
编写于
5月 13, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #96433
上级
e2785c32
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
57 addition
and
7 deletion
+57
-7
extensions/vscode-notebook-tests/src/notebook.test.ts
extensions/vscode-notebook-tests/src/notebook.test.ts
+13
-0
extensions/vscode-notebook-tests/src/notebookTestMain.ts
extensions/vscode-notebook-tests/src/notebookTestMain.ts
+9
-3
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+10
-0
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+5
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+2
-0
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+14
-0
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+4
-2
未找到文件。
extensions/vscode-notebook-tests/src/notebook.test.ts
浏览文件 @
03acd225
...
...
@@ -321,6 +321,19 @@ suite('notebook working copy', () => {
});
});
suite
(
'
metadata
'
,
()
=>
{
test
(
'
custom metadata should be supported
'
,
async
function
()
{
const
resource
=
vscode
.
Uri
.
parse
(
join
(
vscode
.
workspace
.
rootPath
||
''
,
'
./first.vsctestnb
'
));
await
vscode
.
commands
.
executeCommand
(
'
vscode.openWith
'
,
resource
,
'
notebookCoreTest
'
);
await
waitFor
(
500
);
assert
.
equal
(
vscode
.
notebook
.
activeNotebookEditor
!==
undefined
,
true
,
'
notebook first
'
);
assert
.
equal
(
vscode
.
notebook
.
activeNotebookEditor
!
.
document
.
metadata
.
custom
[
'
testMetadata
'
]
as
boolean
,
false
);
assert
.
equal
(
vscode
.
notebook
.
activeNotebookEditor
!
.
selection
?.
metadata
.
custom
[
'
testCellMetadata
'
]
as
boolean
,
true
);
assert
.
equal
(
vscode
.
notebook
.
activeNotebookEditor
!
.
selection
?.
language
,
'
typescript
'
);
});
});
suite
(
'
regression
'
,
()
=>
{
test
(
'
microsoft/vscode-github-issue-notebooks#26. Insert template cell in the new empty document
'
,
async
function
()
{
const
resource
=
vscode
.
Uri
.
parse
(
join
(
vscode
.
workspace
.
rootPath
||
''
,
'
./empty.vsctestnb
'
));
...
...
extensions/vscode-notebook-tests/src/notebookTestMain.ts
浏览文件 @
03acd225
...
...
@@ -17,19 +17,25 @@ export function activate(context: vscode.ExtensionContext): any {
};
}
return
{
const
dto
:
vscode
.
NotebookData
=
{
languages
:
[
'
typescript
'
],
metadata
:
{},
metadata
:
{
custom
:
{
testMetadata
:
false
}
},
cells
:
[
{
source
:
'
test
'
,
language
:
'
typescript
'
,
cellKind
:
vscode
.
CellKind
.
Code
,
outputs
:
[],
metadata
:
{}
metadata
:
{
custom
:
{
testCellMetadata
:
true
}
}
}
]
};
return
dto
;
},
executeCell
:
async
(
_document
:
vscode
.
NotebookDocument
,
_cell
:
vscode
.
NotebookCell
|
undefined
,
_token
:
vscode
.
CancellationToken
)
=>
{
if
(
!
_cell
)
{
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
03acd225
...
...
@@ -1590,6 +1590,11 @@ declare module 'vscode' {
* The total duration of the cell's last run
*/
lastRunDuration
?:
number
;
/**
* Additional attributes of a cell metadata.
*/
[
key
:
string
]:
any
;
}
export
interface
NotebookCell
{
...
...
@@ -1635,6 +1640,11 @@ declare module 'vscode' {
hasExecutionOrder
?:
boolean
;
displayOrder
?:
GlobPattern
[];
/**
* Additional attributes of a cell metadata.
*/
[
key
:
string
]:
any
;
}
export
interface
NotebookDocument
{
...
...
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
03acd225
...
...
@@ -38,7 +38,7 @@ export class MainThreadNotebookDocument extends Disposable {
}));
this
.
_register
(
this
.
_textModel
.
onDidSelectionChange
(
e
=>
{
const
selectionsChange
=
e
?
{
selections
:
e
}
:
null
;
this
.
_proxy
.
$acceptEditorPropertiesChanged
(
uri
,
{
selections
:
selectionsChange
});
this
.
_proxy
.
$acceptEditorPropertiesChanged
(
uri
,
{
selections
:
selectionsChange
,
metadata
:
null
});
}));
}
...
...
@@ -250,6 +250,8 @@ export class MainThreadNotebookController implements IMainNotebookController {
document
.
textModel
.
insertTemplateCell
(
mainCell
);
}
this
.
_proxy
.
$acceptEditorPropertiesChanged
(
uri
,
{
selections
:
null
,
metadata
:
document
.
textModel
.
metadata
});
return
document
.
textModel
;
}
...
...
@@ -285,7 +287,8 @@ export class MainThreadNotebookController implements IMainNotebookController {
addedDocuments
:
[{
viewType
:
document
.
viewType
,
handle
:
document
.
handle
,
uri
:
document
.
uri
uri
:
document
.
uri
,
metadata
:
document
.
textModel
.
metadata
}]
});
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
03acd225
...
...
@@ -1539,6 +1539,7 @@ export interface INotebookSelectionChangeEvent {
export
interface
INotebookEditorPropertiesChangeData
{
selections
:
INotebookSelectionChangeEvent
|
null
;
metadata
:
NotebookDocumentMetadata
|
null
;
}
export
interface
INotebookModelAddedData
{
...
...
@@ -1546,6 +1547,7 @@ export interface INotebookModelAddedData {
handle
:
number
;
// versionId: number;
viewType
:
string
;
metadata
?:
NotebookDocumentMetadata
;
}
export
interface
INotebookDocumentsAndEditorsDelta
{
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
03acd225
...
...
@@ -949,6 +949,13 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
editor
.
editor
.
selection
=
undefined
;
}
}
if
(
data
.
metadata
)
{
editor
.
editor
.
document
.
metadata
=
{
...
notebookDocumentMetadataDefaults
,
...
data
.
metadata
};
}
}
async
$acceptDocumentAndEditorsDelta
(
delta
:
INotebookDocumentsAndEditorsDelta
)
{
...
...
@@ -978,6 +985,13 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
const
viewType
=
modelData
.
viewType
;
if
(
!
this
.
_documents
.
has
(
revivedUri
.
toString
()))
{
let
document
=
new
ExtHostNotebookDocument
(
this
.
_proxy
,
this
.
_documentsAndEditors
,
viewType
,
revivedUri
,
this
);
if
(
modelData
.
metadata
)
{
document
.
metadata
=
{
...
notebookDocumentMetadataDefaults
,
...
modelData
.
metadata
};
}
this
.
_documents
.
set
(
revivedUri
.
toString
(),
document
);
}
...
...
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
浏览文件 @
03acd225
...
...
@@ -55,7 +55,8 @@ export const notebookDocumentMetadataDefaults: Required<NotebookDocumentMetadata
cellEditable
:
true
,
cellRunnable
:
true
,
hasExecutionOrder
:
true
,
displayOrder
:
NOTEBOOK_DISPLAY_ORDER
displayOrder
:
NOTEBOOK_DISPLAY_ORDER
,
custom
:
{}
};
export
interface
NotebookDocumentMetadata
{
...
...
@@ -65,6 +66,7 @@ export interface NotebookDocumentMetadata {
cellRunnable
:
boolean
;
hasExecutionOrder
:
boolean
;
displayOrder
?:
GlobPattern
[];
custom
?:
{
[
key
:
string
]:
any
};
}
export
enum
NotebookCellRunState
{
...
...
@@ -80,9 +82,9 @@ export interface NotebookCellMetadata {
executionOrder
?:
number
;
statusMessage
?:
string
;
runState
?:
NotebookCellRunState
;
runStartTime
?:
number
;
lastRunDuration
?:
number
;
custom
?:
{
[
key
:
string
]:
any
};
}
export
interface
INotebookDisplayOrder
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录