From 62a601469ef56c1fedb939ccbabf0b58a84cc7d5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 3 Jun 2022 19:59:56 +0200 Subject: [PATCH] Add functions high-lighting --- queries/highlights.scm | 12 ++++++++++++ test/highlight/functions.tig | 8 ++++++++ test/highlight/identifiers.tig | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/highlight/functions.tig diff --git a/queries/highlights.scm b/queries/highlights.scm index be0dfd5..628eea6 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -48,6 +48,18 @@ ] @punctuation.bracket ; }}} +; Functions {{{ +(function_call + function: (identifier) @function) +(function_declaration + name: (identifier) @function) +(primitive_declaration + name: (identifier) @function) + +(parameters + name: (identifier) @variable.parameter) +; }}} + ; Misc {{{ (comment) @comment diff --git a/test/highlight/functions.tig b/test/highlight/functions.tig new file mode 100644 index 0000000..802f394 --- /dev/null +++ b/test/highlight/functions.tig @@ -0,0 +1,8 @@ +primitive print(s: string) +/* ^ function */ +/* ^ variable.parameter */ + +function func(a: int) : int = (print("Hello World!"); a) +/* ^ function */ +/* ^ variable.parameter */ +/* ^ function */ diff --git a/test/highlight/identifiers.tig b/test/highlight/identifiers.tig index eb43bf9..8a4bfef 100644 --- a/test/highlight/identifiers.tig +++ b/test/highlight/identifiers.tig @@ -22,8 +22,8 @@ var array := int_array[12] of 27; /* ^ type */ primitive func(a: int, b: string) : array -/* ^ variable */ +/* ^ variable.parameter */ /* ^ type */ -/* ^ variable */ +/* ^ variable.parameter */ /* ^ type */ /* ^ type */