gleam-lang / tree-sitter-gleam

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

Consider the "field" of field accesses to be a function wherever the "record" is a module #10

Closed J3RN closed 2 years ago

J3RN commented 2 years ago

Currently we only consider the possibility for a field_access to actually be a remote function when it is being used in a function call expression or on the right side of a pipe. However, there is at least one other case where this could be true:

let foo = io.println
foo("Hello, World!")

Here, io.println is a remote function which is being bound to the local variable foo.

In order to catch this and other circumstances where a field_access may actually be a remote function reference, I generalized the highlight matcher.

I also added a test to ensure that highlighting of remote function invocations behaves as we expect.