mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Show reason for failed rename refactoring
Return an error with a meaningful message for requests to `textDocument/rename` if the operation cannot be performed. Pass errors raised by rename handling code to the LSP runtime. As a consequence, the VS Code client shows and logs the request as if a server-side programming error occured. Resolves https://github.com/rust-analyzer/rust-analyzer/issues/3981
This commit is contained in:
parent
05261f5aeb
commit
e90931a204
4 changed files with 138 additions and 61 deletions
|
@ -77,7 +77,9 @@ pub use crate::{
|
|||
hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult},
|
||||
inlay_hints::{InlayHint, InlayHintsConfig, InlayKind},
|
||||
markup::Markup,
|
||||
references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult},
|
||||
references::{
|
||||
Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, RenameError,
|
||||
},
|
||||
runnables::{Runnable, RunnableKind, TestId},
|
||||
syntax_highlighting::{
|
||||
Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange,
|
||||
|
@ -490,7 +492,7 @@ impl Analysis {
|
|||
&self,
|
||||
position: FilePosition,
|
||||
new_name: &str,
|
||||
) -> Cancelable<Option<RangeInfo<SourceChange>>> {
|
||||
) -> Cancelable<Result<RangeInfo<SourceChange>, RenameError>> {
|
||||
self.with_db(|db| references::rename(db, position, new_name))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue