internal: deduplicate
This commit is contained in:
@@ -10,7 +10,9 @@ use crate::{
|
||||
from_json,
|
||||
global_state::GlobalStateSnapshot,
|
||||
line_index::{LineIndex, OffsetEncoding},
|
||||
lsp_ext, LspError, Result,
|
||||
lsp_ext,
|
||||
lsp_utils::invalid_params_error,
|
||||
Result,
|
||||
};
|
||||
|
||||
pub(crate) fn abs_path(url: &lsp_types::Url) -> Result<AbsPathBuf> {
|
||||
@@ -85,10 +87,8 @@ pub(crate) fn annotation(
|
||||
snap: &GlobalStateSnapshot,
|
||||
code_lens: lsp_types::CodeLens,
|
||||
) -> Result<Annotation> {
|
||||
let data = code_lens.data.ok_or_else(|| LspError {
|
||||
code: lsp_server::ErrorCode::InvalidParams as i32,
|
||||
message: "code lens without data".to_string(),
|
||||
});
|
||||
let data =
|
||||
code_lens.data.ok_or_else(|| invalid_params_error("code lens without data".to_string()))?;
|
||||
let resolve = from_json::<lsp_ext::CodeLensResolveData>("CodeLensResolveData", data)?;
|
||||
|
||||
match resolve {
|
||||
|
||||
Reference in New Issue
Block a user