Skip to content

Commit

Permalink
update Gleam grammar and queries
Browse files Browse the repository at this point in the history
With respect to the queries:

The locals scope for functions was not large enough, so a function's
parameter could outlive the function body. To fix it, we just widen
the scope to the `function` node.

See also gleam-lang/tree-sitter-gleam#25

With respect to the parser:

An external scanner has been added that fixes the parsing of strings.
Previously, a comment inside a string would act like a comment rather
than string contents.

See also gleam-lang/tree-sitter-gleam#14 (comment)

A new constructor node has been added as well which makes type
highlighting more fine grained.

See also gleam-lang/tree-sitter-gleam#29
  • Loading branch information
the-mikedavis authored and mtoohey31 committed Jun 15, 2022
1 parent e7377c5 commit da8af3a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "gleam"
source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "7159ce961592192b0e7cdf88782cda0fdf41a4cb" }
source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "d7861b2a4b4d594c58bb4f1be5f1f4ee4c67e5c3" }

[[language]]
name = "ron"
Expand Down
5 changes: 5 additions & 0 deletions runtime/queries/gleam/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
(import alias: (identifier) @namespace)
(remote_type_identifier
module: (identifier) @namespace)
(remote_constructor_name
module: (identifier) @namespace)
((field_access
record: (identifier) @namespace
field: (label) @function)
Expand Down Expand Up @@ -45,6 +47,9 @@
(remote_type_identifier) @type
(type_identifier) @type

; Data constructors
(constructor_name) @constructor

; Literals
(string) @string
(bit_string_segment_option) @function.builtin
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/gleam/locals.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; Scopes
(function_body) @local.scope
(function) @local.scope

(case_clause) @local.scope

Expand Down

0 comments on commit da8af3a

Please sign in to comment.