From 8dd56bbe3b32862f8810b58d8ccff0faa1317176 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Fri, 9 May 2025 21:32:20 +0200 Subject: [PATCH] Change outline captures from `@name` to `@context.extra` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change all argument captures from `@name` to `@context.extra` in both call patterns to properly categorize these elements as contextual information rather than names to avoid capturing them for `ZED_SYMBOL` variable. This variable is used for running tests. Sample code: ```ruby class CategoryTest < ActiveSupport::TestCase class Foo include Bar belongs_to :foo has_many :whatever alias_method :a, :b end class Foo include Bar belongs_to :foo has_many :whatever alias_method :a, :b end module Foo include Bar belongs_to :foo has_many :whatever alias_method :a, :b end class Foo private important! end module Foo private important! end test "the truth" do assert true end end ``` The outline is identical to the current behavior: ``` CategoryTest └── Foo (class) ├── include Bar ├── belongs_to :foo ├── has_many :whatever └── alias_method :a, :b └── Foo (class) ├── include Bar ├── belongs_to :foo ├── has_many :whatever └── alias_method :a, :b └── Foo (module) ├── include Bar ├── belongs_to :foo ├── has_many :whatever └── alias_method :a, :b └── Foo (class) ├── private └── important! └── Foo (module) ├── private └── important! └── test "the truth" ``` --- languages/ruby/outline.scm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/languages/ruby/outline.scm b/languages/ruby/outline.scm index bd2691e..6ef869f 100644 --- a/languages/ruby/outline.scm +++ b/languages/ruby/outline.scm @@ -91,16 +91,16 @@ (call method: (identifier) @name arguments: (argument_list . [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name + (string) @context.extra + (simple_symbol) @context.extra + (scope_resolution) @context.extra + (constant) @context.extra "," @context ]* [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name + (string) @context.extra + (simple_symbol) @context.extra + (scope_resolution) @context.extra + (constant) @context.extra ] ) ) @item @@ -113,16 +113,16 @@ (call method: (identifier) @name arguments: (argument_list . [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name + (string) @context.extra + (simple_symbol) @context.extra + (scope_resolution) @context.extra + (constant) @context.extra "," @context ]* [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name + (string) @context.extra + (simple_symbol) @context.extra + (scope_resolution) @context.extra + (constant) @context.extra ] ) ) @item