Skip to content

Commit 0dd5200

Browse files
author
Gaspar Chilingarov
committed
adds Vim-Elixir-SmartTrace plugin for trace directly in Vim
1 parent fe051ab commit 0dd5200

File tree

4 files changed

+68
-2
lines changed

4 files changed

+68
-2
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@
5252
[submodule "bundle/indentLine"]
5353
path = bundle/indentLine
5454
url = https://github.com/Yggdroot/indentLine.git
55+
[submodule "bundle/vim-elixir-smarttrace"]
56+
path = bundle/vim-elixir-smarttrace
57+
url = https://github.com/gasparch/vim-elixir-smarttrace.git

CHEATSHEET.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,22 @@ shortcuts/commands:
102102
* `<Leader>tv` opens correlative source/test file in vertical split
103103
* `<Leader>t!` opens correlative source/test, creates directories if necessary
104104
105+
#### Tracing
106+
* `<Leader>te` execute ExUnit test under cursor with tracing and window with
107+
trace output
108+
* `<Leader>ts` execute selected text with tracing and show trace
109+
110+
**In trace window**
111+
* `<Enter>` opens file with module/function under cursor and changes window
112+
* `p` opens file with module/function under cursor and stays in trace window
113+
* `%` jumps to matching call/return lines
114+
* `;`, `,` jumps back/forward to same function call
115+
* `(`, `)` jumps back/forward to next function call/return (skips messages)
116+
* `{`, `}` jumps back/forward over repeated function calls
117+
* `F3` opens arguments fold; also when cursor is on function call/ret line
118+
119+
More on [vim-elixir-smarttrace page](https://github.com/gasparch/vim-elixir-smarttrace).
120+
105121
#### Git integration
106122
* `:Gstatus` - show modified files and staged status
107123
* `-` (in normal mode) on file name moves between staged/unstaged mode

README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ avoid laborious task of finding and tuning of plugins/themes.
2424
* Compile project from and jump to errors/warnings
2525
* Run ExUnit tests and jump to errors
2626
* Run ExUnit tests on source save and just to errors
27+
* Tracing
28+
* Run trace on selected ExUnit test or text selection
29+
* Quickly navigate in trace file
2730
* Other
2831
* Colorschemes for Elixir programming
29-
* Git integration directly from Vim.
32+
* Git integration directly from Vim
3033
* Viewing of Module/function documentation
3134
* Restore buffer position on load
3235
* Clutter free vim-airline settings
@@ -116,6 +119,8 @@ file using [vim-sleuth](https://github.com/tpope/vim-sleuth).
116119
Tagbar most of the time shows correct arity on functions and does not report
117120
multiple function clauses. GenServer callbacks moved to separate group.
118121

122+
* `F4` will toggle Tagbar window visibility.
123+
119124
## Compiler and ExUnit integration
120125

121126
Compiler and ExUnit integration provided with vim-elixir-exunit module, which
@@ -209,14 +214,54 @@ Following commands and shortcuts are available:
209214

210215
Use `[e` and `]e` to navigate test errors.
211216

212-
213217
**Note**
214218

215219
All `mix test` commands executed with `--seed 0` parameter which forces
216220
execution from top to down of test file. If you want randomized execution
217221
sequence to check hidden errors in tests - you will need to run tests
218222
manually.
219223

224+
## Tracing support
225+
226+
Erlang runtime has amazing tools to understand what happens in code using trace
227+
and profiling. Unfortumately they have just command line interface and
228+
sometimes output is hard to understand. Vim-Elixir-IDE aims to boost developer
229+
efficiency while using this tools.
230+
231+
#### Running trace
232+
233+
You can run trace on arbitrary piece of code or existing ExUnit test case. I
234+
would recommend running it on ExUnit test, which assures that all aliases,
235+
variables are resolved. If you run trace on code selection it should be
236+
self-sufficient (it will be copied to separate .exs file).
237+
238+
So, once again, run ExUnit tests under tracing, not the selection :)
239+
240+
Tracing support removes some number of redundant messages appearing in trace
241+
log file and tries to make output more readable to human eyes and for
242+
inspection.
243+
244+
Also navigating around trace may be difficult, as there is so much information
245+
present, so navigation shortcuts are provided for that.
246+
247+
Available commands:
248+
249+
* `ErlTraceTest` or `<Leader>te` runs ExUnit test under cursor with tracing
250+
enabled and shows resulting trace in separate window.
251+
* `ErlTraceSelection` or `<Leader>ts` runs selected test with tracing enabled
252+
and shows resulting trace in separate window.
253+
254+
In tracing window there are shortcuts available:
255+
256+
* `<Enter>` opens file with module/function under cursor and switches window
257+
* `p` opens file with module/function under cursor and stays in trace window
258+
* `%` jumps to matching call/return lines
259+
* `;`, `,` jumps back/forward to same function call
260+
* `(`, `)` jumps back/forward to next function call/return (skips messages)
261+
* `{`, `}` jumps back/forward over repeated function calls
262+
* `F3` opens arguments fold; also when cursor is on function call/ret line
263+
264+
220265

221266

222267

@@ -228,3 +273,4 @@ Following commands and shortcuts are available:
228273

229274

230275

276+

bundle/vim-elixir-smarttrace

Submodule vim-elixir-smarttrace added at 4750870

0 commit comments

Comments
 (0)