diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index f17266221f..fb3f0b743e 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs @@ -112,7 +112,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[ AttrCompletion { label: "repr", snippet: Some("repr(${0:C})"), should_be_inner: false }, AttrCompletion { label: "should_panic", - snippet: Some(r#"expected = "${0:reason}""#), + snippet: Some(r#"should_panic(expected = "${0:reason}")"#), should_be_inner: false, }, AttrCompletion { @@ -571,7 +571,7 @@ mod tests { label: "should_panic", source_range: 19..19, delete: 19..19, - insert: "expected = \"${0:reason}\"", + insert: "should_panic(expected = \"${0:reason}\")", kind: Attribute, }, CompletionItem { @@ -810,7 +810,7 @@ mod tests { label: "should_panic", source_range: 20..20, delete: 20..20, - insert: "expected = \"${0:reason}\"", + insert: "should_panic(expected = \"${0:reason}\")", kind: Attribute, }, CompletionItem { diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 127a9e9112..793c481fb6 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -74,10 +74,11 @@ export type RustDocument = vscode.TextDocument & { languageId: "rust" }; export type RustEditor = vscode.TextEditor & { document: RustDocument }; export function isRustDocument(document: vscode.TextDocument): document is RustDocument { - return document.languageId === 'rust' - // SCM diff views have the same URI as the on-disk document but not the same content - && document.uri.scheme !== 'git' - && document.uri.scheme !== 'svn'; + // Prevent corrupted text (particularly via inlay hints) in diff views + // by allowing only `file` schemes + // unfortunately extensions that use diff views not always set this + // to something different than 'file' (see ongoing bug: #4608) + return document.languageId === 'rust' && document.uri.scheme === 'file'; } export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor {