Skip to content

Commit

Permalink
Add notebook document synchronization functions
Browse files Browse the repository at this point in the history
  • Loading branch information
zebreus committed Nov 18, 2023
1 parent 7b58012 commit 6670420
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ async-trait = "0.1"
auto_impl = "1.0"
bytes = "1.0"
dashmap = "5.1"
futures = { version = "0.3", default-features = false, features = ["std", "async-await"] }
futures = { version = "0.3", default-features = false, features = [
"std",
"async-await",
] }
httparse = "1.8"
lsp-types = "0.94.1"
memchr = "2.5"
Expand All @@ -41,10 +44,18 @@ tracing = "0.1"
[dev-dependencies]
async-tungstenite = { version = "0.22", features = ["tokio-runtime"] }
tracing-subscriber = "0.3"
tokio = { version = "1.17", features = ["io-util", "io-std", "macros", "rt-multi-thread"] }
tokio = { version = "1.17", features = [
"io-util",
"io-std",
"macros",
"rt-multi-thread",
] }
tokio-util = { version = "0.7", features = ["compat"] }
ws_stream_tungstenite = { version = "0.10", features = ["tokio_io"] }

[workspace]
members = [".", "./tower-lsp-macros"]
default-members = ["."]

[patch.crates-io]
lsp-types = { git = 'https://github.com/zebreus/lsp-types.git' }
48 changes: 48 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,54 @@ pub trait LanguageServer: Send + Sync + 'static {
warn!("Got a textDocument/didClose notification, but it is not implemented");
}

// Notebook Document Synchronization

/// The [`notebookDocument/didOpen`] notification is sent from the client to the server when a new notebook document is opened.
/// It is only sent for notebooks selected by the `notebookDocumentSync` server capability.
///
/// [`notebookDocument/didOpen`]: https://microsoft.github.io/language-server-protocol/specification/#notebookDocument_didChange
///
/// TODO: Write more documentation
#[rpc(name = "notebookDocument/didOpen")]
async fn notebook_did_open(&self, params: DidOpenNotebookDocumentParams) {
let _ = params;
warn!("Got a notebookDocument/didOpen notification, but it is not implemented");
}

/// The [`notebookDocument/didChange`] notification is sent from the client to the server when a notebook document changes.
/// It is only sent for notebooks selected by the `notebookDocumentSync` server capability.
///
/// [`notebookDocument/didChange`]: https://microsoft.github.io/language-server-protocol/specification#notebookDocument_didChange
///
/// TODO: Write more documentation
#[rpc(name = "notebookDocument/didChange")]
async fn notebook_did_change(&self, params: DidChangeNotebookDocumentParams) {
let _ = params;
warn!("Got a notebookDocument/didChange notification, but it is not implemented");
}

/// The [`notebookDocument/didSave`] notification is sent from the client to the server when a notebook document is saved.
/// It is only sent for notebooks selected by the `notebookDocumentSync` server capability.
///
/// [`notebookDocument/didSave`]: https://microsoft.github.io/language-server-protocol/specification#notebookDocument_didSave
#[rpc(name = "notebookDocument/didSave")]
async fn notebook_did_save(&self, params: DidSaveNotebookDocumentParams) {
let _ = params;
warn!("Got a notebookDocument/didSave notification, but it is not implemented");
}

/// The [`notebookDocument/didClose`] notification is sent from the client to the server when a notebook document is closed.
/// It is only sent for notebooks selected by the `notebookDocumentSync` server capability.
///
/// [`notebookDocument/didClose`]: https://microsoft.github.io/language-server-protocol/specification#notebookDocument_didClose
///
/// TODO: Write more documentation
#[rpc(name = "notebookDocument/didClose")]
async fn notebook_did_close(&self, params: DidCloseNotebookDocumentParams) {
let _ = params;
warn!("Got a notebookDocument/didClose notification, but it is not implemented");
}

// Language Features

/// The [`textDocument/declaration`] request asks the server for the declaration location of a
Expand Down

0 comments on commit 6670420

Please sign in to comment.