mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-25 04:36:23 +00:00
Merge pull request #73758 from DavidMunozMartinez/master
Possible fix for #72483
This commit is contained in:
@@ -405,10 +405,10 @@ export function settingKeyToDisplayFormat(key: string, groupId = ''): { category
|
||||
|
||||
function wordifyKey(key: string): string {
|
||||
return key
|
||||
.replace(/\.([a-z])/g, (match, p1) => ` › ${p1.toUpperCase()}`)
|
||||
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
|
||||
.replace(/^[a-z]/g, match => match.toUpperCase()) // foo => Foo
|
||||
.replace(/\b\w+\b/g, match => {
|
||||
.replace(/\.([a-z0-9])/g, (match, 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
|
||||
return knownAcronyms.has(match.toLowerCase()) ?
|
||||
match.toUpperCase() :
|
||||
match;
|
||||
|
||||
@@ -101,6 +101,20 @@ suite('SettingsTree', () => {
|
||||
category: 'Something Else',
|
||||
label: 'Etc'
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
settingKeyToDisplayFormat('foo.1leading.number'),
|
||||
{
|
||||
category: 'Foo › 1leading',
|
||||
label: 'Number'
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
settingKeyToDisplayFormat('foo.1Leading.number'),
|
||||
{
|
||||
category: 'Foo › 1 Leading',
|
||||
label: 'Number'
|
||||
});
|
||||
});
|
||||
|
||||
test('parseQuery', () => {
|
||||
|
||||
Reference in New Issue
Block a user