Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
129016f0
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,发现更多精彩内容 >>
提交
129016f0
编写于
12月 19, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
labels - adopt for search view
上级
5d04ca2e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
10 deletion
+23
-10
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+9
-1
src/vs/workbench/parts/search/browser/searchResultsView.ts
src/vs/workbench/parts/search/browser/searchResultsView.ts
+7
-5
src/vs/workbench/parts/search/browser/searchView.ts
src/vs/workbench/parts/search/browser/searchView.ts
+7
-4
未找到文件。
src/vs/workbench/browser/labels.ts
浏览文件 @
129016f0
...
...
@@ -45,7 +45,14 @@ export interface IResourceLabelHandle extends IDisposable {
readonly
element
:
HTMLElement
;
/**
* Most basic method to apply a label.
* Most generic way to apply a label directly.
*/
setValue
(
label
?:
string
,
description
?:
string
,
options
?:
IIconLabelValueOptions
):
void
;
/**
* Convinient method to apply a label by passing a resource along.
*
* Note: for file resources consider to use the #setFile() method instead.
*/
setLabel
(
label
:
IResourceLabel
,
options
?:
IResourceLabelOptions
):
void
;
...
...
@@ -117,6 +124,7 @@ export class ResourceLabels extends Disposable {
// Only expose a handle to the outside
const
label
:
IResourceLabelHandle
=
{
element
:
widget
.
element
,
setValue
:
(
label
?:
string
,
description
?:
string
,
options
?:
IIconLabelValueOptions
)
=>
widget
.
setValue
(
label
,
description
,
options
),
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
),
...
...
src/vs/workbench/parts/search/browser/searchResultsView.ts
浏览文件 @
129016f0
...
...
@@ -23,7 +23,7 @@ import { ISearchConfigurationProperties } from 'vs/platform/search/common/search
import
{
attachBadgeStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
FileLabel
}
from
'
vs/workbench/browser/labels
'
;
import
{
IResourceLabelHandle
,
ResourceLabels
}
from
'
vs/workbench/browser/labels
'
;
import
{
RemoveAction
,
ReplaceAction
,
ReplaceAllAction
,
ReplaceAllInFolderAction
}
from
'
vs/workbench/parts/search/browser/searchActions
'
;
import
{
SearchView
}
from
'
vs/workbench/parts/search/browser/searchView
'
;
import
{
FileMatch
,
FolderMatch
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchModel
}
from
'
vs/workbench/parts/search/common/searchModel
'
;
...
...
@@ -35,14 +35,14 @@ export class SearchSorter implements ISorter {
}
interface
IFolderMatchTemplate
{
label
:
FileLabel
;
label
:
IResourceLabelHandle
;
badge
:
CountBadge
;
actions
:
ActionBar
;
}
interface
IFileMatchTemplate
{
el
:
HTMLElement
;
label
:
FileLabel
;
label
:
IResourceLabelHandle
;
badge
:
CountBadge
;
actions
:
ActionBar
;
}
...
...
@@ -84,6 +84,7 @@ export class FolderMatchRenderer extends Disposable implements ITreeRenderer<Fol
constructor
(
private
searchModel
:
SearchModel
,
private
searchView
:
SearchView
,
private
labels
:
ResourceLabels
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IThemeService
private
themeService
:
IThemeService
,
@
IWorkspaceContextService
protected
contextService
:
IWorkspaceContextService
...
...
@@ -93,7 +94,7 @@ export class FolderMatchRenderer extends Disposable implements ITreeRenderer<Fol
renderTemplate
(
container
:
HTMLElement
):
IFolderMatchTemplate
{
let
folderMatchElement
=
DOM
.
append
(
container
,
DOM
.
$
(
'
.foldermatch
'
));
const
label
=
this
.
instantiationService
.
createInstance
(
FileLabel
,
folderMatchElement
,
void
0
);
const
label
=
this
.
labels
.
create
(
folderMatchElement
);
const
badge
=
new
CountBadge
(
DOM
.
append
(
folderMatchElement
,
DOM
.
$
(
'
.badge
'
)));
this
.
_register
(
attachBadgeStyler
(
badge
,
this
.
themeService
));
const
actionBarContainer
=
DOM
.
append
(
folderMatchElement
,
DOM
.
$
(
'
.actionBarContainer
'
));
...
...
@@ -146,6 +147,7 @@ export class FileMatchRenderer extends Disposable implements ITreeRenderer<FileM
constructor
(
private
searchModel
:
SearchModel
,
private
searchView
:
SearchView
,
private
labels
:
ResourceLabels
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IThemeService
private
themeService
:
IThemeService
,
@
IWorkspaceContextService
protected
contextService
:
IWorkspaceContextService
...
...
@@ -155,7 +157,7 @@ export class FileMatchRenderer extends Disposable implements ITreeRenderer<FileM
renderTemplate
(
container
:
HTMLElement
):
IFileMatchTemplate
{
let
fileMatchElement
=
DOM
.
append
(
container
,
DOM
.
$
(
'
.filematch
'
));
const
label
=
this
.
instantiationService
.
createInstance
(
FileLabel
,
fileMatchElement
,
void
0
);
const
label
=
this
.
labels
.
create
(
fileMatchElement
);
const
badge
=
new
CountBadge
(
DOM
.
append
(
fileMatchElement
,
DOM
.
$
(
'
.badge
'
)));
this
.
_register
(
attachBadgeStyler
(
badge
,
this
.
themeService
));
const
actionBarContainer
=
DOM
.
append
(
fileMatchElement
,
DOM
.
$
(
'
.actionBarContainer
'
));
...
...
src/vs/workbench/parts/search/browser/searchView.ts
浏览文件 @
129016f0
...
...
@@ -62,6 +62,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorG
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IPreferencesService
,
ISettingsEditorOptions
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
ResourceLabels
}
from
'
vs/workbench/browser/labels
'
;
const
$
=
dom
.
$
;
...
...
@@ -136,6 +137,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
private
contextMenu
:
IMenu
;
private
tree
:
WorkbenchObjectTree
<
RenderableMatch
>
;
private
labels
:
ResourceLabels
;
private
viewletState
:
object
;
private
globalMemento
:
object
;
private
messagesElement
:
HTMLElement
;
...
...
@@ -584,18 +586,19 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
}
};
this
.
tree
=
<
WorkbenchObjectTree
<
RenderableMatch
,
any
>>
this
.
instantiationService
.
createInstance
(
WorkbenchObjectTree
,
this
.
labels
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
ResourceLabels
));
this
.
tree
=
this
.
_register
(
<
WorkbenchObjectTree
<
RenderableMatch
,
any
>>
this
.
instantiationService
.
createInstance
(
WorkbenchObjectTree
,
this
.
resultsElement
,
delegate
,
[
this
.
_register
(
this
.
instantiationService
.
createInstance
(
FolderMatchRenderer
,
this
.
viewModel
,
this
)),
this
.
_register
(
this
.
instantiationService
.
createInstance
(
FileMatchRenderer
,
this
.
viewModel
,
this
)),
this
.
_register
(
this
.
instantiationService
.
createInstance
(
FolderMatchRenderer
,
this
.
viewModel
,
this
,
this
.
labels
)),
this
.
_register
(
this
.
instantiationService
.
createInstance
(
FileMatchRenderer
,
this
.
viewModel
,
this
,
this
.
labels
)),
this
.
_register
(
this
.
instantiationService
.
createInstance
(
MatchRenderer
,
this
.
viewModel
,
this
)),
],
{
identityProvider
,
accessibilityProvider
:
this
.
instantiationService
.
createInstance
(
SearchAccessibilityProvider
,
this
.
viewModel
)
});
})
)
;
this
.
_register
(
this
.
tree
.
onContextMenu
(
e
=>
this
.
onContextMenu
(
e
)));
const
resourceNavigator
=
this
.
_register
(
new
TreeResourceNavigator2
(
this
.
tree
,
{
openOnFocus
:
true
}));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录