Giter Site home page Giter Site logo

xdebug-trace-for-vim's People

Contributors

agileadam avatar

Stargazers

 avatar

Watchers

 avatar  avatar

xdebug-trace-for-vim's Issues

Option to work with show_mem_delta

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.