|
| 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 | + |
| 18 | + |
| 19 | +### Active Support Test Cases |
| 20 | + |
| 21 | +Navigates between Active Support test cases using the `Document Symbol` feature. |
| 22 | + |
| 23 | + |
| 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 | + |
| 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 | + |
| 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 | + |
| 54 | + |
| 55 | +### Go to Active Record Associations |
| 56 | + |
| 57 | +Navigates to the definitions of Active Record associations. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +### Go to Route Helper Definitions |
| 62 | + |
| 63 | + |
| 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 | + |
| 71 | + |
| 72 | +### Commands |
| 73 | + |
| 74 | +These commands are also available in the Command Palette. |
| 75 | + |
| 76 | +#### Rails Generate |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +#### Rails Destroy |
| 81 | + |
| 82 | + |
| 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 | + |
| 91 | + |
| 92 | +### Run Tests In The Terminal |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | +### Debug Tests With VS Code |
| 97 | + |
| 98 | + |
0 commit comments