Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ffbd6987
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ffbd6987
编写于
1月 26, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Settings search - show individual Folder settings counts in dropdown
上级
41e7dbc0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
27 deletion
+31
-27
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+10
-9
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
...workbench/parts/preferences/browser/preferencesWidgets.ts
+21
-18
未找到文件。
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
ffbd6987
...
@@ -488,26 +488,27 @@ class PreferencesRenderersController extends Disposable {
...
@@ -488,26 +488,27 @@ class PreferencesRenderersController extends Disposable {
}
}
private
searchAllSettingsTargets
(
query
:
string
,
searchProvider
:
ISearchProvider
,
groupId
:
string
,
groupLabel
:
string
,
groupOrder
:
number
):
TPromise
<
void
>
{
private
searchAllSettingsTargets
(
query
:
string
,
searchProvider
:
ISearchProvider
,
groupId
:
string
,
groupLabel
:
string
,
groupOrder
:
number
):
TPromise
<
void
>
{
if
(
!
query
)
{
// Don't open the other settings targets when query is empty
return
TPromise
.
wrap
(
null
);
}
const
searchPs
=
[
const
searchPs
=
[
this
.
searchSettingsTarget
(
searchProvider
,
ConfigurationTarget
.
WORKSPACE
,
groupId
,
groupLabel
,
groupOrder
),
this
.
searchSettingsTarget
(
query
,
searchProvider
,
ConfigurationTarget
.
WORKSPACE
,
groupId
,
groupLabel
,
groupOrder
),
this
.
searchSettingsTarget
(
searchProvider
,
ConfigurationTarget
.
USER
,
groupId
,
groupLabel
,
groupOrder
)
this
.
searchSettingsTarget
(
query
,
searchProvider
,
ConfigurationTarget
.
USER
,
groupId
,
groupLabel
,
groupOrder
)
];
];
for
(
const
folder
of
this
.
workspaceContextService
.
getWorkspace
().
folders
)
{
for
(
const
folder
of
this
.
workspaceContextService
.
getWorkspace
().
folders
)
{
const
folderSettingsResource
=
this
.
preferencesService
.
getFolderSettingsResource
(
folder
.
uri
);
const
folderSettingsResource
=
this
.
preferencesService
.
getFolderSettingsResource
(
folder
.
uri
);
searchPs
.
push
(
this
.
searchSettingsTarget
(
searchProvider
,
folderSettingsResource
,
groupId
,
groupLabel
,
groupOrder
));
searchPs
.
push
(
this
.
searchSettingsTarget
(
query
,
searchProvider
,
folderSettingsResource
,
groupId
,
groupLabel
,
groupOrder
));
}
}
return
TPromise
.
join
(
searchPs
).
then
(()
=>
{
});
return
TPromise
.
join
(
searchPs
).
then
(()
=>
{
});
}
}
private
searchSettingsTarget
(
provider
:
ISearchProvider
,
target
:
SettingsTarget
,
groupId
:
string
,
groupLabel
:
string
,
groupOrder
:
number
):
TPromise
<
void
>
{
private
searchSettingsTarget
(
query
:
string
,
provider
:
ISearchProvider
,
target
:
SettingsTarget
,
groupId
:
string
,
groupLabel
:
string
,
groupOrder
:
number
):
TPromise
<
void
>
{
if
(
!
query
)
{
// Don't open the other settings targets when query is empty
this
.
_onDidFilterResultsCountChange
.
fire
({
target
,
count
:
0
});
return
TPromise
.
wrap
(
null
);
}
return
this
.
getPreferencesEditorModel
(
target
).
then
(
model
=>
{
return
this
.
getPreferencesEditorModel
(
target
).
then
(
model
=>
{
return
this
.
_filterOrSearchPreferencesModel
(
''
,
<
ISettingsEditorModel
>
model
,
provider
,
groupId
,
groupLabel
,
groupOrder
);
return
this
.
_filterOrSearchPreferencesModel
(
''
,
<
ISettingsEditorModel
>
model
,
provider
,
groupId
,
groupLabel
,
groupOrder
);
}).
then
(
result
=>
{
}).
then
(
result
=>
{
...
...
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
浏览文件 @
ffbd6987
...
@@ -281,7 +281,7 @@ export class SettingsGroupTitleWidget extends Widget implements IViewZone {
...
@@ -281,7 +281,7 @@ export class SettingsGroupTitleWidget extends Widget implements IViewZone {
export
class
FolderSettingsActionItem
extends
BaseActionItem
{
export
class
FolderSettingsActionItem
extends
BaseActionItem
{
private
_folder
:
IWorkspaceFolder
;
private
_folder
:
IWorkspaceFolder
;
private
_
count
:
number
;
private
_
folderSettingCounts
=
new
Map
<
string
,
number
>
()
;
private
container
:
HTMLElement
;
private
container
:
HTMLElement
;
private
anchorElement
:
HTMLElement
;
private
anchorElement
:
HTMLElement
;
...
@@ -311,8 +311,9 @@ export class FolderSettingsActionItem extends BaseActionItem {
...
@@ -311,8 +311,9 @@ export class FolderSettingsActionItem extends BaseActionItem {
this
.
update
();
this
.
update
();
}
}
public
setCount
(
value
:
number
):
void
{
public
setCount
(
settingsTarget
:
URI
,
count
:
number
):
void
{
this
.
_count
=
value
;
const
folder
=
this
.
contextService
.
getWorkspaceFolder
(
settingsTarget
).
uri
;
this
.
_folderSettingCounts
.
set
(
folder
.
toString
(),
count
);
this
.
update
();
this
.
update
();
}
}
...
@@ -383,21 +384,18 @@ export class FolderSettingsActionItem extends BaseActionItem {
...
@@ -383,21 +384,18 @@ export class FolderSettingsActionItem extends BaseActionItem {
}
}
private
update
():
void
{
private
update
():
void
{
let
total
=
0
;
this
.
_folderSettingCounts
.
forEach
(
n
=>
total
+=
n
);
const
workspace
=
this
.
contextService
.
getWorkspace
();
const
workspace
=
this
.
contextService
.
getWorkspace
();
if
(
this
.
_folder
)
{
if
(
this
.
_folder
)
{
this
.
labelElement
.
textContent
=
this
.
_folder
.
name
;
this
.
labelElement
.
textContent
=
this
.
_folder
.
name
;
this
.
anchorElement
.
title
=
this
.
_folder
.
name
;
this
.
anchorElement
.
title
=
this
.
_folder
.
name
;
let
detailsText
=
this
.
_action
.
label
;
const
detailsText
=
this
.
labelWithCount
(
this
.
_action
.
label
,
total
);
if
(
this
.
_count
)
{
detailsText
+=
` (
${
this
.
_count
}
)`
;
}
this
.
detailsElement
.
textContent
=
detailsText
;
this
.
detailsElement
.
textContent
=
detailsText
;
DOM
.
toggleClass
(
this
.
dropDownElement
,
'
hide
'
,
workspace
.
folders
.
length
===
1
||
!
this
.
_action
.
checked
);
DOM
.
toggleClass
(
this
.
dropDownElement
,
'
hide
'
,
workspace
.
folders
.
length
===
1
||
!
this
.
_action
.
checked
);
}
else
{
}
else
{
let
labelText
=
this
.
_action
.
label
;
const
labelText
=
this
.
labelWithCount
(
this
.
_action
.
label
,
total
);
if
(
this
.
_count
)
{
labelText
+=
` (
${
this
.
_count
}
)`
;
}
this
.
labelElement
.
textContent
=
labelText
;
this
.
labelElement
.
textContent
=
labelText
;
this
.
detailsElement
.
textContent
=
''
;
this
.
detailsElement
.
textContent
=
''
;
this
.
anchorElement
.
title
=
this
.
_action
.
label
;
this
.
anchorElement
.
title
=
this
.
_action
.
label
;
...
@@ -424,9 +422,10 @@ export class FolderSettingsActionItem extends BaseActionItem {
...
@@ -424,9 +422,10 @@ export class FolderSettingsActionItem extends BaseActionItem {
if
(
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
&&
workspaceFolders
.
length
>
0
)
{
if
(
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
&&
workspaceFolders
.
length
>
0
)
{
actions
.
push
(
new
Separator
());
actions
.
push
(
new
Separator
());
actions
.
push
(...
workspaceFolders
.
map
((
folder
,
index
)
=>
{
actions
.
push
(...
workspaceFolders
.
map
((
folder
,
index
)
=>
{
const
folderCount
=
this
.
_folderSettingCounts
.
get
(
folder
.
uri
.
toString
());
return
<
IAction
>
{
return
<
IAction
>
{
id
:
'
folderSettingsTarget
'
+
index
,
id
:
'
folderSettingsTarget
'
+
index
,
label
:
folder
.
name
,
label
:
this
.
labelWithCount
(
folder
.
name
,
folderCount
)
,
checked
:
this
.
folder
&&
this
.
folder
.
uri
.
toString
()
===
folder
.
uri
.
toString
(),
checked
:
this
.
folder
&&
this
.
folder
.
uri
.
toString
()
===
folder
.
uri
.
toString
(),
enabled
:
true
,
enabled
:
true
,
run
:
()
=>
this
.
_action
.
run
(
folder
)
run
:
()
=>
this
.
_action
.
run
(
folder
)
...
@@ -436,6 +435,15 @@ export class FolderSettingsActionItem extends BaseActionItem {
...
@@ -436,6 +435,15 @@ export class FolderSettingsActionItem extends BaseActionItem {
return
actions
;
return
actions
;
}
}
private
labelWithCount
(
label
:
string
,
count
:
number
|
undefined
):
string
{
// Append the count if it's >0 and not undefined
if
(
count
)
{
label
+=
` (
${
count
}
)`
;
}
return
label
;
}
public
dispose
():
void
{
public
dispose
():
void
{
dispose
(
this
.
disposables
);
dispose
(
this
.
disposables
);
super
.
dispose
();
super
.
dispose
();
...
@@ -450,7 +458,6 @@ export class SettingsTargetsWidget extends Widget {
...
@@ -450,7 +458,6 @@ export class SettingsTargetsWidget extends Widget {
private
userSettings
:
Action
;
private
userSettings
:
Action
;
private
workspaceSettings
:
Action
;
private
workspaceSettings
:
Action
;
private
folderSettings
:
FolderSettingsActionItem
;
private
folderSettings
:
FolderSettingsActionItem
;
private
folderSettingCounts
=
new
Map
<
string
,
number
>
();
private
_settingsTarget
:
SettingsTarget
;
private
_settingsTarget
:
SettingsTarget
;
...
@@ -523,11 +530,7 @@ export class SettingsTargetsWidget extends Widget {
...
@@ -523,11 +530,7 @@ export class SettingsTargetsWidget extends Widget {
this
.
userSettings
.
label
=
label
;
this
.
userSettings
.
label
=
label
;
}
else
if
(
settingsTarget
instanceof
URI
)
{
}
else
if
(
settingsTarget
instanceof
URI
)
{
this
.
folderSettingCounts
.
set
(
settingsTarget
.
toString
(),
count
);
this
.
folderSettings
.
setCount
(
settingsTarget
,
count
);
let
total
=
0
;
this
.
folderSettingCounts
.
forEach
(
count
=>
total
+=
count
);
this
.
folderSettings
.
setCount
(
total
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录