aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorErin van der Veen2022-04-20 14:31:59 +0000
committerGitHub2022-04-20 14:31:59 +0000
commit961647719769e6b2baa8ae74630c16ab8963fa61 (patch)
tree968d5e266802e5a281e36916b8c05c75f0bcd524 /runtime/queries
parent5247d3ae2d19da1959534b676fdbea9c34b0df06 (diff)
Add Nickel language (#2173)
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/nickel/highlights.scm67
-rw-r--r--runtime/queries/nickel/indents.scm17
2 files changed, 84 insertions, 0 deletions
diff --git a/runtime/queries/nickel/highlights.scm b/runtime/queries/nickel/highlights.scm
new file mode 100644
index 00000000..a204dfca
--- /dev/null
+++ b/runtime/queries/nickel/highlights.scm
@@ -0,0 +1,67 @@
+(types) @type
+(type_builtin) @type.builtin
+"Array" @type.builtin
+
+(enum_tag) @constructor
+
+"null" @constant.builtin
+(bool) @constant.builtin.boolean
+(str_esc_char) @constant.character.escape
+(num_literal) @constant.numeric
+
+(str_chunks) @string
+
+; NOTE: Nickel has no block comments
+(comment) @comment.line
+; Nickel doesn't use comments for documentation, ideally this would be
+; `@documentation` or something similar
+(annot_atom
+ doc: (static_string) @comment.block.documentation
+)
+
+(record_operand (atom (ident) @variable))
+(let_expr
+ "let" @keyword
+ pat: (pattern
+ (ident) @variable
+ )
+ "in" @keyword
+)
+(fun_expr
+ "fun" @keyword.function
+ pats:
+ (pattern
+ id: (ident) @variable.parameter
+ )+
+ "=>" @operator
+)
+(record_field) @variable.other.member
+
+[
+ "."
+] @punctuation.delimiter
+[
+ "{" "}"
+ "(" ")"
+ "[|" "|]"
+ "[" "]"
+] @punctuation.bracket
+(multstr_start) @punctuation.bracket
+(multstr_end) @punctuation.bracket
+(interpolation_start) @punctuation.bracket
+(interpolation_end) @punctuation.bracket
+
+["forall" "default" "doc"] @keyword
+["if" "then" "else" "switch"] @keyword.control.conditional
+"import" @keyword.control.import
+
+(infix_expr
+ op: (_) @operator
+)
+
+(applicative
+ t1: (applicative
+ (record_operand) @function
+ )
+)
+(builtin) @function.builtin
diff --git a/runtime/queries/nickel/indents.scm b/runtime/queries/nickel/indents.scm
new file mode 100644
index 00000000..8be5a6bd
--- /dev/null
+++ b/runtime/queries/nickel/indents.scm
@@ -0,0 +1,17 @@
+[
+ (fun_expr)
+ (let_expr)
+ (switch_expr)
+ (ite_expr)
+
+ (uni_record)
+ (str_chunks_multi)
+ "["
+ "[|"
+] @indent
+
+[
+ "}"
+ "]"
+ "|]"
+] @outdent