Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
befaab50
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,发现更多精彩内容 >>
提交
befaab50
编写于
3月 13, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ICellViewModel only visible to contrib
上级
0faba333
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
32 addition
and
57 deletion
+32
-57
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+2
-32
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+3
-3
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
...rkbench/contrib/notebook/browser/view/notebookCellList.ts
+9
-8
src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
...ntrib/notebook/browser/view/renderers/backLayerWebView.ts
+6
-5
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
...h/contrib/notebook/browser/view/renderers/cellRenderer.ts
+6
-5
src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts
...bench/contrib/notebook/browser/view/renderers/codeCell.ts
+3
-2
src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts
...h/contrib/notebook/browser/view/renderers/markdownCell.ts
+3
-2
未找到文件。
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
befaab50
...
...
@@ -3,20 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IMouseWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
import
{
OutputRenderer
}
from
'
vs/workbench/contrib/notebook/browser/view/output/outputRenderer
'
;
import
{
IOutput
,
CellKind
,
IRenderOutput
,
NotebookCellOutputsSplice
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IOutput
,
CellKind
,
IRenderOutput
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
NotebookViewModel
,
IModelDecorationsChangeAccessor
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel
'
;
import
{
FindMatch
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
FindMatch
}
from
'
vs/editor/common/model
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
MarkdownRenderer
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/mdRenderer
'
;
export
const
KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED
=
new
RawContextKey
<
boolean
>
(
'
notebookFindWidgetFocused
'
,
false
);
...
...
@@ -31,36 +28,9 @@ export interface ICellViewModel {
handle
:
number
;
uri
:
URI
;
cellKind
:
CellKind
;
lineCount
:
number
;
outputs
:
IOutput
[]
onDidChangeOutputs
:
Event
<
NotebookCellOutputsSplice
[]
>
;
state
:
CellState
;
onDidChangeCellState
:
Event
<
void
>
;
focusMode
:
CellFocusMode
;
onDidChangeFocusMode
:
Event
<
void
>
;
selfSizeMonitoring
:
boolean
;
editorHeight
:
number
;
editorAttached
:
boolean
;
onDidChangeEditorAttachState
:
Event
<
boolean
>
;
getHTML
():
HTMLElement
|
null
;
resolveTextModel
():
Promise
<
ITextModel
>
;
attachTextEditor
(
editor
:
ICodeEditor
):
void
;
detachTextEditor
():
void
;
setText
(
strs
:
string
[]):
void
;
getText
():
string
;
updateOutputHeight
(
index
:
number
,
height
:
number
):
void
;
getOutputOffset
(
index
:
number
):
number
;
getOutputTotalHeight
():
number
;
getLineScrollTopOffset
(
line
:
number
):
number
;
getHeight
(
lineHeight
:
number
):
number
;
hasDynamicHeight
():
boolean
;
getMarkdownRenderer
():
MarkdownRenderer
;
revealRangeInCenter
(
range
:
Range
):
void
;
setSelection
(
range
:
Range
):
void
;
onDidChangeCursorSelection
:
Event
<
void
>
;
cursorAtBoundary
():
CursorAtBoundary
;
onDeselect
():
void
;
spliceOutputHeights
(
start
:
number
,
deleteCnt
:
number
,
heights
:
number
[]):
void
;
}
export
interface
INotebookEditor
{
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
befaab50
...
...
@@ -344,7 +344,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
const
scrollTop
=
this
.
list
?.
scrollTop
||
0
;
const
scrollHeight
=
this
.
list
?.
scrollHeight
||
0
;
this
.
webview
!
.
element
.
style
.
height
=
`
${
scrollHeight
}
px`
;
let
updateItems
:
{
cell
:
I
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
}[]
=
[];
let
updateItems
:
{
cell
:
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
}[]
=
[];
if
(
this
.
webview
?.
insetMapping
)
{
this
.
webview
?.
insetMapping
.
forEach
((
value
,
key
)
=>
{
...
...
@@ -373,7 +373,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
}));
this
.
list
?.
splice
(
0
,
this
.
list
?.
length
||
0
);
this
.
list
?.
splice
(
0
,
0
,
this
.
notebookViewModel
!
.
viewCells
);
this
.
list
?.
splice
(
0
,
0
,
this
.
notebookViewModel
!
.
viewCells
as
CellViewModel
[]
);
this
.
list
?.
layout
();
}
...
...
@@ -640,7 +640,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
list
?.
triggerScrollFromMouseWheelEvent
(
event
);
}
createInset
(
cell
:
I
CellViewModel
,
output
:
IOutput
,
shadowContent
:
string
,
offset
:
number
)
{
createInset
(
cell
:
CellViewModel
,
output
:
IOutput
,
shadowContent
:
string
,
offset
:
number
)
{
if
(
!
this
.
webview
)
{
return
;
}
...
...
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
浏览文件 @
befaab50
...
...
@@ -16,25 +16,26 @@ import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
EDITOR_TOP_PADDING
,
NOTEBOOK_EDITOR_CURSOR_BOUNDARY
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
CellRevealType
,
CellRevealPosition
,
CursorAtBoundary
,
ICellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CellRevealType
,
CellRevealPosition
,
CursorAtBoundary
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
export
class
NotebookCellList
extends
WorkbenchList
<
I
CellViewModel
>
implements
IDisposable
{
export
class
NotebookCellList
extends
WorkbenchList
<
CellViewModel
>
implements
IDisposable
{
get
onWillScroll
():
Event
<
ScrollEvent
>
{
return
this
.
view
.
onWillScroll
;
}
get
rowsContainer
():
HTMLElement
{
return
this
.
view
.
containerDomNode
;
}
private
_previousSelectedElements
:
I
CellViewModel
[]
=
[];
private
_previousSelectedElements
:
CellViewModel
[]
=
[];
private
_localDisposableStore
=
new
DisposableStore
();
constructor
(
private
listUser
:
string
,
container
:
HTMLElement
,
delegate
:
IListVirtualDelegate
<
I
CellViewModel
>
,
renderers
:
IListRenderer
<
I
CellViewModel
,
any
>
[],
delegate
:
IListVirtualDelegate
<
CellViewModel
>
,
renderers
:
IListRenderer
<
CellViewModel
,
any
>
[],
contextKeyService
:
IContextKeyService
,
options
:
IWorkbenchListOptions
<
I
CellViewModel
>
,
options
:
IWorkbenchListOptions
<
CellViewModel
>
,
@
IListService
listService
:
IListService
,
@
IThemeService
themeService
:
IThemeService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
...
...
@@ -58,7 +59,7 @@ export class NotebookCellList extends WorkbenchList<ICellViewModel> implements I
let
cursorSelectionLisener
:
IDisposable
|
null
=
null
;
const
recomputeContext
=
(
element
:
I
CellViewModel
)
=>
{
const
recomputeContext
=
(
element
:
CellViewModel
)
=>
{
switch
(
element
.
cursorAtBoundary
())
{
case
CursorAtBoundary
.
Both
:
notebookEditorCursorAtBoundaryContext
.
set
(
'
both
'
);
...
...
@@ -331,7 +332,7 @@ export class NotebookCellList extends WorkbenchList<ICellViewModel> implements I
}
}
function
getEditorAttachedPromise
(
element
:
I
CellViewModel
)
{
function
getEditorAttachedPromise
(
element
:
CellViewModel
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
Event
.
once
(
element
.
onDidChangeEditorAttachState
)(
state
=>
state
?
resolve
()
:
reject
());
});
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
浏览文件 @
befaab50
...
...
@@ -9,11 +9,12 @@ import * as path from 'vs/base/common/path';
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
,
ICellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
CELL_MARGIN
,
IOutput
}
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
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
export
interface
IDimentionMessage
{
type
:
'
dimension
'
;
...
...
@@ -71,7 +72,7 @@ let version = 0;
export
class
BackLayerWebView
extends
Disposable
{
element
:
HTMLElement
;
webview
:
WebviewElement
;
insetMapping
:
Map
<
IOutput
,
{
outputId
:
string
,
cell
:
I
CellViewModel
,
cacheOffset
:
number
|
undefined
}
>
=
new
Map
();
insetMapping
:
Map
<
IOutput
,
{
outputId
:
string
,
cell
:
CellViewModel
,
cacheOffset
:
number
|
undefined
}
>
=
new
Map
();
reversedInsetMapping
:
Map
<
string
,
IOutput
>
=
new
Map
();
preloadsCache
:
Map
<
string
,
boolean
>
=
new
Map
();
localResourceRootsCache
:
URI
[]
|
undefined
=
undefined
;
...
...
@@ -291,7 +292,7 @@ export class BackLayerWebView extends Disposable {
return
webview
;
}
shouldUpdateInset
(
cell
:
I
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
)
{
shouldUpdateInset
(
cell
:
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
)
{
let
outputCache
=
this
.
insetMapping
.
get
(
output
)
!
;
let
outputIndex
=
cell
.
outputs
.
indexOf
(
output
);
...
...
@@ -305,7 +306,7 @@ export class BackLayerWebView extends Disposable {
return
true
;
}
updateViewScrollTop
(
top
:
number
,
items
:
{
cell
:
I
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
}[])
{
updateViewScrollTop
(
top
:
number
,
items
:
{
cell
:
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
}[])
{
let
widgets
:
IContentWidgetTopRequest
[]
=
items
.
map
(
item
=>
{
let
outputCache
=
this
.
insetMapping
.
get
(
item
.
output
)
!
;
let
id
=
outputCache
.
outputId
;
...
...
@@ -333,7 +334,7 @@ export class BackLayerWebView extends Disposable {
this
.
webview
.
sendMessage
(
message
);
}
createInset
(
cell
:
I
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
,
offset
:
number
,
shadowContent
:
string
,
preloads
:
Set
<
number
>
)
{
createInset
(
cell
:
CellViewModel
,
output
:
IOutput
,
cellTop
:
number
,
offset
:
number
,
shadowContent
:
string
,
preloads
:
Set
<
number
>
)
{
this
.
updateRendererPreloads
(
preloads
);
let
initialTop
=
cellTop
+
offset
;
let
outputId
=
UUID
.
generateUuid
();
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
浏览文件 @
befaab50
...
...
@@ -21,6 +21,7 @@ import { CodeCell } from 'vs/workbench/contrib/notebook/browser/view/renderers/c
import
{
StatefullMarkdownCell
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/markdownCell
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EDITOR_TOP_PADDING
,
EDITOR_BOTTOM_PADDING
,
CellKind
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
export
class
NotebookCellListDelegate
implements
IListVirtualDelegate
<
ICellViewModel
>
{
private
_lineHeight
:
number
;
...
...
@@ -31,15 +32,15 @@ export class NotebookCellListDelegate implements IListVirtualDelegate<ICellViewM
this
.
_lineHeight
=
BareFontInfo
.
createFromRawSettings
(
editorOptions
,
getZoomLevel
()).
lineHeight
;
}
getHeight
(
element
:
I
CellViewModel
):
number
{
getHeight
(
element
:
CellViewModel
):
number
{
return
element
.
getHeight
(
this
.
_lineHeight
);
}
hasDynamicHeight
(
element
:
I
CellViewModel
):
boolean
{
hasDynamicHeight
(
element
:
CellViewModel
):
boolean
{
return
element
.
hasDynamicHeight
();
}
getTemplateId
(
element
:
I
CellViewModel
):
string
{
getTemplateId
(
element
:
CellViewModel
):
string
{
if
(
element
.
cellKind
===
CellKind
.
Markdown
)
{
return
MarkdownCellRenderer
.
TEMPLATE_ID
;
}
else
{
...
...
@@ -221,7 +222,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
return
template
;
}
renderElement
(
element
:
I
CellViewModel
,
index
:
number
,
templateData
:
CellRenderTemplate
,
height
:
number
|
undefined
):
void
{
renderElement
(
element
:
CellViewModel
,
index
:
number
,
templateData
:
CellRenderTemplate
,
height
:
number
|
undefined
):
void
{
templateData
.
editingContainer
!
.
style
.
display
=
'
none
'
;
templateData
.
cellContainer
.
innerHTML
=
''
;
let
renderedHTML
=
element
.
getHTML
();
...
...
@@ -317,7 +318,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
return
tempalte
;
}
renderElement
(
element
:
I
CellViewModel
,
index
:
number
,
templateData
:
CellRenderTemplate
,
height
:
number
|
undefined
):
void
{
renderElement
(
element
:
CellViewModel
,
index
:
number
,
templateData
:
CellRenderTemplate
,
height
:
number
|
undefined
):
void
{
if
(
height
===
undefined
)
{
return
;
}
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts
浏览文件 @
befaab50
...
...
@@ -8,11 +8,12 @@ import * as DOM from 'vs/base/browser/dom';
import
{
Disposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
getResizesObserver
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/sizeObserver
'
;
import
{
CELL_MARGIN
,
IOutput
,
EDITOR_TOP_PADDING
,
EDITOR_BOTTOM_PADDING
,
ITransformedDisplayOutputDto
,
IRenderOutput
,
CellOutputKind
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
CellRenderTemplate
,
INotebookEditor
,
CellFocusMode
,
ICellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CellRenderTemplate
,
INotebookEditor
,
CellFocusMode
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
raceCancellation
}
from
'
vs/base/common/async
'
;
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
IQuickInputService
,
IQuickPickItem
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
interface
IMimeTypeRenderer
extends
IQuickPickItem
{
index
:
number
;
...
...
@@ -23,7 +24,7 @@ export class CodeCell extends Disposable {
private
outputElements
=
new
Map
<
IOutput
,
HTMLElement
>
();
constructor
(
private
notebookEditor
:
INotebookEditor
,
private
viewCell
:
I
CellViewModel
,
private
viewCell
:
CellViewModel
,
private
templateData
:
CellRenderTemplate
,
@
INotebookService
private
notebookService
:
INotebookService
,
@
IQuickInputService
private
readonly
quickInputService
:
IQuickInputService
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts
浏览文件 @
befaab50
...
...
@@ -9,9 +9,10 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
getResizesObserver
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/sizeObserver
'
;
import
{
CELL_MARGIN
,
EDITOR_TOP_PADDING
,
EDITOR_BOTTOM_PADDING
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
INotebookEditor
,
CellRenderTemplate
,
CellFocusMode
,
CellState
,
ICellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEditor
,
CellRenderTemplate
,
CellFocusMode
,
CellState
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
raceCancellation
}
from
'
vs/base/common/async
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
export
class
StatefullMarkdownCell
extends
Disposable
{
private
editor
:
CodeEditorWidget
|
null
=
null
;
...
...
@@ -22,7 +23,7 @@ export class StatefullMarkdownCell extends Disposable {
constructor
(
notebookEditor
:
INotebookEditor
,
public
viewCell
:
I
CellViewModel
,
public
viewCell
:
CellViewModel
,
templateData
:
CellRenderTemplate
,
editorOptions
:
IEditorOptions
,
instantiationService
:
IInstantiationService
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录