Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9e5b12a7
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,发现更多精彩内容 >>
提交
9e5b12a7
编写于
11月 07, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - use const enum for MenuId
上级
f7f121bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
50 deletion
+45
-50
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+42
-47
src/vs/platform/actions/test/common/menuService.test.ts
src/vs/platform/actions/test/common/menuService.test.ts
+1
-1
src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts
.../services/actions/electron-browser/menusExtensionPoint.ts
+2
-2
未找到文件。
src/vs/platform/actions/common/actions.ts
浏览文件 @
9e5b12a7
...
...
@@ -58,49 +58,44 @@ export function isISubmenuItem(item: IMenuItem | ISubmenuItem): item is ISubmenu
return
(
item
as
ISubmenuItem
).
submenu
!==
undefined
;
}
export
class
MenuId
{
private
static
ID
=
1
;
static
readonly
EditorTitle
=
new
MenuId
();
static
readonly
EditorTitleContext
=
new
MenuId
();
static
readonly
EditorContext
=
new
MenuId
();
static
readonly
EmptyEditorGroupContext
=
new
MenuId
();
static
readonly
ExplorerContext
=
new
MenuId
();
static
readonly
OpenEditorsContext
=
new
MenuId
();
static
readonly
ProblemsPanelContext
=
new
MenuId
();
static
readonly
DebugVariablesContext
=
new
MenuId
();
static
readonly
DebugWatchContext
=
new
MenuId
();
static
readonly
DebugCallStackContext
=
new
MenuId
();
static
readonly
DebugBreakpointsContext
=
new
MenuId
();
static
readonly
DebugConsoleContext
=
new
MenuId
();
static
readonly
SCMTitle
=
new
MenuId
();
static
readonly
SCMSourceControl
=
new
MenuId
();
static
readonly
SCMResourceGroupContext
=
new
MenuId
();
static
readonly
SCMResourceContext
=
new
MenuId
();
static
readonly
SCMChangeContext
=
new
MenuId
();
static
readonly
CommandPalette
=
new
MenuId
();
static
readonly
ViewTitle
=
new
MenuId
();
static
readonly
ViewItemContext
=
new
MenuId
();
static
readonly
TouchBarContext
=
new
MenuId
();
static
readonly
SearchContext
=
new
MenuId
();
static
readonly
MenubarFileMenu
=
new
MenuId
();
static
readonly
MenubarEditMenu
=
new
MenuId
();
static
readonly
MenubarRecentMenu
=
new
MenuId
();
static
readonly
MenubarSelectionMenu
=
new
MenuId
();
static
readonly
MenubarViewMenu
=
new
MenuId
();
static
readonly
MenubarAppearanceMenu
=
new
MenuId
();
static
readonly
MenubarLayoutMenu
=
new
MenuId
();
static
readonly
MenubarGoMenu
=
new
MenuId
();
static
readonly
MenubarSwitchEditorMenu
=
new
MenuId
();
static
readonly
MenubarSwitchGroupMenu
=
new
MenuId
();
static
readonly
MenubarDebugMenu
=
new
MenuId
();
static
readonly
MenubarNewBreakpointMenu
=
new
MenuId
();
static
readonly
MenubarPreferencesMenu
=
new
MenuId
();
static
readonly
MenubarHelpMenu
=
new
MenuId
();
static
readonly
MenubarTerminalMenu
=
new
MenuId
();
readonly
id
:
string
=
String
(
MenuId
.
ID
++
);
export
const
enum
MenuId
{
EditorTitle
,
EditorTitleContext
,
EditorContext
,
EmptyEditorGroupContext
,
ExplorerContext
,
OpenEditorsContext
,
ProblemsPanelContext
,
DebugVariablesContext
,
DebugWatchContext
,
DebugCallStackContext
,
DebugBreakpointsContext
,
DebugConsoleContext
,
SCMTitle
,
SCMSourceControl
,
SCMResourceGroupContext
,
SCMResourceContext
,
SCMChangeContext
,
CommandPalette
,
ViewTitle
,
ViewItemContext
,
TouchBarContext
,
SearchContext
,
MenubarFileMenu
,
MenubarEditMenu
,
MenubarRecentMenu
,
MenubarSelectionMenu
,
MenubarViewMenu
,
MenubarAppearanceMenu
,
MenubarLayoutMenu
,
MenubarGoMenu
,
MenubarSwitchEditorMenu
,
MenubarSwitchGroupMenu
,
MenubarDebugMenu
,
MenubarNewBreakpointMenu
,
MenubarPreferencesMenu
,
MenubarHelpMenu
,
MenubarTerminalMenu
,
}
export
interface
IMenuActionOptions
{
...
...
@@ -162,9 +157,9 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
}
appendMenuItem
(
id
:
MenuId
,
item
:
IMenuItem
|
ISubmenuItem
):
IDisposable
{
let
array
=
this
.
_menuItems
[
id
.
id
];
let
array
=
this
.
_menuItems
[
id
];
if
(
!
array
)
{
this
.
_menuItems
[
id
.
id
]
=
array
=
[
item
];
this
.
_menuItems
[
id
]
=
array
=
[
item
];
}
else
{
array
.
push
(
item
);
}
...
...
@@ -180,10 +175,10 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
};
}
getMenuItems
(
{
id
}
:
MenuId
):
(
IMenuItem
|
ISubmenuItem
)[]
{
getMenuItems
(
id
:
MenuId
):
(
IMenuItem
|
ISubmenuItem
)[]
{
const
result
=
this
.
_menuItems
[
id
]
||
[];
if
(
id
===
MenuId
.
CommandPalette
.
id
)
{
if
(
id
===
MenuId
.
CommandPalette
)
{
// CommandPalette is special because it shows
// all commands by default
this
.
_appendImplicitItems
(
result
);
...
...
src/vs/platform/actions/test/common/menuService.test.ts
浏览文件 @
9e5b12a7
...
...
@@ -28,7 +28,7 @@ suite('MenuService', function () {
setup
(
function
()
{
menuService
=
new
MenuService
(
NullCommandService
);
testMenuId
=
new
MenuId
()
;
testMenuId
=
Math
.
PI
;
disposables
=
[];
});
...
...
src/vs/workbench/services/actions/electron-browser/menusExtensionPoint.ts
浏览文件 @
9e5b12a7
...
...
@@ -24,7 +24,7 @@ namespace schema {
group
?:
string
;
}
export
function
parseMenuId
(
value
:
string
):
MenuId
{
export
function
parseMenuId
(
value
:
string
):
MenuId
|
undefined
{
switch
(
value
)
{
case
'
commandPalette
'
:
return
MenuId
.
CommandPalette
;
case
'
touchBar
'
:
return
MenuId
.
TouchBarContext
;
...
...
@@ -326,7 +326,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
}
const
menu
=
schema
.
parseMenuId
(
entry
.
key
);
if
(
!
menu
)
{
if
(
typeof
menu
!==
'
number
'
)
{
collector
.
warn
(
localize
(
'
menuId.invalid
'
,
"
`{0}` is not a valid menu identifier
"
,
entry
.
key
));
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录