Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4ecf3f8f
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,发现更多精彩内容 >>
提交
4ecf3f8f
编写于
11月 09, 2020
作者:
J
João Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
98e0e93a
61500a46
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
68 addition
and
45 deletion
+68
-45
src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
...s/workbench/contrib/extensions/browser/extensionEditor.ts
+14
-37
src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
...nch/contrib/extensions/browser/extensions.contribution.ts
+1
-1
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
...workbench/contrib/extensions/browser/extensionsActions.ts
+52
-6
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
...s/workbench/contrib/extensions/browser/extensionsViews.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
浏览文件 @
4ecf3f8f
...
...
@@ -27,7 +27,12 @@ import { IExtensionsWorkbenchService, IExtensionsViewPaneContainer, VIEWLET_ID,
import
{
RatingsWidget
,
InstallCountWidget
,
RemoteBadgeWidget
}
from
'
vs/workbench/contrib/extensions/browser/extensionsWidgets
'
;
import
{
EditorOptions
,
IEditorOpenContext
}
from
'
vs/workbench/common/editor
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
UpdateAction
,
ReloadAction
,
MaliciousStatusLabelAction
,
IgnoreExtensionRecommendationAction
,
UndoIgnoreExtensionRecommendationAction
,
EnableDropDownAction
,
DisableDropDownAction
,
StatusLabelAction
,
SetFileIconThemeAction
,
SetColorThemeAction
,
RemoteInstallAction
,
ExtensionToolTipAction
,
SystemDisabledWarningAction
,
LocalInstallAction
,
ToggleSyncExtensionAction
,
SetProductIconThemeAction
,
ActionWithDropDownAction
,
InstallDropdownAction
,
InstallingLabelAction
,
UninstallAction
,
ExtensionActionWithDropdownActionViewItem
,
ExtensionDropDownAction
}
from
'
vs/workbench/contrib/extensions/browser/extensionsActions
'
;
import
{
UpdateAction
,
ReloadAction
,
MaliciousStatusLabelAction
,
EnableDropDownAction
,
DisableDropDownAction
,
StatusLabelAction
,
SetFileIconThemeAction
,
SetColorThemeAction
,
RemoteInstallAction
,
ExtensionToolTipAction
,
SystemDisabledWarningAction
,
LocalInstallAction
,
ToggleSyncExtensionAction
,
SetProductIconThemeAction
,
ActionWithDropDownAction
,
InstallDropdownAction
,
InstallingLabelAction
,
UninstallAction
,
ExtensionActionWithDropdownActionViewItem
,
ExtensionDropDownAction
,
InstallAnotherVersionAction
,
ExtensionEditorManageExtensionAction
}
from
'
vs/workbench/contrib/extensions/browser/extensionsActions
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
DomScrollableElement
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
IOpenerService
,
matchesScheme
}
from
'
vs/platform/opener/common/opener
'
;
...
...
@@ -407,7 +412,6 @@ export class ExtensionEditor extends EditorPane {
const
combinedInstallAction
=
this
.
instantiationService
.
createInstance
(
InstallDropdownAction
);
const
systemDisabledWarningAction
=
this
.
instantiationService
.
createInstance
(
SystemDisabledWarningAction
);
const
actions
=
[
this
.
instantiationService
.
createInstance
(
ToggleSyncExtensionAction
),
reloadAction
,
this
.
instantiationService
.
createInstance
(
StatusLabelAction
),
this
.
instantiationService
.
createInstance
(
UpdateAction
),
...
...
@@ -421,8 +425,13 @@ export class ExtensionEditor extends EditorPane {
this
.
instantiationService
.
createInstance
(
LocalInstallAction
),
combinedInstallAction
,
this
.
instantiationService
.
createInstance
(
InstallingLabelAction
),
this
.
instantiationService
.
createInstance
(
UninstallAction
),
this
.
instantiationService
.
createInstance
(
ActionWithDropDownAction
,
'
extensions.uninstall
'
,
UninstallAction
.
UninstallLabel
,
[
this
.
instantiationService
.
createInstance
(
UninstallAction
),
this
.
instantiationService
.
createInstance
(
InstallAnotherVersionAction
),
]),
this
.
instantiationService
.
createInstance
(
ToggleSyncExtensionAction
),
systemDisabledWarningAction
,
this
.
instantiationService
.
createInstance
(
ExtensionEditorManageExtensionAction
),
this
.
instantiationService
.
createInstance
(
ExtensionToolTipAction
,
systemDisabledWarningAction
,
reloadAction
),
this
.
instantiationService
.
createInstance
(
MaliciousStatusLabelAction
,
true
),
];
...
...
@@ -435,7 +444,7 @@ export class ExtensionEditor extends EditorPane {
this
.
transientDisposables
.
add
(
disposable
);
}
this
.
setSubText
(
extension
,
reloadAction
,
template
);
this
.
setSubText
(
extension
,
template
);
template
.
content
.
innerText
=
''
;
// Clear content before setting navbar actions.
template
.
navbar
.
clear
();
...
...
@@ -466,56 +475,24 @@ export class ExtensionEditor extends EditorPane {
this
.
editorLoadComplete
=
true
;
}
private
setSubText
(
extension
:
IExtension
,
reloadAction
:
ReloadAction
,
template
:
IExtensionEditorTemplate
):
void
{
private
setSubText
(
extension
:
IExtension
,
template
:
IExtensionEditorTemplate
):
void
{
hide
(
template
.
subtextContainer
);
const
ignoreAction
=
this
.
instantiationService
.
createInstance
(
IgnoreExtensionRecommendationAction
,
extension
);
const
undoIgnoreAction
=
this
.
instantiationService
.
createInstance
(
UndoIgnoreExtensionRecommendationAction
,
extension
);
ignoreAction
.
enabled
=
false
;
undoIgnoreAction
.
enabled
=
false
;
template
.
ignoreActionbar
.
clear
();
template
.
ignoreActionbar
.
push
([
ignoreAction
,
undoIgnoreAction
],
{
icon
:
true
,
label
:
true
});
this
.
transientDisposables
.
add
(
ignoreAction
);
this
.
transientDisposables
.
add
(
undoIgnoreAction
);
const
updateRecommendationFn
=
()
=>
{
const
extRecommendations
=
this
.
extensionRecommendationsService
.
getAllRecommendationsWithReason
();
if
(
extRecommendations
[
extension
.
identifier
.
id
.
toLowerCase
()])
{
ignoreAction
.
enabled
=
true
;
undoIgnoreAction
.
enabled
=
false
;
template
.
subtext
.
textContent
=
extRecommendations
[
extension
.
identifier
.
id
.
toLowerCase
()].
reasonText
;
show
(
template
.
subtextContainer
);
}
else
if
(
this
.
extensionIgnoredRecommendationsService
.
globalIgnoredRecommendations
.
indexOf
(
extension
.
identifier
.
id
.
toLowerCase
())
!==
-
1
)
{
ignoreAction
.
enabled
=
false
;
undoIgnoreAction
.
enabled
=
true
;
template
.
subtext
.
textContent
=
localize
(
'
recommendationHasBeenIgnored
'
,
"
You have chosen not to receive recommendations for this extension.
"
);
show
(
template
.
subtextContainer
);
}
else
{
ignoreAction
.
enabled
=
false
;
undoIgnoreAction
.
enabled
=
false
;
template
.
subtext
.
textContent
=
''
;
hide
(
template
.
subtextContainer
);
}
};
updateRecommendationFn
();
this
.
transientDisposables
.
add
(
this
.
extensionRecommendationsService
.
onDidChangeRecommendations
(()
=>
updateRecommendationFn
()));
this
.
transientDisposables
.
add
(
reloadAction
.
onDidChange
(
e
=>
{
if
(
e
.
tooltip
)
{
template
.
subtext
.
textContent
=
reloadAction
.
tooltip
;
show
(
template
.
subtextContainer
);
ignoreAction
.
enabled
=
false
;
undoIgnoreAction
.
enabled
=
false
;
}
if
(
e
.
enabled
===
true
)
{
show
(
template
.
subtextContainer
);
}
if
(
e
.
enabled
===
false
)
{
hide
(
template
.
subtextContainer
);
}
this
.
layout
();
}));
}
clearInput
():
void
{
...
...
src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
浏览文件 @
4ecf3f8f
...
...
@@ -918,7 +918,7 @@ class ExtensionsContributions implements IWorkbenchContribution {
menu
:
{
id
:
MenuId
.
ExtensionContext
,
group
:
'
2_configure
'
,
when
:
C
ONTEXT_SYNC_ENABLEMENT
when
:
C
ontextKeyExpr
.
and
(
CONTEXT_SYNC_ENABLEMENT
,
ContextKeyExpr
.
has
(
'
inExtensionEditor
'
).
negate
())
},
});
}
...
...
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
浏览文件 @
4ecf3f8f
...
...
@@ -167,7 +167,7 @@ export abstract class ExtensionAction extends Action implements IExtensionContai
abstract
update
():
void
;
}
export
abstract
class
ActionWithDropDownAction
extends
ExtensionAction
{
export
class
ActionWithDropDownAction
extends
ExtensionAction
{
private
action
:
IAction
|
undefined
;
...
...
@@ -577,7 +577,7 @@ export class LocalInstallAction extends InstallInOtherServerAction {
export
class
UninstallAction
extends
ExtensionAction
{
private
static
readonly
UninstallLabel
=
localize
(
'
uninstallAction
'
,
"
Uninstall
"
);
static
readonly
UninstallLabel
=
localize
(
'
uninstallAction
'
,
"
Uninstall
"
);
private
static
readonly
UninstallingLabel
=
localize
(
'
Uninstalling
'
,
"
Uninstalling
"
);
private
static
readonly
UninstallClass
=
`
${
ExtensionAction
.
LABEL_ACTION_CLASS
}
uninstall`
;
...
...
@@ -832,7 +832,7 @@ export class DropDownMenuActionViewItem extends ExtensionActionViewItem {
}
}
export
function
getContextMenuActions
(
extension
:
IExtension
|
undefined
|
null
,
instantiationService
:
IInstantiationService
):
IAction
[][]
{
export
function
getContextMenuActions
(
extension
:
IExtension
|
undefined
|
null
,
in
ExtensionEditor
:
boolean
,
in
stantiationService
:
IInstantiationService
):
IAction
[][]
{
return
instantiationService
.
invokeFunction
(
accessor
=>
{
const
scopedContextKeyService
=
accessor
.
get
(
IContextKeyService
).
createScoped
();
const
menuService
=
accessor
.
get
(
IMenuService
);
...
...
@@ -845,6 +845,7 @@ export function getContextMenuActions(extension: IExtension | undefined | null,
scopedContextKeyService
.
createKey
<
boolean
>
(
'
isExtensionRecommended
'
,
!!
extensionRecommendationsService
.
getAllRecommendationsWithReason
()[
extension
.
identifier
.
id
.
toLowerCase
()]);
scopedContextKeyService
.
createKey
<
boolean
>
(
'
isExtensionWorkspaceRecommended
'
,
extensionRecommendationsService
.
getAllRecommendationsWithReason
()[
extension
.
identifier
.
id
.
toLowerCase
()]?.
reasonId
===
ExtensionRecommendationReason
.
Workspace
);
scopedContextKeyService
.
createKey
<
boolean
>
(
'
isUserIgnoredRecommendation
'
,
extensionIgnoredRecommendationsService
.
globalIgnoredRecommendations
.
some
(
e
=>
e
===
extension
.
identifier
.
id
.
toLowerCase
()));
scopedContextKeyService
.
createKey
<
boolean
>
(
'
inExtensionEditor
'
,
inExtensionEditor
);
if
(
extension
.
state
===
ExtensionState
.
Installed
)
{
scopedContextKeyService
.
createKey
<
string
>
(
'
extensionStatus
'
,
'
installed
'
);
}
...
...
@@ -917,7 +918,7 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
this
.
instantiationService
.
createInstance
(
InstallAnotherVersionAction
)
]);
getContextMenuActions
(
this
.
extension
,
this
.
instantiationService
).
forEach
(
actions
=>
groups
.
push
(
actions
));
getContextMenuActions
(
this
.
extension
,
false
,
this
.
instantiationService
).
forEach
(
actions
=>
groups
.
push
(
actions
));
groups
.
forEach
(
group
=>
group
.
forEach
(
extensionAction
=>
{
if
(
extensionAction
instanceof
ExtensionAction
)
{
...
...
@@ -945,6 +946,51 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
}
}
export
class
ExtensionEditorManageExtensionAction
extends
ExtensionDropDownAction
{
private
static
readonly
ID
=
'
extensionEditor.manageExtension
'
;
private
static
readonly
Class
=
`
${
ExtensionAction
.
ICON_ACTION_CLASS
}
manage codicon-gear`
;
private
static
readonly
HideManageExtensionClass
=
`
${
ExtensionEditorManageExtensionAction
.
Class
}
hide`
;
constructor
(
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IExtensionService
private
readonly
extensionService
:
IExtensionService
)
{
super
(
ExtensionEditorManageExtensionAction
.
ID
,
''
,
''
,
true
,
true
,
instantiationService
);
this
.
tooltip
=
localize
(
'
manage
'
,
"
Manage
"
);
this
.
update
();
}
async
getActionGroups
(
runningExtensions
:
IExtensionDescription
[]):
Promise
<
IAction
[][]
>
{
const
groups
:
IAction
[][]
=
[];
getContextMenuActions
(
this
.
extension
,
true
,
this
.
instantiationService
).
forEach
(
actions
=>
groups
.
push
(
actions
));
groups
.
forEach
(
group
=>
group
.
forEach
(
extensionAction
=>
{
if
(
extensionAction
instanceof
ExtensionAction
)
{
extensionAction
.
extension
=
this
.
extension
;
}
}));
return
groups
;
}
async
run
():
Promise
<
any
>
{
const
runtimeExtensions
=
await
this
.
extensionService
.
getExtensions
();
return
super
.
run
({
actionGroups
:
await
this
.
getActionGroups
(
runtimeExtensions
),
disposeActionsOnHide
:
true
});
}
update
():
void
{
this
.
class
=
ExtensionEditorManageExtensionAction
.
HideManageExtensionClass
;
this
.
enabled
=
false
;
if
(
this
.
extension
)
{
const
state
=
this
.
extension
.
state
;
this
.
enabled
=
state
===
ExtensionState
.
Installed
;
this
.
class
=
this
.
enabled
||
state
===
ExtensionState
.
Uninstalling
?
ExtensionEditorManageExtensionAction
.
Class
:
ExtensionEditorManageExtensionAction
.
HideManageExtensionClass
;
this
.
tooltip
=
state
===
ExtensionState
.
Uninstalling
?
localize
(
'
ManageExtensionAction.uninstallingTooltip
'
,
"
Uninstalling
"
)
:
''
;
}
}
}
export
class
MenuItemExtensionAction
extends
ExtensionAction
{
constructor
(
...
...
@@ -981,12 +1027,12 @@ export class InstallAnotherVersionAction extends ExtensionAction {
@
IQuickInputService
private
readonly
quickInputService
:
IQuickInputService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
)
{
super
(
InstallAnotherVersionAction
.
ID
,
InstallAnotherVersionAction
.
LABEL
);
super
(
InstallAnotherVersionAction
.
ID
,
InstallAnotherVersionAction
.
LABEL
,
ExtensionAction
.
LABEL_ACTION_CLASS
);
this
.
update
();
}
update
():
void
{
this
.
enabled
=
!!
this
.
extension
&&
!
this
.
extension
.
isBuiltin
&&
!!
this
.
extension
.
gallery
;
this
.
enabled
=
!!
this
.
extension
&&
!
this
.
extension
.
isBuiltin
&&
!!
this
.
extension
.
gallery
&&
this
.
extension
.
state
!==
ExtensionState
.
Uninstalling
&&
this
.
extension
.
state
!==
ExtensionState
.
Installing
;
}
run
():
Promise
<
any
>
{
...
...
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
浏览文件 @
4ecf3f8f
...
...
@@ -249,7 +249,7 @@ export class ExtensionsListView extends ViewPane {
getActions
:
()
=>
actions
.
slice
(
0
,
actions
.
length
-
1
)
});
}
else
if
(
e
.
element
)
{
const
groups
=
getContextMenuActions
(
e
.
element
,
this
.
instantiationService
);
const
groups
=
getContextMenuActions
(
e
.
element
,
false
,
this
.
instantiationService
);
groups
.
forEach
(
group
=>
group
.
forEach
(
extensionAction
=>
{
if
(
extensionAction
instanceof
ExtensionAction
)
{
extensionAction
.
extension
=
e
.
element
!
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录