mirror of
https://github.com/xHyroM/zed-discord-presence.git
synced 2024-11-12 17:38:06 +01:00
refactor: cleanup
This commit is contained in:
parent
7219822bfb
commit
be343e10c6
2 changed files with 12 additions and 46 deletions
|
@ -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(),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Option<Hover>> {
|
||||
self.on_change(Document::new(
|
||||
params.text_document_position_params.text_document.uri,
|
||||
))
|
||||
.await;
|
||||
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
async fn folding_range(&self, params: FoldingRangeParams) -> Result<Option<Vec<FoldingRange>>> {
|
||||
self.on_change(Document::new(params.text_document.uri))
|
||||
.await;
|
||||
|
||||
return Ok(Some(vec![]));
|
||||
}
|
||||
|
||||
async fn semantic_tokens_full(
|
||||
&self,
|
||||
params: SemanticTokensParams,
|
||||
) -> Result<Option<SemanticTokensResult>> {
|
||||
self.on_change(Document::new(params.text_document.uri))
|
||||
.await;
|
||||
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
async fn semantic_tokens_full_delta(
|
||||
&self,
|
||||
params: SemanticTokensDeltaParams,
|
||||
) -> Result<Option<SemanticTokensFullDeltaResult>> {
|
||||
self.on_change(Document::new(params.text_document.uri))
|
||||
.await;
|
||||
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
|
Loading…
Reference in a new issue