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
ResourceLabel listens #63655
Comments
@jrieken I pushed a couple of things:
I adopted @sandy081 I got a little bit lost for I feel like a follow up item could be to have PS: the labels are still listening on events even if they are not visible. I thought about changing that, but it would have the downside that I would have to basically replay each event that happened when the label becomes visible. I thought this was not a big enough gain to have. PPS: I guess this means we could change the event leak listener count again. |
✅ |
When adding the listener-leak-warning (b548ced) I had to chose a very high default limit of 500 listeners. This is mostly because of the
ResourceLabel
which registers5
listeners per instance. This multiples quickly because the resource label is used everywhere. On a normal screen the explorer shows ~40 elements which results is 200 listeners already. The same is true for one page of search results and a page full of git changes, totalling then at 600 listeners, 120 listener per event.Instead, "containers" should listen. In above sample the explorer-, the search-, and the git-viewlet. That would total in 3*5 listeners. This would be especially useful for those event-handlers that are all the same, like this one: https://github.com/Microsoft/vscode/blob/d21dbf9cc1ad020a8dc686de8d29894a2a6ea7b3/src/vs/workbench/browser/labels.ts#L79-L83
Also, listening can be made smarter. Today, a theme change updates a label even when its viewlet isn't visible.
For some events this might be more tricky, esp. those that require state form the widget, like its uri or specific config. It would still try to keep the widget stupid and to make that state accessible via getters so the outside can make a decision with that information.
The text was updated successfully, but these errors were encountered: