Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
33475542
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,发现更多精彩内容 >>
提交
33475542
编写于
12月 19, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
labels - adopt for markers panel
上级
2d892bd5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
64 addition
and
25 deletion
+64
-25
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+53
-2
src/vs/workbench/parts/markers/electron-browser/markersPanel.ts
.../workbench/parts/markers/electron-browser/markersPanel.ts
+5
-3
src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts
...bench/parts/markers/electron-browser/markersTreeViewer.ts
+6
-20
未找到文件。
src/vs/workbench/browser/labels.ts
浏览文件 @
33475542
...
...
@@ -28,7 +28,21 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
export
interface
IResourceLabelHandle
extends
IDisposable
{
readonly
element
:
HTMLElement
;
/**
* Most basic method to apply a label.
*/
setLabel
(
label
:
IResourceLabel
,
options
?:
IResourceLabelOptions
):
void
;
/**
* Convinient method to apply a label by passing an editor along.
*/
setEditor
(
editor
:
IEditorInput
,
options
?:
IResourceLabelOptions
):
void
;
/**
* Convinient method to render a file label based on a resource.
*/
setFile
(
resource
:
uri
,
options
?:
IFileLabelOptions
):
void
;
clear
():
void
;
onClick
(
callback
:
(
event
:
MouseEvent
)
=>
void
):
IDisposable
;
...
...
@@ -88,6 +102,8 @@ export class ResourceLabels extends Disposable {
const
label
:
IResourceLabelHandle
=
{
element
:
widget
.
element
,
setLabel
:
(
label
:
IResourceLabel
,
options
?:
IResourceLabelOptions
)
=>
widget
.
setLabel
(
label
,
options
),
setEditor
:
(
editor
:
IEditorInput
,
options
?:
IResourceLabelOptions
)
=>
widget
.
setEditor
(
editor
,
options
),
setFile
:
(
resource
:
uri
,
options
?:
IFileLabelOptions
)
=>
widget
.
setFile
(
resource
,
options
),
clear
:
()
=>
widget
.
clear
(),
onClick
:
(
callback
:
(
event
:
MouseEvent
)
=>
void
)
=>
widget
.
onClick
(
callback
),
dispose
:
()
=>
this
.
disposeWidget
(
widget
)
...
...
@@ -163,8 +179,10 @@ class ResourceLabelWidget extends IconLabel {
options
:
IIconLabelCreationOptions
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
@
IDecorationsService
protected
decorationsService
:
IDecorationsService
,
@
ILabelService
protected
labelService
:
ILabelService
@
IDecorationsService
private
decorationsService
:
IDecorationsService
,
@
ILabelService
private
labelService
:
ILabelService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
)
{
super
(
container
,
options
);
}
...
...
@@ -250,6 +268,39 @@ class ResourceLabelWidget extends IconLabel {
return
true
;
}
setEditor
(
editor
:
IEditorInput
,
options
?:
IResourceLabelOptions
):
void
{
this
.
setLabel
({
resource
:
toResource
(
editor
,
{
supportSideBySide
:
true
}),
name
:
editor
.
getName
(),
description
:
editor
.
getDescription
()
},
options
);
}
setFile
(
resource
:
uri
,
options
?:
IFileLabelOptions
):
void
{
const
hideLabel
=
options
&&
options
.
hideLabel
;
let
name
:
string
;
if
(
!
hideLabel
)
{
if
(
options
&&
options
.
fileKind
===
FileKind
.
ROOT_FOLDER
)
{
const
workspaceFolder
=
this
.
contextService
.
getWorkspaceFolder
(
resource
);
if
(
workspaceFolder
)
{
name
=
workspaceFolder
.
name
;
}
}
if
(
!
name
)
{
name
=
resources
.
basenameOrAuthority
(
resource
);
}
}
let
description
:
string
;
const
hidePath
=
(
options
&&
options
.
hidePath
)
||
(
resource
.
scheme
===
Schemas
.
untitled
&&
!
this
.
untitledEditorService
.
hasAssociatedFilePath
(
resource
));
if
(
!
hidePath
)
{
description
=
this
.
labelService
.
getUriLabel
(
resources
.
dirname
(
resource
),
{
relative
:
true
});
}
this
.
setLabel
({
resource
,
name
,
description
},
options
);
}
clear
():
void
{
this
.
label
=
void
0
;
this
.
options
=
void
0
;
...
...
src/vs/workbench/parts/markers/electron-browser/markersPanel.ts
浏览文件 @
33475542
...
...
@@ -33,7 +33,7 @@ import { IExpression, getEmptyExpression } from 'vs/base/common/glob';
import
{
mixin
,
deepClone
}
from
'
vs/base/common/objects
'
;
import
{
IWorkspaceFolder
,
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
isAbsolute
,
join
}
from
'
vs/base/common/paths
'
;
import
{
FilterData
,
Fil
eResourceMarkersRenderer
,
Fil
ter
,
VirtualDelegate
,
ResourceMarkersRenderer
,
MarkerRenderer
,
RelatedInformationRenderer
,
TreeElement
,
MarkersTreeAccessibilityProvider
,
MarkersViewState
}
from
'
vs/workbench/parts/markers/electron-browser/markersTreeViewer
'
;
import
{
FilterData
,
Filter
,
VirtualDelegate
,
ResourceMarkersRenderer
,
MarkerRenderer
,
RelatedInformationRenderer
,
TreeElement
,
MarkersTreeAccessibilityProvider
,
MarkersViewState
}
from
'
vs/workbench/parts/markers/electron-browser/markersTreeViewer
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
Separator
,
ActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IMenuService
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -42,6 +42,7 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ResourceLabels
}
from
'
vs/workbench/browser/labels
'
;
function
createModelIterator
(
model
:
MarkersModel
):
Iterator
<
ITreeElement
<
TreeElement
>>
{
const
resourcesIt
=
Iterator
.
fromArray
(
model
.
resourceMarkers
);
...
...
@@ -287,10 +288,11 @@ export class MarkersPanel extends Panel implements IMarkerFilterController {
const
onDidChangeRenderNodeCount
=
new
Relay
<
ITreeNode
<
any
,
any
>>
();
const
labels
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
ResourceLabels
));
const
virtualDelegate
=
new
VirtualDelegate
(
this
.
markersViewState
);
const
renderers
=
[
this
.
instantiationService
.
createInstance
(
FileResourceMarkersRenderer
,
onDidChangeRenderNodeCount
.
event
),
this
.
instantiationService
.
createInstance
(
ResourceMarkersRenderer
,
onDidChangeRenderNodeCount
.
event
),
this
.
instantiationService
.
createInstance
(
ResourceMarkersRenderer
,
labels
,
onDidChangeRenderNodeCount
.
event
),
this
.
instantiationService
.
createInstance
(
MarkerRenderer
,
this
.
markersViewState
,
a
=>
this
.
getActionItem
(
a
)),
this
.
instantiationService
.
createInstance
(
RelatedInformationRenderer
)
];
...
...
src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts
浏览文件 @
33475542
...
...
@@ -7,7 +7,7 @@ import * as dom from 'vs/base/browser/dom';
import
*
as
network
from
'
vs/base/common/network
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
{
CountBadge
}
from
'
vs/base/browser/ui/countBadge/countBadge
'
;
import
{
FileLabel
,
ResourceLabel
}
from
'
vs/workbench/browser/labels
'
;
import
{
ResourceLabels
,
IResourceLabelHandle
}
from
'
vs/workbench/browser/labels
'
;
import
{
HighlightedLabel
}
from
'
vs/base/browser/ui/highlightedlabel/highlightedLabel
'
;
import
{
IMarker
,
MarkerSeverity
}
from
'
vs/platform/markers/common/markers
'
;
import
{
ResourceMarkers
,
Marker
,
RelatedInformation
}
from
'
vs/workbench/parts/markers/electron-browser/markersModel
'
;
...
...
@@ -34,7 +34,7 @@ import { localize } from 'vs/nls';
export
type
TreeElement
=
ResourceMarkers
|
Marker
|
RelatedInformation
;
interface
IResourceMarkersTemplateData
{
resourceLabel
:
ResourceLabel
;
resourceLabel
:
IResourceLabelHandle
;
count
:
CountBadge
;
styler
:
IDisposable
;
}
...
...
@@ -69,7 +69,6 @@ export class MarkersTreeAccessibilityProvider implements IAccessibilityProvider<
}
const
enum
TemplateId
{
FileResourceMarkers
=
'
frm
'
,
ResourceMarkers
=
'
rm
'
,
Marker
=
'
m
'
,
RelatedInformation
=
'
ri
'
...
...
@@ -90,11 +89,7 @@ export class VirtualDelegate implements IListVirtualDelegate<TreeElement> {
getTemplateId
(
element
:
TreeElement
):
string
{
if
(
element
instanceof
ResourceMarkers
)
{
if
((
element
).
resource
.
scheme
===
network
.
Schemas
.
file
||
(
<
ResourceMarkers
>
element
).
resource
.
scheme
===
network
.
Schemas
.
untitled
)
{
return
TemplateId
.
FileResourceMarkers
;
}
else
{
return
TemplateId
.
ResourceMarkers
;
}
return
TemplateId
.
ResourceMarkers
;
}
else
if
(
element
instanceof
Marker
)
{
return
TemplateId
.
Marker
;
}
else
{
...
...
@@ -135,6 +130,7 @@ export class ResourceMarkersRenderer implements ITreeRenderer<ResourceMarkers, R
private
disposables
:
IDisposable
[]
=
[];
constructor
(
protected
labels
:
ResourceLabels
,
onDidChangeRenderNodeCount
:
Event
<
ITreeNode
<
ResourceMarkers
,
ResourceMarkersFilterData
>>
,
@
IInstantiationService
protected
instantiationService
:
IInstantiationService
,
@
IThemeService
private
themeService
:
IThemeService
,
...
...
@@ -149,7 +145,7 @@ export class ResourceMarkersRenderer implements ITreeRenderer<ResourceMarkers, R
const
data
=
<
IResourceMarkersTemplateData
>
Object
.
create
(
null
);
const
resourceLabelContainer
=
dom
.
append
(
container
,
dom
.
$
(
'
.resource-label-container
'
));
data
.
resourceLabel
=
this
.
createResourceLabel
(
resourceLabelContainer
);
data
.
resourceLabel
=
this
.
labels
.
create
(
resourceLabelContainer
,
{
supportHighlights
:
true
}
);
const
badgeWrapper
=
dom
.
append
(
container
,
dom
.
$
(
'
.count-badge-wrapper
'
));
data
.
count
=
new
CountBadge
(
badgeWrapper
);
...
...
@@ -162,7 +158,7 @@ export class ResourceMarkersRenderer implements ITreeRenderer<ResourceMarkers, R
const
resourceMarkers
=
node
.
element
;
const
uriMatches
=
node
.
filterData
&&
node
.
filterData
.
uriMatches
||
[];
if
(
templateData
.
resourceLabel
instanceof
FileLabel
)
{
if
(
resourceMarkers
.
resource
.
scheme
===
network
.
Schemas
.
file
||
resourceMarkers
.
resource
.
scheme
===
network
.
Schemas
.
untitled
)
{
templateData
.
resourceLabel
.
setFile
(
resourceMarkers
.
resource
,
{
matches
:
uriMatches
});
}
else
{
templateData
.
resourceLabel
.
setLabel
({
name
:
resourceMarkers
.
name
,
description
:
this
.
labelService
.
getUriLabel
(
dirname
(
resourceMarkers
.
resource
),
{
relative
:
true
}),
resource
:
resourceMarkers
.
resource
},
{
matches
:
uriMatches
});
...
...
@@ -181,10 +177,6 @@ export class ResourceMarkersRenderer implements ITreeRenderer<ResourceMarkers, R
templateData
.
styler
.
dispose
();
}
protected
createResourceLabel
(
container
:
HTMLElement
):
ResourceLabel
{
return
this
.
instantiationService
.
createInstance
(
ResourceLabel
,
container
,
{
supportHighlights
:
true
});
}
private
onDidChangeRenderNodeCount
(
node
:
ITreeNode
<
ResourceMarkers
,
ResourceMarkersFilterData
>
):
void
{
const
templateData
=
this
.
renderedNodes
.
get
(
node
);
...
...
@@ -205,12 +197,6 @@ export class ResourceMarkersRenderer implements ITreeRenderer<ResourceMarkers, R
}
export
class
FileResourceMarkersRenderer
extends
ResourceMarkersRenderer
{
templateId
=
TemplateId
.
FileResourceMarkers
;
protected
createResourceLabel
(
container
:
HTMLElement
):
ResourceLabel
{
return
this
.
instantiationService
.
createInstance
(
FileLabel
,
container
,
{
supportHighlights
:
true
});
}
}
export
class
MarkerRenderer
implements
ITreeRenderer
<
Marker
,
MarkerFilterData
,
IMarkerTemplateData
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录