Skip to content

Commit

Permalink
Fix regexp for the eval command
Browse files Browse the repository at this point in the history
I.e. now it can parse both eval XML commands like:
<eval expression="2 + 2" value="4"/>
and
<eval expression="2 + 2" value="4" />
(i.e. with trailing space)
  • Loading branch information
astashov committed Dec 30, 2012
1 parent 631a9eb commit 1e2f8de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion autoload/ruby_debugger.vim
Expand Up @@ -829,7 +829,7 @@ endfunction
function! RubyDebugger.commands.eval(cmd)
" rdebug-ide-gem doesn't escape attributes of tag properly, so we should not
" use usual attribute extractor here...
let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\" \\/>")
let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\"\\s*\\/>")
echo "Evaluated expression:\n" . s:unescape_html(match[1]) ."\nResulted value is:\n" . match[2] . "\n"
endfunction

Expand Down
7 changes: 4 additions & 3 deletions src/additionals/autoload/ruby_debugger.vim
Expand Up @@ -692,10 +692,11 @@ endfunction


" Debug current opened test
function! RubyDebugger.run_test() dict
function! RubyDebugger.run_test(...) dict
let file = s:get_filename()
if file =~ '_spec\.rb$'
call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file)
let line = a:0 && a:0 > 0 && !empty(a:1) ? a:1 : " "
call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file . line)
elseif file =~ '\.feature$'
call g:RubyDebugger.start(g:ruby_debugger_cucumber_path . ' ' . file)
elseif file =~ '_test\.rb$'
Expand Down Expand Up @@ -828,7 +829,7 @@ endfunction
function! RubyDebugger.commands.eval(cmd)
" rdebug-ide-gem doesn't escape attributes of tag properly, so we should not
" use usual attribute extractor here...
let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\" \\/>")
let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\"\\s*\\/>")
echo "Evaluated expression:\n" . s:unescape_html(match[1]) ."\nResulted value is:\n" . match[2] . "\n"
endfunction

Expand Down
2 changes: 1 addition & 1 deletion src/ruby_debugger/commands.vim
Expand Up @@ -117,7 +117,7 @@ endfunction
function! RubyDebugger.commands.eval(cmd)
" rdebug-ide-gem doesn't escape attributes of tag properly, so we should not
" use usual attribute extractor here...
let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\" \\/>")
let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\"\\s*\\/>")
echo "Evaluated expression:\n" . s:unescape_html(match[1]) ."\nResulted value is:\n" . match[2] . "\n"
endfunction

Expand Down

0 comments on commit 1e2f8de

Please sign in to comment.