Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
all:
cd padre && cargo build

clean:
cd padre && cargo clean
6 changes: 4 additions & 2 deletions autoload/padre/buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ endfunction

function! padre#buffer#SetMainPadreKeyBindingsForCurrentBuffer()
nnoremap <silent> <buffer> r :PadreRun<cr>
nnoremap <silent> <buffer> S :PadreStepIn<cr>
nnoremap <silent> <buffer> s :PadreStepOver<cr>
nnoremap <silent> <buffer> S :<C-U>execute v:count1 . " PadreStepIn"<cr>
nnoremap <silent> <buffer> s :<C-U>execute v:count1 . " PadreStepOver"<cr>
nnoremap <silent> <buffer> C-s :PadreStepOut<cr>
vnoremap <silent> <buffer> p y:PadrePrintVariable <C-R>"<cr>
nnoremap <silent> <buffer> C :PadreContinue<cr>
nnoremap <silent> <buffer> ZZ :PadreStop<cr>
Expand All @@ -30,6 +31,7 @@ function! padre#buffer#UnsetPadreKeyBindingsForCurrentBuffer()
nnoremap <silent> <buffer> r r
nnoremap <silent> <buffer> S S
nnoremap <silent> <buffer> s s
nnoremap <silent> <buffer> C-s C-s
vnoremap <silent> <buffer> p p
nnoremap <silent> <buffer> C C
nnoremap <silent> <buffer> ZZ ZZ
Expand Down
112 changes: 49 additions & 63 deletions autoload/padre/debugger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function! padre#debugger#Debug(...)
endfunction

function! padre#debugger#Run()
call padre#socket#Send({"cmd": "run"}, function('padre#debugger#RunCallback'))
call padre#socket#Send({"cmd": "run"}, function('padre#debugger#GenericCallback'))
endfunction

function! padre#debugger#Stop()
Expand All @@ -161,31 +161,41 @@ function! padre#debugger#Stop()
endfunction

function! s:SetBreakpointInDebugger(line, file)
call padre#socket#Send({"cmd": "breakpoint", "file": a:file, "line": str2nr(a:line)}, function('padre#debugger#BreakpointCallback'))
call padre#socket#Send({"cmd": "breakpoint", "file": a:file, "line": str2nr(a:line)}, function('padre#debugger#GenericCallback'))
endfunction

function! padre#debugger#Breakpoint()
let l:breakpointAdded = padre#signs#ToggleBreakpoint()

if !empty(l:breakpointAdded) && padre#socket#Status() is# "open"
call s:SetBreakpointInDebugger(l:breakpointAdded['line'], l:breakpointAdded['file'])
if padre#socket#Status() is# "open"
if !empty(l:breakpointAdded)
call s:SetBreakpointInDebugger(l:breakpointAdded['line'], l:breakpointAdded['file'])
else
let l:file = expand('%')
let l:line = getpos('.')[1]
call padre#socket#Send({"cmd": "unbreakpoint", "file": l:file, "line": getpos('.')[1]}, function('padre#debugger#GenericCallback'))
endif
endif
endfunction

function! padre#debugger#StepIn()
call padre#socket#Send({"cmd": "stepIn"}, function('padre#debugger#StepInCallback'))
function! padre#debugger#StepIn(count)
call padre#socket#Send({"cmd": "stepIn", "count": a:count}, function('padre#debugger#GenericCallback'))
endfunction

function! padre#debugger#StepOver()
call padre#socket#Send({"cmd": "stepOver"}, function('padre#debugger#StepOverCallback'))
function! padre#debugger#StepOver(count)
call padre#socket#Send({"cmd": "stepOver", "count": a:count}, function('padre#debugger#GenericCallback'))
endfunction

function! padre#debugger#StepOut()
call padre#socket#Send({"cmd": "stepOut"}, function('padre#debugger#GenericCallback'))
endfunction

function! padre#debugger#PrintVariable(variable)
call padre#socket#Send({"cmd": "print", "variable": a:variable}, function('padre#debugger#PrintVariableCallback'))
endfunction

function! padre#debugger#Continue()
call padre#socket#Send({"cmd": "continue"}, function('padre#debugger#ContinueCallback'))
call padre#socket#Send({"cmd": "continue"}, function('padre#debugger#GenericCallback'))
endfunction

