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

fix(lsp): improve err handling when loading source text #8025

Conversation

camc314
Copy link
Contributor

@camc314 camc314 commented Dec 19, 2024

note i didn't test this, but it's panicing because fs::read_to_string is returning an error as the path no longer exists.

fixes #8023

@camc314 camc314 changed the title fix(lsp): improve err handling when loading source text fix(linter): handle file read errors gracefully Dec 19, 2024
Copy link
Contributor Author

camc314 commented Dec 19, 2024


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-bug Category - Bug labels Dec 19, 2024
@camc314 camc314 changed the title fix(linter): handle file read errors gracefully fix(lsp): improve err handling when loading source text Dec 19, 2024
@camc314 camc314 marked this pull request as ready for review December 19, 2024 18:27
@camc314 camc314 requested review from Boshen and Sysix December 19, 2024 18:27
@camc314 camc314 force-pushed the c/12-19-fix_lsp_improve_err_handling_when_loading_source_text branch from 885aaa9 to 27a5698 Compare December 19, 2024 18:29
@Sysix
Copy link
Collaborator

Sysix commented Dec 19, 2024

Thanks 👍
I am still asking myself why vscode has sent textDocument/didOpen. But this should be another problem ;)

Copy link

codspeed-hq bot commented Dec 19, 2024

CodSpeed Performance Report

Merging #8025 will not alter performance

Comparing c/12-19-fix_lsp_improve_err_handling_when_loading_source_text (6344b93) with main (0f9308f)

Summary

✅ 29 untouched benchmarks

@camc314
Copy link
Contributor Author

camc314 commented Dec 19, 2024

Thanks 👍 I am still asking myself why vscode has sent textDocument/didOpen. But this should be another problem ;)

i think the textDocument/didOpen that it sends is correct - it's just confusing for us to handle because it's opened a buffer that references a deleted file.

@camc314
Copy link
Contributor Author

camc314 commented Dec 19, 2024

we should probably pass around DidOpenTextDocumentParams::text_document::TextDocumentItem::text and lint the actual text content of the doc rather than tryiing to read from disk, but that's a bigger lift that i think we should do in a different PR

@camc314
Copy link
Contributor Author

camc314 commented Dec 19, 2024

Screenshot 2024-12-19 at 19 06 06

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 19, 2024
Copy link
Contributor Author

camc314 commented Dec 19, 2024

Merge activity

  • Dec 19, 2:07 PM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 19, 2:07 PM EST: A user added this pull request to the Graphite merge queue.
  • Dec 19, 2:12 PM EST: A user merged this pull request with the Graphite merge queue.

note i didn't test this, but it's panicing because `fs::read_to_string` is returning an error as the path no longer exists.

fixes #8023
@camc314 camc314 force-pushed the c/12-19-fix_lsp_improve_err_handling_when_loading_source_text branch from 27a5698 to 6344b93 Compare December 19, 2024 19:07
@graphite-app graphite-app bot merged commit 6344b93 into main Dec 19, 2024
29 checks passed
@graphite-app graphite-app bot deleted the c/12-19-fix_lsp_improve_err_handling_when_loading_source_text branch December 19, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-editor Area - Editor and Language Server C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vscode: Language Server crashed 5 times in the last 3 minutes.
2 participants