Repository: gleam-lang/tree-sitter-gleam (js)

Issue:
Function name sometimes not highlighted
Hello! I found an instance in which a function name does not get highlighted. It's not clear to me why this is right away

![image](https://user-images.githubusercontent.com/6134406/168885923-5f14bbdb-20e2-425a-91c6-7790d4584f47.png)

https://github.com/gleam-lang/stdlib/blob/f9d57db847ff2a8471c9136bd309c870b610d04d/src/gleam/uri.gleam#L325

Pull request description:
use `function` node as a locals scope rather than `function_body`
closes #25

Parameters live outside of the `function_body`, so if you have a function parameter that matches a module name, it will highlight the module as a `@variable.parameter` for the rest of the document instead of just the body of the function. As a fix we can set `function` as a scope instead, so function names, parameters, and body all live under one scope.

Patch:
diff --git a/queries/locals.scm b/queries/locals.scm
index bd5903e..4930057 100644
--- a/queries/locals.scm
+++ b/queries/locals.scm
@@ -1,5 +1,5 @@
 ; Scopes
-(function_body) @local.scope
+(function) @local.scope
 
 (case_clause) @local.scope
 


Test patch:
diff --git a/test/highlight/functions.gleam b/test/highlight/functions.gleam
index 6fe50dc..1080358 100644
--- a/test/highlight/functions.gleam
+++ b/test/highlight/functions.gleam
@@ -68,6 +68,13 @@ fn trial(uri) {
   }
 }
 
+fn my_uri_to_string(my_uri) -> String {
+  uri.to_string(my_uri)
+  // <- module
+  //   ^ function
+  //             ^ variable.parameter
+}
+
 fn myfun(argument) {
   let local_fun = fn(x) { x + 1 }
   //   ^ variable