agileadam / xdebug-trace-for-vim Goto Github PK
View Code? Open in Web Editor NEWProvides syntax and folding for xdebug trace output files (foo.xt)
Provides syntax and folding for xdebug trace output files (foo.xt)
Thanks so much for sharing these tips. Makes analyzing the trace much better. We run traces with show_mem_delta enabled which adds a third column. Here is an update that lets you set a toggle to support it.
--- xt-2columns.vim 2020-05-01 15:48:03.000000000 -0400
+++ xt.vim 2020-05-01 17:05:37.000000000 -0400
@@ -4,18 +4,31 @@
" You may have to set this variable accordingly in your .vimrc like this:
" let g:xt_extra_spaces=2 "Spaces between second column and -> in xdebug trace
+" If xdebug has show_mem_delta enabled, the columns will be different.
+" let g:xt_show_mem_delta=1
+
function! XdebugTracerFolds()
" Get the number of spaces between the second column last digit and the ->
let extra_spaces = get(g:, 'xt_extra_spaces', 2)
+ let show_mem_delta = get(g:, 'xt_show_mem_delta', 0)
" Subtract extra spaces from the total space count to 'start' at level 1
- let this_indent = strchars(matchstr(getline(v:lnum), ' \+[0-9.]\+ \+\d\+\zs *')) - extra_spaces
+ if show_mem_delta == 1
+ let this_indent = strchars(matchstr(getline(v:lnum), ' \+[0-9.]\+ \+\d\+ \+[0-9+-]*\zs *')) - extra_spaces
+ else
+ let this_indent = strchars(matchstr(getline(v:lnum), ' \+[0-9.]\+ \+\d\+\zs *')) - extra_spaces
+ endif
+
if this_indent == -1 * extra_spaces
return 0
endif
- let next_indent = strchars(matchstr(getline(v:lnum + 1), ' \+[0-9.]\+ \+\d\+\zs *')) - extra_spaces
+ if show_mem_delta == 1
+ let next_indent = strchars(matchstr(getline(v:lnum + 1), ' \+[0-9.]\+ \+\d\+ \+[0-9+-]*\zs *')) - extra_spaces
+ else
+ let next_indent = strchars(matchstr(getline(v:lnum + 1), ' \+[0-9.]\+ \+\d\+\zs *')) - extra_spaces
+ endif
if next_indent <= this_indent
return this_indent
@@ -30,6 +43,7 @@
setlocal foldcolumn=4
setlocal foldmethod=expr
setlocal foldexpr=XdebugTracerFolds()
+setlocal foldlevel=1
function! XdebugTracerFoldText()
let foldsize = (v:foldend-v:foldstart)
Then in filetype.vm one just needs
let g:xt_show_mem_delta=1
vims regex syntax is a little foreign and I could not figure out making the extra block itself optional.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.