""""""""""""""""
Expand All @@ -198,63 +208,12 @@ function! padre#debugger#SignalPADREStarted()
endfor
endfunction

function! padre#debugger#RunCallback(channel_id, data)
function! padre#debugger#GenericCallback(channel_id, data)
if a:data['status'] != 'OK'
call padre#debugger#Log(2, 'Error: ' . string(a:data))
return
endif

if has_key(a:data, 'pid')
call padre#debugger#Log(4, 'Process ' . a:data['pid'] . ' Running')
endif
endfunction

function! padre#debugger#BreakpointCallback(channel_id, data)
if a:data['status'] == 'OK'
elseif a:data['status'] == 'PENDING'
call padre#debugger#Log(4, 'Breakpoint pending')
else
call padre#debugger#Log(2, 'Error: ' . string(a:data))
endif
endfunction

function! padre#debugger#BreakpointSet(fileName, lineNum)
let l:msg = 'Breakpoint set file=' . a:fileName . ', line=' . a:lineNum
call padre#debugger#Log(4, l:msg)
endfunction

function! padre#debugger#StepInCallback(channel_id, data)
if a:data['status'] != 'OK'
call padre#debugger#Log(2, 'Error: ' . string(a:data))
endif
endfunction

function! padre#debugger#StepOverCallback(channel_id, data)
if a:data['status'] != 'OK'
call padre#debugger#Log(2, 'Error: ' . string(a:data))
endif
endfunction

function! padre#debugger#ContinueCallback(channel_id, data)
if a:data['status'] != 'OK'
call padre#debugger#Log(2, 'Error: ' . string(a:data))
endif
endfunction

function! padre#debugger#PrintVariableCallback(channel_id, data)
let l:status = remove(a:data, 'status')
if l:status != 'OK'
call padre#debugger#Log(2, 'Error printing variable: ' . string(a:data))
return
endif

let l:variable_name = remove(a:data, 'variable')

execute "let l:json = system('python -m json.tool', '" . substitute(json_encode(a:data), "'", "''", "g") . "')"
let l:msg = 'Variable ' . l:variable_name . "=\n" . l:json
call padre#debugger#Log(4, l:msg)
endfunction

function! padre#debugger#JumpToPosition(file, line)
let l:msg = 'Stopped file=' . a:file . ' line=' . a:line
call padre#debugger#Log(4, l:msg)
Expand Down Expand Up @@ -304,8 +263,35 @@ function! padre#debugger#JumpToPosition(file, line)
redraw
endfunction

function! padre#debugger#ProcessExited(exit_code, pid)
call padre#debugger#Log(4, 'Process ' . a:pid . ' finished with exit code=' . a:exit_code)
function! padre#debugger#PrintVariableCallback(channel_id, data)
if a:data['status'] != 'OK'
call padre#debugger#Log(2, 'Error: ' . string(a:data))
endif

let s:text = 'Variable (' . a:data['type'] . ') ' . a:data['variable'] . '=' . a:data['value']

let l:current_tabpagenr = tabpagenr()

call padre#layout#OpenTabWithBuffer('PADRE_Logs_' . s:PadreNumber)

let l:current_window = winnr()
let l:logs_window = padre#layout#GetLogsWindow()

if l:current_window != l:logs_window
execute l:logs_window . ' wincmd w'
endif

call padre#buffer#AppendBuffer(strftime('%y/%m/%d %H:%M:%S ') . s:text, 0)

if l:current_window != l:logs_window
execute l:current_window . ' wincmd w'
endif

if l:current_tabpagenr != tabpagenr()
execute l:current_tabpagenr . 'tabnext'
endif

redraw
endfunction

function! padre#debugger#Log(level, text)
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ trigger:
- feature/*

jobs:
- job: rustfmt
- job: rust_static
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 5

steps:
- template: ci/rustfmt.yml
- template: ci/rust-static.yml

- job: padre_tests
pool:
Expand Down
3 changes: 2 additions & 1 deletion ci/install-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ steps:
- script: |
set -e
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH"
rustup update
displayName: Install rust

- script: |
Expand Down
29 changes: 4 additions & 25 deletions ci/padre-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,16 @@ steps:
- template: install-rust.yml

- script: |
cargo install cargo-junit
displayName: Install test reporters

- script: |
sudo apt-get install software-properties-common python3 python3-pip python3-setuptools
pip3 install wheel
pip3 install behave pyhamcrest psutil
displayName: Install python dependencies

- script: |
cd padre
cargo test -- --nocapture
env:
RUST_BACKTRACE: 1
RUSTFLAGS: '-D warnings'
displayName: Run Padre CLI unit testing

- script: |
cd padre
cargo junit --name TESTS-cargo.xml
displayName: Run Padre CLI unit testing reporting

- script: |
sudo apt-get install -y lldb-5.0 gcc
sudo apt-get install -y software-properties-common python3 python3-pip python3-setuptools lldb-5.0 gcc
sudo ln -s /usr/bin/lldb-5.0 /usr/bin/lldb
sudo ln -s /usr/bin/lldb-server-5.0 /usr/bin/lldb-server
sudo ln -s /usr/bin/lldb-server-5.0 /usr/lib/llvm-5.0/bin/lldb-server-5.0.0
sudo rm /usr/local/bin/node
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
displayName: Install lldb-5, node-12 and build essentials
pip3 install wheel
pip3 install behave pyhamcrest psutil
displayName: Install lldb-5, node-12 and build and test essentials

- script: |
cd padre
Expand Down
27 changes: 27 additions & 0 deletions ci/rust-static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
steps:
- template: install-rust.yml

- script: |
cd padre
cargo fmt --all -- --check
displayName: Check formatting

- script: |
rustup component add rustfmt
displayName: Install rustfmt

- script: |
cargo install cargo-junit
displayName: Install test reporters

- script: |
cd padre
cargo test -- --nocapture
env:
RUST_BACKTRACE: 1
displayName: Run Padre CLI unit testing

- script: |
cd padre
cargo junit --name TESTS-cargo.xml
displayName: Run Padre CLI unit testing reporting
11 changes: 0 additions & 11 deletions ci/rustfmt.yml

This file was deleted.

Loading