Skip to content

Commit

Permalink
Log an error when there are no buffer snapshots for some LSP version (#…
Browse files Browse the repository at this point in the history
…22934)

I'm hoping this will bring more visibility to issues related to keeping
track of what version of code the LSP has:

* I've seen diagnostic ranges not appearing in the correct places.

* There have also been reports of edits from language servers
misapplying. This might bring more visibility to the issue - it doesn't
seem good to silently use the current version of the buffer.

Release Notes:

- N/A
  • Loading branch information
mgsloan authored Jan 10, 2025
1 parent 685dd77 commit c41b25c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/project/src/lsp_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,10 @@ impl LocalLspStore {
snapshots.retain(|snapshot| snapshot.version + OLD_VERSIONS_TO_RETAIN >= version);
Ok(found_snapshot)
} else {
match buffer.read(cx).project_path(cx) {
Some(project_path) => log::error!("No LSP snapshots found for buffer with path {:?}", project_path.path),
None => log::error!("No LSP snapshots found for buffer without a project path (which is also unexpected)"),
}
Ok((buffer.read(cx)).text_snapshot())
}
}
Expand Down

0 comments on commit c41b25c

Please sign in to comment.