Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5f48c695
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,发现更多精彩内容 >>
提交
5f48c695
编写于
3月 20, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
callh - show anchor as root node in tree, don't show badges, show current call path as meta title
上级
5f09de6e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
59 addition
and
71 deletion
+59
-71
src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts
...ntrib/callHierarchy/browser/callHierarchy.contribution.ts
+0
-2
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
...kbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
+40
-25
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.ts
...kbench/contrib/callHierarchy/browser/callHierarchyTree.ts
+19
-30
src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css
...nch/contrib/callHierarchy/browser/media/callHierarchy.css
+0
-14
未找到文件。
src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts
浏览文件 @
5f48c695
...
...
@@ -19,7 +19,6 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
PeekContext
}
from
'
vs/editor/contrib/referenceSearch/peekViewWidget
'
;
const
_ctxHasCompletionItemProvider
=
new
RawContextKey
<
boolean
>
(
'
editorHasCallHierarchyProvider
'
,
false
);
const
_ctxCallHierarchyVisible
=
new
RawContextKey
<
boolean
>
(
'
callHierarchyVisible
'
,
false
);
...
...
@@ -102,7 +101,6 @@ class CallHierarchyController extends Disposable implements IEditorContribution
widget
.
showMessage
(
localize
(
'
no.item
'
,
"
No results
"
));
return
;
}
widget
.
showItem
(
item
);
});
}
...
...
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
浏览文件 @
5f48c695
...
...
@@ -7,7 +7,7 @@ import 'vs/css!./media/callHierarchy';
import
{
PeekViewWidget
}
from
'
vs/editor/contrib/referenceSearch/peekViewWidget
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CallHierarchy
Item
,
CallHierarchyProvider
,
CallHierarchyDirection
}
from
'
vs/workbench/contrib/callHierarchy/common/callHierarchy
'
;
import
{
CallHierarchy
Provider
,
CallHierarchyDirection
,
CallHierarchyItem
}
from
'
vs/workbench/contrib/callHierarchy/common/callHierarchy
'
;
import
{
WorkbenchAsyncDataTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
FuzzyScore
}
from
'
vs/base/common/filters
'
;
import
*
as
callHTree
from
'
vs/workbench/contrib/callHierarchy/browser/callHierarchyTree
'
;
...
...
@@ -262,6 +262,22 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
localDispose
.
push
({
dispose
:
()
=>
this
.
_editor
.
deltaDecorations
(
ids
,
[])
});
localDispose
.
push
(
value
);
});
let
node
:
callHTree
.
Call
|
CallHierarchyItem
=
element
;
let
names
=
[
element
.
item
.
name
];
while
(
true
)
{
let
parent
=
this
.
_tree
.
getParentElement
(
node
);
if
(
!
(
parent
instanceof
callHTree
.
Call
))
{
break
;
}
if
(
this
.
_direction
===
CallHierarchyDirection
.
CallsTo
)
{
names
.
push
(
parent
.
item
.
name
);
}
else
{
names
.
unshift
(
parent
.
item
.
name
);
}
node
=
parent
;
}
this
.
setMetaTitle
(
localize
(
'
meta
'
,
"
– {0}
"
,
names
.
join
(
'
→
'
)));
}
},
undefined
,
this
.
_disposables
);
...
...
@@ -295,14 +311,14 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
this
.
_tree
.
onDidChangeSelection
(
e
=>
{
const
[
element
]
=
e
.
elements
;
// don't close on click
if
(
element
&&
!
(
e
.
browserEvent
instanceof
MouseEvent
))
{
if
(
element
&&
isNonEmptyArray
(
element
.
locations
)
&&
!
(
e
.
browserEvent
instanceof
MouseEvent
))
{
this
.
dispose
();
this
.
_editorService
.
openEditor
({
resource
:
element
.
item
.
uri
,
options
:
{
selection
:
element
.
locations
[
0
].
range
}
});
}
});
}
,
undefined
,
this
.
_disposables
);
}
showLoading
():
void
{
...
...
@@ -319,30 +335,29 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
this
.
_show
();
}
showItem
(
item
:
CallHierarchyItem
)
{
this
.
_parent
.
dataset
[
'
state
'
]
=
State
.
Data
;
async
showItem
(
item
:
CallHierarchyItem
):
Promise
<
void
>
{
this
.
_show
();
this
.
_tree
.
setInput
(
item
).
then
(()
=>
{
if
(
!
this
.
_tree
.
getFirstElementChild
(
item
))
{
//
this
.
showMessage
(
this
.
_direction
===
CallHierarchyDirection
.
CallsFrom
?
localize
(
'
empt.callsFrom
'
,
"
No calls from '{0}'
"
,
item
.
name
)
:
localize
(
'
empt.callsTo
'
,
"
No calls to '{0}'
"
,
item
.
name
));
}
else
{
this
.
_tree
.
domFocus
(
);
this
.
_tree
.
focusFirst
();
this
.
setTitle
(
item
.
name
,
item
.
detail
||
this
.
_labelService
.
getUriLabel
(
item
.
uri
,
{
relative
:
true
}),
);
this
.
setMetaTitle
(
this
.
_direction
===
CallHierarchyDirection
.
CallsFrom
?
localize
(
'
title.from
'
,
"
– calls from '{0}'
"
,
item
.
name
)
:
localize
(
'
title.to
'
,
"
– calls to '{0}'
"
,
item
.
name
));
}
}
);
await
this
.
_tree
.
setInput
(
item
);
const
[
root
]
=
this
.
_tree
.
getNode
(
item
).
children
;
await
this
.
_tree
.
expand
(
root
.
element
as
callHTree
.
Call
);
const
firstChild
=
this
.
_tree
.
getFirstElementChild
(
root
.
element
);
if
(
!
(
firstChild
instanceof
callHTree
.
Call
))
{
//
this
.
showMessage
(
this
.
_direction
===
CallHierarchyDirection
.
CallsFrom
?
localize
(
'
empt.callsFrom
'
,
"
No calls from '{0}'
"
,
item
.
name
)
:
localize
(
'
empt.callsTo
'
,
"
No calls to '{0}'
"
,
item
.
name
)
);
}
else
{
this
.
_parent
.
dataset
[
'
state
'
]
=
State
.
Data
;
this
.
_tree
.
domFocus
();
this
.
_tree
.
setFocus
([
firstChild
]
);
this
.
setTitle
(
item
.
name
,
item
.
detail
||
this
.
_labelService
.
getUriLabel
(
item
.
uri
,
{
relative
:
true
}),
);
}
if
(
!
this
.
_toggleDirection
)
{
this
.
_toggleDirection
=
new
ToggleHierarchyDirectionAction
(
...
...
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.ts
浏览文件 @
5f48c695
...
...
@@ -11,16 +11,10 @@ import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import
{
IconLabel
}
from
'
vs/base/browser/ui/iconLabel/iconLabel
'
;
import
{
symbolKindToCssClass
,
Location
}
from
'
vs/editor/common/modes
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
CountBadge
}
from
'
vs/base/browser/ui/countBadge/countBadge
'
;
import
{
$
,
append
}
from
'
vs/base/browser/dom
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
attachBadgeStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
export
class
Call
{
constructor
(
readonly
direction
:
CallHierarchyDirection
,
readonly
item
:
CallHierarchyItem
,
readonly
locations
:
Location
[]
)
{
}
...
...
@@ -30,22 +24,29 @@ export class SingleDirectionDataSource implements IAsyncDataSource<CallHierarchy
constructor
(
public
provider
:
CallHierarchyProvider
,
public
d
irection
:
()
=>
CallHierarchyDirection
public
getD
irection
:
()
=>
CallHierarchyDirection
)
{
}
hasChildren
(
_element
:
CallHierarchyItem
):
boolean
{
hasChildren
():
boolean
{
return
true
;
}
async
getChildren
(
element
:
CallHierarchyItem
|
Call
):
Promise
<
Call
[]
>
{
if
(
element
instanceof
Call
)
{
element
=
element
.
item
;
try
{
const
direction
=
this
.
getDirection
();
const
calls
=
await
this
.
provider
.
resolveCallHierarchyItem
(
element
.
item
,
direction
,
CancellationToken
.
None
);
if
(
!
calls
)
{
return
[];
}
return
calls
.
map
(([
item
,
locations
])
=>
new
Call
(
item
,
locations
));
}
catch
{
return
[];
}
}
else
{
// 'root'
return
[
new
Call
(
element
,
[{
uri
:
element
.
uri
,
range
:
Range
.
lift
(
element
.
range
).
collapseToStart
()
}])];
}
const
direction
=
this
.
direction
();
const
calls
=
await
this
.
provider
.
resolveCallHierarchyItem
(
element
,
direction
,
CancellationToken
.
None
);
return
calls
?
calls
.
map
(([
item
,
locations
])
=>
new
Call
(
direction
,
item
,
locations
))
:
[];
}
}
...
...
@@ -56,9 +57,7 @@ export class IdentityProvider implements IIdentityProvider<Call> {
}
class
CallRenderingTemplate
{
readonly
disposable
:
IDisposable
[];
readonly
iconLabel
:
IconLabel
;
readonly
badge
:
CountBadge
;
}
export
class
CallRenderer
implements
ITreeRenderer
<
Call
,
FuzzyScore
,
CallRenderingTemplate
>
{
...
...
@@ -69,15 +68,11 @@ export class CallRenderer implements ITreeRenderer<Call, FuzzyScore, CallRenderi
constructor
(
@
ILabelService
private
readonly
_labelService
:
ILabelService
,
@
IThemeService
private
readonly
_themeService
:
IThemeService
,
)
{
}
renderTemplate
(
parent
:
HTMLElement
):
CallRenderingTemplate
{
const
container
=
append
(
parent
,
$
(
'
.call
'
));
renderTemplate
(
container
:
HTMLElement
):
CallRenderingTemplate
{
const
iconLabel
=
new
IconLabel
(
container
,
{
supportHighlights
:
true
});
const
badge
=
new
CountBadge
(
append
(
container
,
$
(
'
.count
'
)));
const
listener
=
attachBadgeStyler
(
badge
,
this
.
_themeService
);
return
{
iconLabel
,
badge
,
disposable
:
[
iconLabel
,
listener
]
};
return
{
iconLabel
};
}
renderElement
(
node
:
ITreeNode
<
Call
,
FuzzyScore
>
,
_index
:
number
,
template
:
CallRenderingTemplate
):
void
{
...
...
@@ -93,15 +88,9 @@ export class CallRenderer implements ITreeRenderer<Call, FuzzyScore, CallRenderi
extraClasses
:
[
symbolKindToCssClass
(
element
.
item
.
kind
,
true
)]
}
);
template
.
badge
.
setCount
(
element
.
locations
.
length
);
template
.
badge
.
setTitleFormat
(
element
.
direction
===
CallHierarchyDirection
.
CallsTo
?
localize
(
'
count.to
'
,
"
{0} calls to
"
)
:
localize
(
'
count.from
'
,
"
{0} calls from
"
));
}
disposeTemplate
(
template
:
CallRenderingTemplate
):
void
{
dispose
(
template
.
disposable
);
template
.
iconLabel
.
dispose
(
);
}
}
...
...
src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css
浏览文件 @
5f48c695
...
...
@@ -37,17 +37,3 @@
.monaco-workbench
.call-hierarchy
.tree
{
height
:
100%
;
}
.monaco-workbench
.call-hierarchy
.call
{
display
:
flex
;
}
.monaco-workbench
.call-hierarchy
.call
.count
{
margin-right
:
12px
;
margin-left
:
auto
;
display
:
none
;
}
.monaco-workbench
.call-hierarchy
.monaco-list-row.focused
.call
.count
{
display
:
unset
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录