aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2021-07-01 15:16:23 -0600
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-07-18 16:44:40 +0000
commit27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c (patch)
tree87c8a660a1e924b3c7d19ea4cf82881e9527226a
parentfix(elixir): add missing possible parameters (diff)
downloadnvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.tar
nvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.tar.gz
nvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.tar.bz2
nvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.tar.lz
nvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.tar.xz
nvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.tar.zst
nvim-treesitter-27f5e99cdd1b4e7f6a5cc30016d990ebf81a561c.zip
c: don't treat uppercase functions as constants
A macro function such as #define FOO(x) ... should be highlighted with @function.macro, even though the name is in all-caps (which would otherwise be treated as a constant). Similarly, call sites of such functions, e.g. int y = FOO(x); should be highlighted with @function instead of @constant. This is as simple as moving the query definition for macro functions after the query definition for constants.
-rw-r--r--queries/c/highlights.scm18
1 files changed, 9 insertions, 9 deletions
diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm
index 757dc232e..8a9b092a7 100644
--- a/queries/c/highlights.scm
+++ b/queries/c/highlights.scm
@@ -111,15 +111,6 @@
(number_literal) @number
(char_literal) @character
-(call_expression
- function: (identifier) @function)
-(call_expression
- function: (field_expression
- field: (field_identifier) @function))
-(function_declarator
- declarator: (identifier) @function)
-(preproc_function_def
- name: (identifier) @function.macro)
[
(preproc_arg)
(preproc_defined)
@@ -157,6 +148,15 @@
argument: (_) @constant
(#eq? @_u "#undef"))
+(call_expression
+ function: (identifier) @function)
+(call_expression
+ function: (field_expression
+ field: (field_identifier) @function))
+(function_declarator
+ declarator: (identifier) @function)
+(preproc_function_def
+ name: (identifier) @function.macro)
(comment) @comment