Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f4755117
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,发现更多精彩内容 >>
提交
f4755117
编写于
7月 17, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kernel change event.
上级
f33c9c14
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
55 addition
and
12 deletion
+55
-12
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+2
-2
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+12
-2
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+0
-4
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
+22
-4
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
...workbench/contrib/notebook/browser/notebookServiceImpl.ts
+14
-0
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+3
-0
src/vs/workbench/contrib/notebook/common/notebookService.ts
src/vs/workbench/contrib/notebook/common/notebookService.ts
+1
-0
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
f4755117
...
...
@@ -1822,6 +1822,7 @@ declare module 'vscode' {
}
export
interface
NotebookKernel
{
readonly
id
:
string
;
label
:
string
;
description
?:
string
;
isPreferred
?:
boolean
;
...
...
@@ -1890,8 +1891,7 @@ declare module 'vscode' {
*/
export
function
createConcatTextDocument
(
notebook
:
NotebookDocument
,
selector
?:
DocumentSelector
):
NotebookConcatTextDocument
;
export
let
activeNotebookKernel
:
NotebookKernel
|
undefined
;
export
const
onDidChangeActiveNotebookKernel
:
Event
<
void
>
;
export
const
onDidChangeActiveNotebookKernel
:
Event
<
{
document
:
NotebookDocument
,
kernel
:
NotebookKernel
|
undefined
}
>
;
}
//#endregion
...
...
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
f4755117
...
...
@@ -308,6 +308,10 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
this
.
_updateState
();
}));
this
.
_register
(
this
.
_notebookService
.
onDidChangeNotebookActiveKernel
(
e
=>
{
this
.
_proxy
.
$acceptNotebookActiveKernelChange
(
e
);
}));
const
updateOrder
=
()
=>
{
let
userOrder
=
this
.
configurationService
.
getValue
<
string
[]
>
(
'
notebook.displayOrder
'
);
this
.
_proxy
.
$acceptDisplayOrder
({
...
...
@@ -464,8 +468,14 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
const
provider
=
this
.
_notebookService
.
registerNotebookKernelProvider
({
onDidChangeKernels
:
emitter
.
event
,
selector
:
documentFilter
,
provideKernels
:
(
uri
:
URI
,
token
:
CancellationToken
)
=>
{
return
that
.
_proxy
.
$provideNotebookKernels
(
handle
,
uri
,
token
);
provideKernels
:
async
(
uri
:
URI
,
token
:
CancellationToken
)
=>
{
const
kernels
=
await
that
.
_proxy
.
$provideNotebookKernels
(
handle
,
uri
,
token
);
return
kernels
.
map
(
kernel
=>
{
return
{
...
kernel
,
providerHandle
:
handle
};
});
},
resolveKernel
:
(
editorId
:
string
,
uri
:
URI
,
kernelId
:
string
,
token
:
CancellationToken
)
=>
{
return
that
.
_proxy
.
$resolveNotebookKernel
(
handle
,
editorId
,
uri
,
kernelId
,
token
);
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
f4755117
...
...
@@ -933,10 +933,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
checkProposedApiEnabled
(
extension
);
return
extHostNotebook
.
onDidChangeVisibleNotebookEditors
;
},
get
activeNotebookKernel
()
{
checkProposedApiEnabled
(
extension
);
return
extHostNotebook
.
activeNotebookKernel
;
},
get
onDidChangeActiveNotebookKernel
()
{
checkProposedApiEnabled
(
extension
);
return
extHostNotebook
.
onDidChangeActiveNotebookKernel
;
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
f4755117
...
...
@@ -1623,6 +1623,7 @@ export interface ExtHostNotebookShape {
$saveNotebookAs
(
viewType
:
string
,
uri
:
UriComponents
,
target
:
UriComponents
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
$backup
(
viewType
:
string
,
uri
:
UriComponents
,
cancellation
:
CancellationToken
):
Promise
<
string
|
undefined
>
;
$acceptDisplayOrder
(
displayOrder
:
INotebookDisplayOrder
):
void
;
$acceptNotebookActiveKernelChange
(
event
:
{
uri
:
UriComponents
,
providerHandle
:
number
|
undefined
,
kernelId
:
string
|
undefined
}):
void
;
$renderOutputs
(
uriComponents
:
UriComponents
,
id
:
string
,
request
:
IOutputRenderRequest
<
UriComponents
>
):
Promise
<
IOutputRenderResponse
<
UriComponents
>
|
undefined
>
;
$renderOutputs2
<
T
>
(
uriComponents
:
UriComponents
,
id
:
string
,
request
:
IOutputRenderRequest
<
T
>
):
Promise
<
IOutputRenderResponse
<
T
>
|
undefined
>
;
$onDidReceiveMessage
(
editorId
:
string
,
rendererId
:
string
|
undefined
,
message
:
unknown
):
void
;
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
f4755117
...
...
@@ -767,11 +767,18 @@ export class ExtHostNotebookKernelProviderAdapter extends Disposable {
const
data
=
await
this
.
_provider
.
provideKernels
(
document
,
token
)
||
[];
const
newMap
=
new
Map
<
vscode
.
NotebookKernel
,
string
>
();
let
kernel_unique_pool
=
0
;
let
kernelIdCache
=
new
Set
<
string
>
();
const
transformedData
:
INotebookKernelInfoDto2
[]
=
data
.
map
(
kernel
=>
{
let
id
=
this
.
_kernelToId
.
get
(
kernel
);
if
(
id
===
undefined
)
{
id
=
UUID
.
generateUuid
();
if
(
kernel
.
id
&&
kernelIdCache
.
has
(
kernel
.
id
))
{
id
=
`
${
this
.
_extension
.
identifier
.
value
}
_
${
kernel
.
id
}
_
${
kernel_unique_pool
++
}
`
;
}
else
{
id
=
`
${
this
.
_extension
.
identifier
.
value
}
_
${
kernel
.
id
||
UUID
.
generateUuid
()}
`
;
}
this
.
_kernelToId
.
set
(
kernel
,
id
);
}
...
...
@@ -798,6 +805,10 @@ export class ExtHostNotebookKernelProviderAdapter extends Disposable {
return
transformedData
;
}
getKernel
(
kernelId
:
string
)
{
return
this
.
_idToKernel
.
get
(
kernelId
);
}
async
resolveNotebook
(
kernelId
:
string
,
document
:
ExtHostNotebookDocument
,
webview
:
vscode
.
NotebookCommunication
,
token
:
CancellationToken
)
{
const
kernel
=
this
.
_idToKernel
.
get
(
kernelId
);
...
...
@@ -864,9 +875,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
private
_onDidCloseNotebookDocument
=
new
Emitter
<
vscode
.
NotebookDocument
>
();
onDidCloseNotebookDocument
:
Event
<
vscode
.
NotebookDocument
>
=
this
.
_onDidCloseNotebookDocument
.
event
;
visibleNotebookEditors
:
ExtHostNotebookEditor
[]
=
[];
activeNotebookKernel
?:
vscode
.
NotebookKernel
;
private
_onDidChangeActiveNotebookKernel
=
new
Emitter
<
void
>
();
private
_onDidChangeActiveNotebookKernel
=
new
Emitter
<
{
document
:
ExtHostNotebookDocument
,
kernel
:
vscode
.
NotebookKernel
|
undefined
}
>
();
onDidChangeActiveNotebookKernel
=
this
.
_onDidChangeActiveNotebookKernel
.
event
;
private
_onDidChangeVisibleNotebookEditors
=
new
Emitter
<
vscode
.
NotebookEditor
[]
>
();
onDidChangeVisibleNotebookEditors
=
this
.
_onDidChangeVisibleNotebookEditors
.
event
;
...
...
@@ -1314,6 +1323,15 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
this
.
_outputDisplayOrder
=
displayOrder
;
}
$acceptNotebookActiveKernelChange
(
event
:
{
uri
:
UriComponents
,
providerHandle
:
number
|
undefined
,
kernelId
:
string
|
undefined
})
{
if
(
event
.
providerHandle
!==
undefined
)
{
this
.
_withAdapter
(
event
.
providerHandle
,
event
.
uri
,
async
(
adapter
,
document
)
=>
{
const
kernel
=
event
.
kernelId
?
adapter
.
getKernel
(
event
.
kernelId
)
:
undefined
;
this
.
_onDidChangeActiveNotebookKernel
.
fire
({
document
,
kernel
});
});
}
}
// TODO: remove document - editor one on one mapping
private
_getEditorFromURI
(
uriComponents
:
UriComponents
)
{
const
uriStr
=
URI
.
revive
(
uriComponents
).
toString
();
...
...
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
浏览文件 @
f4755117
...
...
@@ -174,6 +174,7 @@ export class NotebookService extends Disposable implements INotebookService, ICu
private
readonly
_models
=
new
Map
<
string
,
ModelData
>
();
private
_onDidChangeActiveEditor
=
new
Emitter
<
string
|
null
>
();
onDidChangeActiveEditor
:
Event
<
string
|
null
>
=
this
.
_onDidChangeActiveEditor
.
event
;
private
_activeEditorDisposables
=
new
DisposableStore
();
private
_onDidChangeVisibleEditors
=
new
Emitter
<
string
[]
>
();
onDidChangeVisibleEditors
:
Event
<
string
[]
>
=
this
.
_onDidChangeVisibleEditors
.
event
;
private
readonly
_onNotebookEditorAdd
:
Emitter
<
INotebookEditor
>
=
this
.
_register
(
new
Emitter
<
INotebookEditor
>
());
...
...
@@ -191,6 +192,8 @@ export class NotebookService extends Disposable implements INotebookService, ICu
private
readonly
_onDidChangeKernels
=
new
Emitter
<
void
>
();
onDidChangeKernels
:
Event
<
void
>
=
this
.
_onDidChangeKernels
.
event
;
private
readonly
_onDidChangeNotebookActiveKernel
=
new
Emitter
<
{
uri
:
URI
,
providerHandle
:
number
|
undefined
,
kernelId
:
string
|
undefined
}
>
();
onDidChangeNotebookActiveKernel
:
Event
<
{
uri
:
URI
,
providerHandle
:
number
|
undefined
,
kernelId
:
string
|
undefined
}
>
=
this
.
_onDidChangeNotebookActiveKernel
.
event
;
private
cutItems
:
NotebookCellTextModel
[]
|
undefined
;
private
_lastClipboardIsCopy
:
boolean
=
true
;
...
...
@@ -768,6 +771,17 @@ export class NotebookService extends Disposable implements INotebookService, ICu
}
updateActiveNotebookEditor
(
editor
:
INotebookEditor
|
null
)
{
this
.
_activeEditorDisposables
.
clear
();
if
(
editor
)
{
this
.
_activeEditorDisposables
.
add
(
editor
.
onDidChangeKernel
(()
=>
{
this
.
_onDidChangeNotebookActiveKernel
.
fire
({
uri
:
editor
.
uri
!
,
providerHandle
:
editor
.
activeKernel
?.
providerHandle
,
kernelId
:
editor
.
activeKernel
?.
id
});
}));
}
this
.
_onDidChangeActiveEditor
.
fire
(
editor
?
editor
.
getId
()
:
null
);
}
...
...
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
浏览文件 @
f4755117
...
...
@@ -118,7 +118,9 @@ export interface INotebookKernelInfo {
extension
:
ExtensionIdentifier
;
extensionLocation
:
URI
,
preloads
:
URI
[];
providerHandle
?:
number
;
executeNotebook
(
viewType
:
string
,
uri
:
URI
,
handle
:
number
|
undefined
,
token
:
CancellationToken
):
Promise
<
void
>
;
}
export
interface
INotebookKernelInfoDto
{
...
...
@@ -641,6 +643,7 @@ export interface INotebookKernelInfoDto2 {
label
:
string
;
extension
:
ExtensionIdentifier
;
extensionLocation
:
URI
;
providerHandle
?:
number
;
description
?:
string
;
isPreferred
?:
boolean
;
preloads
?:
UriComponents
[];
...
...
src/vs/workbench/contrib/notebook/common/notebookService.ts
浏览文件 @
f4755117
...
...
@@ -43,6 +43,7 @@ export interface INotebookService {
onNotebookDocumentRemove
:
Event
<
URI
[]
>
;
onNotebookDocumentAdd
:
Event
<
URI
[]
>
;
onDidChangeKernels
:
Event
<
void
>
;
onDidChangeNotebookActiveKernel
:
Event
<
{
uri
:
URI
,
providerHandle
:
number
|
undefined
,
kernelId
:
string
|
undefined
}
>
;
registerNotebookController
(
viewType
:
string
,
extensionData
:
NotebookExtensionDescription
,
controller
:
IMainNotebookController
):
void
;
unregisterNotebookProvider
(
viewType
:
string
):
void
;
registerNotebookRenderer
(
id
:
string
,
renderer
:
INotebookRendererInfo
):
void
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录