Skip to content
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

Raise explicit NonExistingDocumentError for unseen untitled files #2334

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

vinistock
Copy link
Member

Motivation

I'm not exactly sure what order of operations is required to trigger this problem, but based on our telemetry it seems to be possible to receive a request for an unsaved file before we received a didOpen notification for it.

Since the file is unsaved, we cannot try to read it from disk and there's no path associated to it.

Implementation

Started checking if path exists. If we never saw the document before (it's not in the store) and there's no path, then we have no hope of figuring out what the document contains. We can only raise.

Automated Tests

Added a test reproducing the issue.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Jul 18, 2024
@vinistock vinistock self-assigned this Jul 18, 2024
@vinistock vinistock requested a review from a team as a code owner July 18, 2024 20:47
@vinistock vinistock requested review from andyw8 and st0012 July 18, 2024 20:47
@vinistock vinistock merged commit d414cb5 into main Jul 19, 2024
35 checks passed
@vinistock vinistock deleted the vs/fix_get_for_untitled_files branch July 19, 2024 13:43
Earlopain added a commit to Earlopain/ruby-lsp that referenced this pull request Aug 3, 2024
These are expected to happen.
VSCode extensions can registers additional uri schemes
for which they provide content for.
These do not exist on disk which means the server will not find  them in the index.

Happens since Shopify#2334

Also adds a test that virtual documents raise the same error
https://code.visualstudio.com/api/extension-guides/virtual-documents
https://code.visualstudio.com/api/references/document-selector#document-scheme

Closes Shopify#2384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants