Skip to content

Vader test fixes for Neovim #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2020
Merged
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
17 changes: 12 additions & 5 deletions autoload/pydocstring.vim
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ function! s:insert_docstring(docstrings, end_lineno) abort
endfunction

function! s:callback(msg, indent, start_lineno) abort
let docstrings = reverse(json_decode(a:msg))
let msg = join(a:msg, '')
" Check needed for Neovim
if len(msg) == 0
return
endif

let docstrings = reverse(json_decode(msg))
silent! execute 'normal! 0'
let length = len(docstrings)
for docstring in docstrings
Expand All @@ -65,10 +71,11 @@ function! s:callback(msg, indent, start_lineno) abort
endfunction

function! s:format_callback(msg, indent, start_lineno) abort
call add(s:results, a:msg)
call extend(s:results, a:msg)
endfunction

function! s:exit_callback(msg) abort
unlet s:job " Needed for Neovim
if len(s:results)
let view = winsaveview()
silent execute '% delete'
Expand All @@ -94,8 +101,8 @@ function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort

let s:job = jobstart(a:cmd, {
\ 'on_stdout': {_c, m, _e -> a:cb(m, a:indent, a:start_lineno)},
\ 'on_stderr': {_c, m, _e -> a:cb(m, a:indent, a:start_lineno)},
\ 'on_exit': {_c, m, _e -> a:ex_cb(m)},
\ 'stdout_buffered': v:true,
\ })

if exists('*chansend')
Expand All @@ -114,8 +121,8 @@ function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort
endif

let s:job = job_start(a:cmd, {
\ 'callback': {_, m -> a:cb(m, a:indent, a:start_lineno)},
\ 'exit_cb': {_, m -> a:ex_cb(m)},
\ 'callback': {_, m -> a:cb([m], a:indent, a:start_lineno)},
\ 'exit_cb': {_, m -> a:ex_cb([m])},
\ 'in_mode': 'nl',
\ })

Expand Down