Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ac6237c7
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 搜索 >>
提交
ac6237c7
编写于
5月 22, 2019
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #73374
上级
ff4753f4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
10 deletion
+36
-10
src/vs/workbench/contrib/preferences/browser/settingsLayout.ts
...s/workbench/contrib/preferences/browser/settingsLayout.ts
+5
-1
src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts
...rkbench/contrib/preferences/browser/settingsTreeModels.ts
+9
-3
src/vs/workbench/contrib/preferences/test/browser/settingsTreeModels.test.ts
...ntrib/preferences/test/browser/settingsTreeModels.test.ts
+22
-6
未找到文件。
src/vs/workbench/contrib/preferences/browser/settingsLayout.ts
浏览文件 @
ac6237c7
...
...
@@ -196,7 +196,7 @@ export const tocData: ITOCEntry = {
]
};
export
const
knownAcronyms
=
new
Set
();
export
const
knownAcronyms
=
new
Set
<
string
>
();
[
'
css
'
,
'
html
'
,
...
...
@@ -209,3 +209,7 @@ export const knownAcronyms = new Set();
'
id
'
,
'
php
'
,
].
forEach
(
str
=>
knownAcronyms
.
add
(
str
));
export
const
knownTermMappings
=
new
Map
<
string
,
string
>
();
knownTermMappings
.
set
(
'
power shell
'
,
'
PowerShell
'
);
knownTermMappings
.
set
(
'
powershell
'
,
'
PowerShell
'
);
src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts
浏览文件 @
ac6237c7
...
...
@@ -11,7 +11,7 @@ import { localize } from 'vs/nls';
import
{
ConfigurationTarget
,
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
SettingsTarget
}
from
'
vs/workbench/contrib/preferences/browser/preferencesWidgets
'
;
import
{
ITOCEntry
,
knownAcronyms
}
from
'
vs/workbench/contrib/preferences/browser/settingsLayout
'
;
import
{
ITOCEntry
,
knownAcronyms
,
knownTermMappings
}
from
'
vs/workbench/contrib/preferences/browser/settingsLayout
'
;
import
{
MODIFIED_SETTING_TAG
}
from
'
vs/workbench/contrib/preferences/common/preferences
'
;
import
{
IExtensionSetting
,
ISearchResult
,
ISetting
,
SettingValueType
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
...
...
@@ -404,8 +404,8 @@ export function settingKeyToDisplayFormat(key: string, groupId = ''): { category
}
function
wordifyKey
(
key
:
string
):
string
{
return
key
.
replace
(
/
\.([
a-z0-9
])
/g
,
(
match
,
p1
)
=>
` ›
${
p1
.
toUpperCase
()}
`
)
// Replace dot with spaced '>'
key
=
key
.
replace
(
/
\.([
a-z0-9
])
/g
,
(
_
,
p1
)
=>
` ›
${
p1
.
toUpperCase
()}
`
)
// Replace dot with spaced '>'
.
replace
(
/
([
a-z0-9
])([
A-Z
])
/g
,
'
$1 $2
'
)
// Camel case to spacing, fooBar => foo Bar
.
replace
(
/^
[
a-z
]
/g
,
match
=>
match
.
toUpperCase
())
// Upper casing all first letters, foo => Foo
.
replace
(
/
\b\w
+
\b
/g
,
match
=>
{
// Upper casing known acronyms
...
...
@@ -413,6 +413,12 @@ function wordifyKey(key: string): string {
match
.
toUpperCase
()
:
match
;
});
for
(
let
[
k
,
v
]
of
knownTermMappings
)
{
key
=
key
.
replace
(
new
RegExp
(
`\\b
${
k
}
\\b`
,
'
gi
'
),
v
);
}
return
key
;
}
function
trimCategoryForGroup
(
category
:
string
,
groupId
:
string
):
string
{
...
...
src/vs/workbench/contrib/preferences/test/browser/settingsTreeModels.test.ts
浏览文件 @
ac6237c7
...
...
@@ -35,6 +35,20 @@ suite('SettingsTree', () => {
category
:
''
,
label
:
'
Foo
'
});
assert
.
deepEqual
(
settingKeyToDisplayFormat
(
'
foo.1leading.number
'
),
{
category
:
'
Foo › 1leading
'
,
label
:
'
Number
'
});
assert
.
deepEqual
(
settingKeyToDisplayFormat
(
'
foo.1Leading.number
'
),
{
category
:
'
Foo › 1 Leading
'
,
label
:
'
Number
'
});
});
test
(
'
settingKeyToDisplayFormat - with category
'
,
()
=>
{
...
...
@@ -101,19 +115,21 @@ suite('SettingsTree', () => {
category
:
'
Something Else
'
,
label
:
'
Etc
'
});
});
test
(
'
settingKeyToDisplayFormat - known acronym/term
'
,
()
=>
{
assert
.
deepEqual
(
settingKeyToDisplayFormat
(
'
foo.1leading.number
'
),
settingKeyToDisplayFormat
(
'
css.someCssSetting
'
),
{
category
:
'
Foo › 1leading
'
,
label
:
'
Number
'
category
:
'
CSS
'
,
label
:
'
Some CSS Setting
'
});
assert
.
deepEqual
(
settingKeyToDisplayFormat
(
'
foo.1Leading.number
'
),
settingKeyToDisplayFormat
(
'
powershell.somePowerShellSetting
'
),
{
category
:
'
Foo › 1 Leading
'
,
label
:
'
Number
'
category
:
'
PowerShell
'
,
label
:
'
Some PowerShell Setting
'
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录