tree-sitter-grammars / tree-sitter-query

TS query grammar for tree-sitter
Apache License 2.0
52 stars 14 forks source link

fix: allow supertype nodes as identifiers #33

Closed clason closed 6 months ago

clason commented 6 months ago

Add / to valid IDENTIFIER to support foo/bar supertype nodes in queries, e.g., for Haskell. Followup could add dedicated support for such nodes (if there is a use case).

Closes #29.

@lucario387

lucario387 commented 6 months ago

OOps.

(foo/bar
  (baz)
  (bez))

creates a tree like

(program ; [0, 0] - [15, 0]
  (list ; [0, 0] - [2, 8]
    (symbol) ; [0, 1] - [0, 8]
    (list ; [1, 2] - [1, 7]
      (symbol)) ; [1, 3] - [1, 6]
    (list ; [2, 2] - [2, 7]
      (symbol)))) ; [2, 3] - [2, 6]
clason commented 6 months ago

Does #34 work better? Then I'll merge that despite the state increase.

lucario387 commented 6 months ago

Yes, it now does work with the formatter more often.

lucario387 commented 6 months ago

tbf, both this and #34 does work. But somehow nvim/format-queries.lua somehow doesn't like this as much as #34

clason commented 6 months ago

Okie, let's go with #34 then. The indeterminacy is bad, though, and should be looked at.