Skip to content

Commit c092241

Browse files
committed
clean unhandle error
1 parent dea4bfd commit c092241

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

crates/emmylua_ls/src/handlers/notification_handler.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use log::error;
44
use lsp_server::Notification;
55
use lsp_types::{
66
notification::{
7-
Cancel, DidChangeTextDocument, DidChangeWatchedFiles, DidOpenTextDocument,
8-
DidSaveTextDocument, Notification as lsp_notification,
7+
Cancel, DidChangeTextDocument, DidChangeWatchedFiles, DidCloseTextDocument,
8+
DidOpenTextDocument, DidSaveTextDocument, Notification as lsp_notification, SetTrace,
99
},
1010
CancelParams, NumberOrString,
1111
};
@@ -14,8 +14,8 @@ use serde::de::DeserializeOwned;
1414
use crate::context::{ServerContext, ServerContextSnapshot};
1515

1616
use super::text_document::{
17-
on_did_change_text_document, on_did_change_watched_files, on_did_open_text_document,
18-
on_did_save_text_document,
17+
on_did_change_text_document, on_did_change_watched_files, on_did_close_document,
18+
on_did_open_text_document, on_did_save_text_document, on_set_trace,
1919
};
2020

2121
pub async fn on_notification_handler(
@@ -29,7 +29,9 @@ pub async fn on_notification_handler(
2929
.await
3030
.on_parallel::<DidOpenTextDocument, _, _>(on_did_open_text_document)
3131
.on_parallel::<DidSaveTextDocument, _, _>(on_did_save_text_document)
32+
.on_parallel::<DidCloseTextDocument, _, _>(on_did_close_document)
3233
.on_parallel::<DidChangeWatchedFiles, _, _>(on_did_change_watched_files)
34+
.on_parallel::<SetTrace, _, _>(on_set_trace)
3335
.finish();
3436

3537
Ok(())
@@ -41,10 +43,7 @@ pub struct NotificationDispatcher<'a> {
4143
}
4244

4345
impl<'a> NotificationDispatcher<'a> {
44-
pub fn new(
45-
notification: Notification,
46-
context: &'a mut ServerContext,
47-
) -> Self {
46+
pub fn new(notification: Notification, context: &'a mut ServerContext) -> Self {
4847
NotificationDispatcher {
4948
notification: Some(notification),
5049
context,

crates/emmylua_ls/src/handlers/text_document/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
mod text_document_handler;
22
mod watched_file_handler;
3+
mod set_trace;
34

45
use lsp_types::{
56
ClientCapabilities, SaveOptions, ServerCapabilities, TextDocumentSyncCapability,
67
TextDocumentSyncKind, TextDocumentSyncSaveOptions,
78
};
89
pub use text_document_handler::{
9-
on_did_change_text_document, on_did_open_text_document, on_did_save_text_document,
10+
on_did_change_text_document, on_did_close_document, on_did_open_text_document,
11+
on_did_save_text_document,
1012
};
1113
pub use watched_file_handler::on_did_change_watched_files;
14+
pub use set_trace::on_set_trace;
1215

1316
pub fn register_capabilities(
1417
server_capabilities: &mut ServerCapabilities,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use lsp_types::SetTraceParams;
2+
3+
use crate::context::ServerContextSnapshot;
4+
5+
pub async fn on_set_trace(_: ServerContextSnapshot, _: SetTraceParams) -> Option<()> {
6+
Some(())
7+
}

crates/emmylua_ls/src/handlers/text_document/text_document_handler.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use lsp_types::{DidChangeTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams};
1+
use lsp_types::{DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams};
22

33
use crate::context::ServerContextSnapshot;
44

@@ -44,5 +44,13 @@ pub async fn on_did_change_text_document(
4444
context.file_diagnostic.add_diagnostic_task(file_id).await;
4545
}
4646

47+
Some(())
48+
}
49+
50+
pub async fn on_did_close_document(
51+
_: ServerContextSnapshot,
52+
_: DidCloseTextDocumentParams,
53+
) -> Option<()> {
54+
4755
Some(())
4856
}

0 commit comments

Comments
 (0)