-
Notifications
You must be signed in to change notification settings - Fork 25
Change outline captures from @name to @context.extra
#93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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"
```
|
We probably could use |
| (simple_symbol) @context.extra | ||
| (scope_resolution) @context.extra | ||
| (constant) @context.extra | ||
| "," @context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this capture should be @context.extra as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use context.extra here and everywhere else because we will lose ability to search through symbols:
CleanShot.2025-05-10.at.06.57.58.mp4
|
hey @vitallium 👋 I tested this branch locally and there is something odd now: calling it from the class works fine: ⏵ Task `test test/models/cnae_test.rb -n /CnaeTest/` finished successfully
⏵ Command: /bin/zsh -i -c 'bin/rails test test/models/cnae_test.rb -n /CnaeTest/'but calling from the test is not getting the right test name. it uses the word class CnaeTest < ActiveSupport::TestCase
test "formats a CNAE code" do # <<< running here
assert_equal "6209-1/00", Cnae.format("6209100")
end⏵ Task `test test/models/cnae_test.rb -n /test/` finished successfully
⏵ Command: /bin/zsh -i -c 'bin/rails test test/models/cnae_test.rb -n /test/'See it is using |
|
I think the fix here is not correct. I think losing ability to search through additional information of methods like This query has 3 captures:
The task template in such a scenario will be like this: [
{
"label": "test $ZED_RELATIVE_FILE -n /$ZED_CUSTOM_name/",
"command": "bin/rails",
"args": ["test", "$ZED_RELATIVE_FILE", "-n", "/$ZED_CUSTOM_name/"],
"tags": ["ruby-test"]
}
]This isn't the best option, but it should work. I'll open another PR using this approach. |
Yeah, I noticed that as well. Please see my comment above about the incorrect fix in this pull request. Thanks for testing it too! |
Change all argument captures from
@nameto@context.extrain both call patterns to properly categorize these elements as contextual information rather than names to avoid capturing them forZED_SYMBOLvariable. This variable is used for running tests.Sample code:
The outline is identical to the current behavior:
Screenshots
Fixes #92