-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Files do not restore their preferred resource path casing when reloading window #102627
Comments
@haxiomic isn't it enough to close the file and open it again? Having a hard time to understand how the casing of the file is persisted even when you close the file. What storage key do you still see the old casing persist? |
@bpasero closing the file and opening has no affect, I’ve also tried
The extension still receives the original incorrect name The problem is original name is always kept somewhere inside the workspaceStorage folder, I assume whatever checks are used when updating this state ignore file name casing so it never changes. The only workaround I’ve found is to delete this folder manually |
@haxiomic without knowing the exact storage key that the extension is trying to access it is hard to understand the issue. It is possible that maybe the extension stores the URI? |
Looks to be in I ran through the repro steps, renaming EXAMPLE.hx to Example.hx and in state.vscdb, the name is Example.hx everywhere except {
"file:///Users/geo/Downloads/haxe-name-bug/EXAMPLE.hx": {
"lineCount": 9,
"lines": []
}
} I don't know a lot about codelens at this point but this is the jsonrpc object pass in the vshaxe extension for autocomplete: {
"jsonrpc": "2.0",
"id": 17,
"method": "display/completion",
"params": {
"file": "/Users/geo/Downloads/haxe-name-bug/EXAMPLE.hx",
"contents": "class Example {\n\n\tstatic var x:Int;\n\n\tstatic public function main() {\nxx\n\t}\n\n}",
"offset": 72,
"wasAutoTriggered": false,
"meta": [":deprecated"]
}
} |
Thanks for finding out about the key. |
This doesn't make sense. The |
I cannot reproduce an issue here. My steps are the following:
To get out of this you will have to:
I am thinking this just works as designed and is a consequence of all the work we did to fix #12448
Well, not sure I would agree? You store canonical URIs in memory, so when the editor input gets created, even when the user changed the URI, the input will get your canonical form. I will store and restore only this form because for the editor input that is the only correct URI. |
Has nothing to do with code lens. Do the following
Yes, we have defined a canonical URI but not so that it survives a reload of the window/process. The form on disk should be the actual form and it seems that the serialised editor input defines the "wrong" canonical uri here. |
File editor inputs now keep track of their This still requires a restart of VSCode but you no longer have to close the editor to get the "correct" URI. |
Cannot do this, I see data loss when the file is dirty:
|
Very tricky, not having a good solution for now. The truth is that backup identifiers are the hash of a file path, so when an editor opens and gets dirty, the backup is a hash of its file path (preserving the casing). When the file is renamed, the hash does not change because we no longer change the underlying model, we just change the label. If we now simply go ahead and change the model URI on restart because we pick the preferred URI now, the backup can no longer be found and the data is lost. Somehow the backup service would also need to be aware of a preferred URI vs initial URI. The workaround for now is as I stated before:
|
Would it make sense to validate the persisted URI before making it the canonical one? Maybe not the whole path but just the basename? |
@jrieken can you clarify what that would mean? |
When restoring an editor input from a case-insensitive file system, check for its actual casing before proceeding to open. |
Unfortunately there is no straightforward solution to know what casing a file has on disk other than doing node.js recently added And even if we decide to figure out the real path as it is on disk and then proceeding to create a model with that path, backups would still be stored under the previous case and fail to be looked up. I think it is not impossible to fix this, e.g. we have a method to iterate over all backups and could then use the proper Bottom line: I think the backup service should take the OS path case into account when answering the question wether a backup exists for a resource or not. |
If I change the casing of a filename in vscode on macOS, the old file name casing is forever stored in
~/Library/Application Support/Code/workspaceStorage
, this causes problems with extensions that require case-sensitive file pathsSteps to Reproduce:
~/Library/Application Support/Code/workspaceStorage
This has come up when using the haxe language extension – after changing a file's case, the old file case given by vscode is sent to the haxe compiler, breaking autocomplete for this file (haxe nightly build 4.2)
Does this issue occur when all extensions are disabled?: Technically Yes (but it's probably not an issue without extensions)
The text was updated successfully, but these errors were encountered: