internal: make upstream bug less annoying
This commit is contained in:
parent
c41870076b
commit
3a055a6b1f
@ -7,7 +7,6 @@
|
|||||||
process::{self, Stdio},
|
process::{self, Stdio},
|
||||||
};
|
};
|
||||||
|
|
||||||
use always_assert::always;
|
|
||||||
use ide::{
|
use ide::{
|
||||||
AnnotationConfig, AssistKind, AssistResolveStrategy, FileId, FilePosition, FileRange,
|
AnnotationConfig, AssistKind, AssistResolveStrategy, FileId, FilePosition, FileRange,
|
||||||
HoverAction, HoverGotoTypeData, Query, RangeInfo, Runnable, RunnableKind, SingleResolve,
|
HoverAction, HoverGotoTypeData, Query, RangeInfo, Runnable, RunnableKind, SingleResolve,
|
||||||
@ -268,7 +267,9 @@ pub(crate) fn handle_on_type_formatting(
|
|||||||
let char_typed = params.ch.chars().next().unwrap_or('\0');
|
let char_typed = params.ch.chars().next().unwrap_or('\0');
|
||||||
|
|
||||||
let text = snap.analysis.file_text(position.file_id)?;
|
let text = snap.analysis.file_text(position.file_id)?;
|
||||||
if !always!(text[usize::from(position.offset)..].starts_with(char_typed)) {
|
if !text[usize::from(position.offset)..].starts_with(char_typed) {
|
||||||
|
// Add `always!` here once VS Code bug is fixed:
|
||||||
|
// https://github.com/rust-analyzer/rust-analyzer/issues/10002
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user