mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-25 01:41:41 +01:00
fix: refresh single element when element is known (#220126)
This commit is contained in:
@@ -1408,9 +1408,7 @@ export class SettingsEditor2 extends EditorPane {
|
||||
keys.forEach(key => this.settingsTreeModel.updateElementsByName(key));
|
||||
}
|
||||
|
||||
// Attempt to render the tree once rather than
|
||||
// once for each key to avoid redundant calls to this.refreshTree()
|
||||
this.renderTree();
|
||||
keys.forEach(key => this.renderTree(key));
|
||||
} else {
|
||||
this.renderTree();
|
||||
}
|
||||
@@ -1450,7 +1448,6 @@ export class SettingsEditor2 extends EditorPane {
|
||||
// update `list`s live, as they have a separate "submit edit" step built in before this
|
||||
(focusedSetting.parentElement && !focusedSetting.parentElement.classList.contains('setting-item-list'))
|
||||
) {
|
||||
|
||||
this.updateModifiedLabelForKey(key);
|
||||
this.scheduleRefresh(focusedSetting, key);
|
||||
return;
|
||||
@@ -1466,8 +1463,10 @@ export class SettingsEditor2 extends EditorPane {
|
||||
if (key) {
|
||||
const elements = this.currentSettingsModel.getElementsByName(key);
|
||||
if (elements && elements.length) {
|
||||
// TODO https://github.com/microsoft/vscode/issues/57360
|
||||
this.refreshTree();
|
||||
if (elements.length >= 2) {
|
||||
console.warn('More than one setting with key ' + key + ' found');
|
||||
}
|
||||
this.refreshSingleElement(elements[0]);
|
||||
} else {
|
||||
// Refresh requested for a key that we don't know about
|
||||
return;
|
||||
@@ -1483,6 +1482,12 @@ export class SettingsEditor2 extends EditorPane {
|
||||
return !!DOM.findParentWithClass(<HTMLElement>this.rootElement.ownerDocument.activeElement, 'context-view');
|
||||
}
|
||||
|
||||
private refreshSingleElement(element: SettingsTreeSettingElement): void {
|
||||
if (this.isVisible()) {
|
||||
this.settingsTree.rerender(element);
|
||||
}
|
||||
}
|
||||
|
||||
private refreshTree(): void {
|
||||
if (this.isVisible()) {
|
||||
this.settingsTree.setChildren(null, createGroupIterator(this.currentSettingsModel.root));
|
||||
|
||||
Reference in New Issue
Block a user