-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Labels
A-documentationdocs for rust-analyzer usage/inner workingdocs for rust-analyzer usage/inner working
Description
I just saw #19375 was merged, but I couldn't find any user-facing documentation on how to use #[rust_analyzer::completions(...)]
. I did find these comments, but they're within the code:
rust-analyzer/crates/hir-def/src/lib.rs
Lines 1507 to 1527 in 2e1ff25
// Feature: Completions Attribute | |
// Crate authors can opt their type out of completions in some cases. | |
// This is done with the `#[rust_analyzer::completions(...)]` attribute. | |
// | |
// All completeable things support `#[rust_analyzer::completions(ignore_flyimport)]`, | |
// which causes the thing to get excluded from flyimport completion. It will still | |
// be completed when in scope. This is analogous to the setting `rust-analyzer.completion.autoimport.exclude` | |
// with `"type": "always"`. | |
// | |
// In addition, traits support two more modes: `#[rust_analyzer::completions(ignore_flyimport_methods)]`, | |
// which means the trait itself may still be flyimported but its methods won't, and | |
// `#[rust_analyzer::completions(ignore_methods)]`, which means the methods won't be completed even when | |
// the trait is in scope (but the trait itself may still be completed). The methods will still be completed | |
// on `dyn Trait`, `impl Trait` or where the trait is specified in bounds. These modes correspond to | |
// the settings `rust-analyzer.completion.autoimport.exclude` with `"type": "methods"` and | |
// `rust-analyzer.completion.excludeTraits`, respectively. | |
// | |
// Malformed attributes will be ignored without warnings. | |
// | |
// Note that users have no way to override this attribute, so be careful and only include things | |
// users definitely do not want to be completed! |
Is there a place this can be documented so it is easier to discover and learn about? (I would be willing to open a PR for this, though I may have a few extra questions.) Thank you!
joshka
Metadata
Metadata
Assignees
Labels
A-documentationdocs for rust-analyzer usage/inner workingdocs for rust-analyzer usage/inner working