Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f86fd688
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,发现更多精彩内容 >>
未验证
提交
f86fd688
编写于
6月 15, 2020
作者:
J
João Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix references widget
上级
a790f912
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
32 deletion
+50
-32
src/vs/base/browser/ui/tree/abstractTree.ts
src/vs/base/browser/ui/tree/abstractTree.ts
+0
-6
src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
+4
-11
src/vs/platform/list/browser/listService.ts
src/vs/platform/list/browser/listService.ts
+39
-9
src/vs/workbench/browser/actions/listCommands.ts
src/vs/workbench/browser/actions/listCommands.ts
+7
-6
未找到文件。
src/vs/base/browser/ui/tree/abstractTree.ts
浏览文件 @
f86fd688
...
...
@@ -1099,12 +1099,6 @@ class TreeNodeListMouseController<T, TFilterData, TRef> extends MouseController<
}
const
onTwistie
=
hasClass
(
e
.
browserEvent
.
target
as
HTMLElement
,
'
monaco-tl-twistie
'
);
// TODO@joao: fix folder expansion
if
(
e
.
browserEvent
.
detail
!==
2
&&
!
onTwistie
)
{
return
super
.
onPointer
(
e
);
}
let
expandOnlyOnTwistieClick
=
false
;
if
(
typeof
this
.
tree
.
expandOnlyOnTwistieClick
===
'
function
'
)
{
...
...
src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
浏览文件 @
f86fd688
...
...
@@ -317,6 +317,8 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
accessibilityProvider
:
new
AccessibilityProvider
(),
keyboardNavigationLabelProvider
:
this
.
_instantiationService
.
createInstance
(
StringRepresentationProvider
),
identityProvider
:
new
IdentityProvider
(),
openOnSingleClick
:
true
,
openOnFocus
:
true
,
overrideStyles
:
{
listBackground
:
peekView
.
peekViewResultsBackground
}
...
...
@@ -372,21 +374,12 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
this
.
_onDidSelectReference
.
fire
({
element
,
kind
,
source
:
'
tree
'
});
}
};
this
.
_tree
.
onDidChangeFocus
(
e
=>
{
onEvent
(
e
.
elements
[
0
],
'
show
'
);
});
this
.
_tree
.
onDidOpen
(
e
=>
{
if
(
e
.
browserEvent
instanceof
MouseEvent
&&
(
e
.
browserEvent
.
ctrlKey
||
e
.
browserEvent
.
metaKey
||
e
.
browserEvent
.
altKey
))
{
// modifier-click -> open to the side
if
(
e
.
sideBySide
)
{
onEvent
(
e
.
element
,
'
side
'
);
}
else
if
(
e
.
browserEvent
instanceof
KeyboardEvent
||
(
e
.
browserEvent
instanceof
MouseEvent
&&
e
.
browserEvent
.
detail
===
2
)
||
(
<
GestureEvent
>
e
.
browserEvent
).
tapCount
===
2
)
{
// keybinding (list service command)
// OR double click
// OR double tap
// -> close widget and goto target
}
else
if
(
e
.
editorOptions
.
pinned
)
{
onEvent
(
e
.
element
,
'
goto
'
);
}
else
{
// preview location
onEvent
(
e
.
element
,
'
show
'
);
}
});
...
...
src/vs/platform/list/browser/listService.ts
浏览文件 @
f86fd688
...
...
@@ -28,6 +28,7 @@ import { IKeyboardNavigationEventFilter, IAbstractTreeOptions, RenderIndentGuide
import
{
IAccessibilityService
}
from
'
vs/platform/accessibility/common/accessibility
'
;
export
type
ListWidget
=
List
<
any
>
|
PagedList
<
any
>
|
ObjectTree
<
any
,
any
>
|
DataTree
<
any
,
any
,
any
>
|
AsyncDataTree
<
any
,
any
,
any
>
;
export
type
WorkbenchListWidget
=
WorkbenchList
<
any
>
|
WorkbenchPagedList
<
any
>
|
WorkbenchObjectTree
<
any
,
any
>
|
WorkbenchCompressibleObjectTree
<
any
,
any
>
|
WorkbenchDataTree
<
any
,
any
,
any
>
|
WorkbenchAsyncDataTree
<
any
,
any
,
any
>
|
WorkbenchCompressibleAsyncDataTree
<
any
,
any
,
any
>
;
export
const
IListService
=
createDecorator
<
IListService
>
(
'
listService
'
);
...
...
@@ -38,11 +39,11 @@ export interface IListService {
/**
* Returns the currently focused list widget if any.
*/
readonly
lastFocusedList
:
ListWidget
|
undefined
;
readonly
lastFocusedList
:
Workbench
ListWidget
|
undefined
;
}
interface
IRegisteredList
{
widget
:
ListWidget
;
widget
:
Workbench
ListWidget
;
extraContextKeys
?:
(
IContextKey
<
boolean
>
)[];
}
...
...
@@ -52,17 +53,17 @@ export class ListService implements IListService {
private
disposables
=
new
DisposableStore
();
private
lists
:
IRegisteredList
[]
=
[];
private
_lastFocusedWidget
:
ListWidget
|
undefined
=
undefined
;
private
_lastFocusedWidget
:
Workbench
ListWidget
|
undefined
=
undefined
;
private
_hasCreatedStyleController
:
boolean
=
false
;
get
lastFocusedList
():
ListWidget
|
undefined
{
get
lastFocusedList
():
Workbench
ListWidget
|
undefined
{
return
this
.
_lastFocusedWidget
;
}
constructor
(@
IThemeService
private
readonly
_themeService
:
IThemeService
)
{
}
register
(
widget
:
ListWidget
,
extraContextKeys
?:
(
IContextKey
<
boolean
>
)[]):
IDisposable
{
register
(
widget
:
Workbench
ListWidget
,
extraContextKeys
?:
(
IContextKey
<
boolean
>
)[]):
IDisposable
{
if
(
!
this
.
_hasCreatedStyleController
)
{
this
.
_hasCreatedStyleController
=
true
;
// create a shared default tree style sheet for performance reasons
...
...
@@ -477,7 +478,7 @@ abstract class ResourceNavigator<T> extends Disposable {
!!
(
<
SelectionKeyboardEvent
>
browserEvent
).
preserveFocus
:
true
;
this
.
open
(
preserveFocus
,
false
,
false
,
browserEvent
);
this
.
_
open
(
preserveFocus
,
false
,
false
,
browserEvent
);
}
}
...
...
@@ -497,7 +498,7 @@ abstract class ResourceNavigator<T> extends Disposable {
if
(
this
.
openOnSingleClick
||
isDoubleClick
||
isKeyboardEvent
)
{
const
sideBySide
=
browserEvent
instanceof
MouseEvent
&&
(
browserEvent
.
ctrlKey
||
browserEvent
.
metaKey
||
browserEvent
.
altKey
);
this
.
open
(
preserveFocus
,
isDoubleClick
||
isMiddleClick
,
sideBySide
,
browserEvent
);
this
.
_
open
(
preserveFocus
,
isDoubleClick
||
isMiddleClick
,
sideBySide
,
browserEvent
);
}
}
...
...
@@ -507,10 +508,10 @@ abstract class ResourceNavigator<T> extends Disposable {
}
const
sideBySide
=
(
browserEvent
.
ctrlKey
||
browserEvent
.
metaKey
||
browserEvent
.
altKey
);
this
.
open
(
true
,
true
,
sideBySide
,
browserEvent
);
this
.
_
open
(
true
,
true
,
sideBySide
,
browserEvent
);
}
private
open
(
preserveFocus
:
boolean
,
pinned
:
boolean
,
sideBySide
:
boolean
,
browserEvent
?:
UIEvent
):
void
{
private
_
open
(
preserveFocus
:
boolean
,
pinned
:
boolean
,
sideBySide
:
boolean
,
browserEvent
?:
UIEvent
):
void
{
this
.
_onDidOpen
.
fire
({
editorOptions
:
{
preserveFocus
,
...
...
@@ -522,6 +523,11 @@ abstract class ResourceNavigator<T> extends Disposable {
browserEvent
});
}
// hack for References Widget: pressing Enter on already selected tree element
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
_open
((
browserEvent
as
any
)?.
preserveFocus
||
false
,
true
,
false
,
browserEvent
);
}
}
export
class
ListResourceNavigator
<
T
>
extends
ResourceNavigator
<
number
>
{
...
...
@@ -594,6 +600,10 @@ export class WorkbenchObjectTree<T extends NonNullable<any>, TFilterData = void>
this
.
internals
=
new
WorkbenchTreeInternals
(
this
,
options
,
getAutomaticKeyboardNavigation
,
options
.
overrideStyles
,
contextKeyService
,
listService
,
themeService
,
configurationService
,
accessibilityService
);
this
.
disposables
.
add
(
this
.
internals
);
}
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
internals
.
open
(
browserEvent
);
}
}
export
interface
IWorkbenchCompressibleObjectTreeOptionsUpdate
extends
ICompressibleObjectTreeOptionsUpdate
{
...
...
@@ -638,6 +648,10 @@ export class WorkbenchCompressibleObjectTree<T extends NonNullable<any>, TFilter
this
.
internals
.
updateStyleOverrides
(
options
.
overrideStyles
);
}
}
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
internals
.
open
(
browserEvent
);
}
}
export
interface
IWorkbenchDataTreeOptionsUpdate
extends
IAbstractTreeOptionsUpdate
{
...
...
@@ -683,6 +697,10 @@ export class WorkbenchDataTree<TInput, T, TFilterData = void> extends DataTree<T
this
.
internals
.
updateStyleOverrides
(
options
.
overrideStyles
);
}
}
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
internals
.
open
(
browserEvent
);
}
}
export
interface
IWorkbenchAsyncDataTreeOptionsUpdate
extends
IAsyncDataTreeOptionsUpdate
{
...
...
@@ -728,6 +746,10 @@ export class WorkbenchAsyncDataTree<TInput, T, TFilterData = void> extends Async
this
.
internals
.
updateStyleOverrides
(
options
.
overrideStyles
);
}
}
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
internals
.
open
(
browserEvent
);
}
}
export
interface
IWorkbenchCompressibleAsyncDataTreeOptions
<
T
,
TFilterData
>
extends
ICompressibleAsyncDataTreeOptions
<
T
,
TFilterData
>
,
IResourceNavigatorOptions
{
...
...
@@ -763,6 +785,10 @@ export class WorkbenchCompressibleAsyncDataTree<TInput, T, TFilterData = void> e
this
.
internals
=
new
WorkbenchTreeInternals
(
this
,
options
,
getAutomaticKeyboardNavigation
,
options
.
overrideStyles
,
contextKeyService
,
listService
,
themeService
,
configurationService
,
accessibilityService
);
this
.
disposables
.
add
(
this
.
internals
);
}
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
internals
.
open
(
browserEvent
);
}
}
function
workbenchTreeDataPreamble
<
T
,
TFilterData
,
TOptions
extends
IAbstractTreeOptions
<
T
,
TFilterData
>
|
IAsyncDataTreeOptions
<
T
,
TFilterData
>>
(
...
...
@@ -935,6 +961,10 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
this
.
styler
=
overrideStyles
?
attachListStyler
(
this
.
tree
,
this
.
themeService
,
overrideStyles
)
:
Disposable
.
None
;
}
open
(
browserEvent
?:
UIEvent
):
void
{
this
.
navigator
.
open
(
browserEvent
);
}
dispose
():
void
{
this
.
disposables
=
dispose
(
this
.
disposables
);
dispose
(
this
.
styler
);
...
...
src/vs/workbench/browser/actions/listCommands.ts
浏览文件 @
f86fd688
...
...
@@ -506,23 +506,24 @@ function focusElement(accessor: ServicesAccessor, retainCurrentFocus: boolean):
// Trees
else
if
(
focused
instanceof
ObjectTree
||
focused
instanceof
DataTree
||
focused
instanceof
AsyncDataTree
)
{
const
list
=
focused
;
const
focus
=
list
.
getFocus
();
const
tree
=
focused
;
const
focus
=
tree
.
getFocus
();
if
(
focus
.
length
>
0
)
{
let
toggleCollapsed
=
true
;
if
(
list
.
expandOnlyOnTwistieClick
===
true
)
{
if
(
tree
.
expandOnlyOnTwistieClick
===
true
)
{
toggleCollapsed
=
false
;
}
else
if
(
typeof
list
.
expandOnlyOnTwistieClick
!==
'
boolean
'
&&
list
.
expandOnlyOnTwistieClick
(
focus
[
0
]))
{
}
else
if
(
typeof
tree
.
expandOnlyOnTwistieClick
!==
'
boolean
'
&&
tree
.
expandOnlyOnTwistieClick
(
focus
[
0
]))
{
toggleCollapsed
=
false
;
}
if
(
toggleCollapsed
)
{
list
.
toggleCollapsed
(
focus
[
0
]);
tree
.
toggleCollapsed
(
focus
[
0
]);
}
}
list
.
setSelection
(
focus
,
fakeKeyboardEvent
);
tree
.
setSelection
(
focus
,
fakeKeyboardEvent
);
tree
.
open
(
fakeKeyboardEvent
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录