Skip to content

Commit f20e4b9

Browse files
committed
use last version +1 on close
1 parent 81a5498 commit f20e4b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pyrefly/lib/lsp/non_wasm/server.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,12 +1597,15 @@ impl Server {
15971597

15981598
fn did_close(&self, params: DidCloseTextDocumentParams) {
15991599
let uri = params.text_document.uri.to_file_path().unwrap();
1600-
self.version_info.lock().remove(&uri);
1600+
let version = self
1601+
.version_info
1602+
.lock()
1603+
.remove(&uri)
1604+
.map(|version| version + 1);
16011605
let open_files = self.open_files.dupe();
16021606
open_files.write().remove(&uri);
1603-
// TODO: should we use the last version or None?
16041607
self.connection
1605-
.publish_diagnostics_for_uri(params.text_document.uri, Vec::new(), None);
1608+
.publish_diagnostics_for_uri(params.text_document.uri, Vec::new(), version);
16061609
let state = self.state.dupe();
16071610
let lsp_queue = self.lsp_queue.dupe();
16081611
let open_files = self.open_files.dupe();

0 commit comments

Comments
 (0)