Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
95957c95
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,体验更适合开发者的 AI 搜索 >>
提交
95957c95
编写于
11月 24, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #35325
上级
8feee8eb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
11 deletion
+56
-11
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
...s/workbench/parts/extensions/browser/extensionsActions.ts
+53
-3
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
...ts/extensions/electron-browser/extensions.contribution.ts
+3
-8
未找到文件。
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
浏览文件 @
95957c95
...
...
@@ -14,10 +14,10 @@ import Event from 'vs/base/common/event';
import
*
as
json
from
'
vs/base/common/json
'
;
import
{
ActionItem
,
IActionItem
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IExtension
,
ExtensionState
,
IExtensionsWorkbenchService
,
VIEWLET_ID
,
IExtensionsViewlet
,
AutoUpdateConfigurationKey
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
ExtensionsConfigurationInitialContent
}
from
'
vs/workbench/parts/extensions/common/extensionsFileTemplate
'
;
import
{
LocalExtensionType
,
IExtensionEnablementService
,
IExtensionTipsService
,
EnablementState
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
LocalExtensionType
,
IExtensionEnablementService
,
IExtensionTipsService
,
EnablementState
,
ExtensionsLabel
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
areSameExtensions
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
...
...
@@ -41,6 +41,9 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import
{
PICK_WORKSPACE_FOLDER_COMMAND
}
from
'
vs/workbench/browser/actions/workspaceActions
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
PagedModel
}
from
'
vs/base/common/paging
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
export
class
InstallAction
extends
Action
{
...
...
@@ -1303,6 +1306,53 @@ export class ChangeSortAction extends Action {
}
}
export
class
ConfigureRecommendedExtensionsCommandsContributor
extends
Disposable
implements
IWorkbenchContribution
{
private
workspaceContextKey
=
new
RawContextKey
<
boolean
>
(
'
workspaceRecommendations
'
,
true
);
private
workspaceFolderContextKey
=
new
RawContextKey
<
boolean
>
(
'
workspaceFolderRecommendations
'
,
true
);
constructor
(
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IWorkspaceContextService
workspaceContextService
:
IWorkspaceContextService
)
{
super
();
const
boundWorkspaceContextKey
=
this
.
workspaceContextKey
.
bindTo
(
contextKeyService
);
boundWorkspaceContextKey
.
set
(
workspaceContextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
);
this
.
_register
(
workspaceContextService
.
onDidChangeWorkbenchState
(()
=>
boundWorkspaceContextKey
.
set
(
workspaceContextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
)));
const
boundWorkspaceFolderContextKey
=
this
.
workspaceFolderContextKey
.
bindTo
(
contextKeyService
);
boundWorkspaceFolderContextKey
.
set
(
workspaceContextService
.
getWorkspace
().
folders
.
length
>
0
);
this
.
_register
(
workspaceContextService
.
onDidChangeWorkspaceFolders
(()
=>
boundWorkspaceFolderContextKey
.
set
(
workspaceContextService
.
getWorkspace
().
folders
.
length
>
0
)));
this
.
registerCommands
();
}
private
registerCommands
():
void
{
CommandsRegistry
.
registerCommand
(
ConfigureWorkspaceRecommendedExtensionsAction
.
ID
,
serviceAccessor
=>
{
serviceAccessor
.
get
(
IInstantiationService
).
createInstance
(
ConfigureWorkspaceRecommendedExtensionsAction
,
ConfigureWorkspaceRecommendedExtensionsAction
.
ID
,
ConfigureWorkspaceRecommendedExtensionsAction
.
LABEL
).
run
();
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
{
command
:
{
id
:
ConfigureWorkspaceRecommendedExtensionsAction
.
ID
,
title
:
`
${
ExtensionsLabel
}
:
${
ConfigureWorkspaceRecommendedExtensionsAction
.
LABEL
}
`
,
},
when
:
this
.
workspaceContextKey
});
CommandsRegistry
.
registerCommand
(
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
ID
,
serviceAccessor
=>
{
serviceAccessor
.
get
(
IInstantiationService
).
createInstance
(
ConfigureWorkspaceFolderRecommendedExtensionsAction
,
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
ID
,
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
LABEL
).
run
();
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
{
command
:
{
id
:
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
ID
,
title
:
`
${
ExtensionsLabel
}
:
${
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
LABEL
}
`
,
},
when
:
this
.
workspaceFolderContextKey
});
}
}
interface
IExtensionsContent
{
recommendations
:
string
[];
}
...
...
@@ -1414,7 +1464,7 @@ export class ConfigureWorkspaceRecommendedExtensionsAction extends AbstractConfi
this
.
enabled
=
this
.
contextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
;
}
public
run
(
event
:
any
):
TPromise
<
any
>
{
public
run
():
TPromise
<
any
>
{
switch
(
this
.
contextService
.
getWorkbenchState
())
{
case
WorkbenchState
.
FOLDER
:
return
this
.
openExtensionsFile
(
this
.
contextService
.
getWorkspace
().
folders
[
0
].
toResource
(
paths
.
join
(
'
.vscode
'
,
'
extensions.json
'
)));
...
...
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
浏览文件 @
95957c95
...
...
@@ -21,8 +21,8 @@ import { VIEWLET_ID, IExtensionsWorkbenchService } from '../common/extensions';
import
{
ExtensionsWorkbenchService
}
from
'
vs/workbench/parts/extensions/node/extensionsWorkbenchService
'
;
import
{
OpenExtensionsViewletAction
,
InstallExtensionsAction
,
ShowOutdatedExtensionsAction
,
ShowRecommendedExtensionsAction
,
ShowRecommendedKeymapExtensionsAction
,
ShowPopularExtensionsAction
,
ShowEnabledExtensionsAction
,
ShowInstalledExtensionsAction
,
ShowDisabledExtensionsAction
,
UpdateAllAction
,
ConfigureWorkspaceRecommendedExtensionsAction
,
ConfigureWorkspaceFolderRecommendedExtensionsAction
,
EnableAllAction
,
EnableAllWorkpsaceAction
,
DisableAllAction
,
DisableAllWorkpsaceAction
,
CheckForUpdatesAction
,
ShowLanguageExtensionsAction
,
ShowAzureExtensionsAction
,
EnableAutoUpdateAction
,
DisableAutoUpdateAction
ShowEnabledExtensionsAction
,
ShowInstalledExtensionsAction
,
ShowDisabledExtensionsAction
,
UpdateAllAction
,
EnableAllAction
,
EnableAllWorkpsaceAction
,
DisableAllAction
,
DisableAllWorkpsaceAction
,
CheckForUpdatesAction
,
ShowLanguageExtensionsAction
,
ShowAzureExtensionsAction
,
EnableAutoUpdateAction
,
DisableAutoUpdateAction
,
ConfigureRecommendedExtensionsCommandsContributor
}
from
'
vs/workbench/parts/extensions/browser/extensionsActions
'
;
import
{
OpenExtensionsFolderAction
,
InstallVSIXAction
}
from
'
vs/workbench/parts/extensions/electron-browser/extensionsActions
'
;
import
{
ExtensionsInput
}
from
'
vs/workbench/parts/extensions/common/extensionsInput
'
;
...
...
@@ -48,6 +48,7 @@ registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
const
workbenchRegistry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
);
workbenchRegistry
.
registerWorkbenchContribution
(
StatusUpdater
,
LifecyclePhase
.
Running
);
workbenchRegistry
.
registerWorkbenchContribution
(
ConfigureRecommendedExtensionsCommandsContributor
,
LifecyclePhase
.
Eventually
);
workbenchRegistry
.
registerWorkbenchContribution
(
KeymapExtensions
,
LifecyclePhase
.
Running
);
workbenchRegistry
.
registerWorkbenchContribution
(
BetterMergeDisabled
,
LifecyclePhase
.
Running
);
...
...
@@ -141,12 +142,6 @@ actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: U
const
openExtensionsFolderActionDescriptor
=
new
SyncActionDescriptor
(
OpenExtensionsFolderAction
,
OpenExtensionsFolderAction
.
ID
,
OpenExtensionsFolderAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
openExtensionsFolderActionDescriptor
,
'
Extensions: Open Extensions Folder
'
,
ExtensionsLabel
);
const
configureWorkspaceExtensionsDescriptor
=
new
SyncActionDescriptor
(
ConfigureWorkspaceRecommendedExtensionsAction
,
ConfigureWorkspaceRecommendedExtensionsAction
.
ID
,
ConfigureWorkspaceRecommendedExtensionsAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
configureWorkspaceExtensionsDescriptor
,
'
Extensions: Configure Recommended Extensions (Workspace)
'
,
ExtensionsLabel
);
const
configureWorkspaceFolderRecommendationsDescriptor
=
new
SyncActionDescriptor
(
ConfigureWorkspaceFolderRecommendedExtensionsAction
,
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
ID
,
ConfigureWorkspaceFolderRecommendedExtensionsAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
configureWorkspaceFolderRecommendationsDescriptor
,
'
Extensions: Configure Recommended Extensions (Workspace Folder)
'
,
ExtensionsLabel
);
const
installVSIXActionDescriptor
=
new
SyncActionDescriptor
(
InstallVSIXAction
,
InstallVSIXAction
.
ID
,
InstallVSIXAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
installVSIXActionDescriptor
,
'
Extensions: Install from VSIX...
'
,
ExtensionsLabel
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录