Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ec284758
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,发现更多精彩内容 >>
提交
ec284758
编写于
2月 03, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make MenuId dynamic
上级
ce8009cb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
75 addition
and
7 deletion
+75
-7
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+70
-2
src/vs/platform/actions/test/common/menuService.test.ts
src/vs/platform/actions/test/common/menuService.test.ts
+1
-1
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+2
-2
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+2
-2
未找到文件。
src/vs/platform/actions/common/actions.ts
浏览文件 @
ec284758
...
...
@@ -56,7 +56,75 @@ export function isISubmenuItem(item: IMenuItem | ISubmenuItem): item is ISubmenu
return
(
item
as
ISubmenuItem
).
submenu
!==
undefined
;
}
export
const
enum
MenuId
{
export
class
MenuId
{
static
readonly
CommandPalette
=
new
MenuId
(
'
CommandPalette
'
);
static
readonly
DebugBreakpointsContext
=
new
MenuId
(
'
DebugBreakpointsContext
'
);
static
readonly
DebugCallStackContext
=
new
MenuId
(
'
DebugCallStackContext
'
);
static
readonly
DebugConsoleContext
=
new
MenuId
(
'
DebugConsoleContext
'
);
static
readonly
DebugVariablesContext
=
new
MenuId
(
'
DebugVariablesContext
'
);
static
readonly
DebugWatchContext
=
new
MenuId
(
'
DebugWatchContext
'
);
static
readonly
DebugToolBar
=
new
MenuId
(
'
DebugToolBar
'
);
static
readonly
EditorContext
=
new
MenuId
(
'
EditorContext
'
);
static
readonly
EditorContextPeek
=
new
MenuId
(
'
EditorContextPeek
'
);
static
readonly
EditorTitle
=
new
MenuId
(
'
EditorTitle
'
);
static
readonly
EditorTitleContext
=
new
MenuId
(
'
EditorTitleContext
'
);
static
readonly
EmptyEditorGroupContext
=
new
MenuId
(
'
EmptyEditorGroupContext
'
);
static
readonly
ExplorerContext
=
new
MenuId
(
'
ExplorerContext
'
);
static
readonly
ExtensionContext
=
new
MenuId
(
'
ExtensionContext
'
);
static
readonly
GlobalActivity
=
new
MenuId
(
'
GlobalActivity
'
);
static
readonly
MenubarAppearanceMenu
=
new
MenuId
(
'
MenubarAppearanceMenu
'
);
static
readonly
MenubarDebugMenu
=
new
MenuId
(
'
MenubarDebugMenu
'
);
static
readonly
MenubarEditMenu
=
new
MenuId
(
'
MenubarEditMenu
'
);
static
readonly
MenubarFileMenu
=
new
MenuId
(
'
MenubarFileMenu
'
);
static
readonly
MenubarGoMenu
=
new
MenuId
(
'
MenubarGoMenu
'
);
static
readonly
MenubarHelpMenu
=
new
MenuId
(
'
MenubarHelpMenu
'
);
static
readonly
MenubarLayoutMenu
=
new
MenuId
(
'
MenubarLayoutMenu
'
);
static
readonly
MenubarNewBreakpointMenu
=
new
MenuId
(
'
MenubarNewBreakpointMenu
'
);
static
readonly
MenubarPreferencesMenu
=
new
MenuId
(
'
MenubarPreferencesMenu
'
);
static
readonly
MenubarRecentMenu
=
new
MenuId
(
'
MenubarRecentMenu
'
);
static
readonly
MenubarSelectionMenu
=
new
MenuId
(
'
MenubarSelectionMenu
'
);
static
readonly
MenubarSwitchEditorMenu
=
new
MenuId
(
'
MenubarSwitchEditorMenu
'
);
static
readonly
MenubarSwitchGroupMenu
=
new
MenuId
(
'
MenubarSwitchGroupMenu
'
);
static
readonly
MenubarTerminalMenu
=
new
MenuId
(
'
MenubarTerminalMenu
'
);
static
readonly
MenubarViewMenu
=
new
MenuId
(
'
MenubarViewMenu
'
);
static
readonly
OpenEditorsContext
=
new
MenuId
(
'
OpenEditorsContext
'
);
static
readonly
ProblemsPanelContext
=
new
MenuId
(
'
ProblemsPanelContext
'
);
static
readonly
SCMChangeContext
=
new
MenuId
(
'
SCMChangeContext
'
);
static
readonly
SCMResourceContext
=
new
MenuId
(
'
SCMResourceContext
'
);
static
readonly
SCMResourceFolderContext
=
new
MenuId
(
'
SCMResourceFolderContext
'
);
static
readonly
SCMResourceGroupContext
=
new
MenuId
(
'
SCMResourceGroupContext
'
);
static
readonly
SCMSourceControl
=
new
MenuId
(
'
SCMSourceControl
'
);
static
readonly
SCMTitle
=
new
MenuId
(
'
SCMTitle
'
);
static
readonly
SearchContext
=
new
MenuId
(
'
SearchContext
'
);
static
readonly
StatusBarWindowIndicatorMenu
=
new
MenuId
(
'
StatusBarWindowIndicatorMenu
'
);
static
readonly
TouchBarContext
=
new
MenuId
(
'
TouchBarContext
'
);
static
readonly
TitleBarContext
=
new
MenuId
(
'
TitleBarContext
'
);
static
readonly
TunnelContext
=
new
MenuId
(
'
TunnelContext
'
);
static
readonly
TunnelInline
=
new
MenuId
(
'
TunnelInline
'
);
static
readonly
TunnelTitle
=
new
MenuId
(
'
TunnelTitle
'
);
static
readonly
ViewItemContext
=
new
MenuId
(
'
ViewItemContext
'
);
static
readonly
ViewTitle
=
new
MenuId
(
'
ViewTitle
'
);
static
readonly
ViewTitleContext
=
new
MenuId
(
'
ViewTitleContext
'
);
static
readonly
CommentThreadTitle
=
new
MenuId
(
'
CommentThreadTitle
'
);
static
readonly
CommentThreadActions
=
new
MenuId
(
'
CommentThreadActions
'
);
static
readonly
CommentTitle
=
new
MenuId
(
'
CommentTitle
'
);
static
readonly
CommentActions
=
new
MenuId
(
'
CommentActions
'
);
static
readonly
BulkEditTitle
=
new
MenuId
(
'
BulkEditTitle
'
);
static
readonly
BulkEditContext
=
new
MenuId
(
'
BulkEditContext
'
);
private
static
_idPool
=
0
;
readonly
id
:
number
;
readonly
_debugName
:
string
;
constructor
(
debugName
:
string
)
{
this
.
id
=
MenuId
.
_idPool
++
;
this
.
_debugName
=
debugName
;
}
}
export
const
enum
MenuId3
{
CommandPalette
,
DebugBreakpointsContext
,
DebugCallStackContext
,
...
...
@@ -146,7 +214,7 @@ export interface IMenuRegistry {
export
const
MenuRegistry
:
IMenuRegistry
=
new
class
implements
IMenuRegistry
{
private
readonly
_commands
=
new
Map
<
string
,
ICommandAction
>
();
private
readonly
_menuItems
=
new
Map
<
number
,
Array
<
IMenuItem
|
ISubmenuItem
>>
();
private
readonly
_menuItems
=
new
Map
<
MenuId
,
Array
<
IMenuItem
|
ISubmenuItem
>>
();
private
readonly
_onDidChangeMenu
=
new
Emitter
<
MenuId
>
();
readonly
onDidChangeMenu
:
Event
<
MenuId
>
=
this
.
_onDidChangeMenu
.
event
;
...
...
src/vs/platform/actions/test/common/menuService.test.ts
浏览文件 @
ec284758
...
...
@@ -28,7 +28,7 @@ suite('MenuService', function () {
setup
(
function
()
{
menuService
=
new
MenuService
(
NullCommandService
);
testMenuId
=
Math
.
PI
;
testMenuId
=
new
MenuId
(
'
testo
'
)
;
disposables
.
clear
();
});
...
...
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
ec284758
...
...
@@ -573,9 +573,9 @@ export class CustomMenubarControl extends MenubarControl {
for
(
let
action
of
actions
)
{
this
.
insertActionsBefore
(
action
,
target
);
if
(
action
instanceof
SubmenuItemAction
)
{
let
submenu
=
this
.
menus
[
action
.
item
.
submenu
];
let
submenu
=
this
.
menus
[
action
.
item
.
submenu
.
id
];
if
(
!
submenu
)
{
submenu
=
this
.
menus
[
action
.
item
.
submenu
]
=
this
.
menuService
.
createMenu
(
action
.
item
.
submenu
,
this
.
contextKeyService
);
submenu
=
this
.
menus
[
action
.
item
.
submenu
.
id
]
=
this
.
menuService
.
createMenu
(
action
.
item
.
submenu
,
this
.
contextKeyService
);
this
.
_register
(
submenu
.
onDidChange
(()
=>
{
if
(
!
this
.
focusInsideMenubar
)
{
const
actions
:
IAction
[]
=
[];
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
ec284758
...
...
@@ -778,8 +778,8 @@ class NativeMenubarControl extends MenubarControl {
if
(
menuItem
instanceof
SubmenuItemAction
)
{
const
submenu
=
{
items
:
[]
};
if
(
!
this
.
menus
[
menuItem
.
item
.
submenu
])
{
const
menu
=
this
.
menus
[
menuItem
.
item
.
submenu
]
=
this
.
menuService
.
createMenu
(
menuItem
.
item
.
submenu
,
this
.
contextKeyService
);
if
(
!
this
.
menus
[
menuItem
.
item
.
submenu
.
id
])
{
const
menu
=
this
.
menus
[
menuItem
.
item
.
submenu
.
id
]
=
this
.
menuService
.
createMenu
(
menuItem
.
item
.
submenu
,
this
.
contextKeyService
);
this
.
_register
(
menu
.
onDidChange
(()
=>
this
.
updateMenubar
()));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录