Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
5d04ca2e
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5d04ca2e
编写于
12月 19, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
labels - adopt for open editors view
上级
33475542
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
31 deletion
+27
-31
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+16
-27
src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts
...nch/parts/files/electron-browser/views/openEditorsView.ts
+11
-4
未找到文件。
src/vs/workbench/browser/labels.ts
浏览文件 @
5d04ca2e
...
...
@@ -25,6 +25,22 @@ import { getIconClasses, getConfiguredLangId } from 'vs/editor/common/services/g
import
{
Disposable
,
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
interface
IResourceLabel
{
name
:
string
;
description
?:
string
;
resource
?:
uri
;
}
export
interface
IResourceLabelOptions
extends
IIconLabelValueOptions
{
fileKind
?:
FileKind
;
fileDecorations
?:
{
colors
:
boolean
,
badges
:
boolean
,
data
?:
IDecorationData
};
}
export
interface
IFileLabelOptions
extends
IResourceLabelOptions
{
hideLabel
?:
boolean
;
hidePath
?:
boolean
;
}
export
interface
IResourceLabelHandle
extends
IDisposable
{
readonly
element
:
HTMLElement
;
...
...
@@ -396,17 +412,6 @@ class ResourceLabelWidget extends IconLabel {
}
}
export
interface
IResourceLabel
{
name
:
string
;
description
?:
string
;
resource
?:
uri
;
}
export
interface
IResourceLabelOptions
extends
IIconLabelValueOptions
{
fileKind
?:
FileKind
;
fileDecorations
?:
{
colors
:
boolean
,
badges
:
boolean
,
data
?:
IDecorationData
};
}
export
class
ResourceLabel
extends
IconLabel
{
private
_onDidRender
=
this
.
_register
(
new
Emitter
<
void
>
());
...
...
@@ -620,22 +625,6 @@ export class ResourceLabel extends IconLabel {
}
}
export
class
EditorLabel
extends
ResourceLabel
{
setEditor
(
editor
:
IEditorInput
,
options
?:
IResourceLabelOptions
):
void
{
this
.
setLabel
({
resource
:
toResource
(
editor
,
{
supportSideBySide
:
true
}),
name
:
editor
.
getName
(),
description
:
editor
.
getDescription
()
},
options
);
}
}
export
interface
IFileLabelOptions
extends
IResourceLabelOptions
{
hideLabel
?:
boolean
;
hidePath
?:
boolean
;
}
export
class
FileLabel
extends
ResourceLabel
{
constructor
(
...
...
src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts
浏览文件 @
5d04ca2e
...
...
@@ -26,7 +26,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
badgeBackground
,
badgeForeground
,
contrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IListVirtualDelegate
,
IListRenderer
,
IListContextMenuEvent
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
EditorLabel
}
from
'
vs/workbench/browser/labels
'
;
import
{
ResourceLabels
,
IResourceLabelHandle
}
from
'
vs/workbench/browser/labels
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IEditorService
,
SIDE_GROUP
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -51,6 +51,7 @@ export class OpenEditorsView extends ViewletPanel {
private
listRefreshScheduler
:
RunOnceScheduler
;
private
structuralRefreshDelay
:
number
;
private
list
:
WorkbenchList
<
OpenEditor
|
IEditorGroup
>
;
private
labels
:
ResourceLabels
;
private
contributedContextMenu
:
IMenu
;
private
needsRefresh
:
boolean
;
private
resourceContext
:
ResourceContextKey
;
...
...
@@ -213,14 +214,19 @@ export class OpenEditorsView extends ViewletPanel {
if
(
this
.
list
)
{
this
.
list
.
dispose
();
}
if
(
this
.
labels
)
{
this
.
labels
.
clear
();
}
this
.
labels
=
this
.
instantiationService
.
createInstance
(
ResourceLabels
);
this
.
list
=
this
.
instantiationService
.
createInstance
(
WorkbenchList
,
container
,
delegate
,
[
new
EditorGroupRenderer
(
this
.
keybindingService
,
this
.
instantiationService
,
this
.
editorGroupService
),
new
OpenEditorRenderer
(
getSelectedElements
,
this
.
instantiationService
,
this
.
keybindingService
,
this
.
configurationService
,
this
.
editorGroupService
)
new
OpenEditorRenderer
(
this
.
labels
,
getSelectedElements
,
this
.
instantiationService
,
this
.
keybindingService
,
this
.
configurationService
,
this
.
editorGroupService
)
],
{
identityProvider
:
{
getId
:
(
element
:
OpenEditor
|
IEditorGroup
)
=>
element
instanceof
OpenEditor
?
element
.
getId
()
:
element
.
id
.
toString
()
},
selectOnMouseDown
:
false
/* disabled to better support DND */
})
as
WorkbenchList
<
OpenEditor
|
IEditorGroup
>
;
this
.
disposables
.
push
(
this
.
list
);
this
.
disposables
.
push
(
this
.
labels
);
this
.
contributedContextMenu
=
this
.
menuService
.
createMenu
(
MenuId
.
OpenEditorsContext
,
this
.
list
.
contextKeyService
);
this
.
disposables
.
push
(
this
.
contributedContextMenu
);
...
...
@@ -478,7 +484,7 @@ export class OpenEditorsView extends ViewletPanel {
interface
IOpenEditorTemplateData
{
container
:
HTMLElement
;
root
:
EditorLabel
;
root
:
IResourceLabelHandle
;
actionBar
:
ActionBar
;
actionRunner
:
OpenEditorActionRunner
;
openEditor
:
OpenEditor
;
...
...
@@ -619,6 +625,7 @@ class OpenEditorRenderer implements IListRenderer<OpenEditor, IOpenEditorTemplat
private
transfer
=
LocalSelectionTransfer
.
getInstance
<
OpenEditor
>
();
constructor
(
private
labels
:
ResourceLabels
,
private
getSelectedElements
:
()
=>
Array
<
OpenEditor
|
IEditorGroup
>
,
private
instantiationService
:
IInstantiationService
,
private
keybindingService
:
IKeybindingService
,
...
...
@@ -643,7 +650,7 @@ class OpenEditorRenderer implements IListRenderer<OpenEditor, IOpenEditorTemplat
const
key
=
this
.
keybindingService
.
lookupKeybinding
(
closeEditorAction
.
id
);
editorTemplate
.
actionBar
.
push
(
closeEditorAction
,
{
icon
:
true
,
label
:
false
,
keybinding
:
key
?
key
.
getLabel
()
:
void
0
});
editorTemplate
.
root
=
this
.
instantiationService
.
createInstance
(
EditorLabel
,
container
,
void
0
);
editorTemplate
.
root
=
this
.
labels
.
create
(
container
);
editorTemplate
.
toDispose
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录