New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add an option to hide adjustment hints outside of unsafe
blocks and functions
#13817
feat: Add an option to hide adjustment hints outside of unsafe
blocks and functions
#13817
Conversation
@@ -110,6 +121,59 @@ pub(super) fn hints( | |||
Some(()) | |||
} | |||
|
|||
fn is_inside_unsafe(sema: &Semantics<'_, RootDatabase>, node: &SyntaxNode) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be working fine, but I'm left wondering if there is a better way...
crates/hir/src/semantics.rs
Outdated
@@ -1458,6 +1470,59 @@ impl<'db> SemanticsImpl<'db> { | |||
.map(|ty| ty.original.is_packed(self.db)) | |||
.unwrap_or(false) | |||
} | |||
|
|||
fn is_inside_unsafe(&self, node: &SyntaxNode) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn is_inside_unsafe(&self, node: &SyntaxNode) -> bool { | |
fn is_inside_unsafe(&self, node: &ast::Expr)-> bool { |
This handles expressions so it should only take such
bb3a66b
to
94d0772
Compare
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
94d0772
to
1038db5
Compare
This might not play completely nice with macro expansions, but we'll see |
☀️ Test successful - checks-actions |
As the title suggests: this PR adds an option (namely
rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe
) that allows to hide adjustment hints outside ofunsafe
blocks and functions:Requested by @BoxyUwU <3