Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
55d34d79
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,发现更多精彩内容 >>
提交
55d34d79
编写于
2月 14, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
No ambiguous naming.
上级
81cfb898
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
125 addition
and
132 deletion
+125
-132
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+1
-2
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+101
-93
src/vs/workbench/contrib/notebook/browser/renderers/backLayerWebView.ts
...ch/contrib/notebook/browser/renderers/backLayerWebView.ts
+11
-11
src/vs/workbench/contrib/notebook/browser/renderers/cellRenderer.ts
...kbench/contrib/notebook/browser/renderers/cellRenderer.ts
+10
-16
src/vs/workbench/contrib/notebook/browser/renderers/codeCell.ts
.../workbench/contrib/notebook/browser/renderers/codeCell.ts
+2
-10
未找到文件。
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
55d34d79
...
...
@@ -19,8 +19,7 @@ export interface INotebookEditor {
focusNotebookCell
(
cell
:
CellViewModel
,
focusEditor
:
boolean
):
void
;
getActiveCell
():
CellViewModel
|
undefined
;
layoutNotebookCell
(
cell
:
CellViewModel
,
height
:
number
):
void
;
createContentWidget
(
cell
:
CellViewModel
,
index
:
number
,
shadowContent
:
string
,
offset
:
number
):
void
;
disposeViewCell
(
cell
:
CellViewModel
):
void
;
createInset
(
cell
:
CellViewModel
,
index
:
number
,
shadowContent
:
string
,
offset
:
number
):
void
;
triggerScroll
(
event
:
IMouseWheelEvent
):
void
;
getFontInfo
():
BareFontInfo
|
undefined
;
getListDimension
():
DOM
.
Dimension
|
null
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
55d34d79
...
...
@@ -3,39 +3,39 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./notebook
'
;
import
{
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
,
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
NotebookEditorInput
,
NotebookEditorModel
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditorInput
'
;
import
{
EditorOptions
,
IEditorMemento
}
from
'
vs/workbench/common/editor
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
getExtraColor
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils
'
;
import
{
textLinkForeground
,
textLinkActiveForeground
,
focusBorder
,
textPreformatForeground
,
contrastBorder
,
textBlockQuoteBackground
,
textBlockQuoteBorder
,
editorBackground
,
foreground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
MarkdownCellRenderer
,
CodeCellRenderer
,
NotebookCellListDelegate
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellRenderer
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
IEditorGroup
,
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IWebviewService
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
BackLayerWebView
}
from
'
vs/workbench/contrib/notebook/browser/renderers/contentWidget
'
;
import
{
IMouseWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
DisposableStore
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
'
vs/css!./notebook
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
{
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IContextKeyService
,
IContextKey
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
INotebook
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
contrastBorder
,
editorBackground
,
focusBorder
,
foreground
,
textBlockQuoteBackground
,
textBlockQuoteBorder
,
textLinkActiveForeground
,
textLinkForeground
,
textPreformatForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IThemeService
,
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorOptions
,
IEditorMemento
}
from
'
vs/workbench/common/editor
'
;
import
{
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
NotebookEditorInput
,
NotebookEditorModel
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditorInput
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
OutputRenderer
}
from
'
vs/workbench/contrib/notebook/browser/output/outputRenderer
'
;
import
{
BackLayerWebView
}
from
'
vs/workbench/contrib/notebook/browser/renderers/backLayerWebView
'
;
import
{
CodeCellRenderer
,
MarkdownCellRenderer
,
NotebookCellListDelegate
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellRenderer
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
CELL_MARGIN
,
INotebook
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IWebviewService
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
getExtraColor
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils
'
;
import
{
IEditorGroup
,
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
const
$
=
DOM
.
$
;
const
NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
NotebookEditorViewState
'
;
...
...
@@ -87,9 +87,6 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
outputRenderer
=
new
OutputRenderer
(
this
,
this
.
instantiationService
);
}
getOutputRenderer
():
OutputRenderer
{
return
this
.
outputRenderer
;
}
get
minimumWidth
():
number
{
return
375
;
}
get
maximumWidth
():
number
{
return
Number
.
POSITIVE_INFINITY
;
}
...
...
@@ -99,6 +96,8 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
set
maximumWidth
(
value
:
number
)
{
/*noop*/
}
//#region Editor
protected
createEditor
(
parent
:
HTMLElement
):
void
{
this
.
rootElement
=
DOM
.
append
(
parent
,
$
(
'
.notebook-editor
'
));
this
.
createBody
(
this
.
rootElement
);
...
...
@@ -177,47 +176,6 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
_register
(
this
.
list
);
}
getFontInfo
():
BareFontInfo
|
undefined
{
return
this
.
fontInfo
;
}
getListDimension
():
DOM
.
Dimension
|
null
{
return
this
.
dimension
;
}
triggerScroll
(
event
:
IMouseWheelEvent
)
{
this
.
list
?.
triggerScrollFromMouseWheelEvent
(
event
);
}
createContentWidget
(
cell
:
CellViewModel
,
outputIndex
:
number
,
shadowContent
:
string
,
offset
:
number
)
{
if
(
!
this
.
webview
)
{
return
;
}
let
preloads
=
this
.
notebook
!
.
renderers
;
if
(
!
this
.
webview
!
.
mapping
.
has
(
cell
.
id
))
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
this
.
webview
!
.
createContentWidget
(
cell
,
offset
,
shadowContent
,
top
+
offset
,
preloads
);
this
.
webview
!
.
outputMapping
.
set
(
cell
.
id
+
`-
${
outputIndex
}
`
,
true
);
}
else
if
(
!
this
.
webview
!
.
outputMapping
.
has
(
cell
.
id
+
`-
${
outputIndex
}
`
))
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
this
.
webview
!
.
outputMapping
.
set
(
cell
.
id
+
`-
${
outputIndex
}
`
,
true
);
this
.
webview
!
.
createContentWidget
(
cell
,
offset
,
shadowContent
,
top
+
offset
,
preloads
);
}
else
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
let
scrollTop
=
this
.
list
?.
scrollTop
||
0
;
this
.
webview
!
.
updateViewScrollTop
(
-
scrollTop
,
[{
id
:
cell
.
id
,
top
:
top
+
offset
}]);
}
}
disposeViewCell
(
cell
:
CellViewModel
)
{
}
onHide
()
{
this
.
viewCells
.
forEach
(
cell
=>
{
if
(
cell
.
getText
()
!==
''
)
{
...
...
@@ -275,7 +233,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
});
if
(
this
.
webview
)
{
this
.
webview
?.
clear
ContentWidg
ets
();
this
.
webview
?.
clear
Ins
ets
();
this
.
webview
?.
clearPreloadsCache
();
}
else
{
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
,
this
.
environmentSerice
);
...
...
@@ -305,7 +263,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
webview
?.
mapping
.
forEach
((
item
)
=>
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
item
.
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
let
newTop
=
this
.
webview
!
.
shouldRender
ContentWidg
et
(
item
.
cell
.
id
,
top
);
let
newTop
=
this
.
webview
!
.
shouldRender
Ins
et
(
item
.
cell
.
id
,
top
);
if
(
newTop
!==
undefined
)
{
updateItems
.
push
({
...
...
@@ -339,6 +297,43 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
});
}
private
saveTextEditorViewState
(
input
:
NotebookEditorInput
):
void
{
if
(
this
.
group
)
{
let
state
:
{
[
key
:
number
]:
boolean
}
=
{};
this
.
viewCells
.
filter
(
cell
=>
cell
.
isEditing
).
forEach
(
cell
=>
state
[
cell
.
cell
.
handle
]
=
true
);
this
.
editorMemento
.
saveEditorState
(
this
.
group
,
input
,
{
editingCells
:
state
});
}
}
private
loadTextEditorViewState
(
input
:
NotebookEditorInput
):
INotebookEditorViewState
|
undefined
{
if
(
this
.
group
)
{
return
this
.
editorMemento
.
loadEditorState
(
this
.
group
,
input
);
}
return
;
}
layout
(
dimension
:
DOM
.
Dimension
):
void
{
this
.
dimension
=
new
DOM
.
Dimension
(
dimension
.
width
,
dimension
.
height
);
DOM
.
toggleClass
(
this
.
rootElement
,
'
mid-width
'
,
dimension
.
width
<
1000
&&
dimension
.
width
>=
600
);
DOM
.
toggleClass
(
this
.
rootElement
,
'
narrow-width
'
,
dimension
.
width
<
600
);
DOM
.
size
(
this
.
body
,
dimension
.
width
,
dimension
.
height
);
this
.
list
?.
layout
(
dimension
.
height
,
dimension
.
width
);
}
protected
saveState
():
void
{
if
(
this
.
input
instanceof
NotebookEditorInput
)
{
this
.
saveTextEditorViewState
(
this
.
input
);
}
super
.
saveState
();
}
//#endregion
//#region Cell operations
layoutNotebookCell
(
cell
:
CellViewModel
,
height
:
number
)
{
let
relayout
=
(
cell
:
CellViewModel
,
height
:
number
)
=>
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
...
...
@@ -449,40 +444,53 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
list
?.
splice
(
index
,
1
);
}
layout
(
dimension
:
DOM
.
Dimension
):
void
{
this
.
dimension
=
new
DOM
.
Dimension
(
dimension
.
width
,
dimension
.
height
);
DOM
.
toggleClass
(
this
.
rootElement
,
'
mid-width
'
,
dimension
.
width
<
1000
&&
dimension
.
width
>=
600
);
DOM
.
toggleClass
(
this
.
rootElement
,
'
narrow-width
'
,
dimension
.
width
<
600
);
DOM
.
size
(
this
.
body
,
dimension
.
width
,
dimension
.
height
);
this
.
list
?.
layout
(
dimension
.
height
,
dimension
.
width
)
;
//#endregion
//#region MISC
getFontInfo
():
BareFontInfo
|
undefined
{
return
this
.
fontInfo
;
}
protected
saveState
():
void
{
if
(
this
.
input
instanceof
NotebookEditorInput
)
{
this
.
saveTextEditorViewState
(
this
.
input
);
}
getListDimension
():
DOM
.
Dimension
|
null
{
return
this
.
dimension
;
}
super
.
saveState
();
triggerScroll
(
event
:
IMouseWheelEvent
)
{
this
.
list
?.
triggerScrollFromMouseWheelEvent
(
event
);
}
private
saveTextEditorViewState
(
input
:
NotebookEditorInput
):
void
{
if
(
this
.
group
)
{
let
state
:
{
[
key
:
number
]:
boolean
}
=
{};
this
.
viewCells
.
filter
(
cell
=>
cell
.
isEditing
).
forEach
(
cell
=>
state
[
cell
.
cell
.
handle
]
=
true
);
this
.
editorMemento
.
saveEditorState
(
this
.
group
,
input
,
{
editingCells
:
state
});
createInset
(
cell
:
CellViewModel
,
outputIndex
:
number
,
shadowContent
:
string
,
offset
:
number
)
{
if
(
!
this
.
webview
)
{
return
;
}
}
private
loadTextEditorViewState
(
input
:
NotebookEditorInput
):
INotebookEditorViewState
|
undefined
{
if
(
this
.
group
)
{
return
this
.
editorMemento
.
loadEditorState
(
this
.
group
,
input
);
let
preloads
=
this
.
notebook
!
.
renderers
;
if
(
!
this
.
webview
!
.
mapping
.
has
(
cell
.
id
))
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
this
.
webview
!
.
createInset
(
cell
,
offset
,
shadowContent
,
top
+
offset
,
preloads
);
this
.
webview
!
.
outputMapping
.
set
(
cell
.
id
+
`-
${
outputIndex
}
`
,
true
);
}
else
if
(
!
this
.
webview
!
.
outputMapping
.
has
(
cell
.
id
+
`-
${
outputIndex
}
`
))
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
this
.
webview
!
.
outputMapping
.
set
(
cell
.
id
+
`-
${
outputIndex
}
`
,
true
);
this
.
webview
!
.
createInset
(
cell
,
offset
,
shadowContent
,
top
+
offset
,
preloads
);
}
else
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
let
top
=
this
.
list
?.
getAbsoluteTop
(
index
)
||
0
;
let
scrollTop
=
this
.
list
?.
scrollTop
||
0
;
this
.
webview
!
.
updateViewScrollTop
(
-
scrollTop
,
[{
id
:
cell
.
id
,
top
:
top
+
offset
}]);
}
}
return
;
getOutputRenderer
():
OutputRenderer
{
return
this
.
outputRenderer
;
}
//#endregion
}
const
embeddedEditorBackground
=
'
walkThrough.embeddedEditorBackground
'
;
...
...
src/vs/workbench/contrib/notebook/browser/renderers/
contentWidget
.ts
→
src/vs/workbench/contrib/notebook/browser/renderers/
backLayerWebView
.ts
浏览文件 @
55d34d79
...
...
@@ -3,18 +3,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
IWebviewService
,
WebviewElement
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
*
as
UUID
from
'
vs/base/common/uuid
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
UUID
from
'
vs/base/common/uuid
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IWebviewService
,
WebviewElement
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
export
interface
IDimentionMessage
{
type
:
'
dimension
'
;
...
...
@@ -276,7 +276,7 @@ export class BackLayerWebView extends Disposable {
return
webview
;
}
shouldRender
ContentWidg
et
(
id
:
string
,
widgetTop
:
number
)
{
shouldRender
Ins
et
(
id
:
string
,
widgetTop
:
number
)
{
let
item
=
this
.
mapping
.
get
(
id
);
if
(
item
&&
widgetTop
+
item
.
offset
!==
item
.
top
)
{
...
...
@@ -303,7 +303,7 @@ export class BackLayerWebView extends Disposable {
this
.
webview
.
sendMessage
(
message
);
}
create
ContentWidg
et
(
cell
:
CellViewModel
,
offset
:
number
,
shadowContent
:
string
,
initialTop
:
number
,
preloads
:
Set
<
number
>
)
{
create
Ins
et
(
cell
:
CellViewModel
,
offset
:
number
,
shadowContent
:
string
,
initialTop
:
number
,
preloads
:
Set
<
number
>
)
{
this
.
updateRendererPreloads
(
preloads
);
let
message
:
ICreationRequestMessage
=
{
...
...
@@ -317,7 +317,7 @@ export class BackLayerWebView extends Disposable {
this
.
mapping
.
set
(
cell
.
id
,
{
cell
:
cell
,
offset
,
top
:
initialTop
});
}
clear
ContentWidg
ets
()
{
clear
Ins
ets
()
{
this
.
webview
.
sendMessage
({
type
:
'
clear
'
});
...
...
src/vs/workbench/contrib/notebook/browser/renderers/cellRenderer.ts
浏览文件 @
55d34d79
...
...
@@ -4,25 +4,22 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!../notebook
'
;
import
{
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
IListRenderer
,
IListVirtualDelegate
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
deepClone
}
from
'
vs/base/common/objects
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IListRenderer
,
IListVirtualDelegate
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CellRenderTemplate
,
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CodeCell
}
from
'
vs/workbench/contrib/notebook/browser/renderers/codeCell
'
;
import
{
StatefullMarkdownCell
}
from
'
vs/workbench/contrib/notebook/browser/renderers/markdownCell
'
;
import
{
CellViewModel
}
from
'
./cellViewModel
'
;
import
{
CodeCell
}
from
'
vs/workbench/contrib/notebook/browser/renderers/codeCell
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
CellRenderTemplate
,
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
class
NotebookCellListDelegate
implements
IListVirtualDelegate
<
CellViewModel
>
{
private
_lineHeight
:
number
;
...
...
@@ -272,9 +269,6 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IThemeService
private
readonly
themeService
:
IThemeService
,
@
IModelService
private
readonly
modelService
:
IModelService
,
@
IModeService
private
readonly
modeService
:
IModeService
)
{
super
(
handler
,
contextMenuService
,
configurationService
,
'
python
'
);
}
...
...
@@ -335,7 +329,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
this
.
showContextMenu
(
listIndex
,
element
,
e
.
posx
,
top
+
height
);
}));
elementDisposable
?.
add
(
new
CodeCell
(
this
.
handler
,
element
,
templateData
,
this
.
themeService
,
this
.
instantiationService
,
this
.
modelService
,
this
.
modeService
,
height
));
elementDisposable
?.
add
(
new
CodeCell
(
this
.
handler
,
element
,
templateData
,
height
));
}
disposeTemplate
(
templateData
:
CellRenderTemplate
):
void
{
...
...
src/vs/workbench/contrib/notebook/browser/renderers/codeCell.ts
浏览文件 @
55d34d79
...
...
@@ -6,10 +6,6 @@
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
getResizesObserver
}
from
'
vs/workbench/contrib/notebook/browser/renderers/sizeObserver
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
CellRenderTemplate
,
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
...
...
@@ -18,10 +14,6 @@ export class CodeCell extends Disposable {
handler
:
INotebookEditor
,
viewCell
:
CellViewModel
,
templateData
:
CellRenderTemplate
,
themeService
:
IThemeService
,
instantiationService
:
IInstantiationService
,
modelService
:
IModelService
,
modeService
:
IModeService
,
height
:
number
|
undefined
)
{
super
();
...
...
@@ -107,7 +99,7 @@ export class CodeCell extends Disposable {
hasDynamicHeight
=
hasDynamicHeight
||
result
?.
hasDynamicHeight
;
if
(
result
.
shadowContent
)
{
hasDynamicHeight
=
false
;
handler
.
create
ContentWidg
et
(
viewCell
,
i
,
result
.
shadowContent
,
totalHeight
+
8
);
handler
.
create
Ins
et
(
viewCell
,
i
,
result
.
shadowContent
,
totalHeight
+
8
);
}
}
}
...
...
@@ -149,7 +141,7 @@ export class CodeCell extends Disposable {
hasDynamicHeight
=
hasDynamicHeight
||
result
?.
hasDynamicHeight
;
if
(
result
.
shadowContent
)
{
hasDynamicHeight
=
false
;
handler
.
create
ContentWidg
et
(
viewCell
,
i
,
result
.
shadowContent
,
totalHeight
+
8
);
handler
.
create
Ins
et
(
viewCell
,
i
,
result
.
shadowContent
,
totalHeight
+
8
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录