Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: keyword_argument in BUILD files doesn't contain trailing comma #7

Open
2 tasks done
keith opened this issue Feb 3, 2025 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@keith
Copy link

keith commented Feb 3, 2025

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

NVIM v0.10.0-dev-2995+ga1550dbf0

Describe the bug

in a BILD file if you have:

foo(
  name = "foo",
  target_compatible_with = select({
        "//:tsan": ["@platforms//:incompatible"],
        "//conditions:default": [],
    }),
    srcs = [],
)

And you want to write a query like this:

(keyword_argument
  name: (identifier)
  value: (_) @parameter.inner) @parameter.outer

To select the entire parameter target_compatible_with, the keyword_argument range doesn't include the trailing comma after target_compatible_with

Steps To Reproduce/Bad Parse Tree

With this example in neovim, if you use :InspectTree you see this:

Image

note the trailing is not highlighted.

if you select the common instead, it's only part of the higher level arguments:

Image

Expected Behavior/Parse Tree

I think the trailing comma should be part of the keyword_argument range because if you want to perform an operation like deleting the entire argument, the comma is semantically included in that

Repro

No response

@keith keith added the bug Something isn't working label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant