Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f2fb2b8c
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,发现更多精彩内容 >>
未验证
提交
f2fb2b8c
编写于
5月 31, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename viewType to notebookType,
https://github.com/microsoft/vscode/issues/122922
上级
220f89ba
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
43 addition
and
26 deletion
+43
-26
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+18
-14
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
+1
-1
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/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostNotebookDocument.ts
src/vs/workbench/api/common/extHostNotebookDocument.ts
+3
-2
src/vs/workbench/api/common/extHostNotebookKernels.ts
src/vs/workbench/api/common/extHostNotebookKernels.ts
+3
-2
src/vs/workbench/contrib/notebook/browser/extensionPoint.ts
src/vs/workbench/contrib/notebook/browser/extensionPoint.ts
+13
-2
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
...workbench/contrib/notebook/browser/notebookServiceImpl.ts
+1
-1
src/vs/workbench/test/browser/api/extHostNotebookKernel2.test.ts
...workbench/test/browser/api/extHostNotebookKernel2.test.ts
+1
-1
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
f2fb2b8c
...
...
@@ -11371,11 +11371,14 @@ declare module 'vscode' {
*/
readonly
uri
:
Uri
;
/** @deprecated */
// todo@API remove
readonly
viewType
:
string
;
/**
* The type of notebook.
*/
// todo@API should this be called `notebookType` or `notebookKind`
readonly
viewType
:
string
;
readonly
notebookType
:
string
;
/**
* The version number of this notebook (it will strictly increase after each
...
...
@@ -11872,15 +11875,14 @@ declare module 'vscode' {
* A notebook controller represents an entity that can execute notebook cells. This is often referred to as a kernel.
*
* There can be multiple controllers and the editor will let users choose which controller to use for a certain notebook. The
* {@link NotebookController.
viewType `view
Type`}-property defines for what kind of notebooks a controller is for and
* {@link NotebookController.
notebookType `notebook
Type`}-property defines for what kind of notebooks a controller is for and
* the {@link NotebookController.updateNotebookAffinity `updateNotebookAffinity`}-function allows controllers to set a preference
* for specific notebooks.
* for specific notebook
document
s.
*
* When a cell is being run the editor will invoke the {@link NotebookController.executeHandler `executeHandler`} and a controller
* is expected to create and finalize a {@link NotebookCellExecution notebook cell execution}. However, controllers are also free
* to create executions by themselves.
*/
// todo@api adopt notebookType-rename in comment
export
interface
NotebookController
{
/**
...
...
@@ -11891,11 +11893,14 @@ declare module 'vscode' {
*/
readonly
id
:
string
;
// todo@api remove
/** @deprecated */
readonly
viewType
:
string
;
/**
* The notebook
view
type this controller is for.
* The notebook type this controller is for.
*/
// todo@api rename to notebookType
readonly
viewType
:
string
;
readonly
notebookType
:
string
;
/**
* An array of language identifiers that are supported by this
...
...
@@ -12217,11 +12222,11 @@ declare module 'vscode' {
* path when the document is to be saved.
*
* @see {@link openNotebookDocument}
* @param
viewType The notebook view
type that should be used.
* @param
notebookType The notebook
type that should be used.
* @param content The initial contents of the notebook.
* @returns A promise that resolves to a {@link NotebookDocument notebook}.
*/
export
function
openNotebookDocument
(
view
Type
:
string
,
content
?:
NotebookData
):
Thenable
<
NotebookDocument
>
;
export
function
openNotebookDocument
(
notebook
Type
:
string
,
content
?:
NotebookData
):
Thenable
<
NotebookDocument
>
;
/**
* An event that is emitted when a {@link NotebookDocument notebook} is opened.
...
...
@@ -12255,17 +12260,16 @@ declare module 'vscode' {
* Creates a new notebook controller.
*
* @param id Identifier of the controller. Must be unique per extension.
* @param
viewType A notebook view
type for which this controller is for.
* @param
notebookType A notebook
type for which this controller is for.
* @param label The label of the controller.
* @param handler The execute-handler of the controller.
*/
//todo@API adopt viewType -> notebookType rename
export
function
createNotebookController
(
id
:
string
,
viewType
:
string
,
label
:
string
,
handler
?:
NotebookExecuteHandler
):
NotebookController
;
export
function
createNotebookController
(
id
:
string
,
notebookType
:
string
,
label
:
string
,
handler
?:
NotebookExecuteHandler
):
NotebookController
;
/**
* Register a {@link NotebookCellStatusBarItemProvider cell statusbar item provider} for the given notebook type.
*
* @param notebookType The notebook
view
type to register for.
* @param notebookType The notebook type to register for.
* @param provider A cell status bar provider.
* @return A {@link Disposable} that unregisters this provider when being disposed.
*/
...
...
src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
浏览文件 @
f2fb2b8c
...
...
@@ -44,7 +44,7 @@ abstract class MainThreadKernel implements INotebookKernel {
constructor
(
data
:
INotebookKernelDto2
,
private
_modeService
:
IModeService
)
{
this
.
id
=
data
.
id
;
this
.
viewType
=
data
.
view
Type
;
this
.
viewType
=
data
.
notebook
Type
;
this
.
extension
=
data
.
extensionId
;
this
.
implementsInterrupt
=
data
.
supportsInterrupt
??
false
;
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
f2fb2b8c
...
...
@@ -1079,8 +1079,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
registerNotebookSerializer
(
viewType
:
string
,
serializer
:
vscode
.
NotebookSerializer
,
options
?:
vscode
.
NotebookDocumentContentOptions
,
registration
?:
vscode
.
NotebookRegistrationData
)
{
return
extHostNotebook
.
registerNotebookSerializer
(
extension
,
viewType
,
serializer
,
options
,
extension
.
enableProposedApi
?
registration
:
undefined
);
},
createNotebookController
(
id
:
string
,
view
Type
:
string
,
label
:
string
,
handler
?:
vscode
.
NotebookExecuteHandler
,
rendererScripts
?:
vscode
.
NotebookRendererScript
[])
{
return
extHostNotebookKernels
.
createNotebookController
(
extension
,
id
,
view
Type
,
label
,
handler
,
extension
.
enableProposedApi
?
rendererScripts
:
undefined
);
createNotebookController
(
id
:
string
,
notebook
Type
:
string
,
label
:
string
,
handler
?:
vscode
.
NotebookExecuteHandler
,
rendererScripts
?:
vscode
.
NotebookRendererScript
[])
{
return
extHostNotebookKernels
.
createNotebookController
(
extension
,
id
,
notebook
Type
,
label
,
handler
,
extension
.
enableProposedApi
?
rendererScripts
:
undefined
);
},
registerNotebookCellStatusBarItemProvider
:
(
notebookType
:
string
,
provider
:
vscode
.
NotebookCellStatusBarItemProvider
)
=>
{
return
extHostNotebook
.
registerNotebookCellStatusBarItemProvider
(
extension
,
notebookType
,
provider
);
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
f2fb2b8c
...
...
@@ -907,7 +907,7 @@ export interface MainThreadNotebookDocumentsShape extends IDisposable {
export
interface
INotebookKernelDto2
{
id
:
string
;
view
Type
:
string
;
notebook
Type
:
string
;
extensionId
:
ExtensionIdentifier
;
extensionLocation
:
UriComponents
;
label
:
string
;
...
...
src/vs/workbench/api/common/extHostNotebookDocument.ts
浏览文件 @
f2fb2b8c
...
...
@@ -144,7 +144,7 @@ export class ExtHostNotebookDocument {
private
readonly
_textDocumentsAndEditors
:
ExtHostDocumentsAndEditors
,
private
readonly
_textDocuments
:
ExtHostDocuments
,
private
readonly
_emitter
:
INotebookEventEmitter
,
private
readonly
_
view
Type
:
string
,
private
readonly
_
notebook
Type
:
string
,
private
_metadata
:
extHostTypes
.
NotebookDocumentMetadata
,
readonly
uri
:
URI
,
)
{
}
...
...
@@ -159,7 +159,8 @@ export class ExtHostNotebookDocument {
this
.
_notebook
=
{
get
uri
()
{
return
that
.
uri
;
},
get
version
()
{
return
that
.
_versionId
;
},
get
viewType
()
{
return
that
.
_viewType
;
},
get
viewType
()
{
return
that
.
_notebookType
;
},
get
notebookType
()
{
return
that
.
_notebookType
;
},
get
isDirty
()
{
return
that
.
_isDirty
;
},
get
isUntitled
()
{
return
that
.
uri
.
scheme
===
Schemas
.
untitled
;
},
get
isClosed
()
{
return
that
.
_disposed
;
},
...
...
src/vs/workbench/api/common/extHostNotebookKernels.ts
浏览文件 @
f2fb2b8c
...
...
@@ -72,7 +72,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
const
data
:
INotebookKernelDto2
=
{
id
:
`
${
extension
.
identifier
.
value
}
/
${
id
}
`
,
viewType
,
notebookType
:
viewType
,
extensionId
:
extension
.
identifier
,
extensionLocation
:
extension
.
extensionLocation
,
label
:
label
||
extension
.
identifier
.
value
,
...
...
@@ -111,7 +111,8 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
const
controller
:
vscode
.
NotebookController
=
{
get
id
()
{
return
id
;
},
get
viewType
()
{
return
data
.
viewType
;
},
get
viewType
()
{
return
data
.
notebookType
;
},
get
notebookType
()
{
return
data
.
notebookType
;
},
onDidChangeNotebookAssociation
:
onDidChangeSelection
.
event
,
get
label
()
{
return
data
.
label
;
...
...
src/vs/workbench/contrib/notebook/browser/extensionPoint.ts
浏览文件 @
f2fb2b8c
...
...
@@ -9,6 +9,8 @@ import { ExtensionsRegistry } from 'vs/workbench/services/extensions/common/exte
import
{
NotebookEditorPriority
,
NotebookRendererEntrypoint
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
namespace
NotebookEditorContribution
{
export
const
type
=
'
type
'
;
/** @deprecated use type */
export
const
viewType
=
'
viewType
'
;
export
const
displayName
=
'
displayName
'
;
export
const
selector
=
'
selector
'
;
...
...
@@ -16,6 +18,8 @@ namespace NotebookEditorContribution {
}
export
interface
INotebookEditorContribution
{
readonly
[
NotebookEditorContribution
.
type
]:
string
;
/** @deprecated use type */
readonly
[
NotebookEditorContribution
.
viewType
]:
string
;
readonly
[
NotebookEditorContribution
.
displayName
]:
string
;
readonly
[
NotebookEditorContribution
.
selector
]?:
readonly
{
filenamePattern
?:
string
;
excludeFileNamePattern
?:
string
;
}[];
...
...
@@ -23,6 +27,7 @@ export interface INotebookEditorContribution {
}
namespace
NotebookRendererContribution
{
/** @deprecated use type */
export
const
viewType
=
'
viewType
'
;
export
const
id
=
'
id
'
;
export
const
displayName
=
'
displayName
'
;
...
...
@@ -35,6 +40,7 @@ namespace NotebookRendererContribution {
export
interface
INotebookRendererContribution
{
readonly
[
NotebookRendererContribution
.
id
]?:
string
;
/** @deprecated use type */
readonly
[
NotebookRendererContribution
.
viewType
]?:
string
;
readonly
[
NotebookRendererContribution
.
displayName
]:
string
;
readonly
[
NotebookRendererContribution
.
mimeTypes
]?:
readonly
string
[];
...
...
@@ -47,17 +53,22 @@ export interface INotebookRendererContribution {
const
notebookProviderContribution
:
IJSONSchema
=
{
description
:
nls
.
localize
(
'
contributes.notebook.provider
'
,
'
Contributes notebook document provider.
'
),
type
:
'
array
'
,
defaultSnippets
:
[{
body
:
[{
viewT
ype
:
''
,
displayName
:
''
,
'
selector
'
:
[{
'
filenamePattern
'
:
''
}]
}]
}],
defaultSnippets
:
[{
body
:
[{
t
ype
:
''
,
displayName
:
''
,
'
selector
'
:
[{
'
filenamePattern
'
:
''
}]
}]
}],
items
:
{
type
:
'
object
'
,
required
:
[
NotebookEditorContribution
.
viewT
ype
,
NotebookEditorContribution
.
t
ype
,
NotebookEditorContribution
.
displayName
,
NotebookEditorContribution
.
selector
,
],
properties
:
{
[
NotebookEditorContribution
.
type
]:
{
type
:
'
string
'
,
description
:
nls
.
localize
(
'
contributes.notebook.provider.viewType
'
,
'
Unique identifier of the notebook.
'
),
},
[
NotebookEditorContribution
.
viewType
]:
{
type
:
'
string
'
,
deprecationMessage
:
nls
.
localize
(
'
contributes.notebook.provider.viewType.deprecated
'
,
'
Rename `viewType` to `id`.
'
),
description
:
nls
.
localize
(
'
contributes.notebook.provider.viewType
'
,
'
Unique identifier of the notebook.
'
),
},
[
NotebookEditorContribution
.
displayName
]:
{
...
...
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
浏览文件 @
f2fb2b8c
...
...
@@ -96,7 +96,7 @@ export class NotebookProviderInfoStore extends Disposable {
for
(
const
notebookContribution
of
extension
.
value
)
{
this
.
add
(
new
NotebookProviderInfo
({
extension
:
extension
.
description
.
identifier
,
id
:
notebookContribution
.
viewType
,
id
:
notebookContribution
.
type
||
notebookContribution
.
viewType
,
displayName
:
notebookContribution
.
displayName
,
selectors
:
notebookContribution
.
selector
||
[],
priority
:
this
.
_convertPriority
(
notebookContribution
.
priority
),
...
...
src/vs/workbench/test/browser/api/extHostNotebookKernel2.test.ts
浏览文件 @
f2fb2b8c
...
...
@@ -138,7 +138,7 @@ suite('NotebookKernel', function () {
assert
.
strictEqual
(
first
.
id
,
'
nullExtensionDescription/foo
'
);
assert
.
strictEqual
(
ExtensionIdentifier
.
equals
(
first
.
extensionId
,
nullExtensionDescription
.
identifier
),
true
);
assert
.
strictEqual
(
first
.
label
,
'
Foo
'
);
assert
.
strictEqual
(
first
.
view
Type
,
'
*
'
);
assert
.
strictEqual
(
first
.
notebook
Type
,
'
*
'
);
kernel
.
dispose
();
await
rpcProtocol
.
sync
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录