-
Notifications
You must be signed in to change notification settings - Fork 170
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
Always use complete URI for store key #891
Conversation
|
4336333
to
38fd267
Compare
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.
You said we're receiving the same path twice but with two different schemes. Are we sure we want to act upon requests on a git://
?
Can't we just ignore all requests that are not on a file://
?
I think it's worth responding to requests on |
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.
I agree with Andy, the repeated to_s
is unfortunate.
Related to #896, I wonder if we should create our own abstraction on top of URI that would behaves as we need when performing the hash lookup and that could be used to read/write files from other requests.
That's a good point, I added that to the issue. Maybe we can build our own |
Motivation
There are scenarios where we can receive the same file path with different schemes from VS Code. For example, when someone is looking at the diff editor, we receive the same path twice with two different schemes:
Because we were using the file path as the storage key, these two URIs would conflict and result in inconsistent internal state in the LSP. If you closed the git version, it would delete the file version too and that file would no longer exist (from the LSP's perspective).
Implementation
The switch to use file paths and untitled names as the storage key was a mistake. We should always use the complete URI so that there are no conflicts and each scheme has a separate version of the document. VS Code sends duplicate requests for each scheme version, so we should respect that and treat them as separate documents.
Automated tests
Added some examples that catch the issue.