mirror of
https://github.com/kbwo/testing-language-server.git
synced 2025-12-23 09:47:07 +00:00
Merge pull request #34 from kbwo/feat/handle-shutdown-exit
feat: handle `shutdown` and `exit`
This commit is contained in:
commit
245fd10346
2 changed files with 16 additions and 0 deletions
|
|
@ -85,6 +85,13 @@ fn main_loop(server: &mut TestingLS) -> Result<(), LSError> {
|
|||
let id = value["id"].as_i64().unwrap();
|
||||
server.initialize(id, initialize_params)?;
|
||||
}
|
||||
"shutdown" => {
|
||||
let id = value["id"].as_i64().unwrap();
|
||||
server.shutdown(id)?;
|
||||
}
|
||||
"exit" => {
|
||||
std::process::exit(0);
|
||||
}
|
||||
"workspace/diagnostic" => {
|
||||
server.diagnose_workspace()?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -452,6 +452,15 @@ impl TestingLS {
|
|||
}))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn shutdown(&self, id: i64) -> Result<(), LSError> {
|
||||
send_stdout(&json!({
|
||||
"jsonrpc": "2.0",
|
||||
"id": id,
|
||||
"method": json!(null),
|
||||
}))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue