You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,3 +225,44 @@ You can run any `mix` command in your project, complete with... autocomplete!
225
225
- Phoenix Controllers
226
226
- Phoenix Channels
227
227
- Wallaby/Hound Feature tests
228
+
229
+
Using Projectionist you can easily generate and swap between source files and test files.
230
+
231
+
#### Alternate File
232
+
The most basic usage is to easily swap between a source file and it's associated test.
233
+
234
+
While editing a **source file** such as `lib/blog_web/live/post_live.ex`, by executing the `:A` command a new buffer will be opened with the **test file**`test/blog_web/live/post_live_test.exs`.
235
+
236
+
#### Other Alternates
237
+
While the `:A` command can easily switch between an `.ex` file and its test.
238
+
There are other instances of associated files, such as [Colocated Phoenix Templates](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-colocating-templates).
239
+
In these situations you may have a source file as well as a template file.
240
+
241
+
While editing a **source file** such as `lib/blog_web/live/post_live.ex`, by executing the `:Eheex` command a new buffer will be opened with the **heex file** lib/blog_web/live/post_live.html.heex`.
242
+
243
+
If the `heex` file does not exist you will be prompted to create it, if desired.
244
+
245
+
Similarly, to swap back to the LiveView execute the `:Eliveview` command.
246
+
247
+
#### Create files
248
+
In the case where a source file does not exist one can be created by supplying a directory and name to the `E` commands.
249
+
250
+
`:Eliveview blog_web/post_live` creates a LiveView at `lib/blog_web/live/post_live.ex` with a basic LiveView starter template defining the module.
251
+
`:Econtroller blog_web/post` creates a Controller at `lib/blog_web/controllers/post.ex` with a basic Controller starter template defining the module.
252
+
253
+
#### Projections
254
+
The ':E<filetype>' command can be run with any of the following projections in order to create/switch between files.
0 commit comments