Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1ed6862c
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,发现更多精彩内容 >>
未验证
提交
1ed6862c
编写于
4月 30, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more insights when execution integration tests fail
上级
e1a46ca6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
9 deletion
+29
-9
extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts
.../vscode-api-tests/src/singlefolder-tests/notebook.test.ts
+18
-6
src/vs/workbench/contrib/notebook/browser/contrib/status/editorStatus.ts
...h/contrib/notebook/browser/contrib/status/editorStatus.ts
+11
-3
未找到文件。
extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts
浏览文件 @
1ed6862c
...
...
@@ -98,6 +98,14 @@ function getFocusedCell(editor?: vscode.NotebookEditor) {
return
editor
?
editor
.
document
.
cellAt
(
editor
.
selections
[
0
].
start
)
:
undefined
;
}
async
function
assertKernel
(
controller
:
vscode
.
NotebookController
):
Promise
<
void
>
{
const
success
=
await
vscode
.
commands
.
executeCommand
(
'
notebook.selectKernel
'
,
{
extension
:
'
vscode.vscode-api-tests
'
,
id
:
controller
.
id
});
assert
.
ok
(
success
,
`expected selected kernel to be
${
controller
.
id
}
`
);
}
suite
(
'
Notebook API tests
'
,
function
()
{
const
testDisposables
:
vscode
.
Disposable
[]
=
[];
...
...
@@ -167,9 +175,12 @@ suite('Notebook API tests', function () {
}));
});
let
kernel1
:
Kernel
;
let
kernel2
:
Kernel
;
setup
(()
=>
{
const
kernel1
=
new
Kernel
(
'
mainKernel
'
,
'
Notebook Primary Test Kernel
'
);
kernel1
=
new
Kernel
(
'
mainKernel
'
,
'
Notebook Primary Test Kernel
'
);
const
listener
=
vscode
.
notebook
.
onDidOpenNotebookDocument
(
async
notebook
=>
{
if
(
notebook
.
viewType
===
kernel1
.
controller
.
viewType
)
{
...
...
@@ -181,7 +192,7 @@ suite('Notebook API tests', function () {
});
const
kernel2
=
new
class
extends
Kernel
{
kernel2
=
new
class
extends
Kernel
{
constructor
()
{
super
(
'
secondaryKernel
'
,
'
Notebook Secondary Test Kernel
'
);
this
.
controller
.
hasExecutionOrder
=
false
;
...
...
@@ -755,7 +766,7 @@ suite('Notebook API tests', function () {
});
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.selectKernel
'
,
{
extension
:
'
vscode.vscode-api-tests
'
,
id
:
'
secondaryKernel
'
}
);
await
assertKernel
(
kernel2
.
controller
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
...
...
@@ -797,7 +808,7 @@ suite('Notebook API tests', function () {
const
editor
=
vscode
.
window
.
activeNotebookEditor
!
;
const
cell
=
editor
.
document
.
cellAt
(
0
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.selectKernel
'
,
{
extension
:
'
vscode.vscode-api-tests
'
,
id
:
cancelableKernel
.
controller
.
id
}
);
await
assertKernel
(
cancelableKernel
.
controller
);
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.cancelExecution
'
);
...
...
@@ -844,7 +855,8 @@ suite('Notebook API tests', function () {
const
editor
=
vscode
.
window
.
activeNotebookEditor
!
;
const
cell
=
editor
.
document
.
cellAt
(
0
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.selectKernel
'
,
{
extension
:
'
vscode.vscode-api-tests
'
,
id
:
interruptableKernel
.
controller
.
id
});
await
assertKernel
(
interruptableKernel
.
controller
);
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.cancelExecution
'
);
...
...
@@ -1219,7 +1231,7 @@ suite('Notebook API tests', function () {
const
resource
=
await
createRandomNotebookFile
();
await
vscode
.
commands
.
executeCommand
(
'
vscode.openWith
'
,
resource
,
'
notebookCoreTest
'
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.selectKernel
'
,
{
extension
:
'
vscode.vscode-api-tests
'
,
id
:
verifyOutputSyncKernel
.
controller
.
id
}
);
await
assertKernel
(
verifyOutputSyncKernel
.
controller
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
await
saveAllFilesAndCloseAll
(
undefined
);
...
...
src/vs/workbench/contrib/notebook/browser/contrib/status/editorStatus.ts
浏览文件 @
1ed6862c
...
...
@@ -22,6 +22,7 @@ import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import
{
INotebookKernelService
}
from
'
vs/workbench/contrib/notebook/common/notebookKernelService
'
;
import
{
INotebookKernel
,
INotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
registerAction2
(
class
extends
Action2
{
constructor
()
{
...
...
@@ -57,15 +58,16 @@ registerAction2(class extends Action2 {
});
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
{
id
:
string
,
extension
:
string
}):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
{
id
:
string
,
extension
:
string
}):
Promise
<
boolean
>
{
const
notebookKernelService
=
accessor
.
get
(
INotebookKernelService
);
const
editorService
=
accessor
.
get
(
IEditorService
);
const
quickInputService
=
accessor
.
get
(
IQuickInputService
);
const
labelService
=
accessor
.
get
(
ILabelService
);
const
logService
=
accessor
.
get
(
ILogService
);
const
editor
=
getNotebookEditorFromEditorPane
(
editorService
.
activeEditorPane
);
if
(
!
editor
||
!
editor
.
hasModel
())
{
return
;
return
false
;
}
if
(
context
&&
(
typeof
context
.
id
!==
'
string
'
||
typeof
context
.
extension
!==
'
string
'
))
{
...
...
@@ -78,7 +80,7 @@ registerAction2(class extends Action2 {
if
(
selected
&&
context
&&
selected
.
id
===
context
.
id
&&
ExtensionIdentifier
.
equals
(
selected
.
extension
,
context
.
extension
))
{
// current kernel is wanted kernel -> done
return
;
return
true
;
}
let
newKernel
:
INotebookKernel
|
undefined
;
...
...
@@ -90,6 +92,10 @@ registerAction2(class extends Action2 {
break
;
}
}
if
(
!
newKernel
)
{
logService
.
warn
(
`wanted kernel DOES NOT EXIST, wanted:
${
wantedId
}
, all:
${
all
.
map
(
k
=>
k
.
id
)}
`
);
return
false
;
}
}
if
(
!
newKernel
)
{
...
...
@@ -132,7 +138,9 @@ registerAction2(class extends Action2 {
if
(
newKernel
)
{
notebookKernelService
.
selectKernelForNotebook
(
newKernel
,
notebook
);
return
true
;
}
return
false
;
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录