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

Fix Golang textobject queries #2153

Merged
merged 2 commits into from
Apr 18, 2022

Conversation

the-mikedavis
Copy link
Member

df57914 has the details on the fix itself: it was a node that was removed when we updated for generics support.

Also included is an error log for failures to parse textobjects queries (see here) which makes it easier to debug this in the future.

closes #1920

The current behavior is that invalid queries are discarded silently
which makes it difficult to debug invalid textobjects (either invalid
syntax or an update may have come through that changed the valid set
of nodes).
`method_spec_list` used to be a named node but was removed (I think
for Helix, it was when updated to pull in the support for generics).
Instead of a named node for the list of method specs we have a bunch
of `method_spec` children nodes now. We can match on the set of them
with a `+` wildcard.

Example go for this query:

    type Shape interface {
       area() float64
       perimeter() float64
    }

Which is parsed as:

    (source_file
      (type_declaration
        (type_spec
          name: (type_identifier)
          type: (interface_type
            (method_spec
              name: (field_identifier)
              parameters: (parameter_list)
              result: (type_identifier))
            (method_spec
              name: (field_identifier)
              parameters: (parameter_list)
              result: (type_identifier))))))
@pickfire pickfire merged commit 4e877de into helix-editor:master Apr 18, 2022
@the-mikedavis the-mikedavis deleted the md-go-textobjects-fix branch April 18, 2022 15:15
@pickfire
Copy link
Contributor

Thanks, looks good to me.

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.

Golang Text objects not working
2 participants