mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Prevent compiler errors from terminating the language server process
This commit is contained in:
parent
f3f262574d
commit
b01c516d59
4 changed files with 70 additions and 46 deletions
|
@ -237,7 +237,10 @@ impl LanguageServer for RocServer {
|
|||
let TextDocumentItem {
|
||||
uri, text, version, ..
|
||||
} = params.text_document;
|
||||
self.change(uri, text, version).await;
|
||||
let _res = unwind_async(self.change(uri, text, version)).await;
|
||||
if let Err(e) = _res {
|
||||
self.client.log_message(MessageType::ERROR, e.message).await
|
||||
}
|
||||
}
|
||||
|
||||
async fn did_change(&self, params: DidChangeTextDocumentParams) {
|
||||
|
@ -251,7 +254,10 @@ impl LanguageServer for RocServer {
|
|||
.last()
|
||||
.expect("textDocument change event had no changes ");
|
||||
|
||||
self.change(uri, text, version).await;
|
||||
let _res = unwind_async(self.change(uri, text, version)).await;
|
||||
if let Err(e) = _res {
|
||||
self.client.log_message(MessageType::ERROR, e.message).await
|
||||
}
|
||||
}
|
||||
|
||||
async fn did_close(&self, params: DidCloseTextDocumentParams) {
|
||||
|
@ -359,6 +365,8 @@ async fn main() {
|
|||
let stdout = tokio::io::stdout();
|
||||
|
||||
let (service, socket) = LspService::new(RocServer::new);
|
||||
use roc_error_macros::set_panic_not_exit;
|
||||
set_panic_not_exit(true);
|
||||
Server::new(stdin, stdout, socket).serve(service).await;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue