-
Notifications
You must be signed in to change notification settings - Fork 178
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
Use RBS to index methods #2157
Use RBS to index methods #2157
Conversation
284fdb9
to
8655952
Compare
95acdb1
to
902f098
Compare
9667733
to
3a2c40f
Compare
2d207ac
to
2d867c5
Compare
a49cde6
to
b253e57
Compare
lib/ruby_indexer/test/index_test.rb
Outdated
@@ -92,6 +92,7 @@ class Something | |||
end | |||
|
|||
def test_fuzzy_search | |||
@index = Index.new |
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.
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 don't think it's a good idea to separate different indexing behaviours because then we'll be deviating from what these features are actually going to be used. It'll also make tests harder to maintain in the long term.
Now that we also have method names in the PR, we should use this opportunity to decide a few constant/method names that can better avoid false-positive in such tests.
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.
This test file is already over 1000 lines long so I'm wary of adding more to it. How about this approach:
- one test file for the Ruby indexing (with Prism)
- one test file for the RBS indexing
- one test file which verifies how they work in combination.
b253e57
to
87ce179
Compare
file_path = member.location.buffer.name | ||
location = to_ruby_indexer_location(member.location) | ||
comments = Array(member.comment&.string) | ||
parameters_node = nil |
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.
This will be in a follow-up.
@vinistock @st0012 still WIP but any early input is welcome. |
|
||
owner = class_entry | ||
|
||
klass = member.instance? ? Entry::InstanceMethod : Entry::SingletonMethod |
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.
Headsup that these classes will be merged after #2142
lib/ruby_indexer/test/index_test.rb
Outdated
@@ -92,6 +92,7 @@ class Something | |||
end | |||
|
|||
def test_fuzzy_search | |||
@index = Index.new |
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 don't think it's a good idea to separate different indexing behaviours because then we'll be deviating from what these features are actually going to be used. It'll also make tests harder to maintain in the long term.
Now that we also have method names in the PR, we should use this opportunity to decide a few constant/method names that can better avoid false-positive in such tests.
@st0012 I worked with @vinistock to adjust some tests (had to pick some weird names!). |
0e78d0f
to
97970e8
Compare
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.
After the parameters follow up, let's ensure we're also handling attributes
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 a blocker as it's probably an edge case anyway: Is it necessary to call handle_member
in process_declaration
as well?
97970e8
to
8bb49e7
Compare
@st0012 do you mean in case of methods which are defined outside of any module/class? |
|
The typecheck fails:
|
This PR continues the RBS indexing work to include singleton and instance methods from modules and classes.