From 336bc3c26aea5704225cde63c1ba57d31cb5377e Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 23 Jan 2026 15:00:37 +0100 Subject: [PATCH] outline: Fix uninitiated var declaration not showing in outline (#46499) For the following code, we didn't show anything; after the fix, they are shown in the outline: image Release Notes: - Fix uninitiated var declaration is not shown in outline. --- crates/languages/src/cpp/outline.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/languages/src/cpp/outline.scm b/crates/languages/src/cpp/outline.scm index 1f20bf693c29908f9c83c75ad156c2f4e07821ce..f9697eba3030eeb59249e9ee974779c3d3b9dc33 100644 --- a/crates/languages/src/cpp/outline.scm +++ b/crates/languages/src/cpp/outline.scm @@ -51,10 +51,13 @@ (type_qualifier) ]* @context type: (_) @context - declarator: (init_declarator - ; The declaration may define multiple variables, using @item on the - ; declarator so that they get distinct ranges. - declarator: (_) @item @name)) + declarator: [ + ; The declaration may define multiple variables, using @item on the + ; declarator so that they get distinct ranges. + (init_declarator + declarator: (_) @item @name) + (identifier) @item @name + ] @item) (function_definition (type_qualifier)? @context