Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f9fec24b
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,发现更多精彩内容 >>
未验证
提交
f9fec24b
编写于
4月 19, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make INotebookKernel2 extends INotebookKernel
上级
6b9bd789
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
51 deletion
+25
-51
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
+11
-6
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+2
-2
src/vs/workbench/api/common/extHostNotebookKernels.ts
src/vs/workbench/api/common/extHostNotebookKernels.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/notebookKernelServiceImpl.ts
...nch/contrib/notebook/browser/notebookKernelServiceImpl.ts
+2
-22
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+6
-2
src/vs/workbench/contrib/notebook/common/notebookKernelService.ts
...orkbench/contrib/notebook/common/notebookKernelService.ts
+2
-17
未找到文件。
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
浏览文件 @
f9fec24b
...
...
@@ -89,8 +89,13 @@ abstract class MainThreadKernel implements INotebookKernel2 {
this
.
_onDidChange
.
fire
(
event
);
}
abstract
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
void
;
abstract
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
void
;
abstract
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
;
abstract
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
;
// old stuff
readonly
resolve
=
()
=>
Promise
.
resolve
();
get
friendlyId
()
{
return
this
.
id
;
}
get
providerHandle
()
{
return
undefined
;
}
}
@
extHostNamedCustomer
(
MainContext
.
MainThreadNotebookKernels
)
...
...
@@ -185,11 +190,11 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
async
$addKernel
(
handle
:
number
,
data
:
INotebookKernelDto2
):
Promise
<
void
>
{
const
that
=
this
;
const
kernel
=
new
class
extends
MainThreadKernel
{
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
void
{
that
.
_proxy
.
$executeCells
(
handle
,
uri
,
ranges
);
async
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
{
await
that
.
_proxy
.
$executeCells
(
handle
,
uri
,
ranges
);
}
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
void
{
that
.
_proxy
.
$cancelCells
(
handle
,
uri
,
ranges
);
async
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
{
await
that
.
_proxy
.
$cancelCells
(
handle
,
uri
,
ranges
);
}
}(
data
);
const
registration
=
this
.
_notebookKernelService
.
registerKernel
(
kernel
);
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
f9fec24b
...
...
@@ -1964,8 +1964,8 @@ export interface ExtHostNotebookEditorsShape {
export
interface
ExtHostNotebookKernelsShape
{
$acceptSelection
(
handle
:
number
,
uri
:
UriComponents
,
value
:
boolean
):
void
;
$executeCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
void
;
$cancelCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
void
;
$executeCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
Promise
<
void
>
;
$cancelCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
Promise
<
void
>
;
$acceptRendererMessage
(
handle
:
number
,
editorId
:
string
,
message
:
any
):
void
;
}
...
...
src/vs/workbench/api/common/extHostNotebookKernels.ts
浏览文件 @
f9fec24b
...
...
@@ -199,7 +199,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
}
}
$executeCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
void
{
async
$executeCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
Promise
<
void
>
{
const
obj
=
this
.
_kernelData
.
get
(
handle
);
if
(
!
obj
)
{
// extension can dispose kernels in the meantime
...
...
@@ -223,7 +223,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
}
}
$cancelCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
void
{
async
$cancelCells
(
handle
:
number
,
uri
:
UriComponents
,
ranges
:
ICellRange
[]):
Promise
<
void
>
{
const
obj
=
this
.
_kernelData
.
get
(
handle
);
if
(
!
obj
)
{
// extension can dispose kernels in the meantime
...
...
src/vs/workbench/contrib/notebook/browser/notebookKernelServiceImpl.ts
浏览文件 @
f9fec24b
...
...
@@ -5,7 +5,7 @@
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
DisposableStore
,
dispose
,
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
I
CellRange
,
INotebookKernel
,
I
NotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
INotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
INotebookKernelBindEvent
,
INotebookKernel2
,
INotebookKernelService
}
from
'
vs/workbench/contrib/notebook/common/notebookKernelService
'
;
import
{
score
}
from
'
vs/workbench/contrib/notebook/common/notebookSelector
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
...
...
@@ -143,31 +143,11 @@ class KernelAdaptorBridge implements IWorkbenchContribution {
providerExtensionId
:
'
notAnExtension
'
,
selector
:
{
filenamePattern
:
'
**/*
'
},
async
provideKernels
(
uri
:
URI
)
{
const
model
=
notebookService
.
getNotebookTextModel
(
uri
);
if
(
!
model
)
{
return
[];
}
return
notebookKernelService
.
getMatchingKernels
(
model
).
map
((
kernel
:
INotebookKernel2
):
INotebookKernel
=>
{
return
{
id
:
kernel
.
id
,
friendlyId
:
kernel
.
id
,
label
:
kernel
.
label
,
description
:
kernel
.
description
,
detail
:
kernel
.
detail
,
isPreferred
:
kernel
.
isPreferred
,
preloadUris
:
kernel
.
preloadUris
,
preloadProvides
:
kernel
.
preloadProvides
,
localResourceRoot
:
kernel
.
localResourceRoot
,
supportedLanguages
:
kernel
.
supportedLanguages
,
implementsInterrupt
:
kernel
.
implementsInterrupt
,
implementsExecutionOrder
:
kernel
.
implementsExecutionOrder
,
extension
:
kernel
.
extension
,
async
resolve
()
{
},
async
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
{
kernel
.
executeNotebookCellsRequest
(
uri
,
ranges
);
},
async
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
{
kernel
.
cancelNotebookCellExecution
(
uri
,
ranges
);
},
};
});
return
notebookKernelService
.
getMatchingKernels
(
model
);
}
});
...
...
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
浏览文件 @
f9fec24b
...
...
@@ -764,12 +764,17 @@ export function notebookDocumentFilterMatch(filter: INotebookDocumentFilter, vie
}
export
interface
INotebookKernel
{
/** @deprecated */
providerHandle
?:
number
;
/** @deprecated */
resolve
(
uri
:
URI
,
editorId
:
string
,
token
:
CancellationToken
):
Promise
<
void
>
;
id
?:
string
;
friendlyId
:
string
;
label
:
string
;
extension
:
ExtensionIdentifier
;
localResourceRoot
:
URI
;
providerHandle
?:
number
;
description
?:
string
;
detail
?:
string
;
isPreferred
?:
boolean
;
...
...
@@ -779,7 +784,6 @@ export interface INotebookKernel {
implementsInterrupt
?:
boolean
;
implementsExecutionOrder
?:
boolean
;
resolve
(
uri
:
URI
,
editorId
:
string
,
token
:
CancellationToken
):
Promise
<
void
>
;
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
;
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
Promise
<
void
>
;
}
...
...
src/vs/workbench/contrib/notebook/common/notebookKernelService.ts
浏览文件 @
f9fec24b
...
...
@@ -8,7 +8,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
I
CellRange
,
INotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
I
NotebookKernel
,
INotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
NotebookSelector
}
from
'
vs/workbench/contrib/notebook/common/notebookSelector
'
;
export
interface
INotebookKernel2ChangeEvent
{
...
...
@@ -20,28 +20,13 @@ export interface INotebookKernel2ChangeEvent {
hasExecutionOrder
?:
true
;
}
export
interface
INotebookKernel2
{
export
interface
INotebookKernel2
extends
INotebookKernel
{
readonly
id
:
string
;
readonly
selector
:
NotebookSelector
readonly
extension
:
ExtensionIdentifier
;
readonly
onDidChange
:
Event
<
INotebookKernel2ChangeEvent
>
;
label
:
string
;
description
?:
string
;
detail
?:
string
;
isPreferred
?:
boolean
;
supportedLanguages
:
string
[];
implementsExecutionOrder
:
boolean
;
implementsInterrupt
:
boolean
;
localResourceRoot
:
URI
;
preloadUris
:
URI
[];
preloadProvides
:
string
[];
executeNotebookCellsRequest
(
uri
:
URI
,
ranges
:
ICellRange
[]):
void
;
cancelNotebookCellExecution
(
uri
:
URI
,
ranges
:
ICellRange
[]):
void
}
export
interface
INotebookKernelBindEvent
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录