Skip to content
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

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Conversation

vinistock
Copy link
Member

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.

@vinistock vinistock added the enhancement New feature or request label Aug 23, 2023
@vinistock vinistock added this to the 2023-Q3 milestone Aug 23, 2023
@vinistock vinistock self-assigned this Aug 23, 2023
@vinistock vinistock marked this pull request as ready for review August 28, 2023 19:05
@vinistock vinistock requested a review from a team as a code owner August 28, 2023 19:05
@vinistock vinistock merged commit 17beb77 into main Aug 29, 2023
27 checks passed
@vinistock vinistock deleted the vs/add_dsl_hover branch August 29, 2023 15:48
module Support
class RailsDocumentClient
RAILS_DOC_HOST = "https://api.rubyonrails.org"
SUPPORTED_RAILS_DOC_NAMESPACES = T.let(
Copy link

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:

Suggested change
SUPPORTED_RAILS_DOC_NAMESPACES = T.let(
SUPPORTED_RAILS_DOC_NAMESPACES = T.let(

Comment on lines +33 to +36
extend T::Sig
sig do
params(name: String).returns(T::Array[String])
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extend T::Sig
sig do
params(name: String).returns(T::Array[String])
end
extend T::Sig
sig { params(name: String).returns(T::Array[String]) }

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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"
Copy link

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

@vinistock
Copy link
Member Author

Addressed the comments in #138.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants