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

ruff server: Closing an untitled, unsaved notebook document no longer throws an error #11942

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::server::api::LSPResult;
use crate::server::client::{Notifier, Requester};
use crate::server::Result;
use crate::session::Session;
use lsp_server::ErrorCode;
use lsp_types as types;
use lsp_types::notification as notif;

Expand All @@ -14,20 +12,14 @@ impl super::NotificationHandler for DidCloseNotebook {

impl super::SyncNotificationHandler for DidCloseNotebook {
fn run(
session: &mut Session,
_session: &mut Session,
_notifier: Notifier,
_requester: &mut Requester,
types::DidCloseNotebookDocumentParams {
notebook_document: types::NotebookDocumentIdentifier { uri },
..
}: types::DidCloseNotebookDocumentParams,
_params: types::DidCloseNotebookDocumentParams,
) -> Result<()> {
let key = session.key_from_url(uri);

session
.close_document(&key)
.with_failure_code(ErrorCode::InternalError)?;

// `textDocument/didClose` is called after didCloseNotebook,
// and the document is removed from the index at that point.
// For this specific notification, we don't need to do anything.
Ok(())
}
}
Loading