bazel-contrib / bazel-contrib/vscode-bazel
Add bazel.completion.queryScope to scope completion target query
- Dominant language
- TypeScript
- Stars
- 296
- Forks
- 108
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 5
Description
## 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
```json
"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.
Contributor guide
Research direction
Locate the completion provider and configuration definitions, starting with the existing `kind('.* rule', ...)` query and the related `bazel.commandLine.queryExpression` setting. Done means the new array setting defaults to empty, preserves the workspace-wide query when empty, and scopes completion queries to the configured package patterns when non-empty.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100