Skip to content

Commit 3051ae8

Browse files
Fix microsoft#193468 - Fix bug with error notification when pressing "l" on non-expandable reference item. (microsoft#199996)
* Fix the bug that pressing l key on non-expandable reference item shows error notification (with vim extension) * 💄 --------- Co-authored-by: João Moreno <[email protected]>
1 parent b7c53af commit 3051ae8

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

src/vs/base/browser/ui/tree/abstractTree.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,38 +2357,44 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
23572357
return this.view.setAnchor(undefined);
23582358
}
23592359

2360-
const node = this.model.getNode(element);
2361-
this.anchor.set([node]);
2360+
this.eventBufferer.bufferEvents(() => {
2361+
const node = this.model.getNode(element);
2362+
this.anchor.set([node]);
23622363

2363-
const index = this.model.getListIndex(element);
2364+
const index = this.model.getListIndex(element);
23642365

2365-
if (index > -1) {
2366-
this.view.setAnchor(index, true);
2367-
}
2366+
if (index > -1) {
2367+
this.view.setAnchor(index, true);
2368+
}
2369+
});
23682370
}
23692371

23702372
getAnchor(): T | undefined {
23712373
return firstOrDefault(this.anchor.get(), undefined);
23722374
}
23732375

23742376
setSelection(elements: TRef[], browserEvent?: UIEvent): void {
2375-
const nodes = elements.map(e => this.model.getNode(e));
2376-
this.selection.set(nodes, browserEvent);
2377+
this.eventBufferer.bufferEvents(() => {
2378+
const nodes = elements.map(e => this.model.getNode(e));
2379+
this.selection.set(nodes, browserEvent);
23772380

2378-
const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1);
2379-
this.view.setSelection(indexes, browserEvent, true);
2381+
const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1);
2382+
this.view.setSelection(indexes, browserEvent, true);
2383+
});
23802384
}
23812385

23822386
getSelection(): T[] {
23832387
return this.selection.get();
23842388
}
23852389

23862390
setFocus(elements: TRef[], browserEvent?: UIEvent): void {
2387-
const nodes = elements.map(e => this.model.getNode(e));
2388-
this.focus.set(nodes, browserEvent);
2391+
this.eventBufferer.bufferEvents(() => {
2392+
const nodes = elements.map(e => this.model.getNode(e));
2393+
this.focus.set(nodes, browserEvent);
23892394

2390-
const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1);
2391-
this.view.setFocus(indexes, browserEvent, true);
2395+
const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1);
2396+
this.view.setFocus(indexes, browserEvent, true);
2397+
});
23922398
}
23932399

23942400
focusNext(n = 1, loop = false, browserEvent?: UIEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter): void {

src/vs/workbench/browser/actions/listCommands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ function selectElement(accessor: ServicesAccessor, retainCurrentFocus: boolean):
488488
// List
489489
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
490490
const list = focused;
491-
list.setSelection(list.getFocus(), fakeKeyboardEvent);
492491
list.setAnchor(list.getFocus()[0]);
492+
list.setSelection(list.getFocus(), fakeKeyboardEvent);
493493
}
494494

495495
// Trees
@@ -510,8 +510,8 @@ function selectElement(accessor: ServicesAccessor, retainCurrentFocus: boolean):
510510
tree.toggleCollapsed(focus[0]);
511511
}
512512
}
513-
tree.setSelection(focus, fakeKeyboardEvent);
514513
tree.setAnchor(focus[0]);
514+
tree.setSelection(focus, fakeKeyboardEvent);
515515
}
516516
}
517517

0 commit comments

Comments
 (0)