Skip to content

Commit b09e4ea

Browse files
authored
Update README for Runner approach (#275)
Co-authored-by: Andy Waite <[email protected]>
1 parent 5d9f3c4 commit b09e4ea

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

README.md

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,26 @@ Ruby LSP Rails is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) addon for ex
77

88
## Installation
99

10-
To install, add the following line to your application's Gemfile:
10+
If you haven't already done so, you'll need to first [set up Ruby LSP](https://github.com/Shopify/ruby-lsp#usage).
1111

12-
```ruby
13-
# Gemfile
14-
group :development do
15-
gem "ruby-lsp-rails"
16-
end
17-
```
12+
As of v0.3.0, Ruby LSP will automatically include the Ruby LSP Rails addon in its custom bundle when a Rails app is detected.
13+
There is no need to add the gem to your bundle.
1814

19-
## Usage
15+
## Features
2016

21-
### Hover to reveal ActiveRecord schema
17+
* Hover over an ActiveRecord model to reveal its schema.
18+
* Run or debug a test by clicking on the code lens which appears above the test class, or an individual test.
19+
* Navigate between ActiveSupport test cases with your editor's "Go to Symbol" feature.
2220

23-
1. Start your Rails server
24-
1. Hover over an ActiveRecord model to see its details
25-
26-
### Documentation
21+
## Documentation
2722

2823
See the [documentation](https://shopify.github.io/ruby-lsp-rails) for more in-depth details about the
2924
[supported features](https://shopify.github.io/ruby-lsp-rails/RubyLsp/Rails.html).
3025

31-
### Running Tests
32-
33-
1. Open a test which inherits from `ActiveSupport::TestCase` or one of its descendants, such as `ActionDispatch::IntegrationTest`.
34-
2. Click on the "Run", "Run in Terminal" or "Debug" code lens which appears above the test class, or an individual test.
35-
36-
> [!NOTE]
37-
> When using the Test Explorer view, if your code contains a statement to pause execution (e.g. `debugger`) it will
38-
> cause the test runner to hang.
26+
## How Runtime Introspection Works
3927

40-
## How It Works
28+
LSP tooling is typically based on static analysis, but `ruby-lsp-rails` actually communicates with your Rails app for
29+
some features.
4130

4231
When Ruby LSP Rails starts, it spawns a `rails runner` instance which runs
4332
[`server.rb`](https://github.com/Shopify/ruby-lsp-rails/blob/main/lib/ruby_lsp/ruby_lsp_rails/server.rb).
@@ -46,7 +35,7 @@ The addon communicates with this process over a pipe (i.e. `stdin` and `stdout`)
4635
When extension is stopped (e.g. by quitting the editor), the server instance is shut down.
4736

4837
> [!NOTE]
49-
> Prior to v0.3, `ruby-lsp-rails` used a different approach which involved mounting a Rack application within the Rails app.
38+
> Prior to v0.3.0, `ruby-lsp-rails` used a different approach which involved mounting a Rack application within the Rails app.
5039
> That approach was brittle and susceptible to the application's configuration, such as routing and middleware.
5140
5241
## Contributing

lib/ruby-lsp-rails.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module RubyLsp
99
#
1010
# - [Hover](rdoc-ref:RubyLsp::Rails::Hover)
1111
# - [CodeLens](rdoc-ref:RubyLsp::Rails::CodeLens)
12+
# - [DocumentSymbol](rdoc-ref:RubyLsp::Rails::DocumentSymbol)
1213
module Rails
1314
end
1415
end

lib/ruby_lsp/ruby_lsp_rails/code_lens.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ module Rails
1212
#
1313
# The
1414
# [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens)
15-
# request informs the editor of runnable commands such as tests
15+
# request informs the editor of runnable commands such as tests.
16+
# It's available for tests which inherit from `ActiveSupport::TestCase` or one of its descendants, such as
17+
# `ActionDispatch::IntegrationTest`.
1618
#
1719
# # Example:
1820
#
@@ -32,6 +34,9 @@ module Rails
3234
# ````
3335
#
3436
# The code lenses will be displayed above the class and above each test method.
37+
#
38+
# Note: When using the Test Explorer view, if your code contains a statement to pause execution (e.g. `debugger`) it
39+
# will cause the test runner to hang.
3540
class CodeLens
3641
extend T::Sig
3742
include Requests::Support::Common

0 commit comments

Comments
 (0)