Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4cba1177
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,发现更多精彩内容 >>
提交
4cba1177
编写于
8月 12, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename ContextKeyService type names
上级
8d43ec51
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
38 deletion
+29
-38
src/vs/editor/browser/standalone/simpleServices.ts
src/vs/editor/browser/standalone/simpleServices.ts
+0
-8
src/vs/editor/browser/standalone/standaloneServices.ts
src/vs/editor/browser/standalone/standaloneServices.ts
+3
-2
src/vs/platform/contextkey/browser/contextKeyService.ts
src/vs/platform/contextkey/browser/contextKeyService.ts
+24
-26
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+2
-2
未找到文件。
src/vs/editor/browser/standalone/simpleServices.ts
浏览文件 @
4cba1177
...
...
@@ -10,14 +10,12 @@ import {Schemas} from 'vs/base/common/network';
import
Severity
from
'
vs/base/common/severity
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ConfigurationService
,
IContent
,
IStat
}
from
'
vs/platform/configuration/common/configurationService
'
;
import
{
IEditor
,
IEditorInput
,
IEditorOptions
,
IEditorService
,
IResourceInput
,
ITextEditorModel
,
Position
}
from
'
vs/platform/editor/common/editor
'
;
import
{
AbstractExtensionService
,
ActivatedExtension
}
from
'
vs/platform/extensions/common/abstractExtensionService
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ICommandService
,
ICommandHandler
}
from
'
vs/platform/commands/common/commands
'
;
import
{
KeybindingService2
}
from
'
vs/platform/keybinding/browser/keybindingServiceImpl
'
;
import
{
KeybindingService
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
import
{
IOSupport
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
IKeybindingItem
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -247,12 +245,6 @@ export class StandaloneKeybindingService2 extends KeybindingService2 {
}
}
export
class
StandaloneKeybindingService
extends
KeybindingService
{
constructor
(
configurationService
:
IConfigurationService
)
{
super
(
configurationService
);
}
}
export
class
SimpleExtensionService
extends
AbstractExtensionService
<
ActivatedExtension
>
{
constructor
()
{
...
...
src/vs/editor/browser/standalone/standaloneServices.ts
浏览文件 @
4cba1177
...
...
@@ -38,7 +38,8 @@ import {MainThreadModeServiceImpl} from 'vs/editor/common/services/modeServiceIm
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
import
{
CodeEditorServiceImpl
}
from
'
vs/editor/browser/services/codeEditorServiceImpl
'
;
import
{
SimpleConfigurationService
,
SimpleMessageService
,
SimpleExtensionService
,
StandaloneKeybindingService
,
StandaloneKeybindingService2
}
from
'
vs/editor/browser/standalone/simpleServices
'
;
import
{
SimpleConfigurationService
,
SimpleMessageService
,
SimpleExtensionService
,
StandaloneKeybindingService2
}
from
'
vs/editor/browser/standalone/simpleServices
'
;
import
{
ContextKeyService
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
import
{
IMenuService
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuService
}
from
'
vs/platform/actions/common/menuService
'
;
import
{
ICompatWorkerService
}
from
'
vs/editor/common/services/compatWorkerService
'
;
...
...
@@ -196,7 +197,7 @@ export function ensureDynamicPlatformServices(domElement:HTMLElement, services:
let
contextKeyService
:
IContextKeyService
;
if
(
typeof
services
.
contextKeyService
===
'
undefined
'
)
{
contextKeyService
=
new
StandaloneKeybinding
Service
(
services
.
configurationService
);
contextKeyService
=
new
ContextKey
Service
(
services
.
configurationService
);
r
.
push
(
contextKeyService
);
services
.
contextKeyService
=
contextKeyService
;
}
else
{
...
...
src/vs/platform/contextkey/browser/contextKeyService.ts
浏览文件 @
4cba1177
...
...
@@ -11,12 +11,12 @@ import {IContextKey, IContextKeyServiceTarget, IContextKeyService, SET_CONTEXT_C
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
Event
,
{
Emitter
,
debounceEvent
}
from
'
vs/base/common/event
'
;
export
class
KeybindingContext
{
protected
_parent
:
KeybindingContext
;
export
class
ContextValuesProvider
{
protected
_parent
:
ContextValuesProvider
;
protected
_value
:
any
;
protected
_id
:
number
;
constructor
(
id
:
number
,
parent
:
KeybindingContext
)
{
constructor
(
id
:
number
,
parent
:
ContextValuesProvider
)
{
this
.
_id
=
id
;
this
.
_parent
=
parent
;
this
.
_value
=
Object
.
create
(
null
);
...
...
@@ -54,7 +54,7 @@ export class KeybindingContext {
}
}
class
ConfigAware
KeybindingContext
extends
KeybindingContext
{
class
ConfigAware
ContextValuesProvider
extends
ContextValuesProvider
{
private
_emitter
:
Emitter
<
string
>
;
private
_subscription
:
IDisposable
;
...
...
@@ -101,13 +101,13 @@ class ConfigAwareKeybindingContext extends KeybindingContext {
}
}
class
Keybinding
ContextKey
<
T
>
implements
IContextKey
<
T
>
{
class
ContextKey
<
T
>
implements
IContextKey
<
T
>
{
private
_parent
:
Abstract
Keybinding
Service
;
private
_parent
:
Abstract
ContextKey
Service
;
private
_key
:
string
;
private
_defaultValue
:
T
;
constructor
(
parent
:
Abstract
Keybinding
Service
,
key
:
string
,
defaultValue
:
T
)
{
constructor
(
parent
:
Abstract
ContextKey
Service
,
key
:
string
,
defaultValue
:
T
)
{
this
.
_parent
=
parent
;
this
.
_key
=
key
;
this
.
_defaultValue
=
defaultValue
;
...
...
@@ -129,10 +129,9 @@ class KeybindingContextKey<T> implements IContextKey<T> {
public
get
():
T
{
return
this
.
_parent
.
getContextValue
<
T
>
(
this
.
_key
);
}
}
export
abstract
class
Abstract
Keybinding
Service
{
export
abstract
class
Abstract
ContextKey
Service
{
public
_serviceBrand
:
any
;
protected
_onDidChangeContext
:
Event
<
string
[]
>
;
...
...
@@ -145,7 +144,7 @@ export abstract class AbstractKeybindingService {
}
public
createKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IContextKey
<
T
>
{
return
new
Keybinding
ContextKey
(
this
,
key
,
defaultValue
);
return
new
ContextKey
(
this
,
key
,
defaultValue
);
}
public
get
onDidChangeContext
():
Event
<
string
[]
>
{
...
...
@@ -163,7 +162,7 @@ export abstract class AbstractKeybindingService {
}
public
createScoped
(
domNode
:
IContextKeyServiceTarget
):
IContextKeyService
{
return
new
Scoped
Keybinding
Service
(
this
,
this
.
_onDidChangeContextKey
,
domNode
);
return
new
Scoped
ContextKey
Service
(
this
,
this
.
_onDidChangeContextKey
,
domNode
);
}
public
contextMatchesRules
(
rules
:
ContextKeyExpr
):
boolean
{
...
...
@@ -192,17 +191,16 @@ export abstract class AbstractKeybindingService {
}
}
public
abstract
getContext
(
contextId
:
number
):
KeybindingContext
;
public
abstract
getContext
(
contextId
:
number
):
ContextValuesProvider
;
public
abstract
createChildContext
(
parentContextId
?:
number
):
number
;
public
abstract
disposeContext
(
contextId
:
number
):
void
;
}
export
class
KeybindingService
extends
AbstractKeybinding
Service
implements
IContextKeyService
{
export
class
ContextKeyService
extends
AbstractContextKey
Service
implements
IContextKeyService
{
private
_lastContextId
:
number
;
private
_contexts
:
{
[
contextId
:
string
]:
KeybindingContext
;
[
contextId
:
string
]:
ContextValuesProvider
;
};
private
_toDispose
:
IDisposable
[]
=
[];
...
...
@@ -212,7 +210,7 @@ export class KeybindingService extends AbstractKeybindingService implements ICon
this
.
_lastContextId
=
0
;
this
.
_contexts
=
Object
.
create
(
null
);
const
myContext
=
new
ConfigAware
KeybindingContext
(
this
.
_myContextId
,
configurationService
,
this
.
_onDidChangeContextKey
);
const
myContext
=
new
ConfigAware
ContextValuesProvider
(
this
.
_myContextId
,
configurationService
,
this
.
_onDidChangeContextKey
);
this
.
_contexts
[
String
(
this
.
_myContextId
)]
=
myContext
;
this
.
_toDispose
.
push
(
myContext
);
...
...
@@ -232,13 +230,13 @@ export class KeybindingService extends AbstractKeybindingService implements ICon
this
.
_toDispose
=
dispose
(
this
.
_toDispose
);
}
public
getContext
(
contextId
:
number
):
KeybindingContext
{
public
getContext
(
contextId
:
number
):
ContextValuesProvider
{
return
this
.
_contexts
[
String
(
contextId
)];
}
public
createChildContext
(
parentContextId
:
number
=
this
.
_myContextId
):
number
{
let
id
=
(
++
this
.
_lastContextId
);
this
.
_contexts
[
String
(
id
)]
=
new
KeybindingContext
(
id
,
this
.
getContext
(
parentContextId
));
this
.
_contexts
[
String
(
id
)]
=
new
ContextValuesProvider
(
id
,
this
.
getContext
(
parentContextId
));
return
id
;
}
...
...
@@ -247,16 +245,12 @@ export class KeybindingService extends AbstractKeybindingService implements ICon
}
}
CommandsRegistry
.
registerCommand
(
SET_CONTEXT_COMMAND_ID
,
function
(
accessor
,
contextKey
:
any
,
contextValue
:
any
)
{
accessor
.
get
(
IContextKeyService
).
createKey
(
String
(
contextKey
),
contextValue
);
});
class
ScopedKeybindingService
extends
AbstractKeybindingService
{
class
ScopedContextKeyService
extends
AbstractContextKeyService
{
private
_parent
:
Abstract
Keybinding
Service
;
private
_parent
:
Abstract
ContextKey
Service
;
private
_domNode
:
IContextKeyServiceTarget
;
constructor
(
parent
:
Abstract
Keybinding
Service
,
emitter
:
Emitter
<
string
>
,
domNode
:
IContextKeyServiceTarget
)
{
constructor
(
parent
:
Abstract
ContextKey
Service
,
emitter
:
Emitter
<
string
>
,
domNode
:
IContextKeyServiceTarget
)
{
super
(
parent
.
createChildContext
());
this
.
_parent
=
parent
;
this
.
_onDidChangeContextKey
=
emitter
;
...
...
@@ -273,7 +267,7 @@ class ScopedKeybindingService extends AbstractKeybindingService {
return
this
.
_parent
.
onDidChangeContext
;
}
public
getContext
(
contextId
:
number
):
KeybindingContext
{
public
getContext
(
contextId
:
number
):
ContextValuesProvider
{
return
this
.
_parent
.
getContext
(
contextId
);
}
...
...
@@ -285,3 +279,7 @@ class ScopedKeybindingService extends AbstractKeybindingService {
this
.
_parent
.
disposeContext
(
contextId
);
}
}
CommandsRegistry
.
registerCommand
(
SET_CONTEXT_COMMAND_ID
,
function
(
accessor
,
contextKey
:
any
,
contextValue
:
any
)
{
accessor
.
get
(
IContextKeyService
).
createKey
(
String
(
contextKey
),
contextValue
);
});
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
4cba1177
...
...
@@ -45,7 +45,7 @@ import {IWorkspaceContextService as IWorkbenchWorkspaceContextService} from 'vs/
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ContextMenuService
}
from
'
vs/workbench/services/contextview/electron-browser/contextmenuService
'
;
import
{
WorkbenchKeybindingService2
}
from
'
vs/workbench/services/keybinding/electron-browser/keybindingService
'
;
import
{
Keybinding
Service
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
import
{
ContextKey
Service
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
import
{
IWorkspace
,
IConfiguration
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IKeybindingService2
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
,
RawContextKey
,
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -353,7 +353,7 @@ export class Workbench implements IPartService {
serviceCollection
.
set
(
IStatusbarService
,
this
.
statusbarPart
);
// Keybindings
this
.
contextKeyService
=
this
.
instantiationService
.
createInstance
(
Keybinding
Service
);
this
.
contextKeyService
=
this
.
instantiationService
.
createInstance
(
ContextKey
Service
);
serviceCollection
.
set
(
IContextKeyService
,
this
.
contextKeyService
);
this
.
keybindingService2
=
this
.
instantiationService
.
createInstance
(
WorkbenchKeybindingService2
,
<
any
>
window
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录