gleam-lang / tree-sitter-gleam

🌳 A tree-sitter grammar for the Gleam programming language
Apache License 2.0
71 stars 13 forks source link

would it be possible to have names tagged for consnt/fn on the future (as types are now) ? #40

Closed sdancer closed 1 year ago

sdancer commented 1 year ago
        {Node type (1, 4) - (1, 8)}
        {Node type_name (1, 9) - (1, 16)}
            {Node type_identifier (1, 9) - (1, 16)}

        {Node const (17, 0) - (17, 5)}
        {Node identifier (17, 6) - (17, 14)}

        {Node fn (8, 13) - (8, 15)}
        {Node identifier (8, 16) - (8, 28)}
J3RN commented 1 year ago

This issue was resolved in the Discord, but for posterity:

type_identifier is a bit special. Either way, these names are largely pulled straight from Gleam's parser.

If you want to capture function names, you can do so with this query:

(function
  name: (identifier) @function_name)

Similarly for constants:

(constant
  name: (identifier) @constant_name)