-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
Explorer refresh does not show latest data of the file system provider #185312
Comments
hi @bpasero ask you for some time, Do you think there is such a need? |
Everything should be there in the fs-provider to response to the explorer refreshing. I see no need to add a new method. The explorer should use the existing methods we have: read directories and stat their entries. |
In some cases, the data of the explorer file tree comes from an asynchronous API, the data structure of the tree is usually constructed when the fs-provider is initialized and provided to read directories and stat their entries. if the back-end data is updated, unless I refresh the entire page, I won't get the latest data if I just click the explorer refresh button. |
Lets move this to explorer component, maybe something there is not working properly when you refresh. Do you have a test extension for us to play with? |
refresh
to call when the user click Refresh Explorer
The following is a reproduced repo. I modified it after fork vscode-web-playground. The main change is to change the data source of the file tree. Next are the steps to reproduce the problem I described:
|
We have a great extension developer community over on GitHub discussions and Slack where extension authors help each other. This is a great place for you to ask questions and find support. Happy Coding! |
This is not a problem in VS Code but your sources. You only call |
Yes, but shouldn't it be the right thing to cache the data requested once In an in-memory file system? And thank you @bpasero , I tried to ask others how to deal with this memory file system case. |
Define Type
Use
Why
When I click the refresh button, it will only trigger the
readDirectory
ofFileSystemProvider
and will not re-request the data of the file tree.My understanding of
FileSystemProvider
is that it does not pay attention to the source of the data it uses and when the data is requested. It only pays attention to the implementation of its own readFile, watch and other functions. When the FileSystemService of vscode executes related functions, it will call provider corresponding functions. This is true for most scenarios, but for refresh operations (especially for Web scenarios), just re-reading the folder (without re-requesting the data) after the refresh operation has no effect. Therefore, it is best to provide a refresh function that allows the provider to re-perform its own fetching operation, wait for the end, then let the file system re-read the data of the file tree, and then re-render the file tree.vscode.dev
is not a good example because it installs the git extension by default and hasSync
button to get the latest data. But if git is not installed, I think refresh is quite useful.The text was updated successfully, but these errors were encountered: