mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Merge #10458
10458: feat: Implement custom user snippets r=Veykril a=Veykril  Allows us to address the following issues: - `.arc / .rc / .pin, similar to .box?` https://github.com/rust-analyzer/rust-analyzer/issues/7033 - `Add unsafe snippet` https://github.com/rust-analyzer/rust-analyzer/issues/10392, would allow users to have this without the diagnostic) - `.ok() postfix snippet is annoying` https://github.com/rust-analyzer/rust-analyzer/issues/9636, allows us to get rid of the `ok` postfix and similar ones - `Postfix vec completion` https://github.com/rust-analyzer/rust-analyzer/issues/7773 cc https://github.com/rust-analyzer/rust-analyzer/issues/772 Zulipd discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Custom.20Postfix.20snippets Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
c409cf0e26
23 changed files with 550 additions and 88 deletions
|
@ -97,7 +97,10 @@ impl<'a> FunctionRender<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
item.add_import(import_to_add).lookup_by(self.name);
|
||||
if let Some(import_to_add) = import_to_add {
|
||||
item.add_import(import_to_add);
|
||||
}
|
||||
item.lookup_by(self.name);
|
||||
|
||||
let ret_type = self.func.ret_type(self.ctx.db());
|
||||
item.set_relevance(CompletionRelevance {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue