Merge pull request #18179 from ChayimFriedman2/omit-trait-completion

feat: Allow excluding specific traits from completion
This commit is contained in:
Lukas Wirth 2025-01-01 14:34:56 +00:00 committed by GitHub
commit 7e639ee3dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 1028 additions and 100 deletions

View file

@ -1144,6 +1144,51 @@
}
}
},
{
"title": "completion",
"properties": {
"rust-analyzer.completion.autoimport.exclude": {
"markdownDescription": "A list of full paths to items to exclude from auto-importing completions.\n\nTraits in this list won't have their methods suggested in completions unless the trait\nis in scope.\n\nYou can either specify a string path which defaults to type \"always\" or use the more verbose\nform `{ \"path\": \"path::to::item\", type: \"always\" }`.\n\nFor traits the type \"methods\" can be used to only exclude the methods but not the trait itself.\n\nThis setting also inherits `#rust-analyzer.completion.excludeTraits#`.",
"default": [
{
"path": "core::borrow::Borrow",
"type": "methods"
},
{
"path": "core::borrow::BorrowMut",
"type": "methods"
}
],
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"path": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"always",
"methods"
],
"enumDescriptions": [
"Do not show this item or its methods (if it is a trait) in auto-import completions.",
"Do not show this traits methods in auto-import completions."
]
}
}
}
]
}
}
}
},
{
"title": "completion",
"properties": {
@ -1174,6 +1219,19 @@
}
}
},
{
"title": "completion",
"properties": {
"rust-analyzer.completion.excludeTraits": {
"markdownDescription": "A list of full paths to traits whose methods to exclude from completion.\n\nMethods from these traits won't be completed, even if the trait is in scope. However, they will still be suggested on expressions whose type is `dyn Trait`, `impl Trait` or `T where T: Trait`.\n\nNote that the trait themselves can still be completed.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
}
}
},
{
"title": "completion",
"properties": {