pub enum LspNotification {
PublishDiagnostics(PublishDiagnosticsParams),
LogMessage(LogMessageParams),
ShowMessage(ShowMessageParams),
Progress {
token: Value,
value: Value,
},
Other {
method: Cow<'static, str>,
params: Option<Value>,
},
}Expand description
Typed LSP notification variants.
Uses types from lsp_types crate for LSP-standard notifications.
Variants§
PublishDiagnostics(PublishDiagnosticsParams)
textDocument/publishDiagnostics
LogMessage(LogMessageParams)
window/logMessage
ShowMessage(ShowMessageParams)
window/showMessage
Progress
$/progress
Other
Unknown or unhandled notification
Implementations§
Source§impl LspNotification
impl LspNotification
Sourcepub fn parse(method: &str, params: Option<Value>) -> Self
pub fn parse(method: &str, params: Option<Value>) -> Self
Parse a notification from method name and params.
Attempts to deserialize known notification types based on the method name.
Falls back to Other variant for unknown methods or deserialization failures.
§Examples
ⓘ
use mcpls_core::lsp::types::LspNotification;
use serde_json::json;
let params = json!({
"type": 3,
"message": "Server started"
});
let notification = LspNotification::parse("window/logMessage", Some(params));
match notification {
LspNotification::LogMessage(log) => {
// lsp_types uses `typ` field with MessageType struct
assert_eq!(log.typ, lsp_types::MessageType::INFO);
assert_eq!(log.message, "Server started");
}
_ => panic!("Expected LogMessage variant"),
}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LspNotification
impl !RefUnwindSafe for LspNotification
impl Send for LspNotification
impl Sync for LspNotification
impl Unpin for LspNotification
impl UnsafeUnpin for LspNotification
impl UnwindSafe for LspNotification
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more