Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
425fb1ca
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,发现更多精彩内容 >>
提交
425fb1ca
编写于
4月 06, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Notebook action cleanup, add more to f1
上级
a4f436bd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
45 deletion
+39
-45
src/vs/workbench/contrib/notebook/browser/contrib/notebookActions.ts
...bench/contrib/notebook/browser/contrib/notebookActions.ts
+39
-45
未找到文件。
src/vs/workbench/contrib/notebook/browser/contrib/notebookActions.ts
浏览文件 @
425fb1ca
...
@@ -32,7 +32,6 @@ const COPY_CELL_UP_COMMAND_ID = 'workbench.notebook.cell.copyUp';
...
@@ -32,7 +32,6 @@ const COPY_CELL_UP_COMMAND_ID = 'workbench.notebook.cell.copyUp';
const
COPY_CELL_DOWN_COMMAND_ID
=
'
workbench.notebook.cell.copyDown
'
;
const
COPY_CELL_DOWN_COMMAND_ID
=
'
workbench.notebook.cell.copyDown
'
;
const
EXECUTE_CELL_COMMAND_ID
=
'
workbench.notebook.cell.execute
'
;
const
EXECUTE_CELL_COMMAND_ID
=
'
workbench.notebook.cell.execute
'
;
const
EXECUTE_ACTIVE_CELL_COMMAND_ID
=
'
workbench.notebook.cell.executeActive
'
;
const
CANCEL_CELL_COMMAND_ID
=
'
workbench.notebook.cell.cancelExecution
'
;
const
CANCEL_CELL_COMMAND_ID
=
'
workbench.notebook.cell.cancelExecution
'
;
const
EXECUTE_NOTEBOOK_COMMAND_ID
=
'
workbench.notebook.executeNotebook
'
;
const
EXECUTE_NOTEBOOK_COMMAND_ID
=
'
workbench.notebook.executeNotebook
'
;
const
CANCEL_NOTEBOOK_COMMAND_ID
=
'
workbench.notebook.cancelExecution
'
;
const
CANCEL_NOTEBOOK_COMMAND_ID
=
'
workbench.notebook.cancelExecution
'
;
...
@@ -70,7 +69,7 @@ registerAction2(class extends Action2 {
...
@@ -70,7 +69,7 @@ registerAction2(class extends Action2 {
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -85,13 +84,15 @@ registerAction2(class extends Action2 {
...
@@ -85,13 +84,15 @@ registerAction2(class extends Action2 {
constructor
()
{
constructor
()
{
super
({
super
({
id
:
CANCEL_CELL_COMMAND_ID
,
id
:
CANCEL_CELL_COMMAND_ID
,
title
:
localize
(
'
notebookActions.cancel
'
,
"
Stop Execution
"
),
title
:
localize
(
'
notebookActions.cancel
'
,
"
Stop Cell Execution
"
),
icon
:
{
id
:
'
codicon/primitive-square
'
}
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
icon
:
{
id
:
'
codicon/primitive-square
'
},
f1
:
true
});
});
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -212,7 +213,9 @@ registerAction2(class extends Action2 {
...
@@ -212,7 +213,9 @@ registerAction2(class extends Action2 {
constructor
()
{
constructor
()
{
super
({
super
({
id
:
EXECUTE_NOTEBOOK_COMMAND_ID
,
id
:
EXECUTE_NOTEBOOK_COMMAND_ID
,
title
:
localize
(
'
notebookActions.executeNotebook
'
,
"
Execute Notebook
"
)
title
:
localize
(
'
notebookActions.executeNotebook
'
,
"
Execute Notebook
"
),
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
f1
:
true
});
});
}
}
...
@@ -231,7 +234,9 @@ registerAction2(class extends Action2 {
...
@@ -231,7 +234,9 @@ registerAction2(class extends Action2 {
constructor
()
{
constructor
()
{
super
({
super
({
id
:
CANCEL_NOTEBOOK_COMMAND_ID
,
id
:
CANCEL_NOTEBOOK_COMMAND_ID
,
title
:
localize
(
'
notebookActions.cancelNotebook
'
,
"
Cancel Notebook Execution
"
)
title
:
localize
(
'
notebookActions.cancelNotebook
'
,
"
Cancel Notebook Execution
"
),
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
f1
:
true
});
});
}
}
...
@@ -246,29 +251,6 @@ registerAction2(class extends Action2 {
...
@@ -246,29 +251,6 @@ registerAction2(class extends Action2 {
}
}
});
});
registerAction2
(
class
extends
Action2
{
constructor
()
{
super
({
id
:
EXECUTE_ACTIVE_CELL_COMMAND_ID
,
title
:
localize
(
'
notebookActions.executeNotebookCell
'
,
"
Execute Notebook Active Cell
"
)
});
}
async
run
(
accessor
:
ServicesAccessor
):
Promise
<
void
>
{
let
editorService
=
accessor
.
get
(
IEditorService
);
let
editor
=
getActiveNotebookEditor
(
editorService
);
if
(
!
editor
)
{
return
;
}
let
activeCell
=
editor
.
getActiveCell
();
if
(
activeCell
)
{
return
editor
.
executeNotebookCell
(
activeCell
);
}
}
});
registerAction2
(
class
extends
Action2
{
registerAction2
(
class
extends
Action2
{
constructor
()
{
constructor
()
{
super
({
super
({
...
@@ -368,7 +350,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
...
@@ -368,7 +350,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
command
:
{
command
:
{
id
:
EXECUTE_
ACTIVE_
CELL_COMMAND_ID
,
id
:
EXECUTE_CELL_COMMAND_ID
,
title
:
localize
(
'
notebookActions.menu.execute
'
,
"
Execute Notebook Cell
"
),
title
:
localize
(
'
notebookActions.menu.execute
'
,
"
Execute Notebook Cell
"
),
icon
:
{
id
:
'
codicon/run
'
}
icon
:
{
id
:
'
codicon/run
'
}
},
},
...
@@ -386,7 +368,9 @@ registerAction2(class extends Action2 {
...
@@ -386,7 +368,9 @@ registerAction2(class extends Action2 {
when
:
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)),
when
:
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)),
primary
:
KeyCode
.
KEY_Y
,
primary
:
KeyCode
.
KEY_Y
,
weight
:
KeybindingWeight
.
WorkbenchContrib
weight
:
KeybindingWeight
.
WorkbenchContrib
}
},
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
f1
:
true
});
});
}
}
...
@@ -404,7 +388,9 @@ registerAction2(class extends Action2 {
...
@@ -404,7 +388,9 @@ registerAction2(class extends Action2 {
when
:
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)),
when
:
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)),
primary
:
KeyCode
.
KEY_M
,
primary
:
KeyCode
.
KEY_M
,
weight
:
KeybindingWeight
.
WorkbenchContrib
weight
:
KeybindingWeight
.
WorkbenchContrib
}
},
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
f1
:
true
});
});
}
}
...
@@ -481,6 +467,10 @@ export interface INotebookCellActionContext {
...
@@ -481,6 +467,10 @@ export interface INotebookCellActionContext {
notebookEditor
:
INotebookEditor
;
notebookEditor
:
INotebookEditor
;
}
}
function
isCellActionContext
(
context
:
any
):
context
is
INotebookCellActionContext
{
return
context
&&
!!
context
.
cell
&&
!!
context
.
notebookEditor
;
}
function
getActiveCellContext
(
accessor
:
ServicesAccessor
):
INotebookCellActionContext
|
undefined
{
function
getActiveCellContext
(
accessor
:
ServicesAccessor
):
INotebookCellActionContext
|
undefined
{
const
editorService
=
accessor
.
get
(
IEditorService
);
const
editorService
=
accessor
.
get
(
IEditorService
);
...
@@ -510,7 +500,7 @@ abstract class InsertCellCommand extends Action2 {
...
@@ -510,7 +500,7 @@ abstract class InsertCellCommand extends Action2 {
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -641,7 +631,7 @@ registerAction2(class extends Action2 {
...
@@ -641,7 +631,7 @@ registerAction2(class extends Action2 {
}
}
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -671,7 +661,7 @@ registerAction2(class extends Action2 {
...
@@ -671,7 +661,7 @@ registerAction2(class extends Action2 {
}
}
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -709,7 +699,7 @@ registerAction2(class extends Action2 {
...
@@ -709,7 +699,7 @@ registerAction2(class extends Action2 {
}
}
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -755,7 +745,7 @@ registerAction2(class extends Action2 {
...
@@ -755,7 +745,7 @@ registerAction2(class extends Action2 {
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -789,7 +779,7 @@ registerAction2(class extends Action2 {
...
@@ -789,7 +779,7 @@ registerAction2(class extends Action2 {
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -805,12 +795,14 @@ registerAction2(class extends Action2 {
...
@@ -805,12 +795,14 @@ registerAction2(class extends Action2 {
super
(
super
(
{
{
id
:
COPY_CELL_UP_COMMAND_ID
,
id
:
COPY_CELL_UP_COMMAND_ID
,
title
:
localize
(
'
notebookActions.copyCellUp
'
,
"
Copy Cell Up
"
)
title
:
localize
(
'
notebookActions.copyCellUp
'
,
"
Copy Cell Up
"
),
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
f1
:
true
});
});
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -826,12 +818,14 @@ registerAction2(class extends Action2 {
...
@@ -826,12 +818,14 @@ registerAction2(class extends Action2 {
super
(
super
(
{
{
id
:
COPY_CELL_DOWN_COMMAND_ID
,
id
:
COPY_CELL_DOWN_COMMAND_ID
,
title
:
localize
(
'
notebookActions.copyCellDown
'
,
"
Copy Cell Down
"
)
title
:
localize
(
'
notebookActions.copyCellDown
'
,
"
Copy Cell Down
"
),
category
:
NOTEBOOK_ACTIONS_CATEGORY
,
f1
:
true
});
});
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
)
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -856,7 +850,7 @@ registerAction2(class extends Action2 {
...
@@ -856,7 +850,7 @@ registerAction2(class extends Action2 {
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
@@ -895,7 +889,7 @@ registerAction2(class extends Action2 {
...
@@ -895,7 +889,7 @@ registerAction2(class extends Action2 {
}
}
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
context
?:
INotebookCellActionContext
):
Promise
<
void
>
{
if
(
!
context
)
{
if
(
!
isCellActionContext
(
context
)
)
{
context
=
getActiveCellContext
(
accessor
);
context
=
getActiveCellContext
(
accessor
);
if
(
!
context
)
{
if
(
!
context
)
{
return
;
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录