Skip to content

Commit

Permalink
Merge branch 'remote-bp'
Browse files Browse the repository at this point in the history
  • Loading branch information
puremourning committed Apr 27, 2019
2 parents 3ce0185 + 5cb6f9c commit cd5cd59
Show file tree
Hide file tree
Showing 24 changed files with 1,930 additions and 341 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
*.un~
*.sw[op]
__pycache__
.vscode
tests/*.res
tests/messages
tests/debuglog
test.log
gadgets/
*.pyc
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "vendor/vader.vim"]
path = vendor/vader.vim
url = https://github.com/junegunn/vader.vim
[submodule "vendor/vim-themis"]
path = vendor/vim-themis
url = https://github.com/thinca/vim-themis
4 changes: 4 additions & 0 deletions autoload/vimspector.vim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ function! vimspector#ShowOutput( category ) abort
py3 _vimspector_session.ShowOutput( vim.eval( 'a:category' ) )
endfunction

function! vimspector#ListBreakpoints() abort
py3 _vimspector_session.ListBreakpoints()
endfunction

" Boilerplate {{{
let &cpo=s:save_cpo
unlet s:save_cpo
Expand Down
1 change: 1 addition & 0 deletions autoload/vimspector/internal/channel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ endfunction

function! s:_Send( msg ) abort
call ch_sendraw( s:ch, a:msg )
return 1
endfunction

function! vimspector#internal#channel#Timeout( id ) abort
Expand Down
76 changes: 63 additions & 13 deletions autoload/vimspector/internal/job.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,42 @@ set cpo&vim
" }}}

function! s:_OnServerData( channel, data ) abort
py3 << EOF
_vimspector_session.OnChannelData( vim.eval( 'a:data' ) )
EOF
py3 _vimspector_session.OnChannelData( vim.eval( 'a:data' ) )
endfunction

function! s:_OnServerError( channel, data ) abort
py3 << EOF
_vimspector_session.OnServerStderr( vim.eval( 'a:data' ) )
EOF
py3 _vimspector_session.OnServerStderr( vim.eval( 'a:data' ) )
endfunction

function! s:_OnExit( channel, status ) abort
echom "Channel exit with status " . a:status
unlet s:job
py3 _vimspector_session.OnServerExit( vim.eval( 'a:status' ) )
endfunction

function! s:_OnClose( channel ) abort
echom "Channel closed"
" py3 _vimspector_session.OnChannelClosed()
endfunction

function! s:_Send( msg ) abort
if ! exists( 's:job' )
echom "Can't send message: Job was not initialised correctly"
return
return 0
endif

if job_status( s:job ) != 'run'
echom "Can't send message: Job is not running"
return
return 0
endif

let ch = job_getchannel( s:job )
if ch == 'channel fail'
echom "Channel was closed unexpectedly!"
return
return 0
endif

call ch_sendraw( ch, a:msg )
return 1
endfunction

function! vimspector#internal#job#StartDebugSession( config ) abort
Expand Down Expand Up @@ -98,10 +96,9 @@ function! vimspector#internal#job#StopDebugSession() abort
endif

if job_status( s:job ) == 'run'
call job_stop( s:job, 'term' )
echom "Terminating job"
call job_stop( s:job, 'kill' )
endif

unlet s:job
endfunction

function! vimspector#internal#job#Reset() abort
Expand All @@ -117,6 +114,59 @@ function! vimspector#internal#job#ForceRead() abort
endif
endfunction

function! vimspector#internal#job#StartCommandWithLog( cmd, category )
if ! exists( 's:commands' )
let s:commands = {}
endif

if ! has_key( s:commands, a:category )
let s:commands[ a:category ] = []
endif

let l:index = len( s:commands[ a:category ] )

call add( s:commands[ a:category ], job_start(
\ a:cmd,
\ {
\ 'out_io': 'buffer',
\ 'in_io': 'null',
\ 'err_io': 'buffer',
\ 'out_name': '_vimspector_log_' . a:category . '_out',
\ 'err_name': '_vimspector_log_' . a:category . '_err',
\ 'out_modifiable': 0,
\ 'err_modifiable': 0,
\ 'stoponexit': 'kill'
\ } ) )

if job_status( s:commands[ a:category ][ index ] ) !=# 'run'
echom "Unable to start job for " . a:cmd
return v:none
endif

let l:stdout = ch_getbufnr(
\ job_getchannel( s:commands[ a:category ][ index ] ), 'out' )
let l:stderr = ch_getbufnr(
\ job_getchannel( s:commands[ a:category ][ index ] ), 'err' )

return [ l:stdout, l:stderr ]
endfunction


function! vimspector#internal#job#CleanUpCommand( category )
if ! exists( 's:commands' )
let s:commands = {}
endif

if ! has_key( s:commands, a:category )
return
endif
for j in s:commands[ a:category ]
call job_stop( j, 'kill' )
endfor

unlet s:commands[ a:category ]
endfunction

" Boilerplate {{{
let &cpo=s:save_cpo
unlet s:save_cpo
Expand Down
35 changes: 35 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

jobs:
- job: 'linax'
pool:
vimImage: 'ubuntu-16.04'
container: 'puremourning/vimspector:test'
steps:
- bash: python3 install_gadget.py
displayName: 'Install gadgets'

- bash: vim --version
displayName: 'Print vim version information'

- bash: ./run_tests
displayName: 'Run the tests'

- job: 'macos'
pool:
vmImage: 'macOS-10.13'
steps:
- bash: brew install macvim
displayName: 'Install vim'

- bash: python3 install_gadget.py
displayName: 'Install gadgets'

- bash: vim --version
displayName: 'Print vim version information'

- bash: ./run_tests
displayName: 'Run the tests'
Loading

0 comments on commit cd5cd59

Please sign in to comment.