ruff/crates/ruff_server/src
Jane Lewis 791f6a1820
ruff server: Closing an untitled, unsaved notebook document no longer throws an error (#11942)
## Summary

Fixes #11651.
Fixes #11851.

We were double-closing a notebook document from the index, once in
`textDocument/didClose` and then in the `notebookDocument/didClose`
handler. The second time this happens, taking a snapshot fails.

I've rewritten how we handle snapshots for closing notebooks / notebook
cells so that any failure is simply logged instead of propagating
upwards. This implementation works consistently even if we don't receive
`textDocument/didClose` notifications for each specific cell, since they
get closed (and the diagnostics get cleared) in the notebook document
removal process.

## Test Plan

1. Open an untitled, unsaved notebook with the `Create: New Jupyter
Notebook` command from the VS Code command palette (`Ctrl/Cmd + Shift +
P`)
2. Without saving the document, close it.
3. No error popup should appear.
4. Run the debug command (`Ruff: print debug information`) to confirm
that there are no open documents
2024-06-21 10:53:30 -07:00
..
edit Add Jupyter Notebook document change snapshot test (#11944) 2024-06-21 05:29:27 +00:00
server ruff server: Closing an untitled, unsaved notebook document no longer throws an error (#11942) 2024-06-21 10:53:30 -07:00
session ruff server: Closing an untitled, unsaved notebook document no longer throws an error (#11942) 2024-06-21 10:53:30 -07:00
edit.rs Add Jupyter Notebook document change snapshot test (#11944) 2024-06-21 05:29:27 +00:00
fix.rs Use real file path when available in ruff server (#11800) 2024-06-07 22:48:53 -07:00
format.rs ruff server: Formatting a document with syntax problems no longer spams a visible error popup (#11745) 2024-06-04 17:18:21 -07:00
lib.rs Add Jupyter Notebook document change snapshot test (#11944) 2024-06-21 05:29:27 +00:00
lint.rs Build CommentRanges outside the parser (#11792) 2024-06-09 09:55:17 +00:00
message.rs ruff server: Tracing system now respects log level and trace level, with options to log to a file (#11747) 2024-06-11 11:29:47 -07:00
server.rs Add supported commands in server capabilities (#11850) 2024-06-13 09:32:43 +05:30
session.rs Add Jupyter Notebook document change snapshot test (#11944) 2024-06-21 05:29:27 +00:00
trace.rs ruff server: Support the usage of tildes and environment variables in logFile (#11945) 2024-06-20 18:51:46 +00:00