Skip to content

feat(completion): add queryScope config to scope completion target query#599

Open
runchen0919 wants to merge 2 commits into
bazel-contrib:masterfrom
runchen0919:add-completion-query-scope
Open

feat(completion): add queryScope config to scope completion target query#599
runchen0919 wants to merge 2 commits into
bazel-contrib:masterfrom
runchen0919:add-completion-query-scope

Conversation

@runchen0919

Copy link
Copy Markdown
Contributor

Description

Add bazel.completion.queryScope setting (string array) that limits the Bazel query used by the completion provider to specific package patterns (e.g. ["//src/...", "//lib/..."]), instead of always querying the entire workspace.

Related Issue

#598

Testing

  • Tests added/updated
  • Manual testing performed

Checklist

  • Code follows the project's style guidelines (prettier/eslint)
  • Commit messages follow Conventional Commit conventions
  • Tests pass locally (npm run test)

Add `bazel.completion.queryScope` setting (string array) that limits
the Bazel query used by the completion provider to specific package
patterns (e.g. `["//src/...", "//lib/..."]`), instead of always
querying the entire workspace.
@runchen0919 runchen0919 marked this pull request as ready for review April 7, 2026 02:10
@cbandera

cbandera commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Thank you very much for your first contribution @runchen0919 !
The implementation looks clean and minimal. It's also nice to see that you added tests right away.

Conceptually though, I am sorry to say that I am not really in favor of this change.
One reason is that we see a lot of requests to add new config options for specific needs - this has the potential downside of cluttering the extensions settings and to make it very confusing for future users to configure the extension properly. In order to better judge on the tradeoffs, could you maybe motivate why this change is necessary for your project setup? Is it the overhead of running full repository queries or do you see issues with the completion suggestions themselves?

The second reason is, that I am actually planning to remove the code that you have touched entirely, once the extension bundles a LSP directly. See also this comment: #1 (comment)

@runchen0919

runchen0919 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Thank you very much for your first contribution @runchen0919 ! The implementation looks clean and minimal. It's also nice to see that you added tests right away.

Conceptually though, I am sorry to say that I am not really in favor of this change. One reason is that we see a lot of requests to add new config options for specific needs - this has the potential downside of cluttering the extensions settings and to make it very confusing for future users to configure the extension properly. In order to better judge on the tradeoffs, could you maybe motivate why this change is necessary for your project setup? Is it the overhead of running full repository queries or do you see issues with the completion suggestions themselves?

The second reason is, that I am actually planning to remove the code that you have touched entirely, once the extension bundles a LSP directly. See also this comment: #1 (comment)

Hi, @cbandera Thank you for your reply. Let me explain the problem I encountered. My current project is a multi-language project managed by Bazel, including Python, Java, Go, and some code templates, etc. The code structure is as follows. In reality, as developers, we might only be concerned with the code in a specific directory, not scanning all targets in the root directory. There might be some problematic Bazel files in the code templates, causing the refresh function to encounter errors when scanning from the root directory.

| - code-template
    | - example.bzl   # error
| - src
    | - python
    |- go
    |- java
| - users

@runchen0919 runchen0919 closed this Apr 9, 2026
@runchen0919 runchen0919 reopened this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants