-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Make symbol link icon to be refreshed correctly #168707
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
base: main
Are you sure you want to change the base?
Conversation
Looks like some unit tests are failing here. |
@ShuiRuTian I really don't understand why this needs any changes in the decoration service and why this isn't a problem of the concrete provider, e.g of |
Hi, @jrieken The main purpose is to be a bit more accurate and effective. As we could see, So what about listening to To avoid this, this PR add another However, I agree it's kind of complex, maybe it's better to just fix the issue with listen to |
I leave it up to @lramos15 to know but generally the place to fix this should be the one provider that's wrong, not the service around them |
@ShuiRuTian Are there worries about listening to it in the decoration provider? Is this a performance question? I would definitely attempt that solution first since this is explorer specific and then run a performance profile of some sort. Thanks for looking into this! |
627d7c7
to
82b2548
Compare
82b2548
to
7731fd4
Compare
FYI @bpasero Any concerns about the update to the label file or listening to the file service like this? |
}); | ||
} | ||
|
||
private hasIsSymbolicLinkChanged(newOptions?: IResourceLabelOptions): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasSymbolicLinkChanged
?
@@ -456,6 +461,7 @@ class ResourceLabelWidget extends IconLabel { | |||
} | |||
} | |||
|
|||
const hasIsSymbolicLinkChanged = this.hasIsSymbolicLinkChanged(options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasSymbolicLinkChanged
?
@@ -59,6 +61,9 @@ export class ExplorerDecorationsProvider implements IDecorationsProvider { | |||
this.toDispose.add(explorerRootErrorEmitter.event((resource => { | |||
this._onDidChange.fire([resource]); | |||
}))); | |||
this.toDispose.add(fileService.onDidFilesChange(e => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This event can fire thousands of times at the same time for thousands of files, so whoever is listening needs to be checked for perf bottlenecks if that happens.
We should at least measure the perf baseline on a slower machine (maybe also OS = Windows) when thousands of events come in, e.g. from I am not 100% sure the (relatively minor) issue deserves such a fix when it makes perf worse tbh. |
So we do not want to introduce any potential performance issue or any complexity? Then maybe we could close this PR to keep the house clean. |
We do not want to introduce performance issues. File events are a potential source of performance issue because the amount of events can be very very high. We unfortunately not have a way to listen for specific events, but in reality we would probably only be interested in events for resources that are visible in the explorer. |
At the beginning, this PR adds another Emitter to each decoration provider, so that we could give more control to the caller and avoid the performance issue because we only fetch data when symbolic link is changed. You could reference this comment. But I agree it's indeed kind of weird. And the reviewers give different opinions here and here. I have no idea, let the team decide it... PS: I used force push, so the history is gone... |
@ShuiRuTian I wonder, could we listen to the explorer refresh and then iterating through just the files the explorer knows of checking if they're symbolic links? Like Ben said this is expensive for an edge case and I would like to resolve it, but not at the cost of perf. If you don't have time to investigate such a complex issue I understand and can take a look myself when I have some free cycles. |
@lramos15 Sorry for the late response. Sounds great, but how do we know whether one explorer item was symbolic link or not? I think this info is kind of like an implementation detail now and it's hidden in high level. Or we need to reactor a bit to get this message? |
You would likely need to do some refactoring to get the message to the right place |
When will this be finished? |
Is this still relevant? |
#167146
Another try to fix #167146 by reference #167828 (comment)
This PR makes the following changes:
IDecorationsProvider
is able to fire another eventonForceRefresh
, to tell which URI need to be refreshed.DecorationsService
will listen to the event, record theURI
s that need to be refreshed. And when getting values, it will get the fresh value rather than cache from theIDecorationsProvider
if theIDecorationsProvider
andURI
are both same.However, this PR is kind of noisy, because it adds
onForceRefresh
to allIDecorationsProvider
s. Should this method be optional?