Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
77d49069
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,发现更多精彩内容 >>
提交
77d49069
编写于
2月 05, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
8dbf25e4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
105 deletion
+92
-105
src/vs/editor/contrib/documentSymbols/outlineTree2.ts
src/vs/editor/contrib/documentSymbols/outlineTree2.ts
+31
-31
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
+41
-54
src/vs/workbench/parts/outline/electron-browser/outlinePanel2.ts
...workbench/parts/outline/electron-browser/outlinePanel2.ts
+20
-20
未找到文件。
src/vs/editor/contrib/documentSymbols/outlineTree2.ts
浏览文件 @
77d49069
...
...
@@ -20,13 +20,13 @@ import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
OutlineConfigKeys
}
from
'
vs/editor/contrib/documentSymbols/outline
'
;
export
type
N
OutlineItem
=
OutlineGroup
|
OutlineElement
;
export
type
OutlineItem
=
OutlineGroup
|
OutlineElement
;
export
class
NOutlineNavigationLabelProvider
implements
IKeyboardNavigationLabelProvider
<
N
OutlineItem
>
{
export
class
OutlineNavigationLabelProvider
implements
IKeyboardNavigationLabelProvider
<
OutlineItem
>
{
constructor
(@
IKeybindingService
private
readonly
_keybindingService
:
IKeybindingService
)
{
}
getKeyboardNavigationLabel
(
element
:
N
OutlineItem
):
{
toString
():
string
;
}
{
getKeyboardNavigationLabel
(
element
:
OutlineItem
):
{
toString
():
string
;
}
{
if
(
element
instanceof
OutlineGroup
)
{
return
element
.
provider
.
displayName
;
}
else
{
...
...
@@ -40,66 +40,66 @@ export class NOutlineNavigationLabelProvider implements IKeyboardNavigationLabel
}
export
class
NOutlineIdentityProvider
implements
IIdentityProvider
<
N
OutlineItem
>
{
export
class
OutlineIdentityProvider
implements
IIdentityProvider
<
OutlineItem
>
{
getId
(
element
:
TreeElement
):
{
toString
():
string
;
}
{
return
element
.
id
;
}
}
export
class
N
OutlineGroupTemplate
{
export
class
OutlineGroupTemplate
{
static
id
=
'
OutlineGroupTemplate
'
;
labelContainer
:
HTMLElement
;
label
:
HighlightedLabel
;
}
export
class
N
OutlineElementTemplate
{
export
class
OutlineElementTemplate
{
static
id
=
'
OutlineElementTemplate
'
;
iconLabel
:
IconLabel
;
decoration
:
HTMLElement
;
}
export
class
NOutlineVirtualDelegate
implements
IListVirtualDelegate
<
N
OutlineItem
>
{
export
class
OutlineVirtualDelegate
implements
IListVirtualDelegate
<
OutlineItem
>
{
getHeight
(
_element
:
N
OutlineItem
):
number
{
getHeight
(
_element
:
OutlineItem
):
number
{
return
22
;
}
getTemplateId
(
element
:
N
OutlineItem
):
string
{
getTemplateId
(
element
:
OutlineItem
):
string
{
if
(
element
instanceof
OutlineGroup
)
{
return
N
OutlineGroupTemplate
.
id
;
return
OutlineGroupTemplate
.
id
;
}
else
{
return
N
OutlineElementTemplate
.
id
;
return
OutlineElementTemplate
.
id
;
}
}
}
export
class
NOutlineGroupRenderer
implements
ITreeRenderer
<
OutlineGroup
,
FuzzyScore
,
N
OutlineGroupTemplate
>
{
export
class
OutlineGroupRenderer
implements
ITreeRenderer
<
OutlineGroup
,
FuzzyScore
,
OutlineGroupTemplate
>
{
readonly
templateId
:
string
=
N
OutlineGroupTemplate
.
id
;
readonly
templateId
:
string
=
OutlineGroupTemplate
.
id
;
renderTemplate
(
container
:
HTMLElement
):
N
OutlineGroupTemplate
{
renderTemplate
(
container
:
HTMLElement
):
OutlineGroupTemplate
{
const
labelContainer
=
dom
.
$
(
'
.outline-element-label
'
);
dom
.
addClass
(
container
,
'
outline-element
'
);
dom
.
append
(
container
,
labelContainer
);
return
{
labelContainer
,
label
:
new
HighlightedLabel
(
labelContainer
,
true
)
};
}
renderElement
(
node
:
ITreeNode
<
OutlineGroup
,
FuzzyScore
>
,
index
:
number
,
template
:
N
OutlineGroupTemplate
):
void
{
renderElement
(
node
:
ITreeNode
<
OutlineGroup
,
FuzzyScore
>
,
index
:
number
,
template
:
OutlineGroupTemplate
):
void
{
template
.
label
.
set
(
node
.
element
.
provider
.
displayName
||
localize
(
'
provider
'
,
"
Outline Provider
"
),
createMatches
(
node
.
filterData
)
);
}
disposeTemplate
(
_template
:
N
OutlineGroupTemplate
):
void
{
disposeTemplate
(
_template
:
OutlineGroupTemplate
):
void
{
// nothing
}
}
export
class
NOutlineElementRenderer
implements
ITreeRenderer
<
OutlineElement
,
FuzzyScore
,
N
OutlineElementTemplate
>
{
export
class
OutlineElementRenderer
implements
ITreeRenderer
<
OutlineElement
,
FuzzyScore
,
OutlineElementTemplate
>
{
readonly
templateId
:
string
=
N
OutlineElementTemplate
.
id
;
readonly
templateId
:
string
=
OutlineElementTemplate
.
id
;
renderProblemColors
=
true
;
renderProblemBadges
=
true
;
...
...
@@ -109,7 +109,7 @@ export class NOutlineElementRenderer implements ITreeRenderer<OutlineElement, Fu
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
)
{
}
renderTemplate
(
container
:
HTMLElement
):
N
OutlineElementTemplate
{
renderTemplate
(
container
:
HTMLElement
):
OutlineElementTemplate
{
// const labelContainer = dom.$('.outline-element-label');
const
iconLabel
=
new
IconLabel
(
container
,
{
supportHighlights
:
true
});
const
decoration
=
dom
.
$
(
'
.outline-element-decoration
'
);
...
...
@@ -117,12 +117,12 @@ export class NOutlineElementRenderer implements ITreeRenderer<OutlineElement, Fu
return
{
iconLabel
,
decoration
};
}
renderElement
(
node
:
ITreeNode
<
OutlineElement
,
FuzzyScore
>
,
index
:
number
,
template
:
N
OutlineElementTemplate
):
void
{
renderElement
(
node
:
ITreeNode
<
OutlineElement
,
FuzzyScore
>
,
index
:
number
,
template
:
OutlineElementTemplate
):
void
{
const
{
element
}
=
node
;
const
options
=
{
matches
:
createMatches
(
node
.
filterData
),
extraClasses
:
[],
title
:
localize
(
'
title.template
'
,
"
{0} ({1})
"
,
element
.
symbol
.
name
,
N
OutlineElementRenderer
.
_symbolKindNames
[
element
.
symbol
.
kind
])
title
:
localize
(
'
title.template
'
,
"
{0} ({1})
"
,
element
.
symbol
.
name
,
OutlineElementRenderer
.
_symbolKindNames
[
element
.
symbol
.
kind
])
};
if
(
this
.
_configurationService
.
getValue
(
OutlineConfigKeys
.
icons
))
{
options
.
extraClasses
.
push
(
`outline-element-icon
${
symbolKindToCssClass
(
element
.
symbol
.
kind
,
true
)}
`
);
...
...
@@ -199,33 +199,33 @@ export class NOutlineElementRenderer implements ITreeRenderer<OutlineElement, Fu
[
SymbolKind
.
Variable
]:
localize
(
'
Variable
'
,
"
variable
"
),
};
disposeTemplate
(
_template
:
N
OutlineElementTemplate
):
void
{
disposeTemplate
(
_template
:
OutlineElementTemplate
):
void
{
_template
.
iconLabel
.
dispose
();
}
}
export
const
enum
NOutlineItemCompareType
{
export
const
enum
OutlineSortOrder
{
ByPosition
,
ByName
,
ByKind
}
export
class
NOutlineItemComparator
implements
ITreeSorter
<
N
OutlineItem
>
{
export
class
OutlineItemComparator
implements
ITreeSorter
<
OutlineItem
>
{
constructor
(
public
type
:
NOutlineItemCompareType
=
NOutlineItemCompareType
.
ByPosition
public
type
:
OutlineSortOrder
=
OutlineSortOrder
.
ByPosition
)
{
}
compare
(
a
:
NOutlineItem
,
b
:
N
OutlineItem
):
number
{
compare
(
a
:
OutlineItem
,
b
:
OutlineItem
):
number
{
if
(
a
instanceof
OutlineGroup
&&
b
instanceof
OutlineGroup
)
{
return
a
.
providerIndex
-
b
.
providerIndex
;
}
else
if
(
a
instanceof
OutlineElement
&&
b
instanceof
OutlineElement
)
{
if
(
this
.
type
===
NOutlineItemCompareType
.
ByKind
)
{
if
(
this
.
type
===
OutlineSortOrder
.
ByKind
)
{
return
a
.
symbol
.
kind
-
b
.
symbol
.
kind
||
a
.
symbol
.
name
.
localeCompare
(
b
.
symbol
.
name
);
}
else
if
(
this
.
type
===
NOutlineItemCompareType
.
ByName
)
{
}
else
if
(
this
.
type
===
OutlineSortOrder
.
ByName
)
{
return
a
.
symbol
.
name
.
localeCompare
(
b
.
symbol
.
name
)
||
Range
.
compareRangesUsingStarts
(
a
.
symbol
.
range
,
b
.
symbol
.
range
);
}
else
if
(
this
.
type
===
NOutlineItemCompareType
.
ByPosition
)
{
}
else
if
(
this
.
type
===
OutlineSortOrder
.
ByPosition
)
{
return
Range
.
compareRangesUsingStarts
(
a
.
symbol
.
range
,
b
.
symbol
.
range
)
||
a
.
symbol
.
name
.
localeCompare
(
b
.
symbol
.
name
);
}
}
...
...
@@ -233,9 +233,9 @@ export class NOutlineItemComparator implements ITreeSorter<NOutlineItem> {
}
}
export
class
NOutlineDataSource
implements
IDataSource
<
OutlineModel
,
N
OutlineItem
>
{
export
class
OutlineDataSource
implements
IDataSource
<
OutlineModel
,
OutlineItem
>
{
getChildren
(
element
:
undefined
|
OutlineModel
|
OutlineGroup
|
OutlineElement
):
N
OutlineItem
[]
{
getChildren
(
element
:
undefined
|
OutlineModel
|
OutlineGroup
|
OutlineElement
):
OutlineItem
[]
{
if
(
!
element
)
{
return
[];
}
...
...
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
浏览文件 @
77d49069
...
...
@@ -27,11 +27,14 @@ import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs
import
{
BreadcrumbElement
,
FileElement
}
from
'
vs/workbench/browser/parts/editor/breadcrumbsModel
'
;
import
{
IFileIconTheme
,
IWorkbenchThemeService
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
IAsyncDataSource
,
ITreeRenderer
,
ITreeNode
,
ITreeFilter
,
TreeVisibility
,
ITreeSorter
}
from
'
vs/base/browser/ui/tree/tree
'
;
import
{
NOutlineVirtualDelegate
,
NOutlineGroupRenderer
,
NOutlineElementRenderer
,
NOutlineItemComparator
,
NOutlineIdentityProvider
,
NOutlineNavigationLabelProvider
,
NOutlineDataSource
,
NOutlineItemCompareType
}
from
'
vs/editor/contrib/documentSymbols/outlineTree2
'
;
import
{
OutlineVirtualDelegate
,
OutlineGroupRenderer
,
OutlineElementRenderer
,
OutlineItemComparator
,
OutlineIdentityProvider
,
OutlineNavigationLabelProvider
,
OutlineDataSource
,
OutlineSortOrder
,
OutlineItem
}
from
'
vs/editor/contrib/documentSymbols/outlineTree2
'
;
import
{
IIdentityProvider
,
IListVirtualDelegate
,
IKeyboardNavigationLabelProvider
}
from
'
vs/base/browser/ui/list/list
'
;
export
function
createBreadcrumbsPicker
(
instantiationService
:
IInstantiationService
,
parent
:
HTMLElement
,
element
:
BreadcrumbElement
):
BreadcrumbsPicker
{
let
ctor
:
IConstructorSignature1
<
HTMLElement
,
BreadcrumbsPicker
>
=
element
instanceof
FileElement
?
BreadcrumbsFilePicker
:
BreadcrumbsOutlinePicker
;
const
ctor
:
IConstructorSignature1
<
HTMLElement
,
BreadcrumbsPicker
>
=
element
instanceof
FileElement
?
BreadcrumbsFilePicker
:
BreadcrumbsOutlinePicker
;
return
instantiationService
.
createInstance
(
ctor
,
parent
);
}
...
...
@@ -43,7 +46,7 @@ interface ILayoutInfo {
inputHeight
:
number
;
}
type
Tree
<
E
>
=
WorkbenchDataTree
<
any
,
E
,
FuzzyScore
>
|
WorkbenchAsyncDataTree
<
any
,
E
,
FuzzyScore
>
;
type
Tree
<
I
,
E
>
=
WorkbenchDataTree
<
I
,
E
,
FuzzyScore
>
|
WorkbenchAsyncDataTree
<
I
,
E
,
FuzzyScore
>
;
export
abstract
class
BreadcrumbsPicker
{
...
...
@@ -51,10 +54,9 @@ export abstract class BreadcrumbsPicker {
protected
readonly
_domNode
:
HTMLDivElement
;
protected
readonly
_arrow
:
HTMLDivElement
;
protected
readonly
_treeContainer
:
HTMLDivElement
;
protected
readonly
_tree
:
Tree
<
any
>
;
protected
readonly
_tree
:
Tree
<
any
,
any
>
;
protected
readonly
_fakeEvent
=
new
UIEvent
(
'
fakeEvent
'
);
protected
readonly
_focus
:
dom
.
IFocusTracker
;
protected
readonly
_symbolSortOrder
:
BreadcrumbsConfig
<
'
position
'
|
'
name
'
|
'
type
'
>
;
private
_layoutInfo
:
ILayoutInfo
;
private
readonly
_onDidPickElement
=
new
Emitter
<
{
target
:
any
,
payload
:
any
}
>
();
...
...
@@ -67,7 +69,7 @@ export abstract class BreadcrumbsPicker {
parent
:
HTMLElement
,
@
IInstantiationService
protected
readonly
_instantiationService
:
IInstantiationService
,
@
IWorkbenchThemeService
protected
readonly
_themeService
:
IWorkbenchThemeService
,
@
IConfigurationService
pr
ivate
readonly
_configurationService
:
IConfigurationService
,
@
IConfigurationService
pr
otected
readonly
_configurationService
:
IConfigurationService
,
)
{
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
.
className
=
'
monaco-breadcrumbs-picker show-file-icons
'
;
...
...
@@ -91,19 +93,10 @@ export abstract class BreadcrumbsPicker {
this
.
_treeContainer
.
style
.
boxShadow
=
`0px 5px 8px
${
this
.
_themeService
.
getTheme
().
getColor
(
widgetShadow
)}
`
;
this
.
_domNode
.
appendChild
(
this
.
_treeContainer
);
this
.
_symbolSortOrder
=
BreadcrumbsConfig
.
SymbolSortOrder
.
bindTo
(
this
.
_configurationService
);
const
filterConfig
=
BreadcrumbsConfig
.
FilterOnType
.
bindTo
(
this
.
_configurationService
);
this
.
_disposables
.
push
(
filterConfig
);
// const treeConfig = this._completeTreeConfiguration({ dataSource: undefined, renderer: undefined, highlighter: undefined });
// this._tree = this._instantiationService.createInstance(
// HighlightingWorkbenchTree,
// this._treeContainer,
// treeConfig,
// <IHighlightingTreeOptions>{ useShadows: false, filterOnType: filterConfig.getValue(), showTwistie: false, twistiePixels: 12 },
// { placeholder: localize('placeholder', "Find") }
// );
this
.
_tree
=
this
.
_createTree
(
this
.
_treeContainer
);
this
.
_disposables
.
push
(
this
.
_tree
.
onDidChangeSelection
(
e
=>
{
...
...
@@ -144,7 +137,6 @@ export abstract class BreadcrumbsPicker {
this
.
_onDidPickElement
.
dispose
();
this
.
_tree
.
dispose
();
this
.
_focus
.
dispose
();
this
.
_symbolSortOrder
.
dispose
();
}
setInput
(
input
:
any
,
maxHeight
:
number
,
width
:
number
,
arrowSize
:
number
,
arrowOffset
:
number
):
void
{
...
...
@@ -154,35 +146,13 @@ export abstract class BreadcrumbsPicker {
this
.
_setInput
(
input
).
then
(()
=>
{
this
.
_layout
();
}).
catch
(
onUnexpectedError
);
// let actualInput = this._getInput(input);
// Promise.resolve(this._tree.setInput(actualInput, undefined)).then(() => {
// this._layoutInfo = { maxHeight, width, arrowSize, arrowOffset, inputHeight: 0 };
// this._layout();
// // use proper selection, reveal
// let selection = this._getInitialSelection(this._tree, input);
// if (selection) {
// return this._tree.reveal(selection, 0.5).then(() => {
// this._tree.setSelection([selection], this._tree);
// this._tree.setFocus(selection);
// this._tree.domFocus();
// });
// } else {
// this._tree.focusFirst();
// this._tree.setSelection([this._tree.getFocus()], this._tree);
// this._tree.domFocus();
// return Promise.resolve(null);
// }
// }, onUnexpectedError);
}
pr
ivate
_layout
(
info
:
ILayoutInfo
=
this
.
_layoutInfo
):
void
{
pr
otected
_layout
(
info
:
ILayoutInfo
=
this
.
_layoutInfo
):
void
{
le
t
headerHeight
=
2
*
info
.
arrowSize
;
le
t
treeHeight
=
Math
.
min
(
info
.
maxHeight
-
headerHeight
,
this
.
_tree
.
visibleNodeCount
*
22
);
le
t
totalHeight
=
treeHeight
+
headerHeight
;
cons
t
headerHeight
=
2
*
info
.
arrowSize
;
cons
t
treeHeight
=
Math
.
min
(
info
.
maxHeight
-
headerHeight
,
this
.
_tree
.
visibleNodeCount
*
22
);
cons
t
totalHeight
=
treeHeight
+
headerHeight
;
this
.
_domNode
.
style
.
height
=
`
${
totalHeight
}
px`
;
this
.
_domNode
.
style
.
width
=
`
${
info
.
width
}
px`
;
...
...
@@ -198,7 +168,7 @@ export abstract class BreadcrumbsPicker {
protected
abstract
_setInput
(
element
:
BreadcrumbElement
):
Promise
<
void
>
;
protected
abstract
_createTree
(
container
:
HTMLElement
):
Tree
<
any
>
;
protected
abstract
_createTree
(
container
:
HTMLElement
):
Tree
<
any
,
any
>
;
protected
abstract
_getTargetFromEvent
(
element
:
any
,
payload
:
UIEvent
):
any
|
undefined
;
}
...
...
@@ -469,21 +439,38 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
export
class
BreadcrumbsOutlinePicker
extends
BreadcrumbsPicker
{
protected
readonly
_symbolSortOrder
:
BreadcrumbsConfig
<
'
position
'
|
'
name
'
|
'
type
'
>
;
constructor
(
parent
:
HTMLElement
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IWorkbenchThemeService
themeService
:
IWorkbenchThemeService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
)
{
super
(
parent
,
instantiationService
,
themeService
,
configurationService
);
this
.
_symbolSortOrder
=
BreadcrumbsConfig
.
SymbolSortOrder
.
bindTo
(
this
.
_configurationService
);
}
protected
_createTree
(
container
:
HTMLElement
)
{
return
this
.
_instantiationService
.
createInstance
(
WorkbenchDataTree
,
container
,
new
N
OutlineVirtualDelegate
(),
[
new
NOutlineGroupRenderer
(),
this
.
_instantiationService
.
createInstance
(
N
OutlineElementRenderer
)],
new
N
OutlineDataSource
(),
new
OutlineVirtualDelegate
(),
[
new
OutlineGroupRenderer
(),
this
.
_instantiationService
.
createInstance
(
OutlineElementRenderer
)],
new
OutlineDataSource
(),
{
filterOnType
:
true
,
expandOnlyOnTwistieClick
:
true
,
sorter
:
new
N
OutlineItemComparator
(
this
.
_getOutlineItemCompareType
()),
identityProvider
:
new
N
OutlineIdentityProvider
(),
keyboardNavigationLabelProvider
:
this
.
_instantiationService
.
createInstance
(
N
OutlineNavigationLabelProvider
)
sorter
:
new
OutlineItemComparator
(
this
.
_getOutlineItemCompareType
()),
identityProvider
:
new
OutlineIdentityProvider
(),
keyboardNavigationLabelProvider
:
this
.
_instantiationService
.
createInstance
(
OutlineNavigationLabelProvider
)
}
)
as
WorkbenchDataTree
<
OutlineModel
,
any
,
FuzzyScore
>
;
)
as
WorkbenchDataTree
<
OutlineModel
,
OutlineItem
,
FuzzyScore
>
;
}
dispose
():
void
{
this
.
_symbolSortOrder
.
dispose
();
super
.
dispose
();
}
protected
_setInput
(
input
:
BreadcrumbElement
):
Promise
<
void
>
{
...
...
@@ -515,15 +502,15 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker {
}
}
private
_getOutlineItemCompareType
():
NOutlineItemCompareType
{
private
_getOutlineItemCompareType
():
OutlineSortOrder
{
switch
(
this
.
_symbolSortOrder
.
getValue
())
{
case
'
name
'
:
return
NOutlineItemCompareType
.
ByName
;
return
OutlineSortOrder
.
ByName
;
case
'
type
'
:
return
NOutlineItemCompareType
.
ByKind
;
return
OutlineSortOrder
.
ByKind
;
case
'
position
'
:
default
:
return
NOutlineItemCompareType
.
ByPosition
;
return
OutlineSortOrder
.
ByPosition
;
}
}
}
...
...
src/vs/workbench/parts/outline/electron-browser/outlinePanel2.ts
浏览文件 @
77d49069
...
...
@@ -44,7 +44,7 @@ import { CollapseAction2 } from 'vs/workbench/browser/viewlet';
import
{
ACTIVE_GROUP
,
IEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
OutlineConfigKeys
,
OutlineViewFiltered
,
OutlineViewFocused
}
from
'
../../../../editor/contrib/documentSymbols/outline
'
;
import
{
FuzzyScore
}
from
'
vs/base/common/filters
'
;
import
{
NOutlineDataSource
,
NOutlineItemComparator
,
NOutlineItemCompareType
,
NOutlineVirtualDelegate
,
NOutlineGroupRenderer
,
NOutlineElementRenderer
,
NOutlineItem
,
NOutlineIdentityProvider
,
N
OutlineNavigationLabelProvider
}
from
'
vs/editor/contrib/documentSymbols/outlineTree2
'
;
import
{
OutlineDataSource
,
OutlineItemComparator
,
OutlineSortOrder
,
OutlineVirtualDelegate
,
OutlineGroupRenderer
,
OutlineElementRenderer
,
OutlineItem
,
OutlineIdentityProvider
,
OutlineNavigationLabelProvider
}
from
'
vs/editor/contrib/documentSymbols/outlineTree2
'
;
import
{
IDataTreeViewState
}
from
'
vs/base/browser/ui/tree/dataTree
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
...
...
@@ -159,7 +159,7 @@ class OutlineViewState {
private
_followCursor
=
false
;
private
_filterOnType
=
true
;
private
_sortBy
=
NOutlineItemCompareType
.
ByKind
;
private
_sortBy
=
OutlineSortOrder
.
ByKind
;
private
_onDidChange
=
new
Emitter
<
{
followCursor
?:
boolean
,
sortBy
?:
boolean
,
filterOnType
?:
boolean
}
>
();
readonly
onDidChange
=
this
.
_onDidChange
.
event
;
...
...
@@ -186,14 +186,14 @@ class OutlineViewState {
}
}
set
sortBy
(
value
:
NOutlineItemCompareType
)
{
set
sortBy
(
value
:
OutlineSortOrder
)
{
if
(
value
!==
this
.
_sortBy
)
{
this
.
_sortBy
=
value
;
this
.
_onDidChange
.
fire
({
sortBy
:
true
});
}
}
get
sortBy
():
NOutlineItemCompareType
{
get
sortBy
():
OutlineSortOrder
{
return
this
.
_sortBy
;
}
...
...
@@ -229,10 +229,10 @@ export class OutlinePanel extends ViewletPanel {
private
_message
:
HTMLDivElement
;
private
_inputContainer
:
HTMLDivElement
;
private
_progressBar
:
ProgressBar
;
private
_tree
:
WorkbenchDataTree
<
OutlineModel
,
N
OutlineItem
,
FuzzyScore
>
;
private
_treeDataSource
:
N
OutlineDataSource
;
private
_treeRenderer
:
N
OutlineElementRenderer
;
private
_treeComparator
:
N
OutlineItemComparator
;
private
_tree
:
WorkbenchDataTree
<
OutlineModel
,
OutlineItem
,
FuzzyScore
>
;
private
_treeDataSource
:
OutlineDataSource
;
private
_treeRenderer
:
OutlineElementRenderer
;
private
_treeComparator
:
OutlineItemComparator
;
private
_treeStates
=
new
LRUCache
<
string
,
IDataTreeViewState
>
(
10
);
private
_treeFakeUIEvent
=
new
UIEvent
(
'
me
'
);
...
...
@@ -298,23 +298,23 @@ export class OutlinePanel extends ViewletPanel {
progressContainer
,
this
.
_message
,
this
.
_inputContainer
,
treeContainer
);
this
.
_treeRenderer
=
this
.
_instantiationService
.
createInstance
(
N
OutlineElementRenderer
);
this
.
_treeDataSource
=
new
N
OutlineDataSource
();
this
.
_treeComparator
=
new
N
OutlineItemComparator
(
this
.
_outlineViewState
.
sortBy
);
this
.
_treeRenderer
=
this
.
_instantiationService
.
createInstance
(
OutlineElementRenderer
);
this
.
_treeDataSource
=
new
OutlineDataSource
();
this
.
_treeComparator
=
new
OutlineItemComparator
(
this
.
_outlineViewState
.
sortBy
);
this
.
_tree
=
this
.
_instantiationService
.
createInstance
(
WorkbenchDataTree
,
treeContainer
,
new
N
OutlineVirtualDelegate
(),
[
new
N
OutlineGroupRenderer
(),
this
.
_treeRenderer
],
new
OutlineVirtualDelegate
(),
[
new
OutlineGroupRenderer
(),
this
.
_treeRenderer
],
this
.
_treeDataSource
,
{
expandOnlyOnTwistieClick
:
true
,
filterOnType
:
this
.
_outlineViewState
.
filterOnType
,
sorter
:
new
N
OutlineItemComparator
(),
identityProvider
:
new
N
OutlineIdentityProvider
(),
keyboardNavigationLabelProvider
:
this
.
_instantiationService
.
createInstance
(
N
OutlineNavigationLabelProvider
)
sorter
:
new
OutlineItemComparator
(),
identityProvider
:
new
OutlineIdentityProvider
(),
keyboardNavigationLabelProvider
:
this
.
_instantiationService
.
createInstance
(
OutlineNavigationLabelProvider
)
}
)
as
WorkbenchDataTree
<
OutlineModel
,
N
OutlineItem
,
FuzzyScore
>
;
)
as
WorkbenchDataTree
<
OutlineModel
,
OutlineItem
,
FuzzyScore
>
;
this
.
_treeRenderer
.
renderProblemColors
=
this
.
_configurationService
.
getValue
(
OutlineConfigKeys
.
problemsColors
);
this
.
_treeRenderer
.
renderProblemBadges
=
this
.
_configurationService
.
getValue
(
OutlineConfigKeys
.
problemsBadges
);
...
...
@@ -356,9 +356,9 @@ export class OutlinePanel extends ViewletPanel {
getSecondaryActions
():
IAction
[]
{
let
group
=
new
RadioGroup
([
new
SimpleToggleAction
(
localize
(
'
sortByPosition
'
,
"
Sort By: Position
"
),
this
.
_outlineViewState
.
sortBy
===
NOutlineItemCompareType
.
ByPosition
,
_
=>
this
.
_outlineViewState
.
sortBy
=
NOutlineItemCompareType
.
ByPosition
),
new
SimpleToggleAction
(
localize
(
'
sortByName
'
,
"
Sort By: Name
"
),
this
.
_outlineViewState
.
sortBy
===
NOutlineItemCompareType
.
ByName
,
_
=>
this
.
_outlineViewState
.
sortBy
=
NOutlineItemCompareType
.
ByName
),
new
SimpleToggleAction
(
localize
(
'
sortByKind
'
,
"
Sort By: Type
"
),
this
.
_outlineViewState
.
sortBy
===
NOutlineItemCompareType
.
ByKind
,
_
=>
this
.
_outlineViewState
.
sortBy
=
NOutlineItemCompareType
.
ByKind
),
new
SimpleToggleAction
(
localize
(
'
sortByPosition
'
,
"
Sort By: Position
"
),
this
.
_outlineViewState
.
sortBy
===
OutlineSortOrder
.
ByPosition
,
_
=>
this
.
_outlineViewState
.
sortBy
=
OutlineSortOrder
.
ByPosition
),
new
SimpleToggleAction
(
localize
(
'
sortByName
'
,
"
Sort By: Name
"
),
this
.
_outlineViewState
.
sortBy
===
OutlineSortOrder
.
ByName
,
_
=>
this
.
_outlineViewState
.
sortBy
=
OutlineSortOrder
.
ByName
),
new
SimpleToggleAction
(
localize
(
'
sortByKind
'
,
"
Sort By: Type
"
),
this
.
_outlineViewState
.
sortBy
===
OutlineSortOrder
.
ByKind
,
_
=>
this
.
_outlineViewState
.
sortBy
=
OutlineSortOrder
.
ByKind
),
]);
let
result
=
[
new
SimpleToggleAction
(
localize
(
'
followCur
'
,
"
Follow Cursor
"
),
this
.
_outlineViewState
.
followCursor
,
action
=>
this
.
_outlineViewState
.
followCursor
=
action
.
checked
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录