Closed v6cc closed 3 years ago
I'm noticing the same thing. I'm running Neovim 0.4.4 + Python 3.9.0 on MacOS Big Sur. If I run Vim codi works fine with split text but the virtual text support is not working in neovim.
Like @zdmgmail I tried setting let g:codi#virtual_text=0 in hopes that the sidebar text would work but no dice.
Same issue here, using arch with Neovim 0.4.4 and Python 3.9.1.
I found two things that seems to cause the error, at least on my machine:
preprocess
function in autoload/codi.vim
tries to substitute lacks a ? character.
This can be fixed by adding a custom preprocess function to the codi config:
function! s:pp_py(line)
" Strip escape codes
return substitute(a:line, "\<esc>".'\[?*[0-9;]*\a', '', 'g')
endfunction
let g:codi#interpreters = { \ 'python': { \ 'bin': 'python', \ 'preprocess': function('s:pp_py'), \ }, \ }
Or modifying the preprocess function:
function! s:preprocess(text, ...)
" Default pre-process
let out = substitute(substitute(substitute(a:text,
\ "\
2. The second problem seems to be related to the `codi_nvim_callback` function.
It splits the line python sends back by carriage returns. The problem is that the lines containing the response from the interpreter has a carriage return in the middle of the line.
![2021-01-10_102749](https://user-images.githubusercontent.com/34306800/104119274-9054a700-532e-11eb-92fe-1c3cd5ffb7a6.png)
This causes the wrong outputs to be joined together, resulting in this:
![2021-01-10_103502](https://user-images.githubusercontent.com/34306800/104119444-85e6dd00-532f-11eb-8d35-d930e838a87b.png)
I fixed it by using a snippet from an earlier commit, that checked for carriage return only at the end of the line.
for line in a:data let s:nvim_async_lines[a:job_id] .= line
" If we hit a newline, we're ready to handle the data
if s:nvim_async_lines[a:job_id][-1:] == "\<cr>"
let input = s:nvim_async_lines[a:job_id]
let s:nvim_async_lines[a:job_id] = ''
try
call s:codi_handle_data(s:async_data[a:job_id], input)
catch /E716/
" No-op if data isn't ready
endtry
endif
endfor
I've tested it for python, lua and javascript, and they seem to be working fine now.
@EarlPitts would you happen to have a fork/branch I could try these fixes out on?
@EarlPitts Doh!, I see your PR. Going to test that.
@EarlPitts tested
Works like a charm!
Just merged #131, thanks @EarlPitts!
Closing as fixed.
a.py
if use
let g:codi#virtual_text=0
, not show any thing after:Codi
may be because the envirment, it correct works on my mac
and python, lua not work , typescript, javascript work
python node lua tsun
already installcodi.log has many Garbled, don't know why ..
.vimrc
that will reproduce the issueif use
let g:codi#virtual_text=1
, get this:Environment
Operating system
Version of
script
(if you don't know, just paste the last line of the man page)nvim
python
Log
codi.log