From 276627849b31d03193801f2e31a47b4e32486228 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 22 Oct 2022 16:52:46 +0300 Subject: [PATCH] highlights(gleam): use more specific groups --- queries/gleam/highlights.scm | 20 ++++++++++++-------- tests/query/highlights/gleam/function.gleam | 12 ++++++------ tests/query/highlights/gleam/type.gleam | 6 +++--- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/queries/gleam/highlights.scm b/queries/gleam/highlights.scm index e1dc969ab..0e2712879 100644 --- a/queries/gleam/highlights.scm +++ b/queries/gleam/highlights.scm @@ -1,11 +1,7 @@ ; Keywords [ "as" - "const" - "external" "let" - "opaque" - "pub" "todo" "try" ] @keyword @@ -88,8 +84,8 @@ ; Comments [ (module_comment) - (statement_comment) - (comment) + (statement_comment) + (comment) ] @comment ; Unused Identifiers @@ -112,8 +108,8 @@ ; Numbers [ - (integer) - (float) + (integer) + (float) (bit_string_segment_option_unit) ] @number @@ -142,6 +138,14 @@ ; Type Variables (type_var) @type +; Type Qualifiers +[ + "const" + "external" + "opaque" + "pub" +] @type.qualifier + ; Tuples (tuple_access index: (integer) @operator) diff --git a/tests/query/highlights/gleam/function.gleam b/tests/query/highlights/gleam/function.gleam index 89a302706..bc69ec620 100644 --- a/tests/query/highlights/gleam/function.gleam +++ b/tests/query/highlights/gleam/function.gleam @@ -1,5 +1,5 @@ pub fn add(x: Int, y: Int) -> Int { -// <- keyword +// <- type.qualifier // ^ keyword.function // ^ function // ^ punctuation.bracket @@ -18,7 +18,7 @@ pub fn add(x: Int, y: Int) -> Int { // <- punctuation.bracket pub fn twice(f: fn(t) -> t, x: t) -> t { -// <- keyword +// <- type.qualifier // ^ keyword.function // ^ function // ^ punctuation.bracket @@ -100,8 +100,8 @@ fn replace( // <- punctuation.bracket pub external fn random_float() -> Float = "rand" "uniform" -// <- keyword -// ^ keyword +// <- type.qualifier +// ^ type.qualifier // ^ keyword.function // ^ function // ^ punctuation.bracket @@ -113,8 +113,8 @@ pub external fn random_float() -> Float = "rand" "uniform" // ^ function pub external fn inspect(a) -> a = "Elixir.IO" "inspect" -// <- keyword -// ^ keyword +// <- type.qualifier +// ^ type.qualifier // ^ keyword.function // ^ function // ^ punctuation.bracket diff --git a/tests/query/highlights/gleam/type.gleam b/tests/query/highlights/gleam/type.gleam index 08887e021..d25efde34 100644 --- a/tests/query/highlights/gleam/type.gleam +++ b/tests/query/highlights/gleam/type.gleam @@ -1,5 +1,5 @@ pub type Cat { -// <- keyword +// <- type.qualifier // ^ keyword.function // ^ type // ^ punctuation.bracket @@ -53,8 +53,8 @@ type Box(inner_type) { } pub opaque type Counter { -// <- keyword -// ^ keyword +// <- type.qualifier +// ^ type.qualifier // ^ keyword.function // ^ type // ^ punctuation.bracket