Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
81d4758a
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,发现更多精彩内容 >>
提交
81d4758a
编写于
9月 01, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #105843.
上级
b8e4718a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
3 deletion
+18
-3
src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts
...workbench/contrib/notebook/browser/contrib/coreActions.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+1
-0
src/vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys.ts
...ontrib/notebook/browser/view/renderers/cellContextKeys.ts
+15
-1
未找到文件。
src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts
浏览文件 @
81d4758a
...
...
@@ -18,7 +18,7 @@ import { InputFocusedContext, InputFocusedContextKey } from 'vs/platform/context
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IQuickInputService
,
IQuickPickItem
,
QuickPickInput
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
BaseCellRenderTemplate
,
CellEditState
,
CellFocusMode
,
ICellViewModel
,
INotebookEditor
,
NOTEBOOK_CELL_INPUT_COLLAPSED
,
NOTEBOOK_CELL_EDITABLE
,
NOTEBOOK_CELL_HAS_OUTPUTS
,
NOTEBOOK_CELL_LIST_FOCUSED
,
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE
,
NOTEBOOK_CELL_OUTPUT_COLLAPSED
,
NOTEBOOK_CELL_TYPE
,
NOTEBOOK_EDITOR_EDITABLE
,
NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK
,
NOTEBOOK_EDITOR_FOCUSED
,
NOTEBOOK_EDITOR_RUNNABLE
,
NOTEBOOK_IS_ACTIVE_EDITOR
,
NOTEBOOK_OUTPUT_FOCUSED
,
EXPAND_CELL_CONTENT_COMMAND_ID
,
NOTEBOOK_CELL_FOCUSED
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
BaseCellRenderTemplate
,
CellEditState
,
CellFocusMode
,
ICellViewModel
,
INotebookEditor
,
NOTEBOOK_CELL_INPUT_COLLAPSED
,
NOTEBOOK_CELL_EDITABLE
,
NOTEBOOK_CELL_HAS_OUTPUTS
,
NOTEBOOK_CELL_LIST_FOCUSED
,
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE
,
NOTEBOOK_CELL_OUTPUT_COLLAPSED
,
NOTEBOOK_CELL_TYPE
,
NOTEBOOK_EDITOR_EDITABLE
,
NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK
,
NOTEBOOK_EDITOR_FOCUSED
,
NOTEBOOK_EDITOR_RUNNABLE
,
NOTEBOOK_IS_ACTIVE_EDITOR
,
NOTEBOOK_OUTPUT_FOCUSED
,
EXPAND_CELL_CONTENT_COMMAND_ID
,
NOTEBOOK_CELL_
EDITOR_
FOCUSED
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel
'
;
import
{
CellKind
,
CellUri
,
NotebookCellRunState
,
NOTEBOOK_EDITOR_CURSOR_BOUNDARY
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/common/notebookService
'
;
...
...
@@ -1442,7 +1442,7 @@ registerAction2(class extends NotebookCellAction {
title
:
localize
(
'
notebookActions.splitCell
'
,
"
Split Cell
"
),
menu
:
{
id
:
MenuId
.
NotebookCellTitle
,
when
:
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
NOTEBOOK_EDITOR_EDITABLE
,
NOTEBOOK_CELL_EDITABLE
,
NOTEBOOK_CELL_
FOCUSED
,
InputFocusedContext
),
when
:
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
NOTEBOOK_EDITOR_EDITABLE
,
NOTEBOOK_CELL_EDITABLE
,
NOTEBOOK_CELL_
EDITOR_FOCUSED
),
order
:
CellToolbarOrder
.
SplitCell
,
group
:
CELL_TITLE_CELL_GROUP_ID
,
// alt: {
...
...
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
81d4758a
...
...
@@ -50,6 +50,7 @@ export const NOTEBOOK_VIEW_TYPE = new RawContextKey<string>('notebookViewType',
export
const
NOTEBOOK_CELL_TYPE
=
new
RawContextKey
<
string
>
(
'
notebookCellType
'
,
undefined
);
// code, markdown
export
const
NOTEBOOK_CELL_EDITABLE
=
new
RawContextKey
<
boolean
>
(
'
notebookCellEditable
'
,
false
);
// bool
export
const
NOTEBOOK_CELL_FOCUSED
=
new
RawContextKey
<
boolean
>
(
'
notebookCellFocused
'
,
false
);
// bool
export
const
NOTEBOOK_CELL_EDITOR_FOCUSED
=
new
RawContextKey
<
boolean
>
(
'
notebookCellEditorFocused
'
,
false
);
// bool
export
const
NOTEBOOK_CELL_RUNNABLE
=
new
RawContextKey
<
boolean
>
(
'
notebookCellRunnable
'
,
false
);
// bool
export
const
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE
=
new
RawContextKey
<
boolean
>
(
'
notebookCellMarkdownEditMode
'
,
false
);
// bool
export
const
NOTEBOOK_CELL_RUN_STATE
=
new
RawContextKey
<
string
>
(
'
notebookCellRunState
'
,
undefined
);
// idle, running
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys.ts
浏览文件 @
81d4758a
...
...
@@ -6,7 +6,7 @@
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
INotebookTextModel
,
NotebookCellRunState
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
BaseCellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel
'
;
import
{
NOTEBOOK_CELL_TYPE
,
NOTEBOOK_VIEW_TYPE
,
NOTEBOOK_CELL_EDITABLE
,
NOTEBOOK_CELL_RUNNABLE
,
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE
,
NOTEBOOK_CELL_RUN_STATE
,
NOTEBOOK_CELL_HAS_OUTPUTS
,
CellViewModelStateChangeEvent
,
CellEditState
,
NOTEBOOK_CELL_INPUT_COLLAPSED
,
NOTEBOOK_CELL_OUTPUT_COLLAPSED
,
NOTEBOOK_CELL_FOCUSED
,
INotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
NOTEBOOK_CELL_TYPE
,
NOTEBOOK_VIEW_TYPE
,
NOTEBOOK_CELL_EDITABLE
,
NOTEBOOK_CELL_RUNNABLE
,
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE
,
NOTEBOOK_CELL_RUN_STATE
,
NOTEBOOK_CELL_HAS_OUTPUTS
,
CellViewModelStateChangeEvent
,
CellEditState
,
NOTEBOOK_CELL_INPUT_COLLAPSED
,
NOTEBOOK_CELL_OUTPUT_COLLAPSED
,
NOTEBOOK_CELL_FOCUSED
,
INotebookEditor
,
NOTEBOOK_CELL_EDITOR_FOCUSED
,
CellFocusMode
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CodeCellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel
'
;
import
{
MarkdownCellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel
'
;
import
{
Disposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -18,6 +18,7 @@ export class CellContextKeyManager extends Disposable {
private
cellEditable
!
:
IContextKey
<
boolean
>
;
private
cellRunnable
!
:
IContextKey
<
boolean
>
;
private
cellFocused
!
:
IContextKey
<
boolean
>
;
private
cellEditorFocused
!
:
IContextKey
<
boolean
>
;
private
cellRunState
!
:
IContextKey
<
string
>
;
private
cellHasOutputs
!
:
IContextKey
<
boolean
>
;
private
cellContentCollapsed
!
:
IContextKey
<
boolean
>
;
...
...
@@ -40,6 +41,7 @@ export class CellContextKeyManager extends Disposable {
this
.
viewType
=
NOTEBOOK_VIEW_TYPE
.
bindTo
(
this
.
contextKeyService
);
this
.
cellEditable
=
NOTEBOOK_CELL_EDITABLE
.
bindTo
(
this
.
contextKeyService
);
this
.
cellFocused
=
NOTEBOOK_CELL_FOCUSED
.
bindTo
(
this
.
contextKeyService
);
this
.
cellEditorFocused
=
NOTEBOOK_CELL_EDITOR_FOCUSED
.
bindTo
(
this
.
contextKeyService
);
this
.
cellRunnable
=
NOTEBOOK_CELL_RUNNABLE
.
bindTo
(
this
.
contextKeyService
);
this
.
markdownEditMode
=
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE
.
bindTo
(
this
.
contextKeyService
);
this
.
cellRunState
=
NOTEBOOK_CELL_RUN_STATE
.
bindTo
(
this
.
contextKeyService
);
...
...
@@ -90,6 +92,10 @@ export class CellContextKeyManager extends Disposable {
this
.
updateForEditState
();
}
if
(
e
.
focusModeChanged
)
{
this
.
updateForFocusState
();
}
// if (e.collapseStateChanged) {
// this.updateForCollapseState();
// }
...
...
@@ -97,7 +103,15 @@ export class CellContextKeyManager extends Disposable {
}
private
updateForFocusState
()
{
const
activeCell
=
this
.
notebookEditor
.
getActiveCell
();
this
.
cellFocused
.
set
(
this
.
notebookEditor
.
getActiveCell
()
===
this
.
element
);
if
(
activeCell
===
this
.
element
)
{
this
.
cellEditorFocused
.
set
(
this
.
element
.
focusMode
===
CellFocusMode
.
Editor
);
}
else
{
this
.
cellEditorFocused
.
set
(
false
);
}
}
private
updateForMetadata
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录