From 4230773e7e7537247acb21fa771fa891c64545d6 Mon Sep 17 00:00:00 2001 From: Dalton Barreto Date: Wed, 17 May 2017 22:19:56 -0300 Subject: [PATCH 1/4] Add support for multi-srcpath Now Vebugger can search for a sourcecode in multiple srcpath locations. The first match is returned and it's the file Vebugger will show. --- autoload/vebugger/jdb.vim | 18 ++++++++++-------- doc/vebugger.txt | 6 +++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index a2c9ed2..64a7622 100644 --- a/autoload/vebugger/jdb.vim +++ b/autoload/vebugger/jdb.vim @@ -87,14 +87,16 @@ function! s:findFolderFromStackTrace(src,nameFromStackTrace,frameNumber) endif " If no such tag was found, try to find it using the src path. - let l:path=a:src - for l:dirname in split(a:nameFromStackTrace,'\.') - let l:nextPath=l:path.'/'.fnameescape(l:dirname) - if empty(glob(l:nextPath)) - return l:path - endif - let l:path=l:nextPath - endfor + for l:one_path in split(a:src, ':') + let l:path=l:one_path + for l:dirname in split(a:nameFromStackTrace,'\.') + let l:nextPath=l:path.'/'.fnameescape(l:dirname) + if empty(glob(l:nextPath)) + return l:path + endif + let l:path=l:nextPath + endfor + endfor return l:path endfunction diff --git a/doc/vebugger.txt b/doc/vebugger.txt index 5a7eeb5..b6a3f74 100644 --- a/doc/vebugger.txt +++ b/doc/vebugger.txt @@ -202,7 +202,7 @@ Unlike in the other debuggers, the first argument here is not the name of a file - it's the name of the class to run. The supported extra arguments are: * "args": Command line arguments for the debugged program * "classpath": Where to look for class files -* "srcpath": Where to look for source files +* "srcpath": Where to look for source files. You can have multiple srcpaths, separated by ':' * "version": The version of the debugger to run If you don't supply "classpath" and "srcpath", Vebugger will assume you are using the current directory for source files and class files. @@ -210,6 +210,10 @@ using the current directory for source files and class files. JDB does not have a command for starting it, since you usually want to supply "classpath" and "srcpath". +If you need Vebugger to search for the source files in multiple locations, you can +specify `srcpath` as a ':' separated string. Vebugger will search on all these folders +and the first match will be returned as the Source file to be shown. + LAUNCHING RDEBUG *vebugger-rdebug* From 5865e3b28e1f079c16c45437a6eb1dc773439a05 Mon Sep 17 00:00:00 2001 From: Dalton Barreto Date: Mon, 16 Oct 2017 20:11:15 -0200 Subject: [PATCH 2/4] Adding support for srcpath as string or list --- autoload/vebugger/jdb.vim | 2 +- autoload/vebugger/util.vim | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index 64a7622..bd4adc7 100644 --- a/autoload/vebugger/jdb.vim +++ b/autoload/vebugger/jdb.vim @@ -87,7 +87,7 @@ function! s:findFolderFromStackTrace(src,nameFromStackTrace,frameNumber) endif " If no such tag was found, try to find it using the src path. - for l:one_path in split(a:src, ':') + for l:one_path in vebugger#util#listify(a:src) let l:path=l:one_path for l:dirname in split(a:nameFromStackTrace,'\.') let l:nextPath=l:path.'/'.fnameescape(l:dirname) diff --git a/autoload/vebugger/util.vim b/autoload/vebugger/util.vim index 2db1d12..b05ab50 100644 --- a/autoload/vebugger/util.vim +++ b/autoload/vebugger/util.vim @@ -115,3 +115,12 @@ function! vebugger#util#isPathAbsolute(path) return a:path[0]=~'\v^[/~$]' "Absolute paths in Linux start with ~(home),/(root dir) or $(environment variable) endif endfunction + +function! vebugger#util#listify(stringOrList) + if type(a:stringOrList) == type([]) + return copy(a:stringOrList) " so it could safely be modified by map&filter + else + return [a:stringOrList] + endif +endfunction + From 01326cc9bec515972dc55759c51376f64e5a8631 Mon Sep 17 00:00:00 2001 From: Dalton Barreto Date: Mon, 16 Oct 2017 20:36:12 -0200 Subject: [PATCH 3/4] Removing redundant variable l:one_path --- autoload/vebugger/jdb.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index bd4adc7..319fe3a 100644 --- a/autoload/vebugger/jdb.vim +++ b/autoload/vebugger/jdb.vim @@ -87,8 +87,7 @@ function! s:findFolderFromStackTrace(src,nameFromStackTrace,frameNumber) endif " If no such tag was found, try to find it using the src path. - for l:one_path in vebugger#util#listify(a:src) - let l:path=l:one_path + for l:path in vebugger#util#listify(a:src) for l:dirname in split(a:nameFromStackTrace,'\.') let l:nextPath=l:path.'/'.fnameescape(l:dirname) if empty(glob(l:nextPath)) From 6a6faec69b3b65d4155e07437f84621f13c9a2f0 Mon Sep 17 00:00:00 2001 From: Dalton Barreto Date: Mon, 16 Oct 2017 20:37:39 -0200 Subject: [PATCH 4/4] Updating docs --- doc/vebugger.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/vebugger.txt b/doc/vebugger.txt index b6a3f74..9202029 100644 --- a/doc/vebugger.txt +++ b/doc/vebugger.txt @@ -202,7 +202,7 @@ Unlike in the other debuggers, the first argument here is not the name of a file - it's the name of the class to run. The supported extra arguments are: * "args": Command line arguments for the debugged program * "classpath": Where to look for class files -* "srcpath": Where to look for source files. You can have multiple srcpaths, separated by ':' +* "srcpath": Where to look for source files. You can have multiple srcpaths, passed as a list * "version": The version of the debugger to run If you don't supply "classpath" and "srcpath", Vebugger will assume you are using the current directory for source files and class files. @@ -211,7 +211,7 @@ JDB does not have a command for starting it, since you usually want to supply "classpath" and "srcpath". If you need Vebugger to search for the source files in multiple locations, you can -specify `srcpath` as a ':' separated string. Vebugger will search on all these folders +specify `srcpath` as a list. Vebugger will search on all these folders and the first match will be returned as the Source file to be shown.