metakirby5 / codi.vim

:notebook_with_decorative_cover: The interactive scratchpad for hackers.
MIT License
3.02k stars 83 forks source link

Failing to add better support for Nim #160

Closed lf-araujo closed 7 months ago

lf-araujo commented 7 months ago

Hi,

Current Nim support works but it is painfully slow in files longer than 20loc. I am trying to add support to the improved llvm backend. Well, Codi recognizes the output in the repl, but it does not seem to call CodiUpdatePost.

So here are last lines of current implementation:

[11:41:55.541652] <SNR>74_codi_handle_data[14]: Matched prompt
[11:41:56.775971] <SNR>74_codi_handle_data[9]: [DATA] 55 == type int
[11:41:56.777490] <SNR>74_codi_handle_data[9]: [DATA] nim> 
[11:41:56.778554] <SNR>74_codi_handle_data[14]: Matched prompt
[11:41:56.779706] <SNR>74_codi_handle_data[17]: All prompts received
[11:41:56.781799] <SNR>74_stop_job_for_buf[8]: Stopping job for buffer 10
[11:41:56.787800] <SNR>74_user_au[1]: Doing autocommand CodiUpdatePost

The new configuration:

      \ 'nim': {
          \ 'bin': ['/home/luis/Documents/OneDrive/Coding/Nim/nlvm/nlvm/nlvm', 'r'],
          \ 'prompt': '>>> ',
         \ 'quitcmd': 'quit()',
          \ },
      \ }

And the final lines of the log:

[11:45:34.174951] <SNR>74_codi_handle_data[9]: [DATA] >>> >>> 5
[11:45:34.176310] <SNR>74_codi_handle_data[14]: Matched prompt
[11:45:34.177829] <SNR>74_codi_handle_data[9]: [DATA] >>> >>> ... ... >>> 3
[11:45:34.179108] <SNR>74_codi_handle_data[14]: Matched prompt
[11:45:34.183366] <SNR>74_codi_handle_data[9]: [DATA] >>> >>> >>> ... ... ... ... ... >>> 55: int
[11:45:34.184598] <SNR>74_codi_handle_data[14]: Matched prompt
[11:45:34.185989] <SNR>74_codi_handle_data[9]: [DATA] >>> >>> 
[11:45:34.187331] <SNR>74_codi_handle_data[14]: Matched prompt

It seems Codi is updating with the matched prompts.

metakirby5 commented 7 months ago

It's been awhile since I've worked on Codi, so I unfortunately don't have a great answer 😢

However, I do think it may be worth checking the g:codi#raw option to help with debugging.

lf-araujo commented 7 months ago

Thanks, will close this one and look into raw.