Skip to content

Update README for Code Lens features #94

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

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Ruby LSP Rails is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) extension for extra Rails editor features, such as:

- Displaying an ActiveRecord model's database columns and types when hovering over it
- (More to come!)
- Running tests and debugging tests through the terminal or the editor's UI

## Installation

Expand All @@ -17,17 +17,29 @@ end

## Usage

### Hover to reveal ActiveRecord schema
Copy link
Member

Choose a reason for hiding this comment

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

These features are all listed as part of our documentation generated by RDoc. Should we link to there instead to avoid repeating ourselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but it's not the most appealing format, e.g. https://shopify.github.io/ruby-lsp-rails/RubyLsp/Rails/Hover.html

Maybe the README can act as a brief summary of the behaviour, and we can link to the docs for more detail? That's something I commonly see for other gem's READMEs.

Copy link
Member

Choose a reason for hiding this comment

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

Let's at least limit the README to a few examples. Otherwise, we're documenting the same thing twice, which increases the likelihood we'll forget to update the documentation if anything changes.


1. Start your Rails server
1. Hover over an ActiveRecord model to see its details

Nested models (e.g. `Admin::User`) are not yet supported.

### Running Tests

1. Open a test which inherits from `ActiveSupport::TestCase` or one if its descendants, such as `ActionDispatch::IntegrationTest`.
2. Click on the "Run", "Run in Terminal" or "Debug" code lens which appears above the test class, or an individual test.

Note: When using the Test Explorer view, if your code contains a statement to pause execution (e.g. `debugger`) it will
cause the test runner to hang.

## How It Works

This gem consists of two components that enable enhanced Rails functionality in the editor:

1. A Rack middleware that automatically exposes APIs when Rails server is running
1. A Ruby LSP extension that connects to the exposed APIs to fetch runtime information from the Rails server

This is why the Rails server needs to be running for features to work.
This is why the Rails server needs to be running for some features to work.

> **Note**
>
Expand Down