mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
Merge from vscode 8aa90d444f5d051984e8055f547c4252d53479b3 (#5587)
* Merge from vscode 8aa90d444f5d051984e8055f547c4252d53479b3 * pipeline errors * fix build
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1225,8 +1225,14 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearFilterLinkContainer.style.display = this.viewState.tagFilters && this.viewState.tagFilters.size > 0
|
||||
? 'initial'
|
||||
: 'none';
|
||||
|
||||
if (!this.searchResultModel) {
|
||||
this.countElement.style.display = 'none';
|
||||
DOM.removeClass(this.rootElement, 'no-results');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.tocTreeModel && this.tocTreeModel.settingsTreeRoot) {
|
||||
@@ -1239,9 +1245,6 @@ export class SettingsEditor2 extends BaseEditor {
|
||||
|
||||
this.countElement.style.display = 'block';
|
||||
DOM.toggleClass(this.rootElement, 'no-results', count === 0);
|
||||
this.clearFilterLinkContainer.style.display = this.viewState.tagFilters && this.viewState.tagFilters.size > 0
|
||||
? 'initial'
|
||||
: 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user