liquidz / vim-iced

Clojure Interactive Development Environment for Vim8/Neovim
https://liquidz.github.io/vim-iced/
MIT License
518 stars 35 forks source link

Evaluating code breaks due to long popup output #353

Closed bootleq closed 3 years ago

bootleq commented 3 years ago

Currently the iced#nrepl#eval#code can break during its default callback iced#nrepl#eval#out throwing 'vim-iced: too long texts to show in popup'. Seems we have no handling for this error and lead the workflow to be halted, hooks like evaluated won't trigger, though the eval is in fact successful.

Steps to reproduce:

(Vim 8.2.3174, vim-iced 3.5.4) Execute :IcedEval (apply str (repeat (* 54 200) "x")) (Please change 54 200 to large enough values, to vim's &lines and &columns)

Expected result: after evaluated, small popup appear and display the result, evaluated hook (if any) can be triggered. Actual result: no popup, no evaluated triggered (but the result does echo in vim)

Possible solution

Maybe just remove the throw code? I have done a local try and seems it works fine.

liquidz commented 3 years ago

@bootleq Thanks for your reporting!

Maybe just remove the throw code? I have done a local try and seems it works fine.

We are using the throw code in IcedDocumentPopupOpen and IcedSourcePopupShow as follows. https://github.com/liquidz/vim-iced/blob/0116d293f607883c83ed7a53d0dbccf77ab287c7/autoload/iced/nrepl/document.vim#L141-L157

In this case, virtual text component which uses popup component is the problem. And virtual text should be able to show texts of any length for Vim/Nvim, so I fixed to trim texts in virtual text component.

I just cut v3.5.5 #354 Could you try the latest version?

bootleq commented 3 years ago

Thank you very much!

I didn't notice the catch in those Popup functions, just tried the new version and confirmed fixed.