Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2a558708
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,发现更多精彩内容 >>
提交
2a558708
编写于
3月 30, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #93777. NotebookViewType context key.
上级
d661f7b2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
2 deletion
+14
-2
src/vs/workbench/contrib/notebook/browser/constants.ts
src/vs/workbench/contrib/notebook/browser/constants.ts
+2
-0
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
...h/contrib/notebook/browser/view/renderers/cellRenderer.ts
+3
-1
src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts
...bench/contrib/notebook/browser/view/renderers/codeCell.ts
+9
-1
未找到文件。
src/vs/workbench/contrib/notebook/browser/constants.ts
浏览文件 @
2a558708
...
...
@@ -34,6 +34,8 @@ export const EDITOR_TOP_PADDING = 8;
export
const
EDITOR_BOTTOM_PADDING
=
8
;
// Cell context keys
export
const
NOTEBOOK_VIEW_TYPE
=
'
notebookViewType
'
;
export
const
NOTEBOOK_CELL_TYPE_CONTEXT_KEY
=
'
notebookCellType
'
;
// code, markdown
export
const
NOTEBOOK_CELL_EDITABLE_CONTEXT_KEY
=
'
notebookCellEditable
'
;
// bool
export
const
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE_CONTEXT_KEY
=
'
notebookCellMarkdownEditMode
'
;
// bool
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
浏览文件 @
2a558708
...
...
@@ -24,7 +24,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
EDITOR_BOTTOM_PADDING
,
EDITOR_TOOLBAR_HEIGHT
,
EDITOR_TOP_MARGIN
,
EDITOR_TOP_PADDING
,
NOTEBOOK_CELL_EDITABLE_CONTEXT_KEY
,
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE_CONTEXT_KEY
,
NOTEBOOK_CELL_TYPE_CONTEXT_KEY
,
NOTEBOOK_CELL_RUN_STATE_CONTEXT_KEY
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
import
{
EDITOR_BOTTOM_PADDING
,
EDITOR_TOOLBAR_HEIGHT
,
EDITOR_TOP_MARGIN
,
EDITOR_TOP_PADDING
,
NOTEBOOK_CELL_EDITABLE_CONTEXT_KEY
,
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE_CONTEXT_KEY
,
NOTEBOOK_CELL_TYPE_CONTEXT_KEY
,
NOTEBOOK_CELL_RUN_STATE_CONTEXT_KEY
,
NOTEBOOK_VIEW_TYPE
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
import
{
ExecuteCellAction
,
INotebookCellActionContext
,
CancelCellAction
}
from
'
vs/workbench/contrib/notebook/browser/contrib/notebookActions
'
;
import
{
BaseCellRenderTemplate
,
CellEditState
,
CellRunState
,
CodeCellRenderTemplate
,
ICellViewModel
,
INotebookEditor
,
MarkdownCellRenderTemplate
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CellMenus
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellMenus
'
;
...
...
@@ -223,6 +223,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
const
contextKeyService
=
this
.
contextKeyService
.
createScoped
(
templateData
.
container
);
contextKeyService
.
createKey
(
NOTEBOOK_CELL_TYPE_CONTEXT_KEY
,
'
markdown
'
);
contextKeyService
.
createKey
(
NOTEBOOK_VIEW_TYPE
,
element
.
viewType
);
const
cellEditableKey
=
contextKeyService
.
createKey
(
NOTEBOOK_CELL_EDITABLE_CONTEXT_KEY
,
!!
(
element
.
metadata
?.
editable
));
elementDisposable
.
add
(
element
.
onDidChangeMetadata
(()
=>
{
cellEditableKey
.
set
(
!!
element
.
metadata
?.
editable
);
...
...
@@ -373,6 +374,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
}
contextKeyService
.
createKey
(
NOTEBOOK_CELL_TYPE_CONTEXT_KEY
,
'
code
'
);
contextKeyService
.
createKey
(
NOTEBOOK_VIEW_TYPE
,
element
.
viewType
);
const
cellEditableKey
=
contextKeyService
.
createKey
(
NOTEBOOK_CELL_EDITABLE_CONTEXT_KEY
,
!!
(
element
.
metadata
?.
editable
));
const
updateForMetadata
=
()
=>
{
const
metadata
=
element
.
getEvaluatedMetadata
(
this
.
notebookEditor
.
viewModel
!
.
notebookDocument
.
metadata
);
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts
浏览文件 @
2a558708
...
...
@@ -149,6 +149,8 @@ export class CodeCell extends Disposable {
return
;
}
const
previousOutputHeight
=
this
.
viewCell
.
layoutInfo
.
outputTotalHeight
;
if
(
this
.
viewCell
.
outputs
.
length
)
{
this
.
templateData
.
outputContainer
!
.
style
.
display
=
'
block
'
;
}
else
{
...
...
@@ -197,7 +199,13 @@ export class CodeCell extends Disposable {
let
editorHeight
=
templateData
.
editor
!
.
getContentHeight
();
viewCell
.
editorHeight
=
editorHeight
;
this
.
relayoutCellDebounced
();
if
(
previousOutputHeight
===
0
||
this
.
viewCell
.
layoutInfo
.
outputTotalHeight
===
0
)
{
// first execution or removing all outputs
this
.
relayoutCell
();
}
else
{
this
.
relayoutCellDebounced
();
}
}));
if
(
viewCell
.
outputs
.
length
>
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录