internal: deduplicate

This commit is contained in:
Aleksey Kladov
2021-09-04 12:56:34 +03:00
parent 33199b7e43
commit 2d2c4e7c22
5 changed files with 55 additions and 33 deletions

View File

@@ -8,8 +8,13 @@ use crate::{
from_proto,
global_state::GlobalState,
line_index::{LineEndings, LineIndex, OffsetEncoding},
LspError,
};
pub(crate) fn invalid_params_error(message: String) -> LspError {
LspError { code: lsp_server::ErrorCode::InvalidParams as i32, message }
}
pub(crate) fn is_cancelled(e: &(dyn Error + 'static)) -> bool {
e.downcast_ref::<Cancelled>().is_some()
}