Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
9582aef3
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,发现更多精彩内容 >>
提交
9582aef3
编写于
8月 02, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usage of EditorAction.isSupported()
上级
2ee0412b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
19 deletion
+26
-19
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+4
-0
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+8
-1
src/vs/editor/common/editorActionEnablement.ts
src/vs/editor/common/editorActionEnablement.ts
+0
-1
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+5
-0
src/vs/editor/contrib/quickOpen/browser/quickCommand.ts
src/vs/editor/contrib/quickOpen/browser/quickCommand.ts
+2
-9
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+4
-0
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
+3
-8
未找到文件。
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
9582aef3
...
...
@@ -601,6 +601,10 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
return
this
.
modifiedEditor
.
getActions
();
}
public
getSupportedActions
():
IAction
[]
{
return
this
.
modifiedEditor
.
getSupportedActions
();
}
public
getAction
(
id
:
string
):
IAction
{
return
this
.
modifiedEditor
.
getAction
(
id
);
}
...
...
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
9582aef3
...
...
@@ -24,7 +24,7 @@ import {EditorState} from 'vs/editor/common/core/editorState';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
DynamicEditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
{
EditorAction
,
DynamicEditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
CharacterHardWrappingLineMapperFactory
}
from
'
vs/editor/common/viewModel/characterHardWrappingLineMapper
'
;
...
...
@@ -576,6 +576,13 @@ export abstract class CommonCodeEditor extends EventEmitter implements editorCom
return
result
;
}
public
getSupportedActions
():
IAction
[]
{
let
result
=
this
.
getActions
();
result
=
result
.
filter
(
action
=>
(
<
EditorAction
>
action
).
isSupported
());
return
result
;
}
public
getAction
(
id
:
string
):
IAction
{
var
contribution
=
<
any
>
this
.
contributions
[
id
];
if
(
contribution
)
{
...
...
src/vs/editor/common/editorActionEnablement.ts
浏览文件 @
9582aef3
...
...
@@ -12,7 +12,6 @@ export enum Behaviour {
WidgetFocus
=
1
<<
1
,
Writeable
=
1
<<
2
,
UpdateOnModelChange
=
1
<<
3
,
UpdateOnConfigurationChange
=
1
<<
4
,
UpdateOnCursorPositionChange
=
1
<<
6
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
9582aef3
...
...
@@ -3588,6 +3588,11 @@ export interface IEditor {
*/
getActions
():
IAction
[];
/**
* Returns all actions associated with this editor.
*/
getSupportedActions
():
IAction
[];
/**
* Saves current view state of the editor in a serializable object.
*/
...
...
src/vs/editor/contrib/quickOpen/browser/quickCommand.ts
浏览文件 @
9582aef3
...
...
@@ -12,7 +12,6 @@ import {TPromise} from 'vs/base/common/winjs.base';
import
{
IContext
,
IHighlight
,
QuickOpenEntryGroup
,
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
IAutoFocus
,
Mode
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
EditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
{
ICommonCodeEditor
,
IEditor
,
IEditorActionDescriptorData
}
from
'
vs/editor/common/editorCommon
'
;
import
{
BaseEditorQuickOpenAction
}
from
'
./editorQuickOpen
'
;
...
...
@@ -80,7 +79,7 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction {
}
_getModel
(
value
:
string
):
QuickOpenModel
{
return
new
QuickOpenModel
(
this
.
_editorActionsToEntries
(
this
.
editor
.
getActions
(),
value
));
return
new
QuickOpenModel
(
this
.
_editorActionsToEntries
(
this
.
editor
.
get
Supported
Actions
(),
value
));
}
_sort
(
elementA
:
QuickOpenEntryGroup
,
elementB
:
QuickOpenEntryGroup
):
number
{
...
...
@@ -96,13 +95,7 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction {
for
(
let
i
=
0
;
i
<
actions
.
length
;
i
++
)
{
let
action
=
actions
[
i
];
let
editorAction
=
<
EditorAction
>
action
;
if
(
!
editorAction
.
isSupported
())
{
continue
;
// do not show actions that are not supported in this context
}
let
keys
=
this
.
_keybindingService
.
lookupKeybindings
(
editorAction
.
id
).
map
(
k
=>
this
.
_keybindingService
.
getLabelFor
(
k
));
let
keys
=
this
.
_keybindingService
.
lookupKeybindings
(
action
.
id
).
map
(
k
=>
this
.
_keybindingService
.
getLabelFor
(
k
));
if
(
action
.
label
)
{
let
highlights
=
matchesFuzzy
(
searchValue
,
action
.
label
);
...
...
src/vs/monaco.d.ts
浏览文件 @
9582aef3
...
...
@@ -2888,6 +2888,10 @@ declare module monaco.editor {
* Returns all actions associated with this editor.
*/
getActions
():
IAction
[];
/**
* Returns all actions associated with this editor.
*/
getSupportedActions
():
IAction
[];
/**
* Saves current view state of the editor in a serializable object.
*/
...
...
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
浏览文件 @
9582aef3
...
...
@@ -256,8 +256,8 @@ export class CommandsHandler extends QuickOpenHandler {
let
activeEditorControl
=
<
any
>
(
activeEditor
?
activeEditor
.
getControl
()
:
null
);
let
editorActions
:
EditorAction
[]
=
[];
if
(
activeEditorControl
&&
types
.
isFunction
(
activeEditorControl
.
getActions
))
{
editorActions
=
activeEditorControl
.
getActions
();
if
(
activeEditorControl
&&
types
.
isFunction
(
activeEditorControl
.
get
Supported
Actions
))
{
editorActions
=
activeEditorControl
.
get
Supported
Actions
();
}
let
editorEntries
=
this
.
editorActionsToEntries
(
editorActions
,
searchValue
);
...
...
@@ -319,12 +319,7 @@ export class CommandsHandler extends QuickOpenHandler {
for
(
let
i
=
0
;
i
<
actions
.
length
;
i
++
)
{
let
action
=
actions
[
i
];
let
editorAction
=
<
EditorAction
>
action
;
if
(
!
editorAction
.
isSupported
())
{
continue
;
// do not show actions that are not supported in this context
}
let
keys
=
this
.
keybindingService
.
lookupKeybindings
(
editorAction
.
id
);
let
keys
=
this
.
keybindingService
.
lookupKeybindings
(
action
.
id
);
let
keyLabel
=
keys
.
map
(
k
=>
this
.
keybindingService
.
getLabelFor
(
k
));
let
keyAriaLabel
=
keys
.
map
(
k
=>
this
.
keybindingService
.
getAriaLabelFor
(
k
));
let
label
=
action
.
label
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录