Not show any thing after :Codi
v6cc opened this issue · comments
- Brief description
a.py
a = 3
b = 2
a * b
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 install
codi.log has many Garbled, don't know why ..
- A minimal
.vimrc
that will reproduce the issue
let plugPosition="~/.config/nvim/plugged"
call plug#begin(plugPosition)
Plug 'metakirby5/codi.vim'
call plug#end()
let g:codi#log="/home/test/.config/nvim/codi.log"
if use let g:codi#virtual_text=1
, get this:
Environment
-
Operating system
Linux ar 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 GNU/Linux
-
Version of
script
(if you don't know, just paste the last line of the man page)script from util-linux 2.36.1
-
nvim
NVIM v0.5.0-dev+967-g7afd4526f Build type: RelWithDebInfo LuaJIT 2.0.5 Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-git/src/build/config -I/build/neovim-git/src/neovim-git/src -I/usr/include -I/build/neovim-git/src/build/src/nvim/auto -I/build/neovim-git/src/build/include Compiled by builduser Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim" Run :checkhealth for more info
-
python
Python 3.9.1
-
Log
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:
- The control sequence that the
preprocess
function inautoload/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,
\ "\<cr>".'\|'."\<c-h>", '', 'g'),
\ '\(^\|\n\)\(\^D\)\+', '\1', 'g'),
\ "\<esc>".'\[?*[0-9;]*\a', '', 'g')
if a:0 && has_key(a:1, 'preprocess')
let out = a:1['preprocess'](out)
endif
return out
endfunction
- 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.
This causes the wrong outputs to be joined together, resulting in this:
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.
Just merged #131, thanks @EarlPitts!
Closing as fixed.