Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8183db5b
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,发现更多精彩内容 >>
提交
8183db5b
编写于
11月 06, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Also include keybindings for organize imports and fixAll in the source menu
For #84101
上级
04f403bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
11 deletion
+24
-11
src/vs/editor/contrib/codeAction/codeAction.ts
src/vs/editor/contrib/codeAction/codeAction.ts
+2
-0
src/vs/editor/contrib/codeAction/codeActionCommands.ts
src/vs/editor/contrib/codeAction/codeActionCommands.ts
+3
-8
src/vs/editor/contrib/codeAction/codeActionWidget.ts
src/vs/editor/contrib/codeAction/codeActionWidget.ts
+19
-3
未找到文件。
src/vs/editor/contrib/codeAction/codeAction.ts
浏览文件 @
8183db5b
...
...
@@ -20,6 +20,8 @@ import { DisposableStore, IDisposable, Disposable } from 'vs/base/common/lifecyc
export
const
codeActionCommandId
=
'
editor.action.codeAction
'
;
export
const
refactorCommandId
=
'
editor.action.refactor
'
;
export
const
sourceActionCommandId
=
'
editor.action.sourceAction
'
;
export
const
organizeImportsCommandId
=
'
editor.action.organizeImports
'
;
export
const
fixAllCommandId
=
'
editor.action.fixAll
'
;
export
interface
CodeActionSet
extends
IDisposable
{
readonly
actions
:
readonly
CodeAction
[];
...
...
src/vs/editor/contrib/codeAction/codeActionCommands.ts
浏览文件 @
8183db5b
...
...
@@ -16,7 +16,7 @@ import { IPosition } from 'vs/editor/common/core/position';
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
CodeAction
}
from
'
vs/editor/common/modes
'
;
import
{
CodeActionSet
,
refactorCommandId
,
sourceActionCommandId
,
codeActionCommandId
}
from
'
vs/editor/contrib/codeAction/codeAction
'
;
import
{
CodeActionSet
,
refactorCommandId
,
sourceActionCommandId
,
codeActionCommandId
,
organizeImportsCommandId
,
fixAllCommandId
}
from
'
vs/editor/contrib/codeAction/codeAction
'
;
import
{
CodeActionUi
}
from
'
vs/editor/contrib/codeAction/codeActionUi
'
;
import
{
MessageController
}
from
'
vs/editor/contrib/message/messageController
'
;
import
*
as
nls
from
'
vs/nls
'
;
...
...
@@ -306,7 +306,6 @@ export class RefactorAction extends EditorAction {
}
}
export
class
SourceAction
extends
EditorAction
{
constructor
()
{
...
...
@@ -356,11 +355,9 @@ export class SourceAction extends EditorAction {
export
class
OrganizeImportsAction
extends
EditorAction
{
static
readonly
Id
=
'
editor.action.organizeImports
'
;
constructor
()
{
super
({
id
:
OrganizeImportsAction
.
Id
,
id
:
organizeImportsCommand
Id
,
label
:
nls
.
localize
(
'
organizeImports.label
'
,
"
Organize Imports
"
),
alias
:
'
Organize Imports
'
,
precondition
:
ContextKeyExpr
.
and
(
...
...
@@ -384,11 +381,9 @@ export class OrganizeImportsAction extends EditorAction {
export
class
FixAllAction
extends
EditorAction
{
static
readonly
Id
=
'
editor.action.fixAll
'
;
constructor
()
{
super
({
id
:
FixAllAction
.
Id
,
id
:
fixAllCommand
Id
,
label
:
nls
.
localize
(
'
fixAll.label
'
,
"
Fix All
"
),
alias
:
'
Fix All
'
,
precondition
:
ContextKeyExpr
.
and
(
...
...
src/vs/editor/contrib/codeAction/codeActionWidget.ts
浏览文件 @
8183db5b
...
...
@@ -14,7 +14,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
IPosition
,
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CodeAction
}
from
'
vs/editor/common/modes
'
;
import
{
CodeActionSet
,
refactorCommandId
,
sourceActionCommandId
,
codeActionCommandId
}
from
'
vs/editor/contrib/codeAction/codeAction
'
;
import
{
CodeActionSet
,
refactorCommandId
,
sourceActionCommandId
,
codeActionCommandId
,
organizeImportsCommandId
,
fixAllCommandId
}
from
'
vs/editor/contrib/codeAction/codeAction
'
;
import
{
CodeActionAutoApply
,
CodeActionCommandArgs
,
CodeActionKind
}
from
'
vs/editor/contrib/codeAction/codeActionTrigger
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -95,15 +95,31 @@ export class CodeActionWidget extends Disposable {
}
private
resolveKeybindings
(
actions
:
readonly
CodeActionAction
[]):
Map
<
CodeActionAction
,
ResolvedKeybinding
>
{
const
codeActionCommands
=
new
Set
([
refactorCommandId
,
codeActionCommandId
,
sourceActionCommandId
,
organizeImportsCommandId
,
fixAllCommandId
]);
// Lazy since we may not actually ever read the value
const
allCodeActionBindings
=
new
Lazy
<
readonly
ResolveCodeActionKeybinding
[]
>
(()
=>
this
.
_keybindingService
.
getKeybindings
()
.
filter
(
item
=>
new
Set
([
refactorCommandId
,
codeActionCommandId
,
sourceActionCommandId
])
.
has
(
item
.
command
!
))
.
filter
(
item
=>
codeActionCommands
.
has
(
item
.
command
!
))
.
filter
(
item
=>
item
.
resolvedKeybinding
)
.
map
((
item
):
ResolveCodeActionKeybinding
=>
{
// Special case these commands since they come built-in with VS Code and don't use 'commandArgs'
let
commandArgs
=
item
.
commandArgs
;
if
(
item
.
command
===
organizeImportsCommandId
)
{
commandArgs
=
{
kind
:
CodeActionKind
.
SourceOrganizeImports
.
value
};
}
else
if
(
item
.
command
===
fixAllCommandId
)
{
commandArgs
=
{
kind
:
CodeActionKind
.
SourceFixAll
.
value
};
}
return
{
resolvedKeybinding
:
item
.
resolvedKeybinding
!
,
...
CodeActionCommandArgs
.
fromUser
(
item
.
commandArgs
,
{
...
CodeActionCommandArgs
.
fromUser
(
commandArgs
,
{
kind
:
CodeActionKind
.
None
,
apply
:
CodeActionAutoApply
.
Never
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录