From 100d5d18207523ba168a7132ae7e14442d9a2587 Mon Sep 17 00:00:00 2001 From: Weizhao Ouyang Date: Wed, 6 May 2026 16:41:42 +0800 Subject: [PATCH] fix: add more context support for c/cpp preprocessor directives Add more preprocessor directives for c/cpp, including `#elif`, `#elifdef`, `#elifndef` and `#else`. See: https://cppreference.com/cpp/preprocessor/conditional Signed-off-by: Weizhao Ouyang --- queries/c/context.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/queries/c/context.scm b/queries/c/context.scm index d3a89dd7..20521396 100644 --- a/queries/c/context.scm +++ b/queries/c/context.scm @@ -6,6 +6,17 @@ name: (identifier) (_) @context.end) @context +(preproc_else + (_) @context.end) @context + +(preproc_elif + (_) + (_) @context.end) @context + +(preproc_elifdef + (_) + (_) @context.end) @context + (function_definition body: (_ (_) @context.end)) @context