Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b5a2ab1e
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,发现更多精彩内容 >>
提交
b5a2ab1e
编写于
3月 12, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quick access - allow to search by command alias but not show it
上级
e6872f46
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
48 deletion
+28
-48
src/vs/editor/contrib/quickAccess/commandsQuickAccess.ts
src/vs/editor/contrib/quickAccess/commandsQuickAccess.ts
+6
-28
src/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.ts
...lone/browser/quickAccess/standaloneCommandsQuickAccess.ts
+1
-1
src/vs/platform/quickinput/browser/commandsQuickAccess.ts
src/vs/platform/quickinput/browser/commandsQuickAccess.ts
+14
-3
src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts
...kbench/contrib/quickaccess/browser/commandsQuickAccess.ts
+7
-16
未找到文件。
src/vs/editor/contrib/quickAccess/commandsQuickAccess.ts
浏览文件 @
b5a2ab1e
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
AbstractCommandsQuickAccessProvider
,
ICommandQuickPick
}
from
'
vs/platform/quickinput/browser/commandsQuickAccess
'
;
import
{
AbstractCommandsQuickAccessProvider
,
ICommandQuickPick
,
ICommandsQuickAccessOptions
}
from
'
vs/platform/quickinput/browser/commandsQuickAccess
'
;
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -11,24 +11,17 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
export
interface
IEditorCommandsQuickAccessOptions
{
alias
:
{
enable
:
boolean
;
verify
:
boolean
;
}
}
export
abstract
class
AbstractEditorCommandsQuickAccessProvider
extends
AbstractCommandsQuickAccessProvider
{
constructor
(
options
:
ICommandsQuickAccessOptions
,
instantiationService
:
IInstantiationService
,
keybindingService
:
IKeybindingService
,
commandService
:
ICommandService
,
telemetryService
:
ITelemetryService
,
notificationService
:
INotificationService
,
private
options
?:
IEditorCommandsQuickAccessOptions
notificationService
:
INotificationService
)
{
super
(
instantiationService
,
keybindingService
,
commandService
,
telemetryService
,
notificationService
);
super
(
options
,
instantiationService
,
keybindingService
,
commandService
,
telemetryService
,
notificationService
);
}
/**
...
...
@@ -44,28 +37,13 @@ export abstract class AbstractEditorCommandsQuickAccessProvider extends Abstract
const
editorCommandPicks
:
ICommandQuickPick
[]
=
[];
for
(
const
editorAction
of
activeTextEditorControl
.
getSupportedActions
())
{
const
label
=
editorAction
.
label
||
editorAction
.
id
;
const
alias
:
string
|
undefined
=
this
.
verifyAlias
(
editorAction
.
alias
,
label
,
editorAction
.
id
);
editorCommandPicks
.
push
({
commandId
:
editorAction
.
id
,
label
,
detail
:
alias
commandAlias
:
editorAction
.
alias
,
label
:
editorAction
.
label
||
editorAction
.
id
,
});
}
return
editorCommandPicks
;
}
protected
verifyAlias
(
alias
:
string
|
undefined
,
label
:
string
,
commandId
:
string
):
string
|
undefined
{
if
(
this
.
options
?.
alias
.
verify
&&
alias
&&
alias
!==
label
)
{
console
.
warn
(
`Command alias '
${
label
}
' and label '
${
alias
}
' differ (
${
commandId
}
)`
);
}
if
(
!
this
.
options
?.
alias
.
enable
)
{
return
undefined
;
// we unset the alias if it is not enabled
}
return
alias
;
}
}
src/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.ts
浏览文件 @
b5a2ab1e
...
...
@@ -29,7 +29,7 @@ export class StandaloneCommandsQuickAccessProvider extends AbstractEditorCommand
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
INotificationService
notificationService
:
INotificationService
)
{
super
(
instantiationService
,
keybindingService
,
commandService
,
telemetryService
,
notificationService
);
super
(
{
showAlias
:
false
},
instantiationService
,
keybindingService
,
commandService
,
telemetryService
,
notificationService
);
}
protected
async
getCommandPicks
():
Promise
<
Array
<
ICommandQuickPick
>>
{
...
...
src/vs/platform/quickinput/browser/commandsQuickAccess.ts
浏览文件 @
b5a2ab1e
...
...
@@ -27,6 +27,11 @@ import { timeout } from 'vs/base/common/async';
export
interface
ICommandQuickPick
extends
IPickerQuickAccessItem
{
commandId
:
string
;
commandAlias
:
string
|
undefined
;
}
export
interface
ICommandsQuickAccessOptions
{
showAlias
:
boolean
;
}
export
abstract
class
AbstractCommandsQuickAccessProvider
extends
PickerQuickAccessProvider
<
ICommandQuickPick
>
implements
IDisposable
{
...
...
@@ -40,6 +45,7 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc
private
readonly
commandsHistory
=
this
.
disposables
.
add
(
this
.
instantiationService
.
createInstance
(
CommandsHistory
));
constructor
(
private
options
:
ICommandsQuickAccessOptions
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IKeybindingService
private
readonly
keybindingService
:
IKeybindingService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
,
...
...
@@ -58,10 +64,14 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc
const
filteredCommandPicks
:
ICommandQuickPick
[]
=
[];
for
(
const
commandPick
of
allCommandPicks
)
{
const
labelHighlights
=
withNullAsUndefined
(
AbstractCommandsQuickAccessProvider
.
WORD_FILTER
(
filter
,
commandPick
.
label
));
const
detailHighlights
=
commandPick
.
detail
?
withNullAsUndefined
(
AbstractCommandsQuickAccessProvider
.
WORD_FILTER
(
filter
,
commandPick
.
detail
))
:
undefined
;
const
aliasHighlights
=
commandPick
.
commandAlias
?
withNullAsUndefined
(
AbstractCommandsQuickAccessProvider
.
WORD_FILTER
(
filter
,
commandPick
.
commandAlias
))
:
undefined
;
if
(
labelHighlights
||
aliasHighlights
)
{
commandPick
.
highlights
=
{
label
:
labelHighlights
,
detail
:
this
.
options
.
showAlias
?
aliasHighlights
:
undefined
};
if
(
labelHighlights
||
detailHighlights
)
{
commandPick
.
highlights
=
{
label
:
labelHighlights
,
detail
:
detailHighlights
};
filteredCommandPicks
.
push
(
commandPick
);
}
}
...
...
@@ -128,6 +138,7 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc
commandPicks
.
push
({
...
commandPick
,
ariaLabel
,
detail
:
this
.
options
.
showAlias
?
commandPick
.
commandAlias
:
undefined
,
keybinding
,
accept
:
async
()
=>
{
...
...
src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts
浏览文件 @
b5a2ab1e
...
...
@@ -46,16 +46,7 @@ export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAcce
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
INotificationService
notificationService
:
INotificationService
)
{
super
(
instantiationService
,
keybindingService
,
commandService
,
telemetryService
,
notificationService
,
{
alias
:
{
// Show alias only when not running in english
enable
:
!
Language
.
isDefaultVariant
(),
// Print a warning if the alias does not match the english label
verify
:
!
environmentService
.
isBuilt
&&
Language
.
isDefaultVariant
(),
}
});
super
({
showAlias
:
!
Language
.
isDefaultVariant
()
},
instantiationService
,
keybindingService
,
commandService
,
telemetryService
,
notificationService
);
}
protected
async
getCommandPicks
(
disposables
:
DisposableStore
,
token
:
CancellationToken
):
Promise
<
Array
<
ICommandQuickPick
>>
{
...
...
@@ -96,16 +87,16 @@ export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAcce
}
// Alias
const
alias
Title
=
typeof
action
.
item
.
title
!==
'
string
'
?
action
.
item
.
title
.
original
:
undefined
;
const
alias
Label
=
typeof
action
.
item
.
title
!==
'
string
'
?
action
.
item
.
title
.
original
:
undefined
;
const
aliasCategory
=
(
category
&&
action
.
item
.
category
&&
typeof
action
.
item
.
category
!==
'
string
'
)
?
action
.
item
.
category
.
original
:
undefined
;
let
alias
=
this
.
verifyAlias
((
aliasTitle
&&
category
)
?
aliasCategory
?
`
${
aliasCategory
}
:
${
alias
Title
}
`
:
`
${
category
}
:
${
aliasTitle
}
`
:
alias
Title
,
label
,
action
.
item
.
id
)
;
const
commandAlias
=
(
aliasLabel
&&
category
)
?
aliasCategory
?
`
${
aliasCategory
}
:
${
alias
Label
}
`
:
`
${
category
}
:
${
aliasLabel
}
`
:
alias
Label
;
globalCommandPicks
.
push
({
commandId
:
action
.
item
.
id
,
label
,
detail
:
alias
commandAlias
,
label
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录