-
Notifications
You must be signed in to change notification settings - Fork 172
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
Account for private constants in features #1004
Changes from all commits
18866ca
3e285f2
57aa59a
fad6231
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,17 @@ def test_finds_default_gem_symbols | |
result = RubyLsp::Requests::WorkspaceSymbol.new("Pathname", @index).run | ||
refute_empty(result) | ||
end | ||
|
||
def test_does_not_include_private_constants | ||
@index.index_single(RubyIndexer::IndexablePath.new(nil, "/fake.rb"), <<~RUBY) | ||
class Foo | ||
CONSTANT = 1 | ||
private_constant(:CONSTANT) | ||
end | ||
RUBY | ||
|
||
result = RubyLsp::Requests::WorkspaceSymbol.new("Foo::CONSTANT", @index).run | ||
assert_equal(1, result.length) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may be misunderstanding the test, but if we're looking up There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we fuzzy match the results for workspace symbol and the Jaro-Winkler similarity between
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. That may be worth a code comment. |
||
assert_equal("Foo", T.must(result.first).name) | ||
end | ||
end |
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.
Not in this PR, but since we use this a lot I wonder we should extract it out, e.g.:
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.
That's true. We can extract it in another PR.