mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-15 07:41:11 +01:00
Fix autoSaveDelay missing from Commonly Used, add warnings for settings patterns
This commit is contained in:
@@ -964,7 +964,7 @@ export class SettingsEditor2 extends EditorPane {
|
||||
|
||||
const groups = this.defaultSettingsEditorModel.settingsGroups.slice(1); // Without commonlyUsed
|
||||
const dividedGroups = collections.groupBy(groups, g => g.extensionInfo ? 'extension' : 'core');
|
||||
const settingsResult = resolveSettingsTree(tocData, dividedGroups.core);
|
||||
const settingsResult = resolveSettingsTree(tocData, dividedGroups.core, this.logService);
|
||||
const resolvedSettingsRoot = settingsResult.tree;
|
||||
|
||||
// Warn for settings not included in layout
|
||||
@@ -978,7 +978,7 @@ export class SettingsEditor2 extends EditorPane {
|
||||
this.hasWarnedMissingSettings = true;
|
||||
}
|
||||
|
||||
const commonlyUsed = resolveSettingsTree(commonlyUsedData, dividedGroups.core);
|
||||
const commonlyUsed = resolveSettingsTree(commonlyUsedData, dividedGroups.core, this.logService);
|
||||
resolvedSettingsRoot.children!.unshift(commonlyUsed.tree);
|
||||
|
||||
resolvedSettingsRoot.children!.push(resolveExtensionsSettings(dividedGroups.extension || []));
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface ITOCEntry {
|
||||
export const commonlyUsedData: ITOCEntry = {
|
||||
id: 'commonlyUsed',
|
||||
label: localize('commonlyUsed', "Commonly Used"),
|
||||
settings: ['files.autoSave', 'editor.fontSize', 'editor.fontSizeDelay', 'editor.fontFamily', 'editor.tabSize', 'editor.renderWhitespace', 'editor.cursorStyle', 'editor.multiCursorModifier', 'editor.insertSpaces', 'editor.wordWrap', 'files.exclude', 'files.associations', 'workbench.editor.enablePreview']
|
||||
settings: ['files.autoSave', 'files.autoSaveDelay', 'editor.fontSize', 'editor.fontFamily', 'editor.tabSize', 'editor.renderWhitespace', 'editor.cursorStyle', 'editor.multiCursorModifier', 'editor.insertSpaces', 'editor.wordWrap', 'files.exclude', 'files.associations', 'workbench.editor.enablePreview']
|
||||
};
|
||||
|
||||
export const tocData: ITOCEntry = {
|
||||
|
||||
@@ -55,6 +55,7 @@ import { IList } from 'vs/base/browser/ui/tree/indexTreeModel';
|
||||
import { IListService, WorkbenchObjectTree } from 'vs/platform/list/browser/listService';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
const $ = DOM.$;
|
||||
|
||||
@@ -257,10 +258,10 @@ function getListDisplayValue(element: SettingsTreeSettingElement): IListDataItem
|
||||
});
|
||||
}
|
||||
|
||||
export function resolveSettingsTree(tocData: ITOCEntry, coreSettingsGroups: ISettingsGroup[]): { tree: ITOCEntry, leftoverSettings: Set<ISetting> } {
|
||||
export function resolveSettingsTree(tocData: ITOCEntry, coreSettingsGroups: ISettingsGroup[], logService: ILogService): { tree: ITOCEntry, leftoverSettings: Set<ISetting> } {
|
||||
const allSettings = getFlatSettings(coreSettingsGroups);
|
||||
return {
|
||||
tree: _resolveSettingsTree(tocData, allSettings),
|
||||
tree: _resolveSettingsTree(tocData, allSettings, logService),
|
||||
leftoverSettings: allSettings
|
||||
};
|
||||
}
|
||||
@@ -288,17 +289,17 @@ export function resolveExtensionsSettings(groups: ISettingsGroup[]): ITOCEntry {
|
||||
};
|
||||
}
|
||||
|
||||
function _resolveSettingsTree(tocData: ITOCEntry, allSettings: Set<ISetting>): ITOCEntry {
|
||||
function _resolveSettingsTree(tocData: ITOCEntry, allSettings: Set<ISetting>, logService: ILogService): ITOCEntry {
|
||||
let children: ITOCEntry[] | undefined;
|
||||
if (tocData.children) {
|
||||
children = tocData.children
|
||||
.map(child => _resolveSettingsTree(child, allSettings))
|
||||
.map(child => _resolveSettingsTree(child, allSettings, logService))
|
||||
.filter(child => (child.children && child.children.length) || (child.settings && child.settings.length));
|
||||
}
|
||||
|
||||
let settings: ISetting[] | undefined;
|
||||
if (tocData.settings) {
|
||||
settings = arrays.flatten(tocData.settings.map(pattern => getMatchingSettings(allSettings, <string>pattern)));
|
||||
settings = arrays.flatten(tocData.settings.map(pattern => getMatchingSettings(allSettings, <string>pattern, logService)));
|
||||
}
|
||||
|
||||
if (!children && !settings) {
|
||||
@@ -313,7 +314,7 @@ function _resolveSettingsTree(tocData: ITOCEntry, allSettings: Set<ISetting>): I
|
||||
};
|
||||
}
|
||||
|
||||
function getMatchingSettings(allSettings: Set<ISetting>, pattern: string): ISetting[] {
|
||||
function getMatchingSettings(allSettings: Set<ISetting>, pattern: string, logService: ILogService): ISetting[] {
|
||||
const result: ISetting[] = [];
|
||||
|
||||
allSettings.forEach(s => {
|
||||
@@ -323,6 +324,9 @@ function getMatchingSettings(allSettings: Set<ISetting>, pattern: string): ISett
|
||||
}
|
||||
});
|
||||
|
||||
if (!result.length) {
|
||||
logService.warn(`Settings pattern "${pattern}" doesn't match any settings`);
|
||||
}
|
||||
|
||||
return result.sort((a, b) => a.key.localeCompare(b.key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user