diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-12-21 14:44:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-21 08:44:26 -0500 |
commit | bd85d0ed420b792eebdd81f88fca503e028c9565 (patch) | |
tree | d6f8d5baf4c3c0d760bea2b6b221189674d2e54b /cli/lsp/config.rs | |
parent | 3078fcf55a8aa04d26316ab353d84f2c9512bd47 (diff) |
refactor: rewrite lsp to be async (#8727)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r-- | cli/lsp/config.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index fc3f030c9..b689275ef 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -1,10 +1,12 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -use deno_core::error::AnyError; use deno_core::serde::Deserialize; use deno_core::serde_json; use deno_core::serde_json::Value; use deno_core::url::Url; +use lspower::jsonrpc::Error as LSPError; +use lspower::jsonrpc::Result as LSPResult; +use lspower::lsp_types; #[derive(Debug, Clone, Default)] pub struct ClientCapabilities { @@ -29,8 +31,9 @@ pub struct Config { } impl Config { - pub fn update(&mut self, value: Value) -> Result<(), AnyError> { - let settings: WorkspaceSettings = serde_json::from_value(value)?; + pub fn update(&mut self, value: Value) -> LSPResult<()> { + let settings: WorkspaceSettings = serde_json::from_value(value) + .map_err(|err| LSPError::invalid_params(err.to_string()))?; self.settings = settings; Ok(()) } |