6
6
- [ Go to Controller Action Route] ( #go-to-controller-action-route )
7
7
- [ Go to Controller Action View] ( #go-to-controller-action-view )
8
8
- [ Go to Definition] ( #go-to-definition )
9
- - [ Active Record DSLs and Associations] ( #active-record-dsls-and-associations-1 )
10
- - [ Route Helpers] ( #route-helpers )
9
+ - [ Go to Active Record DSL Definitions] ( #go-to-active-record-dsl-definitions )
10
+ - [ Go to Active Record Associations] ( #go-to-active-record-associations )
11
+ - [ Go to Route Helper Definitions] ( #go-to-route-helper-definitions )
11
12
- [ Ruby File Operations] ( #ruby-file-operations )
12
13
- [ Commands] ( #commands )
13
14
- [ Rails Generate] ( #rails-generate )
20
21
21
22
## Document Symbol
22
23
24
+ Document Symbol is a way to represent the structure of a document. They are used to provide a quick overview of the
25
+ document and to allow for quick navigation.
26
+
27
+ Ruby LSP already provides document symbols for Ruby files, such as classes, modules, methods, etc. But the Rails addon
28
+ provides additional document symbols for Rails specific features.
29
+
30
+ In VS Code, you can open the document symbols view by pressing ` Ctrl + Shift + O ` .
31
+
23
32
### Active Record DSLs and Associations
24
33
25
- ![ Document Symbol for Active Record DSLs and Associations] ( ./ruby-lsp-rails-ar-dsl-document-symbol.gif )
34
+ Navigates between Active Record DSLs and Associations using the ` Document Symbol ` feature.
35
+
36
+ ![ Document Symbol for Active Record DSLs and Associations] ( ./ruby-lsp-rails-document-symbol-ar-model.gif )
26
37
27
38
### Active Support Test Cases
28
39
40
+ Navigates between Active Support test cases using the ` Document Symbol ` feature.
41
+
29
42
![ Document Symbol for tests] ( ./ruby-lsp-rails-test-document-symbol.gif )
30
43
31
44
## Go to Controller Action Route
32
45
46
+ Navigates to the route definition of a controller action using the ` Code Lens ` feature.
47
+
33
48
![ Go to Controller Action Route] ( ./ruby-lsp-rails-controller-action-to-route.gif )
34
49
35
50
## Go to Controller Action View
36
51
52
+ Navigates to the view file(s) of a controller action using the ` Code Lens ` feature.
53
+
37
54
![ Go to Controller Action View] ( ./ruby-lsp-rails-controller-action-to-view.gif )
38
55
39
56
## Go to Definition
40
57
41
- ### Active Record DSLs and Associations
58
+ Go to definition is a feature that allows you to navigate to the definition of a symbol.
59
+
60
+ In VS Code, you can trigger go to definition in 3 different ways:
61
+
62
+ - Select ` Go to Definition ` from the context menu
63
+ - ` F12 ` on a symbol
64
+ - ` Cmd + Click ` on a symbol
65
+
66
+ In the following demos, we will use the ` Cmd + Click ` method to trigger go to definition.
42
67
43
- This feature enables quick navigation between related model files in Rails projects. Developers can jump between
44
- associations like ` belongs_to ` and ` has_many ` using IDE shortcuts, improving code exploration and productivity.
68
+ ### Go to Active Record DSL Definitions
45
69
46
- ![ Active Record DSLs and Associations ] ( ./ruby-lsp-rails-ar-definitions-demo .gif )
70
+ ![ Go to Active Record DSL Definitions ] ( ./ruby-lsp-rails-go-to- ar-dsl-definitions .gif )
47
71
48
- ### Route Helpers
72
+ ### Go to Active Record Associations
49
73
50
- ![ Route Helpers] ( ./ruby-lsp-rails-go-to-route-definition.gif )
74
+ ![ Go to Active Record Associations] ( ./ruby-lsp-rails-go-to-ar-associations.gif )
75
+
76
+ ### Go to Route Helper Definitions
77
+
78
+ ![ Go to Route Helper Definitions] ( ./ruby-lsp-rails-go-to-route-definitions.gif )
51
79
52
80
## Ruby File Operations
53
81
@@ -70,6 +98,8 @@ the above commands.
70
98
71
99
## Run and Debug
72
100
101
+ The Rails addon provides 3 ways to run and debug ` ActiveSupport ` tests using the ` Code Lens ` feature.
102
+
73
103
### Run Tests With Test Explorer
74
104
75
105
![ Run Tests With Test Explorer] ( ./ruby-lsp-rails-run.gif )
0 commit comments