Don't show internal server error on rename

Doesn't quite work due to https://github.com/microsoft/vscode-languageserver-node/issues/730

Note that this intentionally removes `impl std::Error for RenameError`
-- we nether want to blindly bubble the rename error.
This commit is contained in:
Aleksey Kladov
2021-01-13 14:09:51 +03:00
parent 52fa926f00
commit f0e802f490
3 changed files with 10 additions and 14 deletions

View File

@@ -8,7 +8,8 @@ use ide::{
Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId,
FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel,
InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, ReferenceAccess,
Runnable, Severity, SourceChange, SourceFileEdit, SymbolKind, TextEdit, TextRange, TextSize,
RenameError, Runnable, Severity, SourceChange, SourceFileEdit, SymbolKind, TextEdit, TextRange,
TextSize,
};
use itertools::Itertools;
@@ -855,6 +856,10 @@ pub(crate) fn markup_content(markup: Markup) -> lsp_types::MarkupContent {
lsp_types::MarkupContent { kind: lsp_types::MarkupKind::Markdown, value }
}
pub(crate) fn rename_error(err: RenameError) -> crate::LspError {
crate::LspError { code: lsp_server::ErrorCode::InvalidParams as i32, message: err.to_string() }
}
#[cfg(test)]
mod tests {
use ide::Analysis;