Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e80c80fd
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,发现更多精彩内容 >>
提交
e80c80fd
编写于
8月 14, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#78168 strict init
上级
8e28611a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
24 deletion
+28
-24
src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts
...workbench/contrib/extensions/browser/extensionsViewlet.ts
+28
-24
未找到文件。
src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts
浏览文件 @
e80c80fd
...
...
@@ -319,7 +319,8 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
export
class
ExtensionsViewlet
extends
ViewContainerViewlet
implements
IExtensionsViewlet
{
private
onSearchChange
:
EventOf
<
string
>
;
private
readonly
_onSearchChange
:
Emitter
<
string
>
=
this
.
_register
(
new
Emitter
<
string
>
());
private
readonly
onSearchChange
:
EventOf
<
string
>
=
this
.
_onSearchChange
.
event
;
private
nonEmptyWorkspaceContextKey
:
IContextKey
<
boolean
>
;
private
defaultViewsContextKey
:
IContextKey
<
boolean
>
;
private
searchMarketplaceExtensionsContextKey
:
IContextKey
<
boolean
>
;
...
...
@@ -333,12 +334,10 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
private
defaultRecommendedExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchDelayer
:
Delayer
<
void
>
;
private
root
:
HTMLElement
;
private
searchBox
:
SuggestEnabledInput
;
private
extensionsBox
:
HTMLElement
;
private
primaryActions
:
IAction
[];
private
secondaryActions
:
IAction
[]
|
null
;
private
root
:
HTMLElement
|
undefined
;
private
searchBox
:
SuggestEnabledInput
|
undefined
;
private
primaryActions
:
IAction
[]
|
undefined
;
private
secondaryActions
:
IAction
[]
|
null
=
null
;
private
readonly
searchViewletState
:
MementoObject
;
constructor
(
...
...
@@ -417,32 +416,35 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
this
.
_register
(
attachSuggestEnabledInputBoxStyler
(
this
.
searchBox
,
this
.
themeService
));
const
_searchChange
=
new
Emitter
<
string
>
();
this
.
onSearchChange
=
_searchChange
.
event
;
this
.
_register
(
this
.
searchBox
.
onInputDidChange
(()
=>
{
this
.
triggerSearch
();
_searchChange
.
fire
(
this
.
searchBox
.
getValue
());
this
.
_onSearchChange
.
fire
(
this
.
searchBox
!
.
getValue
());
},
this
));
this
.
_register
(
this
.
searchBox
.
onShouldFocusResults
(()
=>
this
.
focusListView
(),
this
));
this
.
_register
(
this
.
onDidChangeVisibility
(
visible
=>
{
if
(
visible
)
{
this
.
searchBox
.
focus
();
this
.
searchBox
!
.
focus
();
}
}));
this
.
extensionsBox
=
append
(
this
.
root
,
$
(
'
.extensions
'
));
super
.
create
(
this
.
extensionsBox
);
super
.
create
(
append
(
this
.
root
,
$
(
'
.extensions
'
)));
}
focus
():
void
{
this
.
searchBox
.
focus
();
if
(
this
.
searchBox
)
{
this
.
searchBox
.
focus
();
}
}
layout
(
dimension
:
Dimension
):
void
{
toggleClass
(
this
.
root
,
'
narrow
'
,
dimension
.
width
<=
300
);
this
.
searchBox
.
layout
({
height
:
20
,
width
:
dimension
.
width
-
34
});
if
(
this
.
root
)
{
toggleClass
(
this
.
root
,
'
narrow
'
,
dimension
.
width
<=
300
);
}
if
(
this
.
searchBox
)
{
this
.
searchBox
.
layout
({
height
:
20
,
width
:
dimension
.
width
-
34
});
}
super
.
layout
(
new
Dimension
(
dimension
.
width
,
dimension
.
height
-
38
));
}
...
...
@@ -453,7 +455,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
getActions
():
IAction
[]
{
if
(
!
this
.
primaryActions
)
{
this
.
primaryActions
=
[
this
.
instantiationService
.
createInstance
(
ClearExtensionsInputAction
,
ClearExtensionsInputAction
.
ID
,
ClearExtensionsInputAction
.
LABEL
,
this
.
onSearchChange
,
this
.
searchBox
.
getValue
()
)
this
.
instantiationService
.
createInstance
(
ClearExtensionsInputAction
,
ClearExtensionsInputAction
.
ID
,
ClearExtensionsInputAction
.
LABEL
,
this
.
onSearchChange
,
this
.
searchBox
?
this
.
searchBox
.
getValue
()
:
''
)
];
}
return
this
.
primaryActions
;
...
...
@@ -487,22 +489,24 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
}
search
(
value
:
string
):
void
{
const
event
=
new
Event
(
'
input
'
,
{
bubbles
:
true
})
as
SearchInputEvent
;
event
.
immediate
=
true
;
if
(
this
.
searchBox
)
{
const
event
=
new
Event
(
'
input
'
,
{
bubbles
:
true
})
as
SearchInputEvent
;
event
.
immediate
=
true
;
this
.
searchBox
.
setValue
(
value
);
this
.
searchBox
.
setValue
(
value
);
}
}
private
triggerSearch
(
immediate
=
false
):
void
{
this
.
searchDelayer
.
trigger
(()
=>
this
.
doSearch
(),
immediate
||
!
this
.
searchBox
.
getValue
()
?
0
:
50
0
).
then
(
undefined
,
err
=>
this
.
onError
(
err
));
private
triggerSearch
():
void
{
this
.
searchDelayer
.
trigger
(()
=>
this
.
doSearch
(),
this
.
searchBox
&&
this
.
searchBox
.
getValue
()
?
500
:
0
).
then
(
undefined
,
err
=>
this
.
onError
(
err
));
}
private
normalizedQuery
():
string
{
return
this
.
searchBox
.
getValue
().
replace
(
/@category/g
,
'
category
'
).
replace
(
/@tag:/g
,
'
tag:
'
).
replace
(
/@ext:/g
,
'
ext:
'
)
;
return
this
.
searchBox
?
this
.
searchBox
.
getValue
().
replace
(
/@category/g
,
'
category
'
).
replace
(
/@tag:/g
,
'
tag:
'
).
replace
(
/@ext:/g
,
'
ext:
'
)
:
''
;
}
protected
saveState
():
void
{
const
value
=
this
.
searchBox
.
getValue
()
;
const
value
=
this
.
searchBox
?
this
.
searchBox
.
getValue
()
:
''
;
if
(
ExtensionsListView
.
isLocalExtensionsQuery
(
value
))
{
this
.
searchViewletState
[
'
query.value
'
]
=
value
;
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录