Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
662ea121
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,发现更多精彩内容 >>
未验证
提交
662ea121
编写于
4月 15, 2021
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NotebookCellRange is now NotebookRange.
上级
ebb0a716
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
37 addition
and
39 deletion
+37
-39
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+11
-13
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+6
-6
src/vs/workbench/api/common/extHostNotebookDocument.ts
src/vs/workbench/api/common/extHostNotebookDocument.ts
+2
-2
src/vs/workbench/api/common/extHostNotebookEditor.ts
src/vs/workbench/api/common/extHostNotebookEditor.ts
+9
-9
src/vs/workbench/api/common/extHostNotebookKernels.ts
src/vs/workbench/api/common/extHostNotebookKernels.ts
+1
-1
src/vs/workbench/api/common/extHostTypeConverters.ts
src/vs/workbench/api/common/extHostTypeConverters.ts
+4
-4
src/vs/workbench/api/common/extHostTypes.ts
src/vs/workbench/api/common/extHostTypes.ts
+3
-3
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
662ea121
...
@@ -1079,7 +1079,7 @@ declare module 'vscode' {
...
@@ -1079,7 +1079,7 @@ declare module 'vscode' {
* @param range A notebook range.
* @param range A notebook range.
* @returns The cells contained by the range or all cells.
* @returns The cells contained by the range or all cells.
*/
*/
getCells
(
range
?:
Notebook
Cell
Range
):
NotebookCell
[];
getCells
(
range
?:
NotebookRange
):
NotebookCell
[];
/**
/**
* Save the document. The saving will be handled by the corresponding content provider
* Save the document. The saving will be handled by the corresponding content provider
...
@@ -1091,9 +1091,7 @@ declare module 'vscode' {
...
@@ -1091,9 +1091,7 @@ declare module 'vscode' {
save
():
Thenable
<
boolean
>
;
save
():
Thenable
<
boolean
>
;
}
}
// todo@API RENAME to NotebookRange
export
class
NotebookRange
{
// todo@API maybe have a NotebookCellPosition sibling
export
class
NotebookCellRange
{
readonly
start
:
number
;
readonly
start
:
number
;
/**
/**
* exclusive
* exclusive
...
@@ -1104,7 +1102,7 @@ declare module 'vscode' {
...
@@ -1104,7 +1102,7 @@ declare module 'vscode' {
constructor
(
start
:
number
,
end
:
number
);
constructor
(
start
:
number
,
end
:
number
);
with
(
change
:
{
start
?:
number
,
end
?:
number
}):
Notebook
Cell
Range
;
with
(
change
:
{
start
?:
number
,
end
?:
number
}):
NotebookRange
;
}
}
export
enum
NotebookEditorRevealType
{
export
enum
NotebookEditorRevealType
{
...
@@ -1140,14 +1138,14 @@ declare module 'vscode' {
...
@@ -1140,14 +1138,14 @@ declare module 'vscode' {
*
*
* The primary selection (or focused range) is `selections[0]`. When the document has no cells, the primary selection is empty `{ start: 0, end: 0 }`;
* The primary selection (or focused range) is `selections[0]`. When the document has no cells, the primary selection is empty `{ start: 0, end: 0 }`;
*/
*/
readonly
selections
:
Notebook
Cell
Range
[];
readonly
selections
:
NotebookRange
[];
/**
/**
* The current visible ranges in the editor (vertically).
* The current visible ranges in the editor (vertically).
*/
*/
readonly
visibleRanges
:
Notebook
Cell
Range
[];
readonly
visibleRanges
:
NotebookRange
[];
revealRange
(
range
:
Notebook
Cell
Range
,
revealType
?:
NotebookEditorRevealType
):
void
;
revealRange
(
range
:
NotebookRange
,
revealType
?:
NotebookEditorRevealType
):
void
;
/**
/**
* The column in which this editor shows.
* The column in which this editor shows.
...
@@ -1194,12 +1192,12 @@ declare module 'vscode' {
...
@@ -1194,12 +1192,12 @@ declare module 'vscode' {
export
interface
NotebookEditorSelectionChangeEvent
{
export
interface
NotebookEditorSelectionChangeEvent
{
readonly
notebookEditor
:
NotebookEditor
;
readonly
notebookEditor
:
NotebookEditor
;
readonly
selections
:
ReadonlyArray
<
Notebook
Cell
Range
>
readonly
selections
:
ReadonlyArray
<
NotebookRange
>
}
}
export
interface
NotebookEditorVisibleRangesChangeEvent
{
export
interface
NotebookEditorVisibleRangesChangeEvent
{
readonly
notebookEditor
:
NotebookEditor
;
readonly
notebookEditor
:
NotebookEditor
;
readonly
visibleRanges
:
ReadonlyArray
<
Notebook
Cell
Range
>
;
readonly
visibleRanges
:
ReadonlyArray
<
NotebookRange
>
;
}
}
export
interface
NotebookCellExecutionStateChangeEvent
{
export
interface
NotebookCellExecutionStateChangeEvent
{
...
@@ -1272,7 +1270,7 @@ declare module 'vscode' {
...
@@ -1272,7 +1270,7 @@ declare module 'vscode' {
viewColumn
?:
ViewColumn
;
viewColumn
?:
ViewColumn
;
preserveFocus
?:
boolean
;
preserveFocus
?:
boolean
;
preview
?:
boolean
;
preview
?:
boolean
;
selections
?:
Notebook
Cell
Range
[];
selections
?:
NotebookRange
[];
}
}
export
namespace
notebook
{
export
namespace
notebook
{
...
@@ -1595,7 +1593,7 @@ declare module 'vscode' {
...
@@ -1595,7 +1593,7 @@ declare module 'vscode' {
* createNotebookCellExecutionTask has not been called by the time the promise returned by this method is
* createNotebookCellExecutionTask has not been called by the time the promise returned by this method is
* resolved, the cell will be put back into the Idle state.
* resolved, the cell will be put back into the Idle state.
*/
*/
executeCellsRequest
(
document
:
NotebookDocument
,
ranges
:
Notebook
Cell
Range
[]):
Thenable
<
void
>
;
executeCellsRequest
(
document
:
NotebookDocument
,
ranges
:
NotebookRange
[]):
Thenable
<
void
>
;
}
}
export
interface
NotebookCellExecuteStartContext
{
export
interface
NotebookCellExecuteStartContext
{
...
@@ -1701,7 +1699,7 @@ declare module 'vscode' {
...
@@ -1701,7 +1699,7 @@ declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditorDecorationType
//#region https://github.com/microsoft/vscode/issues/106744, NotebookEditorDecorationType
export
interface
NotebookEditor
{
export
interface
NotebookEditor
{
setDecorations
(
decorationType
:
NotebookEditorDecorationType
,
range
:
Notebook
Cell
Range
):
void
;
setDecorations
(
decorationType
:
NotebookEditorDecorationType
,
range
:
NotebookRange
):
void
;
}
}
export
interface
NotebookDecorationRenderOptions
{
export
interface
NotebookDecorationRenderOptions
{
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
662ea121
...
@@ -1244,7 +1244,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
...
@@ -1244,7 +1244,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
SourceControlInputBoxValidationType
:
extHostTypes
.
SourceControlInputBoxValidationType
,
SourceControlInputBoxValidationType
:
extHostTypes
.
SourceControlInputBoxValidationType
,
ExtensionRuntime
:
extHostTypes
.
ExtensionRuntime
,
ExtensionRuntime
:
extHostTypes
.
ExtensionRuntime
,
TimelineItem
:
extHostTypes
.
TimelineItem
,
TimelineItem
:
extHostTypes
.
TimelineItem
,
Notebook
CellRange
:
extHostTypes
.
NotebookCell
Range
,
Notebook
Range
:
extHostTypes
.
Notebook
Range
,
NotebookCellKind
:
extHostTypes
.
NotebookCellKind
,
NotebookCellKind
:
extHostTypes
.
NotebookCellKind
,
NotebookCellExecutionState
:
extHostTypes
.
NotebookCellExecutionState
,
NotebookCellExecutionState
:
extHostTypes
.
NotebookCellExecutionState
,
NotebookDocumentMetadata
:
extHostTypes
.
NotebookDocumentMetadata
,
NotebookDocumentMetadata
:
extHostTypes
.
NotebookDocumentMetadata
,
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
662ea121
...
@@ -172,7 +172,7 @@ export class ExtHostNotebookKernelProviderAdapter extends Disposable {
...
@@ -172,7 +172,7 @@ export class ExtHostNotebookKernelProviderAdapter extends Disposable {
return
;
return
;
}
}
const
extCellRange
=
cellRange
.
map
(
c
=>
typeConverters
.
Notebook
Cell
Range
.
to
(
c
));
const
extCellRange
=
cellRange
.
map
(
c
=>
typeConverters
.
NotebookRange
.
to
(
c
));
return
kernel
.
executeCellsRequest
(
document
.
notebookDocument
,
extCellRange
);
return
kernel
.
executeCellsRequest
(
document
.
notebookDocument
,
extCellRange
);
}
}
...
@@ -468,7 +468,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
...
@@ -468,7 +468,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
resolvedOptions
=
{
resolvedOptions
=
{
position
:
typeConverters
.
ViewColumn
.
from
(
options
.
viewColumn
),
position
:
typeConverters
.
ViewColumn
.
from
(
options
.
viewColumn
),
preserveFocus
:
options
.
preserveFocus
,
preserveFocus
:
options
.
preserveFocus
,
selections
:
options
.
selections
&&
options
.
selections
.
map
(
typeConverters
.
Notebook
Cell
Range
.
from
),
selections
:
options
.
selections
&&
options
.
selections
.
map
(
typeConverters
.
NotebookRange
.
from
),
pinned
:
typeof
options
.
preview
===
'
boolean
'
?
!
options
.
preview
:
undefined
pinned
:
typeof
options
.
preview
===
'
boolean
'
?
!
options
.
preview
:
undefined
};
};
}
else
{
}
else
{
...
@@ -711,10 +711,10 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
...
@@ -711,10 +711,10 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
// ONE: make all state updates
// ONE: make all state updates
if
(
data
.
visibleRanges
)
{
if
(
data
.
visibleRanges
)
{
editor
.
_acceptVisibleRanges
(
data
.
visibleRanges
.
ranges
.
map
(
typeConverters
.
Notebook
Cell
Range
.
to
));
editor
.
_acceptVisibleRanges
(
data
.
visibleRanges
.
ranges
.
map
(
typeConverters
.
NotebookRange
.
to
));
}
}
if
(
data
.
selections
)
{
if
(
data
.
selections
)
{
editor
.
_acceptSelections
(
data
.
selections
.
selections
.
map
(
typeConverters
.
Notebook
Cell
Range
.
to
));
editor
.
_acceptSelections
(
data
.
selections
.
selections
.
map
(
typeConverters
.
NotebookRange
.
to
));
}
}
// TWO: send all events after states have been updated
// TWO: send all events after states have been updated
...
@@ -769,8 +769,8 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
...
@@ -769,8 +769,8 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
editorId
,
editorId
,
this
.
_notebookEditorsProxy
,
this
.
_notebookEditorsProxy
,
document
,
document
,
data
.
visibleRanges
.
map
(
typeConverters
.
Notebook
Cell
Range
.
to
),
data
.
visibleRanges
.
map
(
typeConverters
.
NotebookRange
.
to
),
data
.
selections
.
map
(
typeConverters
.
Notebook
Cell
Range
.
to
),
data
.
selections
.
map
(
typeConverters
.
NotebookRange
.
to
),
typeof
data
.
viewColumn
===
'
number
'
?
typeConverters
.
ViewColumn
.
to
(
data
.
viewColumn
)
:
undefined
typeof
data
.
viewColumn
===
'
number
'
?
typeConverters
.
ViewColumn
.
to
(
data
.
viewColumn
)
:
undefined
);
);
...
...
src/vs/workbench/api/common/extHostNotebookDocument.ts
浏览文件 @
662ea121
...
@@ -227,7 +227,7 @@ export class ExtHostNotebookDocument {
...
@@ -227,7 +227,7 @@ export class ExtHostNotebookDocument {
}
}
}
}
private
_validateRange
(
range
:
vscode
.
Notebook
CellRange
):
vscode
.
NotebookCell
Range
{
private
_validateRange
(
range
:
vscode
.
Notebook
Range
):
vscode
.
Notebook
Range
{
if
(
range
.
start
<
0
)
{
if
(
range
.
start
<
0
)
{
range
=
range
.
with
({
start
:
0
});
range
=
range
.
with
({
start
:
0
});
}
}
...
@@ -237,7 +237,7 @@ export class ExtHostNotebookDocument {
...
@@ -237,7 +237,7 @@ export class ExtHostNotebookDocument {
return
range
;
return
range
;
}
}
private
_getCells
(
range
:
vscode
.
Notebook
Cell
Range
):
ExtHostCell
[]
{
private
_getCells
(
range
:
vscode
.
NotebookRange
):
ExtHostCell
[]
{
range
=
this
.
_validateRange
(
range
);
range
=
this
.
_validateRange
(
range
);
const
result
:
ExtHostCell
[]
=
[];
const
result
:
ExtHostCell
[]
=
[];
for
(
let
i
=
range
.
start
;
i
<
range
.
end
;
i
++
)
{
for
(
let
i
=
range
.
start
;
i
<
range
.
end
;
i
++
)
{
...
...
src/vs/workbench/api/common/extHostNotebookEditor.ts
浏览文件 @
662ea121
...
@@ -84,8 +84,8 @@ class NotebookEditorCellEditBuilder implements vscode.NotebookEditorEdit {
...
@@ -84,8 +84,8 @@ class NotebookEditorCellEditBuilder implements vscode.NotebookEditorEdit {
export
class
ExtHostNotebookEditor
{
export
class
ExtHostNotebookEditor
{
private
_selections
:
vscode
.
Notebook
Cell
Range
[]
=
[];
private
_selections
:
vscode
.
NotebookRange
[]
=
[];
private
_visibleRanges
:
vscode
.
Notebook
Cell
Range
[]
=
[];
private
_visibleRanges
:
vscode
.
NotebookRange
[]
=
[];
private
_viewColumn
?:
vscode
.
ViewColumn
;
private
_viewColumn
?:
vscode
.
ViewColumn
;
private
_visible
:
boolean
=
false
;
private
_visible
:
boolean
=
false
;
...
@@ -99,8 +99,8 @@ export class ExtHostNotebookEditor {
...
@@ -99,8 +99,8 @@ export class ExtHostNotebookEditor {
readonly
id
:
string
,
readonly
id
:
string
,
private
readonly
_proxy
:
MainThreadNotebookEditorsShape
,
private
readonly
_proxy
:
MainThreadNotebookEditorsShape
,
readonly
notebookData
:
ExtHostNotebookDocument
,
readonly
notebookData
:
ExtHostNotebookDocument
,
visibleRanges
:
vscode
.
Notebook
Cell
Range
[],
visibleRanges
:
vscode
.
NotebookRange
[],
selections
:
vscode
.
Notebook
Cell
Range
[],
selections
:
vscode
.
NotebookRange
[],
viewColumn
:
vscode
.
ViewColumn
|
undefined
viewColumn
:
vscode
.
ViewColumn
|
undefined
)
{
)
{
this
.
_selections
=
selections
;
this
.
_selections
=
selections
;
...
@@ -124,7 +124,7 @@ export class ExtHostNotebookEditor {
...
@@ -124,7 +124,7 @@ export class ExtHostNotebookEditor {
revealRange
(
range
,
revealType
)
{
revealRange
(
range
,
revealType
)
{
that
.
_proxy
.
$tryRevealRange
(
that
.
_proxy
.
$tryRevealRange
(
that
.
id
,
that
.
id
,
extHostConverter
.
Notebook
Cell
Range
.
from
(
range
),
extHostConverter
.
NotebookRange
.
from
(
range
),
revealType
??
extHostTypes
.
NotebookEditorRevealType
.
Default
revealType
??
extHostTypes
.
NotebookEditorRevealType
.
Default
);
);
},
},
...
@@ -159,11 +159,11 @@ export class ExtHostNotebookEditor {
...
@@ -159,11 +159,11 @@ export class ExtHostNotebookEditor {
this
.
_visible
=
value
;
this
.
_visible
=
value
;
}
}
_acceptVisibleRanges
(
value
:
vscode
.
Notebook
Cell
Range
[]):
void
{
_acceptVisibleRanges
(
value
:
vscode
.
NotebookRange
[]):
void
{
this
.
_visibleRanges
=
value
;
this
.
_visibleRanges
=
value
;
}
}
_acceptSelections
(
selections
:
vscode
.
Notebook
Cell
Range
[]):
void
{
_acceptSelections
(
selections
:
vscode
.
NotebookRange
[]):
void
{
this
.
_selections
=
selections
;
this
.
_selections
=
selections
;
}
}
...
@@ -207,7 +207,7 @@ export class ExtHostNotebookEditor {
...
@@ -207,7 +207,7 @@ export class ExtHostNotebookEditor {
return
this
.
_proxy
.
$tryApplyEdits
(
this
.
id
,
editData
.
documentVersionId
,
compressedEdits
);
return
this
.
_proxy
.
$tryApplyEdits
(
this
.
id
,
editData
.
documentVersionId
,
compressedEdits
);
}
}
setDecorations
(
decorationType
:
vscode
.
NotebookEditorDecorationType
,
range
:
vscode
.
Notebook
Cell
Range
):
void
{
setDecorations
(
decorationType
:
vscode
.
NotebookEditorDecorationType
,
range
:
vscode
.
NotebookRange
):
void
{
if
(
range
.
isEmpty
&&
!
this
.
_hasDecorationsForKey
.
has
(
decorationType
.
key
))
{
if
(
range
.
isEmpty
&&
!
this
.
_hasDecorationsForKey
.
has
(
decorationType
.
key
))
{
// avoid no-op call to the renderer
// avoid no-op call to the renderer
return
;
return
;
...
@@ -220,7 +220,7 @@ export class ExtHostNotebookEditor {
...
@@ -220,7 +220,7 @@ export class ExtHostNotebookEditor {
return
this
.
_proxy
.
$trySetDecorations
(
return
this
.
_proxy
.
$trySetDecorations
(
this
.
id
,
this
.
id
,
extHostConverter
.
Notebook
Cell
Range
.
from
(
range
),
extHostConverter
.
NotebookRange
.
from
(
range
),
decorationType
.
key
decorationType
.
key
);
);
}
}
...
...
src/vs/workbench/api/common/extHostNotebookKernels.ts
浏览文件 @
662ea121
...
@@ -199,7 +199,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
...
@@ -199,7 +199,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
const
cells
:
vscode
.
NotebookCell
[]
=
[];
const
cells
:
vscode
.
NotebookCell
[]
=
[];
for
(
let
range
of
ranges
)
{
for
(
let
range
of
ranges
)
{
cells
.
push
(...
document
.
notebookDocument
.
getCells
(
extHostTypeConverters
.
Notebook
Cell
Range
.
to
(
range
)));
cells
.
push
(...
document
.
notebookDocument
.
getCells
(
extHostTypeConverters
.
NotebookRange
.
to
(
range
)));
}
}
try
{
try
{
...
...
src/vs/workbench/api/common/extHostTypeConverters.ts
浏览文件 @
662ea121
...
@@ -1405,14 +1405,14 @@ export namespace LanguageSelector {
...
@@ -1405,14 +1405,14 @@ export namespace LanguageSelector {
}
}
}
}
export
namespace
Notebook
Cell
Range
{
export
namespace
NotebookRange
{
export
function
from
(
range
:
vscode
.
Notebook
Cell
Range
):
notebooks
.
ICellRange
{
export
function
from
(
range
:
vscode
.
NotebookRange
):
notebooks
.
ICellRange
{
return
{
start
:
range
.
start
,
end
:
range
.
end
};
return
{
start
:
range
.
start
,
end
:
range
.
end
};
}
}
export
function
to
(
range
:
notebooks
.
ICellRange
):
types
.
Notebook
Cell
Range
{
export
function
to
(
range
:
notebooks
.
ICellRange
):
types
.
NotebookRange
{
return
new
types
.
Notebook
Cell
Range
(
range
.
start
,
range
.
end
);
return
new
types
.
NotebookRange
(
range
.
start
,
range
.
end
);
}
}
}
}
...
...
src/vs/workbench/api/common/extHostTypes.ts
浏览文件 @
662ea121
...
@@ -2895,7 +2895,7 @@ export enum ColorThemeKind {
...
@@ -2895,7 +2895,7 @@ export enum ColorThemeKind {
//#region Notebook
//#region Notebook
export
class
Notebook
Cell
Range
{
export
class
NotebookRange
{
private
_start
:
number
;
private
_start
:
number
;
private
_end
:
number
;
private
_end
:
number
;
...
@@ -2923,7 +2923,7 @@ export class NotebookCellRange {
...
@@ -2923,7 +2923,7 @@ export class NotebookCellRange {
this
.
_end
=
end
;
this
.
_end
=
end
;
}
}
with
(
change
:
{
start
?:
number
,
end
?:
number
}):
Notebook
Cell
Range
{
with
(
change
:
{
start
?:
number
,
end
?:
number
}):
NotebookRange
{
let
start
=
this
.
_start
;
let
start
=
this
.
_start
;
let
end
=
this
.
_end
;
let
end
=
this
.
_end
;
...
@@ -2936,7 +2936,7 @@ export class NotebookCellRange {
...
@@ -2936,7 +2936,7 @@ export class NotebookCellRange {
if
(
start
===
this
.
_start
&&
end
===
this
.
_end
)
{
if
(
start
===
this
.
_start
&&
end
===
this
.
_end
)
{
return
this
;
return
this
;
}
}
return
new
Notebook
Cell
Range
(
start
,
end
);
return
new
NotebookRange
(
start
,
end
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录