Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
820a8315
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,发现更多精彩内容 >>
提交
820a8315
编写于
7月 12, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove getGroupId and shouldShowInContextMenu
上级
6df04efd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
59 deletion
+20
-59
src/vs/editor/common/editorAction.ts
src/vs/editor/common/editorAction.ts
+3
-18
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+1
-11
src/vs/editor/contrib/clipboard/browser/clipboard.ts
src/vs/editor/contrib/clipboard/browser/clipboard.ts
+0
-12
src/vs/editor/contrib/contextmenu/browser/contextmenu.ts
src/vs/editor/contrib/contextmenu/browser/contextmenu.ts
+16
-3
src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts
...editor/contrib/referenceSearch/browser/referenceSearch.ts
+0
-4
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+0
-11
未找到文件。
src/vs/editor/common/editorAction.ts
浏览文件 @
820a8315
...
...
@@ -40,13 +40,6 @@ export class EditorAction extends Action implements IEditorContribution {
super
.
dispose
();
}
/**
* A helper to be able to group and sort actions when they are presented visually.
*/
public
getGroupId
():
string
{
return
this
.
id
;
}
public
getDescriptor
():
IEditorActionDescriptorData
{
return
this
.
_descriptor
;
}
...
...
@@ -118,11 +111,9 @@ export class HandlerEditorAction extends EditorAction {
export
class
DynamicEditorAction
extends
EditorAction
{
private
static
_transformBehaviour
(
behaviour
:
IActionEnablement
,
contextMenuGroupId
:
string
):
Behaviour
{
private
static
_transformBehaviour
(
behaviour
:
IActionEnablement
):
Behaviour
{
var
r
=
0
;
if
(
contextMenuGroupId
)
{
r
|=
Behaviour
.
ShowInContextMenu
;
}
else
if
(
behaviour
.
textFocus
)
{
if
(
behaviour
.
textFocus
)
{
// Allowed to set text focus only if not appearing in the context menu
r
|=
Behaviour
.
TextFocus
;
}
...
...
@@ -142,7 +133,6 @@ export class DynamicEditorAction extends EditorAction {
return
r
;
}
private
_contextMenuGroupId
:
string
;
private
_run
:
(
editor
:
ICommonCodeEditor
)
=>
void
;
private
_tokensAtPosition
:
string
[];
private
_wordAtPosition
:
boolean
;
...
...
@@ -152,19 +142,14 @@ export class DynamicEditorAction extends EditorAction {
super
({
id
:
descriptor
.
id
,
label
:
descriptor
.
label
},
editor
,
DynamicEditorAction
.
_transformBehaviour
(
enablement
,
descriptor
.
contextMenuGroupId
));
},
editor
,
DynamicEditorAction
.
_transformBehaviour
(
enablement
));
this
.
_contextMenuGroupId
=
descriptor
.
contextMenuGroupId
;
this
.
_run
=
descriptor
.
run
;
this
.
_tokensAtPosition
=
enablement
.
tokensAtPosition
;
this
.
_wordAtPosition
=
enablement
.
wordAtPosition
;
}
public
getGroupId
():
string
{
return
this
.
_contextMenuGroupId
;
}
public
run
():
TPromise
<
void
>
{
return
TPromise
.
as
(
this
.
_run
(
this
.
editor
));
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
820a8315
...
...
@@ -3368,17 +3368,7 @@ export interface IActionDescriptor {
* A set of enablement conditions.
*/
enablement
?:
IActionEnablement
;
/**
* Control if the action should show up in the context menu and where.
* Built-in groups:
* 1_goto/* => e.g. 1_goto/1_peekDefinition
* 2_change/* => e.g. 2_change/2_format
* 3_edit/* => e.g. 3_edit/1_copy
* 4_tools/* => e.g. 4_tools/1_commands
* You can also create your own group.
* Defaults to null (don't show in context menu).
*/
contextMenuGroupId
?:
string
;
/**
* Method that will be executed when the action is triggered.
* @param editor The editor instance is passed in as a convinience
...
...
src/vs/editor/contrib/clipboard/browser/clipboard.ts
浏览文件 @
820a8315
...
...
@@ -66,10 +66,6 @@ class ExecCommandCutAction extends ClipboardWritingAction {
super
(
descriptor
,
editor
,
Behaviour
.
Writeable
|
Behaviour
.
WidgetFocus
|
Behaviour
.
UpdateOnCursorPositionChange
);
}
public
getGroupId
():
string
{
return
'
3_edit/1_cut
'
;
}
public
getEnablementState
():
boolean
{
return
super
.
getEnablementState
()
&&
editorCursorIsInEditableRange
(
this
.
editor
);
}
...
...
@@ -87,10 +83,6 @@ class ExecCommandCopyAction extends ClipboardWritingAction {
super
(
descriptor
,
editor
,
Behaviour
.
WidgetFocus
);
}
public
getGroupId
():
string
{
return
'
3_edit/2_copy
'
;
}
public
run
():
TPromise
<
boolean
>
{
this
.
editor
.
focus
();
document
.
execCommand
(
'
copy
'
);
...
...
@@ -104,10 +96,6 @@ class ExecCommandPasteAction extends EditorAction {
super
(
descriptor
,
editor
,
Behaviour
.
Writeable
|
Behaviour
.
WidgetFocus
|
Behaviour
.
UpdateOnCursorPositionChange
);
}
public
getGroupId
():
string
{
return
'
3_edit/3_paste
'
;
}
public
getEnablementState
():
boolean
{
return
editorCursorIsInEditableRange
(
this
.
editor
);
}
...
...
src/vs/editor/contrib/contextmenu/browser/contextmenu.ts
浏览文件 @
820a8315
...
...
@@ -28,6 +28,19 @@ interface IPosition {
y
:
number
;
}
interface
OldContextMenuAction
extends
IAction
{
getGroupId
():
string
;
shouldShowInContextMenu
():
boolean
;
isSupported
():
boolean
;
}
namespace
OldContextMenuAction
{
export
function
is
(
thing
:
any
):
thing
is
OldContextMenuAction
{
return
typeof
(
<
OldContextMenuAction
>
thing
).
getGroupId
===
'
function
'
&&
typeof
(
<
OldContextMenuAction
>
thing
).
shouldShowInContextMenu
===
'
function
'
;
}
}
class
ContextMenuController
implements
IEditorContribution
{
public
static
ID
=
'
editor.contrib.contextmenu
'
;
...
...
@@ -130,8 +143,8 @@ class ContextMenuController implements IEditorContribution {
return
[];
}
const
contributedActions
=
<
Editor
Action
[]
>
this
.
_editor
.
getActions
().
filter
(
action
=>
{
if
(
action
instanceof
EditorAction
)
{
const
contributedActions
=
<
OldContextMenu
Action
[]
>
this
.
_editor
.
getActions
().
filter
(
action
=>
{
if
(
OldContextMenuAction
.
is
(
action
)
)
{
return
action
.
shouldShowInContextMenu
()
&&
action
.
isSupported
();
}
});
...
...
@@ -141,7 +154,7 @@ class ContextMenuController implements IEditorContribution {
return
actions
;
}
private
static
_prepareActions
(
actions
:
Editor
Action
[]):
IAction
[]
{
private
static
_prepareActions
(
actions
:
OldContextMenu
Action
[]):
IAction
[]
{
const
data
=
actions
.
map
(
action
=>
{
const
groupId
=
action
.
getGroupId
();
...
...
src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts
浏览文件 @
820a8315
...
...
@@ -57,10 +57,6 @@ export class ReferenceAction extends EditorAction {
}
}
public
getGroupId
():
string
{
return
'
1_goto/4_references
'
;
}
public
isSupported
():
boolean
{
return
ReferenceProviderRegistry
.
has
(
this
.
editor
.
getModel
())
&&
super
.
isSupported
();
}
...
...
src/vs/monaco.d.ts
浏览文件 @
820a8315
...
...
@@ -2795,17 +2795,6 @@ declare module monaco.editor {
* A set of enablement conditions.
*/
enablement
?:
IActionEnablement
;
/**
* Control if the action should show up in the context menu and where.
* Built-in groups:
* 1_goto/* => e.g. 1_goto/1_peekDefinition
* 2_change/* => e.g. 2_change/2_format
* 3_edit/* => e.g. 3_edit/1_copy
* 4_tools/* => e.g. 4_tools/1_commands
* You can also create your own group.
* Defaults to null (don't show in context menu).
*/
contextMenuGroupId
?:
string
;
/**
* Method that will be executed when the action is triggered.
* @param editor The editor instance is passed in as a convinience
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录