Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6a065f46
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,发现更多精彩内容 >>
提交
6a065f46
编写于
3月 18, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove column view idea
上级
abae211a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
2 addition
and
372 deletion
+2
-372
src/vs/base/browser/ui/splitview/splitview.ts
src/vs/base/browser/ui/splitview/splitview.ts
+0
-4
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyList.ts
...kbench/contrib/callHierarchy/browser/callHierarchyList.ts
+0
-252
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
...kbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
+2
-116
未找到文件。
src/vs/base/browser/ui/splitview/splitview.ts
浏览文件 @
6a065f46
...
@@ -117,10 +117,6 @@ export class SplitView extends Disposable {
...
@@ -117,10 +117,6 @@ export class SplitView extends Disposable {
private
_onDidSashReset
=
this
.
_register
(
new
Emitter
<
number
>
());
private
_onDidSashReset
=
this
.
_register
(
new
Emitter
<
number
>
());
readonly
onDidSashReset
=
this
.
_onDidSashReset
.
event
;
readonly
onDidSashReset
=
this
.
_onDidSashReset
.
event
;
get
items
():
ReadonlyArray
<
IView
>
{
return
this
.
viewItems
.
map
(
item
=>
item
.
view
);
}
get
length
():
number
{
get
length
():
number
{
return
this
.
viewItems
.
length
;
return
this
.
viewItems
.
length
;
}
}
...
...
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyList.ts
已删除
100644 → 0
浏览文件 @
abae211a
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CallHierarchyProvider
,
CallHierarchyDirection
}
from
'
vs/workbench/contrib/callHierarchy/common/callHierarchy
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
*
as
callHierarchyTree
from
'
vs/workbench/contrib/callHierarchy/browser/callHierarchyTree
'
;
import
{
Location
,
symbolKindToCssClass
}
from
'
vs/editor/common/modes
'
;
import
{
IListVirtualDelegate
,
IListRenderer
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
IconLabel
}
from
'
vs/base/browser/ui/iconLabel/iconLabel
'
;
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IView
,
Orientation
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
Dimension
,
addClass
}
from
'
vs/base/browser/dom
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
EmbeddedCodeEditorWidget
}
from
'
vs/editor/browser/widget/embeddedCodeEditorWidget
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
export
type
ListElement
=
callHierarchyTree
.
Call
|
Location
;
class
LocationTemplate
{
label
:
IconLabel
;
}
export
class
LocationRenderer
implements
IListRenderer
<
Location
,
LocationTemplate
>
{
static
id
=
'
LocationRenderer
'
;
templateId
:
string
=
LocationRenderer
.
id
;
constructor
(
@
ITextModelService
private
readonly
_textModelService
:
ITextModelService
,
)
{
}
renderTemplate
(
container
:
HTMLElement
):
LocationTemplate
{
const
label
=
new
IconLabel
(
container
,
{
supportHighlights
:
true
});
return
{
label
};
}
renderElement
(
element
:
Location
,
_index
:
number
,
template
:
LocationTemplate
):
void
{
this
.
_textModelService
.
createModelReference
(
element
.
uri
).
then
(
reference
=>
{
const
model
=
reference
.
object
.
textEditorModel
;
const
text
=
model
.
getLineContent
(
element
.
range
.
startLineNumber
);
const
indent
=
model
.
getLineFirstNonWhitespaceColumn
(
element
.
range
.
startLineNumber
)
-
1
;
const
prefix
=
String
(
element
.
range
.
startLineNumber
);
const
shift
=
(
1
+
indent
/*left*/
)
-
(
prefix
.
length
+
2
/*right*/
);
template
.
label
.
setLabel
(
`
${
prefix
}
:
${
text
.
substr
(
indent
)}
`
,
undefined
,
{
matches
:
[{
start
:
element
.
range
.
startColumn
-
shift
,
end
:
element
.
range
.
endColumn
-
shift
}],
extraClasses
:
[
'
location
'
]
});
reference
.
dispose
();
});
}
disposeTemplate
(
template
:
LocationTemplate
):
void
{
template
.
label
.
dispose
();
}
}
class
CallRenderingTemplate
{
iconLabel
:
IconLabel
;
}
export
class
CallRenderer
implements
IListRenderer
<
callHierarchyTree
.
Call
,
CallRenderingTemplate
>
{
static
id
=
'
CallRenderer
'
;
templateId
:
string
=
CallRenderer
.
id
;
renderTemplate
(
container
:
HTMLElement
):
CallRenderingTemplate
{
const
iconLabel
=
new
IconLabel
(
container
,
{
supportHighlights
:
true
});
return
{
iconLabel
};
}
renderElement
(
element
:
callHierarchyTree
.
Call
,
_index
:
number
,
template
:
CallRenderingTemplate
):
void
{
template
.
iconLabel
.
setLabel
(
element
.
item
.
name
,
element
.
item
.
detail
,
{
labelEscapeNewLines
:
true
,
extraClasses
:
[
'
call
'
,
symbolKindToCssClass
(
element
.
item
.
kind
,
true
)]
}
);
}
disposeTemplate
(
template
:
CallRenderingTemplate
):
void
{
template
.
iconLabel
.
dispose
();
}
}
export
class
Delegate
implements
IListVirtualDelegate
<
ListElement
>
{
getHeight
(
element
:
ListElement
):
number
{
return
23
;
}
getTemplateId
(
element
:
ListElement
):
string
{
if
(
element
instanceof
callHierarchyTree
.
Call
)
{
return
CallRenderer
.
id
;
}
else
{
return
LocationRenderer
.
id
;
}
}
}
export
class
CallColumn
extends
Disposable
implements
IView
{
private
_list
:
WorkbenchList
<
ListElement
>
;
private
_token
:
CancellationTokenSource
;
readonly
element
:
HTMLElement
=
document
.
createElement
(
'
div
'
);
readonly
minimumSize
:
number
=
100
;
readonly
maximumSize
:
number
=
Number
.
MAX_VALUE
;
private
readonly
_onDidChange
=
new
Emitter
<
number
|
undefined
>
();
readonly
onDidChange
:
Event
<
number
|
undefined
>
=
this
.
_onDidChange
.
event
;
private
readonly
_fakeEvent
=
new
UIEvent
(
'
fake
'
);
constructor
(
readonly
index
:
number
,
readonly
root
:
callHierarchyTree
.
Call
,
private
readonly
_provider
:
CallHierarchyProvider
,
private
readonly
_direction
:
CallHierarchyDirection
,
private
readonly
_emitter
:
Emitter
<
{
column
:
CallColumn
,
element
:
ListElement
,
focus
:
boolean
}
>
,
private
readonly
_getDim
:
()
=>
Dimension
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
)
{
super
();
addClass
(
this
.
element
,
'
column
'
);
this
.
_list
=
this
.
_register
(
<
WorkbenchList
<
ListElement
>>
this
.
_instantiationService
.
createInstance
(
WorkbenchList
,
this
.
element
,
new
Delegate
(),
[
new
CallRenderer
(),
this
.
_instantiationService
.
createInstance
(
LocationRenderer
)
],
{}
));
this
.
_register
(
this
.
_list
.
onFocusChange
(
e
=>
{
if
(
e
.
browserEvent
!==
this
.
_fakeEvent
&&
e
.
elements
.
length
===
1
)
{
this
.
_emitter
.
fire
({
column
:
this
,
element
:
e
.
elements
[
0
],
focus
:
true
});
}
}));
this
.
_register
(
this
.
_list
.
onSelectionChange
(
e
=>
{
if
(
e
.
browserEvent
!==
this
.
_fakeEvent
&&
e
.
elements
.
length
===
1
)
{
this
.
_emitter
.
fire
({
column
:
this
,
element
:
e
.
elements
[
0
],
focus
:
false
});
}
}));
this
.
_token
=
this
.
_register
(
new
CancellationTokenSource
());
Promise
.
resolve
(
this
.
_provider
.
resolveCallHierarchyItem
(
this
.
root
.
item
,
this
.
_direction
,
this
.
_token
.
token
)).
then
(
calls
=>
{
if
(
calls
&&
calls
.
length
>
0
)
{
const
input
:
ListElement
[]
=
[];
for
(
const
[
item
,
locations
]
of
calls
)
{
input
.
push
(
new
callHierarchyTree
.
Call
(
this
.
_direction
,
item
,
locations
));
input
.
push
(...
locations
);
}
this
.
_list
.
splice
(
0
,
this
.
_list
.
length
,
input
);
this
.
_list
.
focusFirst
(
this
.
_fakeEvent
);
this
.
_list
.
setSelection
([
0
],
this
.
_fakeEvent
);
}
else
{
// show message
}
}).
catch
(
err
=>
{
console
.
error
(
err
);
});
}
layout
(
size
:
number
,
orientation
:
Orientation
):
void
{
const
{
height
,
width
}
=
this
.
_getDim
();
this
.
_list
.
layout
(
height
,
Math
.
min
(
size
,
Math
.
ceil
(
width
/
6
)));
}
focus
():
void
{
this
.
_list
.
domFocus
();
}
}
export
class
LocationColumn
extends
Disposable
implements
IView
{
readonly
element
:
HTMLElement
=
document
.
createElement
(
'
div
'
);
readonly
minimumSize
:
number
=
100
;
readonly
maximumSize
:
number
=
Number
.
MAX_VALUE
;
private
readonly
_onDidChange
=
new
Emitter
<
number
|
undefined
>
();
readonly
onDidChange
:
Event
<
number
|
undefined
>
=
this
.
_onDidChange
.
event
;
private
_editor
:
EmbeddedCodeEditorWidget
;
constructor
(
private
_location
:
Location
,
private
readonly
_getDim
:
()
=>
Dimension
,
editor
:
ICodeEditor
,
@
ITextModelService
private
readonly
_textModelService
:
ITextModelService
,
)
{
super
();
addClass
(
this
.
element
,
'
column
'
);
// todo@joh pretty random selection of options
let
options
:
IEditorOptions
=
{
readOnly
:
true
,
scrollBeyondLastLine
:
false
,
lineNumbers
:
'
off
'
,
scrollbar
:
{
verticalScrollbarSize
:
14
,
horizontal
:
'
auto
'
,
useShadows
:
true
,
verticalHasArrows
:
false
,
horizontalHasArrows
:
false
},
overviewRulerLanes
:
2
,
fixedOverflowWidgets
:
true
,
minimap
:
{
enabled
:
false
},
codeLens
:
false
,
glyphMargin
:
false
,
};
this
.
_editor
=
editor
.
invokeWithinContext
(
accessor
=>
{
return
this
.
_register
(
accessor
.
get
(
IInstantiationService
).
createInstance
(
EmbeddedCodeEditorWidget
,
this
.
element
,
options
,
editor
));
});
this
.
_textModelService
.
createModelReference
(
this
.
_location
.
uri
).
then
(
reference
=>
{
this
.
_editor
.
setModel
(
reference
.
object
.
textEditorModel
);
this
.
_editor
.
revealRangeInCenter
(
this
.
_location
.
range
);
this
.
_editor
.
setSelection
(
this
.
_location
.
range
);
this
.
_register
(
reference
);
});
}
layout
(
size
:
number
)
{
this
.
_editor
.
layout
({
height
:
this
.
_getDim
().
height
,
width
:
size
});
}
focus
():
void
{
this
.
_editor
.
focus
();
}
}
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
浏览文件 @
6a065f46
...
@@ -11,14 +11,13 @@ import { CallHierarchyItem, CallHierarchyProvider, CallHierarchyDirection } from
...
@@ -11,14 +11,13 @@ import { CallHierarchyItem, CallHierarchyProvider, CallHierarchyDirection } from
import
{
WorkbenchAsyncDataTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
WorkbenchAsyncDataTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
FuzzyScore
}
from
'
vs/base/common/filters
'
;
import
{
FuzzyScore
}
from
'
vs/base/common/filters
'
;
import
*
as
callHTree
from
'
vs/workbench/contrib/callHierarchy/browser/callHierarchyTree
'
;
import
*
as
callHTree
from
'
vs/workbench/contrib/callHierarchy/browser/callHierarchyTree
'
;
import
*
as
callHList
from
'
vs/workbench/contrib/callHierarchy/browser/callHierarchyList
'
;
import
{
IAsyncDataTreeOptions
}
from
'
vs/base/browser/ui/tree/asyncDataTree
'
;
import
{
IAsyncDataTreeOptions
}
from
'
vs/base/browser/ui/tree/asyncDataTree
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
SplitView
,
Orientation
,
Sizing
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
SplitView
,
Orientation
,
Sizing
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
Dimension
,
addClass
}
from
'
vs/base/browser/dom
'
;
import
{
Dimension
,
addClass
}
from
'
vs/base/browser/dom
'
;
import
{
E
mitter
,
E
vent
}
from
'
vs/base/common/event
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
EmbeddedCodeEditorWidget
}
from
'
vs/editor/browser/widget/embeddedCodeEditorWidget
'
;
import
{
EmbeddedCodeEditorWidget
}
from
'
vs/editor/browser/widget/embeddedCodeEditorWidget
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
...
@@ -57,10 +56,10 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
...
@@ -57,10 +56,10 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
}
}
dispose
():
void
{
dispose
():
void
{
super
.
dispose
();
this
.
_splitView
.
dispose
();
this
.
_splitView
.
dispose
();
this
.
_tree
.
dispose
();
this
.
_tree
.
dispose
();
this
.
_editor
.
dispose
();
this
.
_editor
.
dispose
();
super
.
dispose
();
}
}
protected
_fillBody
(
container
:
HTMLElement
):
void
{
protected
_fillBody
(
container
:
HTMLElement
):
void
{
...
@@ -228,116 +227,3 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
...
@@ -228,116 +227,3 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
this
.
_splitView
.
layout
(
width
);
this
.
_splitView
.
layout
(
width
);
}
}
}
}
export
class
CallHierarchyColumnPeekWidget
extends
PeekViewWidget
{
private
readonly
_emitter
=
new
Emitter
<
{
column
:
callHList
.
CallColumn
,
element
:
callHList
.
ListElement
,
focus
:
boolean
}
>
();
private
_splitView
:
SplitView
;
private
_dim
:
Dimension
;
constructor
(
editor
:
ICodeEditor
,
private
readonly
_provider
:
CallHierarchyProvider
,
private
readonly
_direction
:
CallHierarchyDirection
,
private
readonly
_root
:
CallHierarchyItem
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
)
{
super
(
editor
,
{
showFrame
:
true
,
showArrow
:
true
,
isResizeable
:
true
,
isAccessible
:
true
});
this
.
create
();
}
dispose
():
void
{
super
.
dispose
();
this
.
_splitView
.
dispose
();
this
.
_emitter
.
dispose
();
}
protected
_fillBody
(
container
:
HTMLElement
):
void
{
addClass
(
container
,
'
call-hierarchy-columns
'
);
this
.
_splitView
=
new
SplitView
(
container
,
{
orientation
:
Orientation
.
HORIZONTAL
});
this
.
_emitter
.
event
(
e
=>
{
const
{
element
,
column
,
focus
}
=
e
;
// remove old
while
(
column
.
index
+
1
<
this
.
_splitView
.
length
)
{
this
.
_splitView
.
removeView
(
this
.
_splitView
.
length
-
1
);
}
const
getDim
=
()
=>
this
.
_dim
||
{
height
:
undefined
,
width
:
undefined
};
// add new
if
(
element
instanceof
callHTree
.
Call
)
{
let
newColumn
=
this
.
_instantiationService
.
createInstance
(
callHList
.
CallColumn
,
column
.
index
+
1
,
element
,
this
.
_provider
,
this
.
_direction
,
this
.
_emitter
,
getDim
);
this
.
_disposables
.
push
(
newColumn
);
this
.
_splitView
.
addView
(
newColumn
,
Sizing
.
Distribute
);
if
(
!
focus
)
{
setTimeout
(()
=>
newColumn
.
focus
());
}
let
parts
=
this
.
_splitView
.
items
.
map
(
column
=>
column
instanceof
callHList
.
CallColumn
?
column
.
root
.
item
.
name
:
undefined
).
filter
(
e
=>
Boolean
(
e
));
this
.
setTitle
(
localize
(
'
title
'
,
"
Call Hierarchy for '{0}'
"
,
parts
.
join
(
'
>
'
)));
}
else
{
if
(
!
focus
)
{
this
.
dispose
();
this
.
_editorService
.
openEditor
({
resource
:
element
.
uri
,
options
:
{
selection
:
element
.
range
}
});
}
else
{
let
newColumn
=
this
.
_instantiationService
.
createInstance
(
callHList
.
LocationColumn
,
element
,
getDim
,
this
.
editor
);
this
.
_disposables
.
push
(
newColumn
);
this
.
_splitView
.
addView
(
newColumn
,
Sizing
.
Distribute
);
}
}
});
}
show
(
where
:
IRange
)
{
this
.
editor
.
revealRangeInCenterIfOutsideViewport
(
where
,
ScrollType
.
Smooth
);
super
.
show
(
where
,
16
);
this
.
setTitle
(
localize
(
'
title
'
,
"
Call Hierarchy for '{0}'
"
,
this
.
_root
.
name
));
// add root items...
const
item
=
this
.
_instantiationService
.
createInstance
(
callHList
.
CallColumn
,
0
,
new
callHTree
.
Call
(
this
.
_direction
,
this
.
_root
,
[]),
this
.
_provider
,
this
.
_direction
,
this
.
_emitter
,
()
=>
this
.
_dim
||
{
height
:
undefined
,
width
:
undefined
}
);
this
.
_disposables
.
push
(
item
);
this
.
_splitView
.
addView
(
item
,
item
.
minimumSize
);
setTimeout
(()
=>
item
.
focus
());
}
protected
_onWidth
(
width
:
number
)
{
if
(
this
.
_dim
)
{
this
.
_doLayoutBody
(
this
.
_dim
.
height
,
width
);
}
}
protected
_doLayoutBody
(
height
:
number
,
width
:
number
):
void
{
super
.
_doLayoutBody
(
height
,
width
);
this
.
_dim
=
{
height
,
width
};
this
.
_splitView
.
layout
(
width
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录