Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3ee6fc3f
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,发现更多精彩内容 >>
提交
3ee6fc3f
编写于
11月 13, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix showing newly enabled extension in enabled section
上级
3d8ad7d7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
32 deletion
+50
-32
src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
...s/workbench/contrib/extensions/browser/extensionEditor.ts
+1
-3
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
...workbench/contrib/extensions/browser/extensionsActions.ts
+28
-9
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
...s/workbench/contrib/extensions/browser/extensionsViews.ts
+21
-20
未找到文件。
src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
浏览文件 @
3ee6fc3f
...
...
@@ -332,8 +332,6 @@ export class ExtensionEditor extends EditorPane {
}
private
async
updateTemplate
(
input
:
ExtensionsInput
,
template
:
IExtensionEditorTemplate
,
preserveFocus
:
boolean
):
Promise
<
void
>
{
const
runningExtensions
=
await
this
.
extensionService
.
getExtensions
();
this
.
activeElement
=
null
;
this
.
editorLoadComplete
=
false
;
const
extension
=
input
.
extension
;
...
...
@@ -421,7 +419,7 @@ export class ExtensionEditor extends EditorPane {
this
.
instantiationService
.
createInstance
(
SetProductIconThemeAction
,
await
this
.
workbenchThemeService
.
getProductIconThemes
()),
this
.
instantiationService
.
createInstance
(
EnableDropDownAction
),
this
.
instantiationService
.
createInstance
(
DisableDropDownAction
,
runningExtensions
),
this
.
instantiationService
.
createInstance
(
DisableDropDownAction
),
this
.
instantiationService
.
createInstance
(
RemoteInstallAction
,
false
),
this
.
instantiationService
.
createInstance
(
LocalInstallAction
),
combinedInstallAction
,
...
...
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
浏览文件 @
3ee6fc3f
...
...
@@ -1104,7 +1104,7 @@ export class DisableForWorkspaceAction extends ExtensionAction {
static
readonly
ID
=
'
extensions.disableForWorkspace
'
;
static
readonly
LABEL
=
localize
(
'
disableForWorkspaceAction
'
,
"
Disable (Workspace)
"
);
constructor
(
readonly
runningExtensions
:
IExtensionDescription
[],
constructor
(
private
_
runningExtensions
:
IExtensionDescription
[],
@
IWorkspaceContextService
private
readonly
workspaceContextService
:
IWorkspaceContextService
,
@
IExtensionsWorkbenchService
private
readonly
extensionsWorkbenchService
:
IExtensionsWorkbenchService
,
@
IWorkbenchExtensionEnablementService
private
readonly
extensionEnablementService
:
IWorkbenchExtensionEnablementService
...
...
@@ -1113,9 +1113,14 @@ export class DisableForWorkspaceAction extends ExtensionAction {
this
.
update
();
}
set
runningExtensions
(
runningExtensions
:
IExtensionDescription
[])
{
this
.
_runningExtensions
=
runningExtensions
;
this
.
update
();
}
update
():
void
{
this
.
enabled
=
false
;
if
(
this
.
extension
&&
this
.
extension
.
local
&&
this
.
runningExtensions
.
some
(
e
=>
areSameExtensions
({
id
:
e
.
identifier
.
value
,
uuid
:
e
.
uuid
},
this
.
extension
!
.
identifier
)
&&
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
))
{
if
(
this
.
extension
&&
this
.
extension
.
local
&&
this
.
_
runningExtensions
.
some
(
e
=>
areSameExtensions
({
id
:
e
.
identifier
.
value
,
uuid
:
e
.
uuid
},
this
.
extension
!
.
identifier
)
&&
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
))
{
this
.
enabled
=
this
.
extension
.
state
===
ExtensionState
.
Installed
&&
(
this
.
extension
.
enablementState
===
EnablementState
.
EnabledGlobally
||
this
.
extension
.
enablementState
===
EnablementState
.
EnabledWorkspace
)
&&
this
.
extensionEnablementService
.
canChangeWorkspaceEnablement
(
this
.
extension
.
local
);
...
...
@@ -1135,7 +1140,8 @@ export class DisableGloballyAction extends ExtensionAction {
static
readonly
ID
=
'
extensions.disableGlobally
'
;
static
readonly
LABEL
=
localize
(
'
disableGloballyAction
'
,
"
Disable
"
);
constructor
(
readonly
runningExtensions
:
IExtensionDescription
[],
constructor
(
private
_runningExtensions
:
IExtensionDescription
[],
@
IExtensionsWorkbenchService
private
readonly
extensionsWorkbenchService
:
IExtensionsWorkbenchService
,
@
IWorkbenchExtensionEnablementService
private
readonly
extensionEnablementService
:
IWorkbenchExtensionEnablementService
)
{
...
...
@@ -1143,9 +1149,14 @@ export class DisableGloballyAction extends ExtensionAction {
this
.
update
();
}
set
runningExtensions
(
runningExtensions
:
IExtensionDescription
[])
{
this
.
_runningExtensions
=
runningExtensions
;
this
.
update
();
}
update
():
void
{
this
.
enabled
=
false
;
if
(
this
.
extension
&&
this
.
extension
.
local
&&
this
.
runningExtensions
.
some
(
e
=>
areSameExtensions
({
id
:
e
.
identifier
.
value
,
uuid
:
e
.
uuid
},
this
.
extension
!
.
identifier
)))
{
if
(
this
.
extension
&&
this
.
extension
.
local
&&
this
.
_
runningExtensions
.
some
(
e
=>
areSameExtensions
({
id
:
e
.
identifier
.
value
,
uuid
:
e
.
uuid
},
this
.
extension
!
.
identifier
)))
{
this
.
enabled
=
this
.
extension
.
state
===
ExtensionState
.
Installed
&&
(
this
.
extension
.
enablementState
===
EnablementState
.
EnabledGlobally
||
this
.
extension
.
enablementState
===
EnablementState
.
EnabledWorkspace
)
&&
this
.
extensionEnablementService
.
canChangeEnablement
(
this
.
extension
.
local
);
...
...
@@ -1175,13 +1186,21 @@ export class EnableDropDownAction extends ActionWithDropDownAction {
export
class
DisableDropDownAction
extends
ActionWithDropDownAction
{
constructor
(
runningExtensions
:
IExtensionDescription
[]
,
@
IExtensionService
extensionService
:
IExtensionService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
)
{
super
(
'
extensions.disable
'
,
localize
(
'
disableAction
'
,
"
Disable
"
),
[
instantiationService
.
createInstance
(
DisableGloballyAction
,
runningExtensions
),
instantiationService
.
createInstance
(
DisableForWorkspaceAction
,
runningExtensions
)
]);
const
actions
=
[
instantiationService
.
createInstance
(
DisableGloballyAction
,
[]),
instantiationService
.
createInstance
(
DisableForWorkspaceAction
,
[])
];
super
(
'
extensions.disable
'
,
localize
(
'
disableAction
'
,
"
Disable
"
),
actions
);
const
updateRunningExtensions
=
async
()
=>
{
const
runningExtensions
=
await
extensionService
.
getExtensions
();
actions
.
forEach
(
a
=>
a
.
runningExtensions
=
runningExtensions
);
};
updateRunningExtensions
();
this
.
_register
(
extensionService
.
onDidChangeExtensions
(()
=>
updateRunningExtensions
()));
}
}
...
...
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
浏览文件 @
3ee6fc3f
...
...
@@ -322,22 +322,26 @@ export class ExtensionsListView extends ViewPane {
private
async
queryLocal
(
query
:
Query
,
options
:
IQueryOptions
):
Promise
<
IQueryResult
>
{
const
local
=
await
this
.
extensionsWorkbenchService
.
queryLocal
();
let
{
extensions
,
canIncludeInstalledExtensions
}
=
await
this
.
filterLocal
(
local
,
query
,
options
);
const
runningExtensions
=
await
this
.
extensionService
.
getExtensions
();
let
{
extensions
,
canIncludeInstalledExtensions
}
=
this
.
filterLocal
(
local
,
runningExtensions
,
query
,
options
);
const
disposables
=
new
DisposableStore
();
const
onDidChangeModel
=
disposables
.
add
(
new
Emitter
<
IPagedModel
<
IExtension
>>
());
if
(
canIncludeInstalledExtensions
)
{
let
isDisposed
:
boolean
=
false
;
disposables
.
add
(
toDisposable
(()
=>
isDisposed
=
true
));
disposables
.
add
(
this
.
extensionsWorkbenchService
.
onChange
(
async
e
=>
{
if
(
e
?.
state
===
ExtensionState
.
Installed
)
{
const
{
extensions
:
newExtensions
}
=
await
this
.
filterLocal
(
this
.
extensionsWorkbenchService
.
local
,
query
,
options
);
if
(
!
isDisposed
)
{
const
mergedExtensions
=
this
.
mergeAddedExtensions
(
extensions
,
newExtensions
);
if
(
mergedExtensions
)
{
extensions
=
mergedExtensions
;
onDidChangeModel
.
fire
(
new
PagedModel
(
extensions
));
}
disposables
.
add
(
Event
.
debounce
(
Event
.
any
(
Event
.
filter
(
this
.
extensionsWorkbenchService
.
onChange
,
e
=>
e
?.
state
===
ExtensionState
.
Installed
),
this
.
extensionService
.
onDidChangeExtensions
),
()
=>
undefined
)(
async
()
=>
{
const
local
=
this
.
extensionsWorkbenchService
.
local
;
const
runningExtensions
=
await
this
.
extensionService
.
getExtensions
();
const
{
extensions
:
newExtensions
}
=
this
.
filterLocal
(
local
,
runningExtensions
,
query
,
options
);
if
(
!
isDisposed
)
{
const
mergedExtensions
=
this
.
mergeAddedExtensions
(
extensions
,
newExtensions
);
if
(
mergedExtensions
)
{
extensions
=
mergedExtensions
;
onDidChangeModel
.
fire
(
new
PagedModel
(
extensions
));
}
}
}));
...
...
@@ -350,7 +354,7 @@ export class ExtensionsListView extends ViewPane {
};
}
private
async
filterLocal
(
local
:
IExtension
[],
query
:
Query
,
options
:
IQueryOptions
):
Promise
<
{
extensions
:
IExtension
[],
canIncludeInstalledExtensions
:
boolean
}
>
{
private
filterLocal
(
local
:
IExtension
[],
runningExtensions
:
IExtensionDescription
[],
query
:
Query
,
options
:
IQueryOptions
):
{
extensions
:
IExtension
[],
canIncludeInstalledExtensions
:
boolean
}
{
let
value
=
query
.
value
;
let
extensions
:
IExtension
[]
=
[];
let
canIncludeInstalledExtensions
=
true
;
...
...
@@ -361,7 +365,7 @@ export class ExtensionsListView extends ViewPane {
}
else
if
(
/@installed/i
.
test
(
value
))
{
extensions
=
await
this
.
filterInstalledExtensions
(
local
,
query
,
options
);
extensions
=
this
.
filterInstalledExtensions
(
local
,
runningExtensions
,
query
,
options
);
}
else
if
(
/@outdated/i
.
test
(
value
))
{
...
...
@@ -369,11 +373,11 @@ export class ExtensionsListView extends ViewPane {
}
else
if
(
/@disabled/i
.
test
(
value
))
{
extensions
=
await
this
.
filterDisabledExtensions
(
local
,
query
,
options
);
extensions
=
this
.
filterDisabledExtensions
(
local
,
runningExtensions
,
query
,
options
);
}
else
if
(
/@enabled/i
.
test
(
value
))
{
extensions
=
await
this
.
filterEnabledExtensions
(
local
,
query
,
options
);
extensions
=
this
.
filterEnabledExtensions
(
local
,
runningExtensions
,
query
,
options
);
}
return
{
extensions
,
canIncludeInstalledExtensions
};
...
...
@@ -441,7 +445,7 @@ export class ExtensionsListView extends ViewPane {
return
{
value
,
categories
};
}
private
async
filterInstalledExtensions
(
local
:
IExtension
[],
query
:
Query
,
options
:
IQueryOptions
):
Promise
<
IExtension
[]
>
{
private
filterInstalledExtensions
(
local
:
IExtension
[],
runningExtensions
:
IExtensionDescription
[],
query
:
Query
,
options
:
IQueryOptions
):
IExtension
[]
{
let
{
value
,
categories
}
=
this
.
parseCategories
(
query
.
value
);
value
=
value
.
replace
(
/@installed/g
,
''
).
replace
(
/@sort:
(\w
+
)(
-
\w
*
)?
/g
,
''
).
trim
().
toLowerCase
();
...
...
@@ -454,7 +458,6 @@ export class ExtensionsListView extends ViewPane {
if
(
options
.
sortBy
!==
undefined
)
{
result
=
this
.
sortExtensions
(
result
,
options
);
}
else
{
const
runningExtensions
=
await
this
.
extensionService
.
getExtensions
();
const
runningExtensionsById
=
runningExtensions
.
reduce
((
result
,
e
)
=>
{
result
.
set
(
ExtensionIdentifier
.
toKey
(
e
.
identifier
.
value
),
e
);
return
result
;
},
new
Map
<
string
,
IExtensionDescription
>
());
result
=
result
.
sort
((
e1
,
e2
)
=>
{
const
running1
=
runningExtensionsById
.
get
(
ExtensionIdentifier
.
toKey
(
e1
.
identifier
.
id
));
...
...
@@ -498,12 +501,11 @@ export class ExtensionsListView extends ViewPane {
return
this
.
sortExtensions
(
result
,
options
);
}
private
async
filterDisabledExtensions
(
local
:
IExtension
[],
query
:
Query
,
options
:
IQueryOptions
):
Promise
<
IExtension
[]
>
{
private
filterDisabledExtensions
(
local
:
IExtension
[],
runningExtensions
:
IExtensionDescription
[],
query
:
Query
,
options
:
IQueryOptions
):
IExtension
[]
{
let
{
value
,
categories
}
=
this
.
parseCategories
(
query
.
value
);
value
=
value
.
replace
(
/@disabled/g
,
''
).
replace
(
/@sort:
(\w
+
)(
-
\w
*
)?
/g
,
''
).
trim
().
toLowerCase
();
const
runningExtensions
=
await
this
.
extensionService
.
getExtensions
();
const
result
=
local
.
sort
((
e1
,
e2
)
=>
e1
.
displayName
.
localeCompare
(
e2
.
displayName
))
.
filter
(
e
=>
runningExtensions
.
every
(
r
=>
!
areSameExtensions
({
id
:
r
.
identifier
.
value
,
uuid
:
r
.
uuid
},
e
.
identifier
))
...
...
@@ -513,13 +515,12 @@ export class ExtensionsListView extends ViewPane {
return
this
.
sortExtensions
(
result
,
options
);
}
private
async
filterEnabledExtensions
(
local
:
IExtension
[],
query
:
Query
,
options
:
IQueryOptions
):
Promise
<
IExtension
[]
>
{
private
filterEnabledExtensions
(
local
:
IExtension
[],
runningExtensions
:
IExtensionDescription
[],
query
:
Query
,
options
:
IQueryOptions
):
IExtension
[]
{
let
{
value
,
categories
}
=
this
.
parseCategories
(
query
.
value
);
value
=
value
?
value
.
replace
(
/@enabled/g
,
''
).
replace
(
/@sort:
(\w
+
)(
-
\w
*
)?
/g
,
''
).
trim
().
toLowerCase
()
:
''
;
local
=
local
.
filter
(
e
=>
!
e
.
isBuiltin
);
const
runningExtensions
=
await
this
.
extensionService
.
getExtensions
();
const
result
=
local
.
sort
((
e1
,
e2
)
=>
e1
.
displayName
.
localeCompare
(
e2
.
displayName
))
.
filter
(
e
=>
runningExtensions
.
some
(
r
=>
areSameExtensions
({
id
:
r
.
identifier
.
value
,
uuid
:
r
.
uuid
},
e
.
identifier
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录