-
Notifications
You must be signed in to change notification settings - Fork 28
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
Move DSL hover functionality from the Ruby LSP #131
Conversation
a5781eb
to
56e2e38
Compare
56e2e38
to
98f3cfe
Compare
module Support | ||
class RailsDocumentClient | ||
RAILS_DOC_HOST = "https://api.rubyonrails.org" | ||
SUPPORTED_RAILS_DOC_NAMESPACES = T.let( |
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.
Adding a space to be consistent with the next constant:
SUPPORTED_RAILS_DOC_NAMESPACES = T.let( | |
SUPPORTED_RAILS_DOC_NAMESPACES = T.let( |
extend T::Sig | ||
sig do | ||
params(name: String).returns(T::Array[String]) | ||
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.
extend T::Sig | |
sig do | |
params(name: String).returns(T::Array[String]) | |
end | |
extend T::Sig | |
sig { params(name: String).returns(T::Array[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.
I think this is such a common thing that we should have a cop for it? I can create an issue if there isn't one already.
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 there's an issue for it. Not sure how common it is, but definitely good to maintain standards.
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.
|
||
response = Net::HTTP.get_response(URI("#{RAILS_DOC_HOST}/v#{RAILTIES_VERSION}/js/search_index.js")) | ||
|
||
if response.code == "302" |
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.
In the docs they seem to favor comparing the class rather than the code:
case res
when Net::HTTPSuccess, Net::HTTPRedirection
# OK
else
res.value
end
Addressed the comments in #138. |
In Shopify/ruby-lsp#915, we are removing the Rails specific hover functionality in favour of the more generic one using the index. The Rails specific part should be in this extension.
This PR just moves the functionality in here. There's no difference other than how the tests are structured, since we don't have the same fixture mechanism in this extension.