-
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
Index core classes using RBS #2132
Conversation
eec49af
to
8958b22
Compare
8958b22
to
4136b05
Compare
assert_equal(0, entry.location.start_column) | ||
assert_operator(entry.location.end_column, :>, 0) | ||
|
||
assert(@index.instance_variable_get(:@entries).key?("String")) |
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 really needed, will delete)
(seeing CI failures for older Rubies, looking into...) |
4136b05
to
623b7b0
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.
LGTM 👍
Once this is merged, I have a branch that will introduce Object
, Kernel
, and BasicObject
to the ancestors list.
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 can be handled in the next PR, but we need to extract includes, prepends and extends and insert those as well.
declarations.each do |declaration| | ||
process_declaration(declaration, pathname) | ||
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.
Should we inline this inside the loop? Is there a need for the process_signature
method?
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.
Hmm, I prefer it this way for readability.
0f078ed
to
8a3229a
Compare
@@ -20,6 +20,7 @@ Gem::Specification.new do |s| | |||
|
|||
s.add_dependency("language_server-protocol", "~> 3.17.0") | |||
s.add_dependency("prism", ">= 0.29.0", "< 0.30") | |||
s.add_dependency("rbs", ">= 3", "< 4") |
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 verified it on 3.0.0. With 2.0.0 it fails because "each_signature" isn't defined.
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'm open to removing the upper constraint)
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.
Let's keep the upper constraint. We can't guarantee that a major version won't break the LSP.
@@ -20,6 +20,7 @@ Gem::Specification.new do |s| | |||
|
|||
s.add_dependency("language_server-protocol", "~> 3.17.0") | |||
s.add_dependency("prism", ">= 0.29.0", "< 0.30") | |||
s.add_dependency("rbs", ">= 3", "< 4") |
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.
Let's keep the upper constraint. We can't guarantee that a major version won't break the LSP.
4787ae6
to
2c07153
Compare
2c07153
to
e3cdd2b
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.
Great work! 🚀
@soutaro I thought you may be interested to see the start of this work. |
hi, jruby maybe not be able to install rbs.
|
@hsw15192617273 we don't currently support JRuby, but feel free to note this on #1257 |
@andyw8 sorry, I don't think that's accurate. The Ruby LSP does work on JRuby, we just didn't add it to CI. Is it possible to add a gemspec constraint to only use |
I don't think it's possible
Wasn't it practically impossible because Sorbet can't run on it? |
The issue blocking JRuby was solved November of last year #1263. My understanding is that it has been working since then. |
@@hsw15192617273 was Ruby LSP working for you previously? (i.e. before RBS was introduced). |
yeah, if install |
but i not use sorbet in ruby code. just run ruby-lsp for vscode extension. JRuby install sorbet maybe not raise exception, I will confirm it tomorrow. |
I planned to implement a pure Ruby RBS parser to make it compatible to other Ruby implementations, but not finished yet... |
@andyw8 for the time being, to unblock our JRuby friends, let's remove the gemspec dependency from RBS and check for the presence of the gem instead. begin
gem("rbs", ">= 3", "< 4")
rescue LoadError
return
end
module RubyLsp
class RBSIndexer
# ... And then where we use it index_rbs if defined?(RubyLsp::RBSIndexer) |
Step towards #1335
To test:
After this we can move on to methods.