Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b0f3fde2
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,发现更多精彩内容 >>
提交
b0f3fde2
编写于
4月 18, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Register views outside viewlet
上级
91db9a6a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
56 deletion
+64
-56
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
...ts/extensions/electron-browser/extensions.contribution.ts
+2
-1
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
...ch/parts/extensions/electron-browser/extensionsViewlet.ts
+62
-55
未找到文件。
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
浏览文件 @
b0f3fde2
...
...
@@ -27,7 +27,7 @@ import {
import
{
ExtensionsInput
}
from
'
vs/workbench/parts/extensions/common/extensionsInput
'
;
import
{
ViewletRegistry
,
Extensions
as
ViewletExtensions
,
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
ExtensionEditor
}
from
'
vs/workbench/parts/extensions/electron-browser/extensionEditor
'
;
import
{
StatusUpdater
,
ExtensionsViewlet
,
MaliciousExtensionChecker
}
from
'
vs/workbench/parts/extensions/electron-browser/extensionsViewlet
'
;
import
{
StatusUpdater
,
ExtensionsViewlet
,
MaliciousExtensionChecker
,
ExtensionsViewletViewsContribution
}
from
'
vs/workbench/parts/extensions/electron-browser/extensionsViewlet
'
;
import
{
IQuickOpenRegistry
,
Extensions
,
QuickOpenHandlerDescriptor
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
,
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
*
as
jsonContributionRegistry
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
...
...
@@ -54,6 +54,7 @@ workbenchRegistry.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Ru
workbenchRegistry
.
registerWorkbenchContribution
(
MaliciousExtensionChecker
,
LifecyclePhase
.
Eventually
);
workbenchRegistry
.
registerWorkbenchContribution
(
ConfigureRecommendedExtensionsCommandsContributor
,
LifecyclePhase
.
Eventually
);
workbenchRegistry
.
registerWorkbenchContribution
(
KeymapExtensions
,
LifecyclePhase
.
Running
);
workbenchRegistry
.
registerWorkbenchContribution
(
ExtensionsViewletViewsContribution
,
LifecyclePhase
.
Starting
);
Registry
.
as
<
IOutputChannelRegistry
>
(
OutputExtensions
.
OutputChannels
)
.
registerChannel
(
ExtensionsChannelId
,
ExtensionsLabel
);
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
浏览文件 @
b0f3fde2
...
...
@@ -66,65 +66,11 @@ const SearchBuiltInExtensionsContext = new RawContextKey<boolean>('searchBuiltIn
const
RecommendedExtensionsContext
=
new
RawContextKey
<
boolean
>
(
'
recommendedExtensions
'
,
false
);
const
DefaultRecommendedExtensionsContext
=
new
RawContextKey
<
boolean
>
(
'
defaultRecommendedExtensions
'
,
false
);
export
class
ExtensionsViewlet
extends
PersistentViewsViewlet
implements
IExtensionsViewlet
{
private
onSearchChange
:
EventOf
<
string
>
;
private
nonEmptyWorkspaceContextKey
:
IContextKey
<
boolean
>
;
private
searchExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchInstalledExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchBuiltInExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
recommendedExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
defaultRecommendedExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchDelayer
:
ThrottledDelayer
<
any
>
;
private
root
:
HTMLElement
;
private
searchBox
:
HTMLInputElement
;
private
extensionsBox
:
HTMLElement
;
private
primaryActions
:
IAction
[];
private
secondaryActions
:
IAction
[];
private
disposables
:
IDisposable
[]
=
[];
export
class
ExtensionsViewletViewsContribution
implements
IWorkbenchContribution
{
constructor
(
@
IPartService
partService
:
IPartService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IProgressService
private
progressService
:
IProgressService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IEditorGroupService
private
editorInputService
:
IEditorGroupService
,
@
IExtensionManagementService
private
extensionManagementService
:
IExtensionManagementService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IThemeService
themeService
:
IThemeService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IStorageService
storageService
:
IStorageService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IExtensionService
extensionService
:
IExtensionService
)
{
super
(
VIEWLET_ID
,
ViewLocation
.
Extensions
,
`
${
VIEWLET_ID
}
.state`
,
true
,
partService
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextService
,
contextKeyService
,
contextMenuService
,
extensionService
);
this
.
registerViews
();
this
.
searchDelayer
=
new
ThrottledDelayer
(
500
);
this
.
nonEmptyWorkspaceContextKey
=
NonEmptyWorkspaceContext
.
bindTo
(
contextKeyService
);
this
.
searchExtensionsContextKey
=
SearchExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
searchInstalledExtensionsContextKey
=
SearchInstalledExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
searchBuiltInExtensionsContextKey
=
SearchBuiltInExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
recommendedExtensionsContextKey
=
RecommendedExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
defaultRecommendedExtensionsContextKey
=
DefaultRecommendedExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
defaultRecommendedExtensionsContextKey
.
set
(
!
this
.
configurationService
.
getValue
<
boolean
>
(
ShowRecommendationsOnlyOnDemandKey
));
this
.
disposables
.
push
(
this
.
viewletService
.
onDidViewletOpen
(
this
.
onViewletOpen
,
this
,
this
.
disposables
));
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectsConfiguration
(
AutoUpdateConfigurationKey
))
{
this
.
secondaryActions
=
null
;
this
.
updateTitleArea
();
}
if
(
e
.
affectedKeys
.
indexOf
(
ShowRecommendationsOnlyOnDemandKey
)
>
-
1
)
{
this
.
defaultRecommendedExtensionsContextKey
.
set
(
!
this
.
configurationService
.
getValue
<
boolean
>
(
ShowRecommendationsOnlyOnDemandKey
));
}
},
this
,
this
.
disposables
);
}
private
registerViews
():
void
{
...
...
@@ -247,6 +193,67 @@ export class ExtensionsViewlet extends PersistentViewsViewlet implements IExtens
canToggleVisibility
:
true
};
}
}
export
class
ExtensionsViewlet
extends
PersistentViewsViewlet
implements
IExtensionsViewlet
{
private
onSearchChange
:
EventOf
<
string
>
;
private
nonEmptyWorkspaceContextKey
:
IContextKey
<
boolean
>
;
private
searchExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchInstalledExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchBuiltInExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
recommendedExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
defaultRecommendedExtensionsContextKey
:
IContextKey
<
boolean
>
;
private
searchDelayer
:
ThrottledDelayer
<
any
>
;
private
root
:
HTMLElement
;
private
searchBox
:
HTMLInputElement
;
private
extensionsBox
:
HTMLElement
;
private
primaryActions
:
IAction
[];
private
secondaryActions
:
IAction
[];
private
disposables
:
IDisposable
[]
=
[];
constructor
(
@
IPartService
partService
:
IPartService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IProgressService
private
progressService
:
IProgressService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IEditorGroupService
private
editorInputService
:
IEditorGroupService
,
@
IExtensionManagementService
private
extensionManagementService
:
IExtensionManagementService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IThemeService
themeService
:
IThemeService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IStorageService
storageService
:
IStorageService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IExtensionService
extensionService
:
IExtensionService
)
{
super
(
VIEWLET_ID
,
ViewLocation
.
Extensions
,
`
${
VIEWLET_ID
}
.state`
,
true
,
partService
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextService
,
contextKeyService
,
contextMenuService
,
extensionService
);
this
.
searchDelayer
=
new
ThrottledDelayer
(
500
);
this
.
nonEmptyWorkspaceContextKey
=
NonEmptyWorkspaceContext
.
bindTo
(
contextKeyService
);
this
.
searchExtensionsContextKey
=
SearchExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
searchInstalledExtensionsContextKey
=
SearchInstalledExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
searchBuiltInExtensionsContextKey
=
SearchBuiltInExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
recommendedExtensionsContextKey
=
RecommendedExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
defaultRecommendedExtensionsContextKey
=
DefaultRecommendedExtensionsContext
.
bindTo
(
contextKeyService
);
this
.
defaultRecommendedExtensionsContextKey
.
set
(
!
this
.
configurationService
.
getValue
<
boolean
>
(
ShowRecommendationsOnlyOnDemandKey
));
this
.
disposables
.
push
(
this
.
viewletService
.
onDidViewletOpen
(
this
.
onViewletOpen
,
this
,
this
.
disposables
));
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectsConfiguration
(
AutoUpdateConfigurationKey
))
{
this
.
secondaryActions
=
null
;
this
.
updateTitleArea
();
}
if
(
e
.
affectedKeys
.
indexOf
(
ShowRecommendationsOnlyOnDemandKey
)
>
-
1
)
{
this
.
defaultRecommendedExtensionsContextKey
.
set
(
!
this
.
configurationService
.
getValue
<
boolean
>
(
ShowRecommendationsOnlyOnDemandKey
));
}
},
this
,
this
.
disposables
);
}
async
create
(
parent
:
HTMLElement
):
TPromise
<
void
>
{
addClass
(
parent
,
'
extensions-viewlet
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录