diff --git a/lsp/src/discord.rs b/lsp/src/discord.rs
index 74881dd..a31af12 100644
--- a/lsp/src/discord.rs
+++ b/lsp/src/discord.rs
@@ -35,6 +35,12 @@ impl Discord {
result.unwrap();
}
+ pub fn kill(&self) {
+ let mut client = self.get_client();
+ let result = client.close();
+ result.unwrap();
+ }
+
pub fn change_file(&self, filename: &str, workspace: &str) {
self.change_activity(
format!("Working on {}", filename),
@@ -58,12 +64,11 @@ impl Discord {
.details(details.as_str())
.timestamps(Timestamps::new().start(timestamp)),
)
- .expect(
- format!(
+ .unwrap_or_else(|_| {
+ panic!(
"Failed to set activity with state {} and details {}",
state, details
)
- .as_str(),
- );
+ });
}
}
diff --git a/lsp/src/main.rs b/lsp/src/main.rs
index 6e6e663..839c14d 100644
--- a/lsp/src/main.rs
+++ b/lsp/src/main.rs
@@ -96,7 +96,7 @@ impl LanguageServer for Backend {
}),
capabilities: ServerCapabilities {
text_document_sync: Some(TextDocumentSyncCapability::Kind(
- TextDocumentSyncKind::NONE,
+ TextDocumentSyncKind::INCREMENTAL,
)),
..Default::default()
},
@@ -113,6 +113,8 @@ impl LanguageServer for Backend {
}
async fn shutdown(&self) -> Result<()> {
+ self.discord.kill();
+
Ok(())
}
@@ -125,47 +127,6 @@ impl LanguageServer for Backend {
self.on_change(Document::new(params.text_document.uri))
.await;
}
-
- async fn did_save(&self, params: DidSaveTextDocumentParams) {
- self.on_change(Document::new(params.text_document.uri))
- .await;
- }
-
- async fn hover(&self, params: HoverParams) -> Result