-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing arbitrary 'context' to setSelection/setFocus #64743
Comments
Looking into the search scenario some more, it might be possible to work around this by doing the debouncing in the controller instead of SearchView. |
Those links look broken, can you provide new links that point to a commit?
Let me know how that goes. |
needed by #64727 |
There was a promise of compatibility between the new and old tree. Thousands of lines have been written and I while I can live some change and cannot live with conceptual changes. |
Fixed the links. |
@roblourens what did you end up doing here? |
We still only have |
In the outline if the tree selection changes (via mouse/keyboard) then that symbol is revealed/selected in the editor (this triggers an editor selection change). In return, when the cursor moves we reveal/select the corresponding symbol in the outline (this triggers a tree selection change). To prevent an infinite event loop a payload is used. |
I might actually be able to prevent my "marker" it a UIEvent, e.g. FakeEvent extends UIEvent... |
That is what I ended up doing, I just stick a property on a fake keyboard event. |
Some time ago, @bpasero introduced the When the user interacts with the tree's focus/selection using the mouse/keyboard, an The current implementation might be incomplete, but I'd love to push it forward so we align everyone. @jrieken I would love to help you getting that to work on your branch. |
+1 for using the open event and not the raw selection/focus events for the advantages mentioned above. |
I intend to push down the |
The old tree allows us to pass some context into the
setSelection
/setFocus
call which is sent through to onDidChangeSelection/onDidChangeFocus event handlers. This lets us implement different behavior depending on "why" the selection/focus changed.Search uses it because F4/shift+F4 are debounced, so it can set selection and tell the controller not to open the editor yet: https://github.com/Microsoft/vscode/blob/41cb808a116e608dbfb7e6b56ef368d1795a86e7/src/vs/workbench/parts/search/browser/searchView.ts#L615
Then later it can tell the controller to open the editor and also focus the editor: https://github.com/Microsoft/vscode/blob/41cb808a116e608dbfb7e6b56ef368d1795a86e7/src/vs/workbench/parts/search/browser/searchView.ts#L578
I also see usage of this feature in the explorer, breadcrumbs, outline, and custom view trees.
The text was updated successfully, but these errors were encountered: