Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ce86f17e
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,发现更多精彩内容 >>
提交
ce86f17e
编写于
8月 08, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up `menuOpts`
上级
016c161e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
30 addition
and
40 deletion
+30
-40
src/vs/editor/common/editorCommonExtensions.ts
src/vs/editor/common/editorCommonExtensions.ts
+22
-15
src/vs/editor/contrib/clipboard/browser/clipboard.ts
src/vs/editor/contrib/clipboard/browser/clipboard.ts
+0
-7
src/vs/editor/contrib/find/common/findController.ts
src/vs/editor/contrib/find/common/findController.ts
+2
-3
src/vs/editor/contrib/format/common/formatActions.ts
src/vs/editor/contrib/format/common/formatActions.ts
+1
-2
src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts
...editor/contrib/goToDeclaration/browser/goToDeclaration.ts
+2
-4
src/vs/editor/contrib/quickOpen/browser/quickCommand.ts
src/vs/editor/contrib/quickOpen/browser/quickCommand.ts
+0
-1
src/vs/editor/contrib/quickOpen/browser/quickOutline.ts
src/vs/editor/contrib/quickOpen/browser/quickOutline.ts
+1
-2
src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts
...editor/contrib/referenceSearch/browser/referenceSearch.ts
+0
-1
src/vs/editor/contrib/rename/browser/rename.ts
src/vs/editor/contrib/rename/browser/rename.ts
+1
-2
src/vs/workbench/parts/debug/browser/debugActions.ts
src/vs/workbench/parts/debug/browser/debugActions.ts
+1
-3
未找到文件。
src/vs/editor/common/editorCommonExtensions.ts
浏览文件 @
ce86f17e
...
...
@@ -8,7 +8,7 @@ import {illegalArgument} from 'vs/base/common/errors';
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
KbExpr
,
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
...
...
@@ -17,7 +17,7 @@ import {ICommandOptions, Command as ConfigBasicCommand, EditorCommand as ConfigE
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
MenuId
,
MenuRegistry
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuId
,
MenuRegistry
,
IMenuItem
}
from
'
vs/platform/actions/common/actions
'
;
export
type
ServicesAccessor
=
ServicesAccessor
;
export
const
Command
=
ConfigBasicCommand
;
...
...
@@ -26,8 +26,6 @@ export type ICommandOptions = ICommandOptions;
// --- Keybinding extensions to make it more concise to express keybindings conditions
export
interface
IEditorCommandMenuOptions
{
kbExpr
:
KbExpr
;
menu
?:
MenuId
;
group
?:
string
;
order
?:
number
;
}
...
...
@@ -118,16 +116,9 @@ class EditorContributionRegistry {
public
registerEditorAction
(
action
:
EditorAction
)
{
if
(
action
.
menuOpts
)
{
MenuRegistry
.
appendMenuItem
(
action
.
menuOpts
.
menu
||
MenuId
.
EditorContext
,
{
command
:
{
id
:
action
.
id
,
title
:
action
.
label
},
when
:
action
.
menuOpts
.
kbExpr
,
group
:
action
.
menuOpts
.
group
,
order
:
action
.
menuOpts
.
order
});
let
menuItem
=
action
.
toMenuItem
();
if
(
menuItem
)
{
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorContext
,
menuItem
);
}
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
action
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
...
...
@@ -155,7 +146,7 @@ export abstract class EditorAction extends ConfigEditorCommand {
public
label
:
string
;
public
alias
:
string
;
p
ublic
menuOpts
:
IEditorCommandMenuOptions
;
p
rivate
menuOpts
:
IEditorCommandMenuOptions
;
constructor
(
opts
:
IActionOptions
)
{
super
(
opts
);
...
...
@@ -164,6 +155,22 @@ export abstract class EditorAction extends ConfigEditorCommand {
this
.
menuOpts
=
opts
.
menuOpts
;
}
public
toMenuItem
():
IMenuItem
{
if
(
!
this
.
menuOpts
)
{
return
null
;
}
return
{
command
:
{
id
:
this
.
id
,
title
:
this
.
label
},
when
:
this
.
precondition
,
group
:
this
.
menuOpts
.
group
,
order
:
this
.
menuOpts
.
order
};
}
protected
runEditorCommand
(
accessor
:
ServicesAccessor
,
editor
:
editorCommon
.
ICommonCodeEditor
,
args
:
any
):
void
|
TPromise
<
void
>
{
if
(
!
this
.
enabled
(
accessor
,
editor
))
{
return
;
...
...
src/vs/editor/contrib/clipboard/browser/clipboard.ts
浏览文件 @
ce86f17e
...
...
@@ -13,7 +13,6 @@ import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation';
import
{
findFocusedEditor
}
from
'
vs/editor/common/config/config
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IActionOptions
,
EditorAction
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
EditorContextKeys
=
editorCommon
.
EditorContextKeys
;
...
...
@@ -59,8 +58,6 @@ class ExecCommandCutAction extends ExecCommandAction {
win
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_X
,
secondary
:
[
KeyMod
.
Shift
|
KeyCode
.
Delete
]
}
},
menuOpts
:
{
kbExpr
:
EditorContextKeys
.
Writable
,
menu
:
MenuId
.
EditorContext
,
group
:
CLIPBOARD_CONTEXT_MENU_GROUP
,
order
:
1
}
...
...
@@ -90,8 +87,6 @@ class ExecCommandCopyAction extends ExecCommandAction {
win
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_C
,
secondary
:
[
KeyMod
.
CtrlCmd
|
KeyCode
.
Insert
]
}
},
menuOpts
:
{
kbExpr
:
null
,
menu
:
MenuId
.
EditorContext
,
group
:
CLIPBOARD_CONTEXT_MENU_GROUP
,
order
:
2
}
...
...
@@ -121,8 +116,6 @@ class ExecCommandPasteAction extends ExecCommandAction {
win
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_V
,
secondary
:
[
KeyMod
.
Shift
|
KeyCode
.
Insert
]
}
},
menuOpts
:
{
kbExpr
:
EditorContextKeys
.
Writable
,
menu
:
MenuId
.
EditorContext
,
group
:
CLIPBOARD_CONTEXT_MENU_GROUP
,
order
:
3
}
...
...
src/vs/editor/contrib/find/common/findController.ts
浏览文件 @
ce86f17e
...
...
@@ -665,15 +665,14 @@ export class CompatChangeAll extends AbstractSelectHighlightsAction {
id
:
'
editor.action.changeAll
'
,
label
:
nls
.
localize
(
'
changeAll.label
'
,
"
Change All Occurrences
"
),
alias
:
'
Change All Occurrences
'
,
precondition
:
null
,
precondition
:
EditorContextKeys
.
Writable
,
kbOpts
:
{
kbExpr
:
EditorContextKeys
.
TextFocus
,
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
F2
},
menuOpts
:
{
group
:
'
1_modification
'
,
order
:
1.2
,
kbExpr
:
EditorContextKeys
.
Writable
order
:
1.2
}
});
}
...
...
src/vs/editor/contrib/format/common/formatActions.ts
浏览文件 @
ce86f17e
...
...
@@ -150,8 +150,7 @@ export class FormatAction extends EditorAction {
},
menuOpts
:
{
group
:
'
1_modification
'
,
order
:
1.3
,
kbExpr
:
ModeContextKeys
.
hasFormattingProvider
order
:
1.3
}
});
}
...
...
src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts
浏览文件 @
ce86f17e
...
...
@@ -162,8 +162,7 @@ export class GoToDefinitionAction extends DefinitionAction {
},
menuOpts
:
{
group
:
'
navigation
'
,
order
:
1.1
,
kbExpr
:
ModeContextKeys
.
hasDefinitionProvider
order
:
1.1
}
});
}
...
...
@@ -201,8 +200,7 @@ export class PeekDefinitionAction extends DefinitionAction {
},
menuOpts
:
{
group
:
'
navigation
'
,
order
:
1.2
,
kbExpr
:
ModeContextKeys
.
hasDefinitionProvider
order
:
1.2
}
});
}
...
...
src/vs/editor/contrib/quickOpen/browser/quickCommand.ts
浏览文件 @
ce86f17e
...
...
@@ -82,7 +82,6 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction {
primary
:
(
browser
.
isIE11orEarlier
?
KeyMod
.
Alt
|
KeyCode
.
F1
:
KeyCode
.
F1
)
},
menuOpts
:
{
kbExpr
:
EditorContextKeys
.
Focus
}
});
}
...
...
src/vs/editor/contrib/quickOpen/browser/quickOutline.ts
浏览文件 @
ce86f17e
...
...
@@ -121,8 +121,7 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction {
},
menuOpts
:
{
group
:
'
navigation
'
,
order
:
3
,
kbExpr
:
ModeContextKeys
.
hasDocumentSymbolProvider
order
:
3
}
});
}
...
...
src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts
浏览文件 @
ce86f17e
...
...
@@ -67,7 +67,6 @@ export class ReferenceAction extends EditorAction {
primary
:
KeyMod
.
Shift
|
KeyCode
.
F12
},
menuOpts
:
{
kbExpr
:
ModeContextKeys
.
hasReferenceProvider
,
group
:
'
navigation
'
,
order
:
1.3
}
...
...
src/vs/editor/contrib/rename/browser/rename.ts
浏览文件 @
ce86f17e
...
...
@@ -159,8 +159,7 @@ export class RenameAction extends EditorAction {
},
menuOpts
:
{
group
:
'
1_modification
'
,
order
:
1.1
,
kbExpr
:
KbExpr
.
and
(
ModeContextKeys
.
hasRenameProvider
,
EditorContextKeys
.
Writable
)
order
:
1.1
}
});
}
...
...
src/vs/workbench/parts/debug/browser/debugActions.ts
浏览文件 @
ce86f17e
...
...
@@ -600,7 +600,6 @@ export class RunToCursorAction extends EditorAction {
alias
:
'
Debug: Run to Cursor
'
,
precondition
:
debug
.
CONTEXT_IN_DEBUG_MODE
,
menuOpts
:
{
kbExpr
:
debug
.
CONTEXT_IN_DEBUG_MODE
,
group
:
'
debug
'
}
});
...
...
@@ -658,9 +657,8 @@ export class SelectionToReplAction extends EditorAction {
id
:
'
editor.debug.action.selectionToRepl
'
,
label
:
nls
.
localize
(
'
debugEvaluate
'
,
"
Debug: Evaluate
"
),
alias
:
'
Debug: Evaluate
'
,
precondition
:
debug
.
CONTEXT_IN_DEBUG_MODE
,
precondition
:
KbExpr
.
and
(
EditorContextKeys
.
HasNonEmptySelection
,
debug
.
CONTEXT_IN_DEBUG_MODE
)
,
menuOpts
:
{
kbExpr
:
KbExpr
.
and
(
EditorContextKeys
.
HasNonEmptySelection
,
debug
.
CONTEXT_IN_DEBUG_MODE
),
group
:
'
debug
'
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录