Skip to content

Add bazel.completion.queryScope to scope completion target query #598

@runchen0919

Description

@runchen0919

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions