Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c22d81d0
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,发现更多精彩内容 >>
提交
c22d81d0
编写于
12月 16, 2015
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #1369: Do not give Electron accelerators that change with keyboard layout under Mac & Linux
上级
9c6f7472
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
51 addition
and
11 deletion
+51
-11
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+2
-2
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
+9
-0
src/vs/platform/keybinding/common/keybindingService.ts
src/vs/platform/keybinding/common/keybindingService.ts
+1
-0
src/vs/workbench/electron-browser/integration.ts
src/vs/workbench/electron-browser/integration.ts
+11
-5
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+1
-1
src/vs/workbench/electron-main/menus.ts
src/vs/workbench/electron-main/menus.ts
+1
-1
src/vs/workbench/services/contextview/electron-browser/contextmenuService.ts
...rvices/contextview/electron-browser/contextmenuService.ts
+5
-2
src/vs/workbench/services/keybinding/electron-browser/pluginKeybindingService.ts
...es/keybinding/electron-browser/pluginKeybindingService.ts
+17
-0
src/vs/workbench/test/browser/servicesTestUtils.ts
src/vs/workbench/test/browser/servicesTestUtils.ts
+4
-0
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
c22d81d0
...
...
@@ -527,7 +527,7 @@ export class Keybinding {
* This prints the binding in a format suitable for electron's accelerators.
* See https://github.com/atom/electron/blob/master/docs/api/accelerator.md
*/
public
toElectronAccelerator
():
string
{
public
_
toElectronAccelerator
():
string
{
return
Keybinding
.
_toElectronAccelerator
(
this
.
value
);
}
...
...
@@ -553,7 +553,7 @@ export interface IKeyBindingLabelProvider {
/**
* Print for Electron
*/
class
ElectronAcceleratorLabelProvider
implements
IKeyBindingLabelProvider
{
export
class
ElectronAcceleratorLabelProvider
implements
IKeyBindingLabelProvider
{
public
static
INSTANCE
=
new
ElectronAcceleratorLabelProvider
();
public
ctrlKeyLabel
=
'
Ctrl
'
;
...
...
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
浏览文件 @
c22d81d0
...
...
@@ -123,6 +123,7 @@ export abstract class AbstractKeybindingService {
public
abstract
getLabelFor
(
keybinding
:
Keybinding
):
string
;
public
abstract
getHTMLLabelFor
(
keybinding
:
Keybinding
):
IHTMLContentElement
[];
public
abstract
getElectronAcceleratorFor
(
keybinding
:
Keybinding
):
string
;
public
abstract
customKeybindingsCount
():
number
;
public
abstract
getContext
(
contextId
:
number
):
KeybindingContext
;
public
abstract
createChildContext
(
parentContextId
?:
number
):
number
;
...
...
@@ -174,6 +175,10 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
return
keybinding
.
_toUSHTMLLabel
();
}
public
getElectronAcceleratorFor
(
keybinding
:
Keybinding
):
string
{
return
keybinding
.
_toElectronAccelerator
();
}
protected
updateResolver
():
void
{
this
.
_createOrUpdateResolver
(
false
);
}
...
...
@@ -334,6 +339,10 @@ class ScopedKeybindingService extends AbstractKeybindingService {
return
this
.
_parent
.
getHTMLLabelFor
(
keybinding
);
}
public
getElectronAcceleratorFor
(
keybinding
:
Keybinding
):
string
{
return
this
.
_parent
.
getElectronAcceleratorFor
(
keybinding
);
}
public
getDefaultKeybindings
():
string
{
return
this
.
_parent
.
getDefaultKeybindings
();
}
...
...
src/vs/platform/keybinding/common/keybindingService.ts
浏览文件 @
c22d81d0
...
...
@@ -94,6 +94,7 @@ export interface IKeybindingService {
getLabelFor
(
keybinding
:
Keybinding
):
string
;
getHTMLLabelFor
(
keybinding
:
Keybinding
):
IHTMLContentElement
[];
getElectronAcceleratorFor
(
keybinding
:
Keybinding
):
string
;
executeCommand
<
T
>
(
commandId
:
string
,
args
?:
any
):
TPromise
<
T
>
;
executeCommand
(
commandId
:
string
,
args
?:
any
):
TPromise
<
any
>
;
...
...
src/vs/workbench/electron-browser/integration.ts
浏览文件 @
c22d81d0
...
...
@@ -121,11 +121,17 @@ export class ElectronIntegration {
return
this
.
partService
.
joinCreation
().
then
(()
=>
{
return
arrays
.
coalesce
(
actionIds
.
map
((
id
)
=>
{
let
bindings
=
this
.
keybindingService
.
lookupKeybindings
(
id
);
if
(
bindings
.
length
)
{
return
{
id
:
id
,
binding
:
bindings
[
0
].
value
// take first user configured binding
};
// return the first binding that can be represented by electron
for
(
let
i
=
0
;
i
<
bindings
.
length
;
i
++
)
{
let
binding
=
bindings
[
i
];
let
electronAccelerator
=
this
.
keybindingService
.
getElectronAcceleratorFor
(
binding
);
if
(
electronAccelerator
)
{
return
{
id
:
id
,
binding
:
binding
.
value
};
}
}
return
null
;
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
c22d81d0
...
...
@@ -326,7 +326,7 @@ export class WorkbenchShell {
result
.
addSingleton
(
IRequestService
,
requestService
);
result
.
addSingleton
(
IWorkspaceContextService
,
this
.
contextService
);
result
.
addSingleton
(
IContextViewService
,
this
.
contextViewService
);
result
.
addSingleton
(
IContextMenuService
,
new
ContextMenuService
(
this
.
messageService
,
this
.
telemetryService
));
result
.
addSingleton
(
IContextMenuService
,
new
ContextMenuService
(
this
.
messageService
,
this
.
telemetryService
,
this
.
keybindingService
));
result
.
addSingleton
(
IMessageService
,
this
.
messageService
);
result
.
addSingleton
(
IStorageService
,
this
.
storageService
);
result
.
addSingleton
(
ILifecycleService
,
lifecycleService
);
...
...
src/vs/workbench/electron-main/menus.ts
浏览文件 @
c22d81d0
...
...
@@ -92,7 +92,7 @@ export class VSCodeMenu {
let
needsMenuUpdate
=
false
;
keybindings
.
forEach
((
keybinding
)
=>
{
let
accelerator
=
new
Keybinding
(
keybinding
.
binding
).
toElectronAccelerator
();
let
accelerator
=
new
Keybinding
(
keybinding
.
binding
).
_
toElectronAccelerator
();
if
(
accelerator
)
{
this
.
mapResolvedKeybindingToActionId
[
keybinding
.
id
]
=
accelerator
;
if
(
this
.
mapLastKnownKeybindingToActionId
[
keybinding
.
id
]
!==
accelerator
)
{
...
...
src/vs/workbench/services/contextview/electron-browser/contextmenuService.ts
浏览文件 @
c22d81d0
...
...
@@ -15,6 +15,7 @@ import {KeybindingsUtils} from 'vs/platform/keybinding/common/keybindingsUtils';
import
{
IContextMenuService
,
IContextMenuDelegate
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
remote
=
require
(
'
remote
'
);
...
...
@@ -25,10 +26,12 @@ export class ContextMenuService implements IContextMenuService {
public
serviceId
=
IContextMenuService
;
private
telemetryService
:
ITelemetryService
;
private
messageService
:
IMessageService
;
private
keybindingService
:
IKeybindingService
;
constructor
(
messageService
:
IMessageService
,
telemetryService
:
ITelemetryService
)
{
constructor
(
messageService
:
IMessageService
,
telemetryService
:
ITelemetryService
,
keybindingService
:
IKeybindingService
)
{
this
.
messageService
=
messageService
;
this
.
telemetryService
=
telemetryService
;
this
.
keybindingService
=
keybindingService
;
}
public
showContextMenu
(
delegate
:
IContextMenuDelegate
):
void
{
...
...
@@ -45,7 +48,7 @@ export class ContextMenuService implements IContextMenuService {
menu
.
append
(
new
MenuItem
({
type
:
'
separator
'
}));
}
else
{
const
keybinding
=
!!
delegate
.
getKeyBinding
?
delegate
.
getKeyBinding
(
a
)
:
undefined
;
const
accelerator
=
keybinding
&&
keybinding
.
toElectronAccelerator
(
);
const
accelerator
=
keybinding
&&
this
.
keybindingService
.
getElectronAcceleratorFor
(
keybinding
);
const
item
=
new
MenuItem
({
label
:
a
.
label
,
...
...
src/vs/workbench/services/keybinding/electron-browser/pluginKeybindingService.ts
浏览文件 @
c22d81d0
...
...
@@ -467,6 +467,23 @@ export default class PluginWorkbenchKeybindingService extends WorkbenchKeybindin
return
keybinding
.
toCustomHTMLLabel
(
this
.
_nativeLabelProvider
);
}
public
getElectronAcceleratorFor
(
keybinding
:
Keybinding
):
string
{
if
(
Platform
.
isWindows
)
{
// electron menus always do the correct rendering on Windows
return
super
.
getElectronAcceleratorFor
(
keybinding
);
}
let
usLabel
=
keybinding
.
_toUSLabel
();
let
label
=
this
.
getLabelFor
(
keybinding
);
if
(
usLabel
!==
label
)
{
// electron menus are incorrect in rendering (linux) and in rendering and interpreting (mac)
// for non US standard keyboard layouts
return
null
;
}
return
super
.
getElectronAcceleratorFor
(
keybinding
);
}
private
_handleKeybindingsExtensionPointUser
(
isBuiltin
:
boolean
,
keybindings
:
ContributedKeyBinding
|
ContributedKeyBinding
[],
collector
:
IMessageCollector
):
boolean
{
if
(
isContributedKeyBindingsArray
(
keybindings
))
{
let
commandAdded
=
false
;
...
...
src/vs/workbench/test/browser/servicesTestUtils.ts
浏览文件 @
c22d81d0
...
...
@@ -173,6 +173,10 @@ export class TestKeybindingService implements IKeybindingService {
return
keybinding
.
_toUSHTMLLabel
();
}
public
getElectronAcceleratorFor
(
keybinding
:
Keybinding
):
string
{
return
keybinding
.
_toElectronAccelerator
();
}
public
createScoped
(
domNode
:
HTMLElement
):
IKeybindingService
{
return
this
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录