Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
719ac741
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,发现更多精彩内容 >>
提交
719ac741
编写于
5月 05, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #96970
上级
42f1a2f1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
35 addition
and
37 deletion
+35
-37
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+35
-37
未找到文件。
src/vs/platform/actions/common/actions.ts
浏览文件 @
719ac741
...
@@ -9,12 +9,13 @@ import { IConstructorSignature2, createDecorator, BrandedService, ServicesAccess
...
@@ -9,12 +9,13 @@ import { IConstructorSignature2, createDecorator, BrandedService, ServicesAccess
import
{
IKeybindings
,
KeybindingsRegistry
,
IKeybindingRule
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IKeybindings
,
KeybindingsRegistry
,
IKeybindingRule
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
ContextKeyExpr
,
IContextKeyService
,
ContextKeyExpression
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ContextKeyExpr
,
IContextKeyService
,
ContextKeyExpression
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ICommandService
,
CommandsRegistry
,
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICommandService
,
CommandsRegistry
,
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
DisposableStore
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
UriDto
}
from
'
vs/base/common/types
'
;
import
{
UriDto
}
from
'
vs/base/common/types
'
;
import
{
Iterable
}
from
'
vs/base/common/iterator
'
;
import
{
Iterable
}
from
'
vs/base/common/iterator
'
;
import
{
LinkedList
}
from
'
vs/base/common/linkedList
'
;
export
interface
ILocalizedString
{
export
interface
ILocalizedString
{
value
:
string
;
value
:
string
;
...
@@ -172,7 +173,7 @@ export interface IMenuRegistry {
...
@@ -172,7 +173,7 @@ export interface IMenuRegistry {
export
const
MenuRegistry
:
IMenuRegistry
=
new
class
implements
IMenuRegistry
{
export
const
MenuRegistry
:
IMenuRegistry
=
new
class
implements
IMenuRegistry
{
private
readonly
_commands
=
new
Map
<
string
,
ICommandAction
>
();
private
readonly
_commands
=
new
Map
<
string
,
ICommandAction
>
();
private
readonly
_menuItems
=
new
Map
<
MenuId
,
Array
<
IMenuItem
|
ISubmenuItem
>>
();
private
readonly
_menuItems
=
new
Map
<
MenuId
,
LinkedList
<
IMenuItem
|
ISubmenuItem
>>
();
private
readonly
_onDidChangeMenu
=
new
Emitter
<
IMenuRegistryChangeEvent
>
();
private
readonly
_onDidChangeMenu
=
new
Emitter
<
IMenuRegistryChangeEvent
>
();
readonly
onDidChangeMenu
:
Event
<
IMenuRegistryChangeEvent
>
=
this
.
_onDidChangeMenu
.
event
;
readonly
onDidChangeMenu
:
Event
<
IMenuRegistryChangeEvent
>
=
this
.
_onDidChangeMenu
.
event
;
...
@@ -190,8 +191,7 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
...
@@ -190,8 +191,7 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
this
.
_commands
.
set
(
command
.
id
,
command
);
this
.
_commands
.
set
(
command
.
id
,
command
);
}
}
this
.
_onDidChangeMenu
.
fire
(
this
.
_commandPaletteChangeEvent
);
this
.
_onDidChangeMenu
.
fire
(
this
.
_commandPaletteChangeEvent
);
return
{
return
toDisposable
(()
=>
{
dispose
:
()
=>
{
let
didChange
=
false
;
let
didChange
=
false
;
for
(
const
command
of
commands
)
{
for
(
const
command
of
commands
)
{
didChange
=
this
.
_commands
.
delete
(
command
.
id
)
||
didChange
;
didChange
=
this
.
_commands
.
delete
(
command
.
id
)
||
didChange
;
...
@@ -199,8 +199,7 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
...
@@ -199,8 +199,7 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
if
(
didChange
)
{
if
(
didChange
)
{
this
.
_onDidChangeMenu
.
fire
(
this
.
_commandPaletteChangeEvent
);
this
.
_onDidChangeMenu
.
fire
(
this
.
_commandPaletteChangeEvent
);
}
}
}
});
};
}
}
getCommand
(
id
:
string
):
ICommandAction
|
undefined
{
getCommand
(
id
:
string
):
ICommandAction
|
undefined
{
...
@@ -220,39 +219,38 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
...
@@ -220,39 +219,38 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
appendMenuItems
(
items
:
Iterable
<
{
id
:
MenuId
,
item
:
IMenuItem
|
ISubmenuItem
}
>
):
IDisposable
{
appendMenuItems
(
items
:
Iterable
<
{
id
:
MenuId
,
item
:
IMenuItem
|
ISubmenuItem
}
>
):
IDisposable
{
const
changedIds
=
new
Set
<
MenuId
>
();
const
changedIds
=
new
Set
<
MenuId
>
();
const
toRemove
=
new
LinkedList
<
Function
>
();
for
(
const
{
id
,
item
}
of
items
)
{
for
(
const
{
id
,
item
}
of
items
)
{
let
array
=
this
.
_menuItems
.
get
(
id
);
let
list
=
this
.
_menuItems
.
get
(
id
);
if
(
!
array
)
{
if
(
!
list
)
{
array
=
[
item
];
list
=
new
LinkedList
();
this
.
_menuItems
.
set
(
id
,
array
);
this
.
_menuItems
.
set
(
id
,
list
);
}
else
{
array
.
push
(
item
);
}
}
toRemove
.
push
(
list
.
push
(
item
));
changedIds
.
add
(
id
);
changedIds
.
add
(
id
);
}
}
this
.
_onDidChangeMenu
.
fire
(
changedIds
);
this
.
_onDidChangeMenu
.
fire
(
changedIds
);
return
{
return
toDisposable
(()
=>
{
dispose
:
()
=>
{
if
(
toRemove
.
size
>
0
)
{
const
changedIds
=
new
Set
<
MenuId
>
();
for
(
let
fn
of
toRemove
)
{
for
(
const
{
id
,
item
}
of
items
)
{
fn
();
const
array
=
this
.
_menuItems
.
get
(
id
);
const
idx
=
array
?.
indexOf
(
item
)
??
-
1
;
if
(
idx
>=
0
)
{
array
!
.
splice
(
idx
,
1
);
changedIds
.
add
(
id
);
}
}
}
this
.
_onDidChangeMenu
.
fire
(
changedIds
);
this
.
_onDidChangeMenu
.
fire
(
changedIds
);
toRemove
.
clear
();
}
}
};
}
)
;
}
}
getMenuItems
(
id
:
MenuId
):
Array
<
IMenuItem
|
ISubmenuItem
>
{
getMenuItems
(
id
:
MenuId
):
Array
<
IMenuItem
|
ISubmenuItem
>
{
const
result
=
(
this
.
_menuItems
.
get
(
id
)
||
[]).
slice
(
0
);
let
result
:
Array
<
IMenuItem
|
ISubmenuItem
>
;
if
(
this
.
_menuItems
.
has
(
id
))
{
result
=
[...
this
.
_menuItems
.
get
(
id
)
!
];
}
else
{
result
=
[];
}
if
(
id
===
MenuId
.
CommandPalette
)
{
if
(
id
===
MenuId
.
CommandPalette
)
{
// CommandPalette is special because it shows
// CommandPalette is special because it shows
// all commands by default
// all commands by default
...
@@ -264,12 +262,12 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
...
@@ -264,12 +262,12 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
private
_appendImplicitItems
(
result
:
Array
<
IMenuItem
|
ISubmenuItem
>
)
{
private
_appendImplicitItems
(
result
:
Array
<
IMenuItem
|
ISubmenuItem
>
)
{
const
set
=
new
Set
<
string
>
();
const
set
=
new
Set
<
string
>
();
const
temp
=
result
.
filter
(
item
=>
{
return
isIMenuItem
(
item
);
})
as
IMenuItem
[];
for
(
const
item
of
result
)
{
if
(
isIMenuItem
(
item
))
{
for
(
const
{
command
,
alt
}
of
temp
)
{
set
.
add
(
item
.
command
.
id
);
set
.
add
(
command
.
id
);
if
(
item
.
alt
)
{
if
(
alt
)
{
set
.
add
(
item
.
alt
.
id
);
set
.
add
(
alt
.
id
);
}
}
}
}
}
this
.
_commands
.
forEach
((
command
,
id
)
=>
{
this
.
_commands
.
forEach
((
command
,
id
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录