(probably) fix bug where sniprun doesn't autorestart
@@ -47,15 +47,12 @@ function! s:configureCommands()
command! SnipReplMemoryClean :call s:clearReplMemory()
" <Plug> mappings
-" command! -range SnipRun <line1>,<line2>call s:run()
nnoremap <silent> <Plug>SnipRun :call <SID>run()<CR>
vnoremap <silent> <Plug>SnipRun :'<'>call <SID>run()<CR>
nnoremap <silent> <Plug>SnipTerminate :call <SID>terminate()<CR>
nnoremap <silent> <Plug>SnipReset call <SID>clean()
nnoremap <silent> <Plug>SnipInfo :call <SID>showinfo()<CR>
nnoremap <silent> <Plug>SnipReplMemoryClean :call <SID>clearReplMemory()<CR>
-
-
endfunction
@@ -69,9 +66,17 @@ function! s:showinfo()
endfunction
function! s:run() range
+ try
+ let s:fl=a:firstline
+ let s:ll=a:lastline
+ call rpcnotify(s:sniprunJobId, s:SnipRun, str2nr(s:fl), str2nr(s:ll), s:scriptdir, s:SnipRun_select_interpreters, s:SnipRun_repl_behavior_enable, s:SnipRun_repl_behavior_disable)
+ catch
+ let s:sniprunJobId = 0
+ call s:connect()
let s:fl=a:firstline
let s:ll=a:lastline
call rpcnotify(s:sniprunJobId, s:SnipRun, str2nr(s:fl), str2nr(s:ll), s:scriptdir, s:SnipRun_select_interpreters, s:SnipRun_repl_behavior_enable, s:SnipRun_repl_behavior_disable)
+ endtry
endfunction
function! s:terminate()
@@ -86,7 +91,7 @@ function! s:clean()
sleep 500m
" necessary to give enough time to clean the sniprun work directory
" in case diskis slow or something, will do something better later
- call terminate()
+ call s:terminate()
endfunction
