Summary
Add a new bazel.completion.queryScope configuration option that allows users to limit the Bazel query used by the completion provider to specific package patterns, instead of always querying the entire workspace.
Motivation
In large monorepos, the completion provider currently runs kind('.* rule', ...) which queries all targets in the workspace. This can be slow and return irrelevant results when a user only cares about a subset of packages.
Proposed Change
Add a new setting bazel.completion.queryScope (type: string[], default: []) under the bazel.completion namespace.
- When empty (default), the existing behavior is preserved — the entire workspace is queried (
kind('.* rule', ...))
- When non-empty, the query is scoped to the specified patterns via union, e.g.
["//src/...", "//lib/..."] → kind('.* rule', //src/... + //lib/...)
Example configuration
"bazel.completion.queryScope": ["//src/...", "//lib/..."]
Difference from bazel.commandLine.queryExpression
| Setting |
Type |
Controls |
bazel.commandLine.queryExpression |
string |
Workspace tree view & quick picker |
bazel.completion.queryScope |
string[] |
BUILD file target auto-completion |
These two settings are independent and control different features.
Summary
Add a new
bazel.completion.queryScopeconfiguration option that allows users to limit the Bazel query used by the completion provider to specific package patterns, instead of always querying the entire workspace.Motivation
In large monorepos, the completion provider currently runs
kind('.* rule', ...)which queries all targets in the workspace. This can be slow and return irrelevant results when a user only cares about a subset of packages.Proposed Change
Add a new setting
bazel.completion.queryScope(type:string[], default:[]) under thebazel.completionnamespace.kind('.* rule', ...))["//src/...", "//lib/..."]→kind('.* rule', //src/... + //lib/...)Example configuration
Difference from
bazel.commandLine.queryExpressionbazel.commandLine.queryExpressionstringbazel.completion.queryScopestring[]These two settings are independent and control different features.