Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
868fb4c3
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,发现更多精彩内容 >>
提交
868fb4c3
编写于
2月 12, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename CellKind to NotebookCellKind
上级
215cd172
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
44 addition
and
23 deletion
+44
-23
extensions/vscode-notebook-tests/src/notebook.test.ts
extensions/vscode-notebook-tests/src/notebook.test.ts
+9
-9
extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts
...nsions/vscode-notebook-tests/src/notebookSmokeTestMain.ts
+2
-2
extensions/vscode-notebook-tests/src/notebookTestMain.ts
extensions/vscode-notebook-tests/src/notebookTestMain.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+3
-3
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+2
-2
src/vs/workbench/api/common/extHostNotebookConcatDocument.ts
src/vs/workbench/api/common/extHostNotebookConcatDocument.ts
+1
-2
src/vs/workbench/api/common/extHostNotebookDocument.ts
src/vs/workbench/api/common/extHostNotebookDocument.ts
+1
-1
src/vs/workbench/api/common/extHostTypeConverters.ts
src/vs/workbench/api/common/extHostTypeConverters.ts
+24
-2
src/vs/workbench/api/common/extHostTypes.ts
src/vs/workbench/api/common/extHostTypes.ts
+1
-1
未找到文件。
extensions/vscode-notebook-tests/src/notebook.test.ts
浏览文件 @
868fb4c3
...
...
@@ -418,7 +418,7 @@ suite('Notebook API tests', () => {
const
cellsChangeEvent
=
getEventOncePromise
<
vscode
.
NotebookCellsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeNotebookCells
);
await
vscode
.
window
.
activeNotebookEditor
!
.
edit
(
editBuilder
=>
{
editBuilder
.
replaceCells
(
1
,
0
,
[{
cellKind
:
vscode
.
CellKind
.
Code
,
language
:
'
javascript
'
,
source
:
'
test 2
'
,
outputs
:
[],
metadata
:
undefined
}]);
editBuilder
.
replaceCells
(
1
,
0
,
[{
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
language
:
'
javascript
'
,
source
:
'
test 2
'
,
outputs
:
[],
metadata
:
undefined
}]);
});
const
cellChangeEventRet
=
await
cellsChangeEvent
;
...
...
@@ -561,13 +561,13 @@ suite('Notebook API tests', () => {
{
const
edit
=
new
vscode
.
WorkspaceEdit
();
edit
.
replaceNotebookCells
(
document
.
uri
,
0
,
0
,
[{
cellKind
:
vscode
.
CellKind
.
Markdown
,
cellKind
:
vscode
.
Notebook
CellKind
.
Markdown
,
language
:
'
markdown
'
,
metadata
:
undefined
,
outputs
:
[],
source
:
'
new_markdown
'
},
{
cellKind
:
vscode
.
CellKind
.
Code
,
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
language
:
'
fooLang
'
,
metadata
:
undefined
,
outputs
:
[],
...
...
@@ -598,13 +598,13 @@ suite('Notebook API tests', () => {
{
const
edit
=
new
vscode
.
WorkspaceEdit
();
edit
.
replaceNotebookCells
(
document
.
uri
,
0
,
1
,
[{
cellKind
:
vscode
.
CellKind
.
Markdown
,
cellKind
:
vscode
.
Notebook
CellKind
.
Markdown
,
language
:
'
markdown
'
,
metadata
:
undefined
,
outputs
:
[],
source
:
'
new2_markdown
'
},
{
cellKind
:
vscode
.
CellKind
.
Code
,
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
language
:
'
fooLang
'
,
metadata
:
undefined
,
outputs
:
[],
...
...
@@ -640,13 +640,13 @@ suite('Notebook API tests', () => {
const
edit
=
new
vscode
.
WorkspaceEdit
();
edit
.
replaceNotebookCells
(
document
.
uri
,
0
,
0
,
[{
cellKind
:
vscode
.
CellKind
.
Markdown
,
cellKind
:
vscode
.
Notebook
CellKind
.
Markdown
,
language
:
'
markdown
'
,
metadata
:
undefined
,
outputs
:
[],
source
:
'
new_markdown
'
},
{
cellKind
:
vscode
.
CellKind
.
Code
,
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
language
:
'
fooLang
'
,
metadata
:
undefined
,
outputs
:
[],
...
...
@@ -685,7 +685,7 @@ suite('Notebook API tests', () => {
const
cellMetadataChangeEvent
=
getEventOncePromise
<
vscode
.
NotebookCellMetadataChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellMetadata
);
const
version
=
vscode
.
window
.
activeNotebookEditor
!
.
document
.
version
;
await
vscode
.
window
.
activeNotebookEditor
!
.
edit
(
editBuilder
=>
{
editBuilder
.
replaceCells
(
1
,
0
,
[{
cellKind
:
vscode
.
CellKind
.
Code
,
language
:
'
javascript
'
,
source
:
'
test 2
'
,
outputs
:
[],
metadata
:
undefined
}]);
editBuilder
.
replaceCells
(
1
,
0
,
[{
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
language
:
'
javascript
'
,
source
:
'
test 2
'
,
outputs
:
[],
metadata
:
undefined
}]);
editBuilder
.
replaceCellMetadata
(
0
,
{
runnable
:
false
});
});
...
...
@@ -704,7 +704,7 @@ suite('Notebook API tests', () => {
const
cellMetadataChangeEvent
=
getEventOncePromise
<
vscode
.
NotebookCellMetadataChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellMetadata
);
const
version
=
vscode
.
window
.
activeNotebookEditor
!
.
document
.
version
;
await
vscode
.
window
.
activeNotebookEditor
!
.
edit
(
editBuilder
=>
{
editBuilder
.
replaceCells
(
1
,
0
,
[{
cellKind
:
vscode
.
CellKind
.
Code
,
language
:
'
javascript
'
,
source
:
'
test 2
'
,
outputs
:
[],
metadata
:
undefined
}]);
editBuilder
.
replaceCells
(
1
,
0
,
[{
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
language
:
'
javascript
'
,
source
:
'
test 2
'
,
outputs
:
[],
metadata
:
undefined
}]);
editBuilder
.
replaceCellMetadata
(
0
,
{
runnable
:
false
});
});
...
...
extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts
浏览文件 @
868fb4c3
...
...
@@ -28,7 +28,7 @@ export function smokeTestActivate(context: vscode.ExtensionContext): any {
{
source
:
'
code()
'
,
language
:
'
typescript
'
,
cellKind
:
vscode
.
CellKind
.
Code
,
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
outputs
:
[],
metadata
:
{
custom
:
{
testCellMetadata
:
123
}
...
...
@@ -37,7 +37,7 @@ export function smokeTestActivate(context: vscode.ExtensionContext): any {
{
source
:
'
Markdown Cell
'
,
language
:
'
markdown
'
,
cellKind
:
vscode
.
CellKind
.
Markdown
,
cellKind
:
vscode
.
Notebook
CellKind
.
Markdown
,
outputs
:
[],
metadata
:
{
custom
:
{
testCellMetadata
:
123
}
...
...
extensions/vscode-notebook-tests/src/notebookTestMain.ts
浏览文件 @
868fb4c3
...
...
@@ -26,7 +26,7 @@ export function activate(context: vscode.ExtensionContext): any {
{
source
:
'
test
'
,
language
:
'
typescript
'
,
cellKind
:
vscode
.
CellKind
.
Code
,
cellKind
:
vscode
.
Notebook
CellKind
.
Code
,
outputs
:
[],
metadata
:
{
custom
:
{
testCellMetadata
:
123
}
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
868fb4c3
...
...
@@ -1000,7 +1000,7 @@ declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/106744, Notebooks (misc)
export
enum
CellKind
{
export
enum
Notebook
CellKind
{
Markdown
=
1
,
Code
=
2
}
...
...
@@ -1052,7 +1052,7 @@ declare module 'vscode' {
readonly
index
:
number
;
readonly
notebook
:
NotebookDocument
;
readonly
uri
:
Uri
;
readonly
cellKind
:
CellKind
;
readonly
cellKind
:
Notebook
CellKind
;
readonly
document
:
TextDocument
;
readonly
language
:
string
;
readonly
outputs
:
readonly
NotebookCellOutput
[];
...
...
@@ -1248,7 +1248,7 @@ declare module 'vscode' {
// todo@API support ids https://github.com/jupyter/enhancement-proposals/blob/master/62-cell-id/cell-id.md
export
interface
NotebookCellData
{
readonly
cellKind
:
CellKind
;
readonly
cellKind
:
Notebook
CellKind
;
readonly
source
:
string
;
readonly
language
:
string
;
// todo@API maybe use a separate data type?
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
868fb4c3
...
...
@@ -1253,9 +1253,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
// checkProposedApiEnabled(extension);
return
extHostTypes
.
TimelineItem
;
},
get
CellKind
()
{
get
Notebook
CellKind
()
{
// checkProposedApiEnabled(extension);
return
extHostTypes
.
CellKind
;
return
extHostTypes
.
Notebook
CellKind
;
},
get
NotebookCellRunState
()
{
// checkProposedApiEnabled(extension);
...
...
src/vs/workbench/api/common/extHostNotebookConcatDocument.ts
浏览文件 @
868fb4c3
...
...
@@ -11,7 +11,6 @@ import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import
{
PrefixSumComputer
}
from
'
vs/editor/common/viewModel/prefixSumComputer
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
score
}
from
'
vs/editor/common/modes/languageSelector
'
;
import
{
CellKind
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
...
...
@@ -76,7 +75,7 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
const
cellLengths
:
number
[]
=
[];
const
cellLineCounts
:
number
[]
=
[];
for
(
const
cell
of
this
.
_notebook
.
cells
)
{
if
(
cell
.
cellKind
===
CellKind
.
Code
&&
(
!
this
.
_selector
||
score
(
this
.
_selector
,
cell
.
uri
,
cell
.
language
,
true
)))
{
if
(
cell
.
cellKind
===
types
.
Notebook
CellKind
.
Code
&&
(
!
this
.
_selector
||
score
(
this
.
_selector
,
cell
.
uri
,
cell
.
language
,
true
)))
{
this
.
_cellUris
.
set
(
cell
.
uri
,
this
.
_cells
.
length
);
this
.
_cells
.
push
(
cell
);
cellLengths
.
push
(
cell
.
document
.
getText
().
length
+
1
);
...
...
src/vs/workbench/api/common/extHostNotebookDocument.ts
浏览文件 @
868fb4c3
...
...
@@ -88,7 +88,7 @@ export class ExtHostCell extends Disposable {
get
index
()
{
return
that
.
_notebook
.
getCellIndex
(
that
);
},
notebook
:
that
.
_notebook
.
notebookDocument
,
uri
:
that
.
uri
,
cellKind
:
this
.
_cellData
.
cellKind
,
cellKind
:
extHostTypeConverters
.
NotebookCellKind
.
to
(
this
.
_cellData
.
cellKind
)
,
document
:
data
.
document
,
get
language
()
{
return
data
!
.
document
.
languageId
;
},
get
outputs
()
{
return
that
.
_outputs
.
map
(
extHostTypeConverters
.
NotebookCellOutput
.
to
);
},
...
...
src/vs/workbench/api/common/extHostTypeConverters.ts
浏览文件 @
868fb4c3
...
...
@@ -31,7 +31,7 @@ import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays';
import
{
RenderLineNumbersType
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
CommandsConverter
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
ExtHostNotebookController
}
from
'
vs/workbench/api/common/extHostNotebook
'
;
import
{
CellEditType
,
ICellDto2
,
INotebookDecorationRenderOptions
,
IOutputDto
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
CellEditType
,
CellKind
,
ICellDto2
,
INotebookDecorationRenderOptions
,
IOutputDto
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
ITestItem
,
ITestState
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
export
interface
PositionLike
{
...
...
@@ -1344,11 +1344,33 @@ export namespace LanguageSelector {
}
}
export
namespace
NotebookCellKind
{
export
function
from
(
data
:
vscode
.
NotebookCellKind
):
CellKind
{
switch
(
data
)
{
case
types
.
NotebookCellKind
.
Markdown
:
return
CellKind
.
Markdown
;
case
types
.
NotebookCellKind
.
Code
:
default
:
return
CellKind
.
Code
;
}
}
export
function
to
(
data
:
CellKind
):
vscode
.
NotebookCellKind
{
switch
(
data
)
{
case
CellKind
.
Markdown
:
return
types
.
NotebookCellKind
.
Markdown
;
case
CellKind
.
Code
:
default
:
return
types
.
NotebookCellKind
.
Code
;
}
}
}
export
namespace
NotebookCellData
{
export
function
from
(
data
:
vscode
.
NotebookCellData
):
ICellDto2
{
return
{
cellKind
:
data
.
cellKind
,
cellKind
:
NotebookCellKind
.
from
(
data
.
cellKind
)
,
language
:
data
.
language
,
source
:
data
.
source
,
metadata
:
data
.
metadata
,
...
...
src/vs/workbench/api/common/extHostTypes.ts
浏览文件 @
868fb4c3
...
...
@@ -2933,7 +2933,7 @@ export class NotebookCellOutput {
)
{
}
}
export
enum
CellKind
{
export
enum
Notebook
CellKind
{
Markdown
=
1
,
Code
=
2
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录