Skip to content

Commit af65b74

Browse files
authored
Merge pull request #445 from Shopify/improve-documentation
Improve features documentation
2 parents b47335b + 314da6f commit af65b74

18 files changed

+103
-11
lines changed

.github/workflows/publish_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ jobs:
2626

2727
- name: Commit to gh-pages
2828
run: |
29-
git add docs
29+
git add docs -f
3030
git commit -m "Publish website $(git log --format=format:%h -1)"
3131
git push --force origin main:gh-pages

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.bundle/
22
/doc/
3+
/docs/
34
/log/*.log
45
/pkg/
56
/tmp/

FEATURES.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Features
2+
3+
## Document Symbol
4+
5+
Document Symbol is a way to represent the structure of a document. They are used to provide a quick overview of the
6+
document and to allow for quick navigation.
7+
8+
Ruby LSP already provides document symbols for Ruby files, such as classes, modules, methods, etc. But the Rails addon
9+
provides additional document symbols for Rails specific features.
10+
11+
In VS Code, you can open the document symbols view by pressing `Ctrl + Shift + O`.
12+
13+
### Active Record Callbacks, Validations, and Associations
14+
15+
Navigates between Active Record callbacks, validations, and associations using the `Document Symbol` feature.
16+
17+
![Document Symbol for Active Record Callbacks, Validations, and Associations](./ruby-lsp-rails-document-symbol-ar-model.gif)
18+
19+
### Active Support Test Cases
20+
21+
Navigates between Active Support test cases using the `Document Symbol` feature.
22+
23+
![Document Symbol for tests](./ruby-lsp-rails-test-document-symbol.gif)
24+
25+
## Go to Controller Action Route
26+
27+
Navigates to the route definition of a controller action using the `Code Lens` feature.
28+
29+
![Go to Controller Action Route](./ruby-lsp-rails-controller-action-to-route.gif)
30+
31+
## Go to Controller Action View
32+
33+
Navigates to the view file(s) of a controller action using the `Code Lens` feature.
34+
35+
![Go to Controller Action View](./ruby-lsp-rails-controller-action-to-view.gif)
36+
37+
## Go to Definition
38+
39+
Go to definition is a feature that allows you to navigate to the definition of a symbol.
40+
41+
In VS Code, you can trigger go to definition in 3 different ways:
42+
43+
- Select `Go to Definition` from the context menu
44+
- `F12` on a symbol
45+
- `Cmd + Click` on a symbol
46+
47+
In the following demos, we will use the `Cmd + Click` method to trigger go to definition.
48+
49+
### Go to Active Record Callback and Validation Definitions
50+
51+
Navigates to the definitions of Active Record callbacks and validations.
52+
53+
![Go to Active Record Callback and Validation Definitions](./ruby-lsp-rails-go-to-ar-dsl-definitions.gif)
54+
55+
### Go to Active Record Associations
56+
57+
Navigates to the definitions of Active Record associations.
58+
59+
![Go to Active Record Associations](./ruby-lsp-rails-go-to-ar-associations.gif)
60+
61+
### Go to Route Helper Definitions
62+
63+
![Go to Route Helper Definitions](./ruby-lsp-rails-go-to-route-definitions.gif)
64+
65+
## Ruby File Operations
66+
67+
The Ruby LSP extension provides a `Ruby file operations` icon in the Explorer view that can be used to trigger
68+
the `Rails generate` and `Rails destroy` commands.
69+
70+
![Ruby file operations](./ruby-lsp-rails-file-operations-icon.gif)
71+
72+
### Commands
73+
74+
These commands are also available in the Command Palette.
75+
76+
#### Rails Generate
77+
78+
![Rails Generate](./ruby-lsp-rails-generate-command.gif)
79+
80+
#### Rails Destroy
81+
82+
![Rails Destroy](./ruby-lsp-rails-destroy-command.gif)
83+
84+
## Run and Debug
85+
86+
The Rails addon provides 3 ways to run and debug `ActiveSupport` tests using the `Code Lens` feature.
87+
88+
### Run Tests With Test Explorer
89+
90+
![Run Tests With Test Explorer](./ruby-lsp-rails-run.gif)
91+
92+
### Run Tests In The Terminal
93+
94+
![Run Tests In The Terminal](./ruby-lsp-rails-run-in-terminal.gif)
95+
96+
### Debug Tests With VS Code
97+
98+
![Debug Tests With VS Code](./ruby-lsp-rails-debug.gif)

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22

33
# Ruby LSP Rails
44

5-
Ruby LSP Rails is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) addon for extra Rails editor features, such as:
6-
7-
* Hover over an ActiveRecord model to reveal its schema.
8-
* Run or debug a test by clicking on the code lens which appears above the test class, or an individual test.
9-
* Navigate to associations, validations, callbacks and test cases using your editor's "Go to Symbol" feature, or outline view.
10-
* Jump to the definition of callbacks using your editor's "Go to Definition" feature.
11-
* Jump to the declaration of a route.
12-
* Code Lens allowing fast-forwarding or rewinding of migrations.
13-
* Code Lens showing the path that a route action corresponds to.
5+
Ruby LSP Rails is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) addon for extra [Rails editor features](https://shopify.github.io/ruby-lsp-rails/RubyLsp/FEATURES.html).
146

157
## Installation
168

@@ -22,7 +14,7 @@ There is no need to add the gem to your bundle.
2214
## Documentation
2315

2416
See the [documentation](https://shopify.github.io/ruby-lsp-rails) for more in-depth details about the
25-
[supported features](https://shopify.github.io/ruby-lsp-rails/RubyLsp/Rails.html).
17+
[supported features](https://shopify.github.io/ruby-lsp-rails/RubyLsp/FEATURES.html).
2618

2719
## How Runtime Introspection Works
2820

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RDoc::Task.new do |rdoc|
2323
rdoc.rdoc_files.include("*.md", "lib/**/*.rb")
2424
rdoc.rdoc_dir = "docs"
2525
rdoc.markup = "markdown"
26+
rdoc.title = "Ruby LSP Rails"
2627
rdoc.generator = "snapper"
2728
rdoc.options.push("--copy-files", "misc")
2829
rdoc.options.push("--copy-files", "LICENSE.txt")
Loading
Loading

misc/ruby-lsp-rails-debug.gif

565 KB
Loading
989 KB
Loading
Loading
154 KB
Loading
1.27 MB
Loading
124 KB
Loading
Loading
Loading
416 KB
Loading

misc/ruby-lsp-rails-run.gif

276 KB
Loading
737 KB
Loading

0 commit comments

Comments
 (0)