Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
234e2db9
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,发现更多精彩内容 >>
提交
234e2db9
编写于
12月 07, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #39855
上级
3c746da0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
21 deletion
+29
-21
src/vs/base/browser/ui/list/listWidget.ts
src/vs/base/browser/ui/list/listWidget.ts
+6
-1
src/vs/platform/list/browser/listService.ts
src/vs/platform/list/browser/listService.ts
+6
-20
src/vs/platform/workbench/common/contextkeys.ts
src/vs/platform/workbench/common/contextkeys.ts
+11
-0
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+6
-0
未找到文件。
src/vs/base/browser/ui/list/listWidget.ts
浏览文件 @
234e2db9
...
@@ -253,6 +253,10 @@ class TraitSpliceable<T> implements ISpliceable<T> {
...
@@ -253,6 +253,10 @@ class TraitSpliceable<T> implements ISpliceable<T> {
}
}
}
}
function
isInputElement
(
e
:
HTMLElement
):
boolean
{
return
e
.
tagName
===
'
INPUT
'
||
e
.
tagName
===
'
TEXTAREA
'
;
}
class
KeyboardController
<
T
>
implements
IDisposable
{
class
KeyboardController
<
T
>
implements
IDisposable
{
private
disposables
:
IDisposable
[];
private
disposables
:
IDisposable
[];
...
@@ -266,7 +270,8 @@ class KeyboardController<T> implements IDisposable {
...
@@ -266,7 +270,8 @@ class KeyboardController<T> implements IDisposable {
this
.
disposables
=
[];
this
.
disposables
=
[];
const
onKeyDown
=
chain
(
domEvent
(
view
.
domNode
,
'
keydown
'
))
const
onKeyDown
=
chain
(
domEvent
(
view
.
domNode
,
'
keydown
'
))
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
));
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
))
.
filter
(
e
=>
!
isInputElement
(
e
.
target
));
onKeyDown
.
filter
(
e
=>
e
.
keyCode
===
KeyCode
.
Enter
).
on
(
this
.
onEnter
,
this
,
this
.
disposables
);
onKeyDown
.
filter
(
e
=>
e
.
keyCode
===
KeyCode
.
Enter
).
on
(
this
.
onEnter
,
this
,
this
.
disposables
);
onKeyDown
.
filter
(
e
=>
e
.
keyCode
===
KeyCode
.
UpArrow
).
on
(
this
.
onUpArrow
,
this
,
this
.
disposables
);
onKeyDown
.
filter
(
e
=>
e
.
keyCode
===
KeyCode
.
UpArrow
).
on
(
this
.
onUpArrow
,
this
,
this
.
disposables
);
...
...
src/vs/platform/list/browser/listService.ts
浏览文件 @
234e2db9
...
@@ -8,14 +8,14 @@ import { ITree, ITreeConfiguration, ITreeOptions } from 'vs/base/parts/tree/brow
...
@@ -8,14 +8,14 @@ import { ITree, ITreeConfiguration, ITreeOptions } from 'vs/base/parts/tree/brow
import
{
List
,
IListOptions
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
{
List
,
IListOptions
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDisposable
,
toDisposable
,
combinedDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
toDisposable
,
combinedDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IContextKeyService
,
IContextKey
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
IContextKey
,
RawContextKey
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
PagedList
,
IPagedRenderer
}
from
'
vs/base/browser/ui/list/listPaging
'
;
import
{
PagedList
,
IPagedRenderer
}
from
'
vs/base/browser/ui/list/listPaging
'
;
import
{
IDelegate
,
IRenderer
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
IDelegate
,
IRenderer
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
Tree
}
from
'
vs/base/parts/tree/browser/treeImpl
'
;
import
{
Tree
}
from
'
vs/base/parts/tree/browser/treeImpl
'
;
import
{
attachListStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
attachListStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
debounce
}
from
'
vs/base/common/decorators
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
InputFocusedContextKey
}
from
'
vs/platform/workbench/common/contextkeys
'
;
export
type
ListWidget
=
List
<
any
>
|
PagedList
<
any
>
|
ITree
;
export
type
ListWidget
=
List
<
any
>
|
PagedList
<
any
>
|
ITree
;
...
@@ -72,14 +72,14 @@ export class ListService implements IListService {
...
@@ -72,14 +72,14 @@ export class ListService implements IListService {
}
}
}
}
const
RawWorkbenchListFocusContextKey
=
new
RawContextKey
<
boolean
>
(
'
listFocus
'
,
true
);
export
const
WorkbenchListFocusContextKey
=
new
RawContextKey
<
boolean
>
(
'
listFocus
'
,
true
);
export
const
WorkbenchListFocusContextKey
=
ContextKeyExpr
.
and
(
RawWorkbenchListFocusContextKey
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)
);
export
type
Widget
=
List
<
any
>
|
PagedList
<
any
>
|
ITree
;
export
type
Widget
=
List
<
any
>
|
PagedList
<
any
>
|
ITree
;
function
createScopedContextKeyService
(
contextKeyService
:
IContextKeyService
,
widget
:
Widget
):
IContextKeyService
{
function
createScopedContextKeyService
(
contextKeyService
:
IContextKeyService
,
widget
:
Widget
):
IContextKeyService
{
const
result
=
contextKeyService
.
createScoped
(
widget
.
getHTMLElement
());
const
result
=
contextKeyService
.
createScoped
(
widget
.
getHTMLElement
());
WorkbenchListFocusContextKey
.
bindTo
(
result
);
Raw
WorkbenchListFocusContextKey
.
bindTo
(
result
);
return
result
;
return
result
;
}
}
...
@@ -147,7 +147,6 @@ export class WorkbenchTree extends Tree {
...
@@ -147,7 +147,6 @@ export class WorkbenchTree extends Tree {
readonly
onFocusChange
:
Event
<
boolean
>
=
this
.
_onFocusChange
.
event
;
readonly
onFocusChange
:
Event
<
boolean
>
=
this
.
_onFocusChange
.
event
;
readonly
contextKeyService
:
IContextKeyService
;
readonly
contextKeyService
:
IContextKeyService
;
private
workbenchListFocusContextKey
:
IContextKey
<
boolean
>
;
private
disposables
:
IDisposable
[]
=
[];
private
disposables
:
IDisposable
[]
=
[];
constructor
(
constructor
(
...
@@ -160,26 +159,13 @@ export class WorkbenchTree extends Tree {
...
@@ -160,26 +159,13 @@ export class WorkbenchTree extends Tree {
)
{
)
{
super
(
container
,
configuration
,
options
);
super
(
container
,
configuration
,
options
);
this
.
contextKeyService
=
contextKeyService
.
createScoped
(
this
.
getHTMLElement
());
this
.
contextKeyService
=
createScopedContextKeyService
(
contextKeyService
,
this
);
this
.
workbenchListFocusContextKey
=
WorkbenchListFocusContextKey
.
bindTo
(
this
.
contextKeyService
);
this
.
disposables
.
push
(
this
.
disposables
.
push
(
this
.
contextKeyService
,
this
.
contextKeyService
,
(
listService
as
ListService
).
register
(
this
),
(
listService
as
ListService
).
register
(
this
),
attachListStyler
(
this
,
themeService
)
attachListStyler
(
this
,
themeService
)
);
);
this
.
onDidFocus
(
this
.
updateContextKey
,
this
,
this
.
disposables
);
this
.
onDidBlur
(
this
.
updateContextKey
,
this
,
this
.
disposables
);
this
.
onDidChangeHighlight
(
this
.
updateContextKey
,
this
,
this
.
disposables
);
}
@
debounce
(
50
)
private
updateContextKey
():
void
{
const
isFocused
=
document
.
activeElement
===
this
.
getHTMLElement
();
this
.
workbenchListFocusContextKey
.
set
(
isFocused
);
this
.
_onFocusChange
.
fire
(
isFocused
);
}
}
dispose
():
void
{
dispose
():
void
{
...
...
src/vs/platform/workbench/common/contextkeys.ts
0 → 100644
浏览文件 @
234e2db9
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
export
const
InputFocusedContextKey
=
'
inputFocus
'
;
export
const
InputFocusedContext
=
new
RawContextKey
<
boolean
>
(
InputFocusedContextKey
,
false
);
\ No newline at end of file
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
234e2db9
...
@@ -96,6 +96,8 @@ import { IDecorationsService } from 'vs/workbench/services/decorations/browser/d
...
@@ -96,6 +96,8 @@ import { IDecorationsService } from 'vs/workbench/services/decorations/browser/d
import
{
ActivityService
}
from
'
vs/workbench/services/activity/browser/activityService
'
;
import
{
ActivityService
}
from
'
vs/workbench/services/activity/browser/activityService
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IListService
,
ListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IListService
,
ListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
InputFocusedContext
}
from
'
vs/platform/workbench/common/contextkeys
'
;
export
const
MessagesVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
globalMessageVisible
'
,
false
);
export
const
MessagesVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
globalMessageVisible
'
,
false
);
export
const
EditorsVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
editorIsOpen
'
,
false
);
export
const
EditorsVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
editorIsOpen
'
,
false
);
...
@@ -277,6 +279,10 @@ export class Workbench implements IPartService {
...
@@ -277,6 +279,10 @@ export class Workbench implements IPartService {
this
.
inZenMode
=
InZenModeContext
.
bindTo
(
this
.
contextKeyService
);
this
.
inZenMode
=
InZenModeContext
.
bindTo
(
this
.
contextKeyService
);
this
.
sideBarVisibleContext
=
SidebarVisibleContext
.
bindTo
(
this
.
contextKeyService
);
this
.
sideBarVisibleContext
=
SidebarVisibleContext
.
bindTo
(
this
.
contextKeyService
);
const
inputFocused
=
InputFocusedContext
.
bindTo
(
this
.
contextKeyService
);
const
onWindowsFocusIn
=
domEvent
(
window
,
'
focusin
'
,
true
);
onWindowsFocusIn
(()
=>
inputFocused
.
set
(
document
.
activeElement
.
tagName
===
'
INPUT
'
||
document
.
activeElement
.
tagName
===
'
TEXTAREA
'
),
null
,
this
.
toDispose
);
// Set workbench state context
// Set workbench state context
const
WorkbenchStateContext
=
new
RawContextKey
<
string
>
(
'
workbenchState
'
,
getWorkbenchStateString
(
this
.
configurationService
.
getWorkbenchState
()));
const
WorkbenchStateContext
=
new
RawContextKey
<
string
>
(
'
workbenchState
'
,
getWorkbenchStateString
(
this
.
configurationService
.
getWorkbenchState
()));
const
workbenchStateContext
=
WorkbenchStateContext
.
bindTo
(
this
.
contextKeyService
);
const
workbenchStateContext
=
WorkbenchStateContext
.
bindTo
(
this
.
contextKeyService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录