-
Notifications
You must be signed in to change notification settings - Fork 30
Add code lens extension (for Rails) #67
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
Conversation
Note: This will requires changes if Shopify/ruby-lsp#734 is merged. |
7d7a71c
to
a24b469
Compare
8e4899b
to
f44c5c4
Compare
extend T::Sig | ||
extend T::Generic | ||
|
||
ResponseType = type_member { { fixed: T.nilable(T::Array[::RubyLsp::Interface::CodeLens]) } } |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@response = T.let([], ResponseType) | ||
@visibility = T.let("public", String) | ||
@prev_visibility = T.let("public", String) | ||
@path = T.let(uri.delete_prefix("file://"), String) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
assert_match("Debug", response[5].command.title) | ||
|
||
ensure | ||
RubyLsp::Requests::Hover.listeners.clear |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
We don't actually need this line, I've removed it.
assert_match("Debug", response[5].command.title) | ||
|
||
ensure | ||
RubyLsp::Requests::Hover.listeners.clear |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
module Rails | ||
class CodeLensTest < ActiveSupport::TestCase | ||
test "recognizes Rails Active Support test cases" do | ||
message_queue = Thread::Queue.new |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
347fe08
to
30624fa
Compare
30624fa
to
abb108b
Compare
@visibility = T.let("public", String) | ||
@prev_visibility = T.let("public", String) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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 may have been accidentally removed in a refactoring, but probably means we are missing a test, I'll look into.
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.
Actually, these can just be removed. Methods defined with test do
don't respect public/private/protected. (see Slack conversation in team channel from June 21).
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.
🎉 🎉 🎉 Yay this is so cool!
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.
Vini & Stan
module Rails | ||
#  | ||
# | ||
# This feature adds several CodeLens features for Rails applications using the built-in test framework: |
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 say Active Support test cases.
# [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens) | ||
# request informs the editor of runnable commands such as tests | ||
# | ||
# Example: |
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.
# Example: | |
# # Example |
# ```ruby | ||
# Run | ||
# class HelloTest < ActiveSupport::TestCase | ||
# test "outputs hello" do |
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.
# test "outputs hello" do | |
# test "outputs hello" do # <- Will show code lenses for executing this test |
sorbet/rbi/gems/[email protected]
Outdated
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Based on #59
Reminder: Ensure @adisonlampert is credited in the release notes.
This depends on Shopify/vscode-ruby-lsp#639
TODO:
T.unsafe
)Testing