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
Opening file with same name but different folder appends a suffix to the filename #143414
Comments
This maybe impossible for us to fix given #136486 |
Unfortunately, a handle we get from the local file system API does not carry the full absolute path and as such we do not know whether the same file is opened or a different file with the same name. We store the handle in memory for the duration of the usage and need to come up with a I fear it will not be so easy for us to move away from this model. |
Would it be possible to not store the handle in memory or delete it when closing the file? Then subsequent opens would be treated the same as first opens. |
No, one limitation of the file system handle API is that you can only get a handle by asking the user for a file or folder from a dialog, there is no other way. You cannot just get a handle without the dialog (or maybe drag and drop, but that is equally a user action).
That is something I would like to avoid actually. Because the layer at where the file system handle comes into the system is really low level and editors are high level. There is no ref-counting of file handles between these 2 components because file handles typically do not have a lifecycle for normal operations. I would not want to add this kind of tangle only to workaround a limitation in the file system API. |
Wow, I just found out To verify:
|
This is great. Thanks @bpasero! |
I can still reproduce the issue in insiders.vscode.dev |
Same here until I reloaded the page, seems like a caching issue, filed microsoft/vscode-dev#533 |
Oh yeah, nice catch. Instead of adding the suffix at the end, we really need to put it before the extension. I can fix that for March! |
Oh and this was actually the original issue reported too, lets reopen and move to March then, since this is only fixed partially. |
Does this issue occur when all extensions are disabled?: Yes
Version: 1.64.2
Commit: f80445a
Date: 2022-02-09T22:00:24.333Z
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.50
Steps to Reproduce:
Expected: The same file opens: test-file.txt
Actual: The same file opens with the suffix -2: test-file.txt-2. This breaks language services for the file.
The text was updated successfully, but these errors were encountered: