metakirby5/codi.vim

Codi broken for Julia 1.2

sbromberger opened this issue · 9 comments

Issue description

  • Codi produces no output for Julia 1.2. Works for python / python3.
  • a = 5; b = 7; a + b (semicolons denote newlines) should produce output.
  • no output.
  • Exact steps to reproduce the issue, starting with the command used to open
    vim
vim
:Codi julia
i
a = 5
b = 7
a + b

Logs attached.

Environment

  • ubuntu 19.10
  • Version of script: script from util-linux 2.34
  • log file attached.

codilog.txt

Same issue here :/

On Arch and nvim

NVIM v0.4.4
Build type: Release
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 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/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

and

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia>

For a file with the following...

a = 50
b = 6

a * b

I sporadically had a > 50 but that was it.. I'm still playing with it.. if I find anything else out I'll update..

UPDATE:

Spent the evening playing around with things to see if I could make it work. I tried changing the prompt in Julia to be the same as Python so: julia> to >>> and then updated the regex to the same as Python. This didn't work. Looking at the log it seems that maybe codi thinks there is suppose to be one more line than there really is. Also seem that a regex isn't working 100% correctly cause the log shows the prompt being strung together multiple times.

codi_log.txt

FYI @originalsouth (maintainer)!

I have it partially working.... If I enable raw mode I can get the correct things to show; however its a little slow and I don't fully trust it..

function! s:pp_remove_esc(line)
  " Strip �[?2004l
  return substitute(a:line, '�[?2004l', '', '')
endfunction

....

      \ 'julia': {
         \ 'bin': ['julia', '-q', '-i', '--color=no', '--history-file=no'],
         \ 'prompt': '\(julia>\)',
         \ 'preprocess': function('s:pp_remove_esc'),
         \ },

EDIT: Silly me... just realized its not putting the output there.. but rather the input..

Let me look into it. Hopefully later today, and otherwise within this week.

There seems to be a problem with the interactive REPL, but I cannot really pinpoint what exactly goes wrong. I tried imposing TERM=dumb and althought this improves thing there are still a bunch of missing "enters" in the output (you can even verify all this with xxd). I will work on it more soon

I just played with the regex for the prompt and added a ton of log commands throughout the code to get an idea of whats going on. It seemed like the problem might have something to do with the REPL sandwiching the output between two blank lines. I think they register as '�[?2004l' and '�[?2004h'. But my knowledge in the realm of Vim scripting is pretty shallow.

might be a dumb question but is there a way to make the terminal that Codi uses, visible?

Not really sure about making Codi's terminal visible, I just used a lot of log commands myself during development 😓

Same issue with Python using Neovim v0.5.0 on Arch. (Lack of output)

Fixed using the following configuration:

function! s:pp_remove_esc(line)
  " Replace �[?2004l or �[?2004h with newline
  return substitute(a:line, '�[?2004l\|�[?2004h', '\n', '')
endfunction

....

let g:codi#interpreters = {
      \ 'python': {
          \ 'bin': 'python',
          \ 'prompt': '^\(>>>\|\.\.\.\) ',
          \ 'preprocess': function('s:pp_remove_esc'),
          \ },
      \ }