liquidz / vim-iced

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

FR: log buffer like in conjure #462

Open glyh opened 1 year ago

glyh commented 1 year ago

In conjure, all your evaluation goes to a log buffer, it contains the evaluated code, the output, along with stdout. User is free to modify anything in that buffer and it won't be stored as it's a temporary buffer.

This will be really helpful for users to tinker around with their code without being afraid that their codebase is broken.

glyh commented 1 year ago

Hello, if I implement this feature would you like to accept it @liquidz ? :)

liquidz commented 1 year ago

@glyh Sorry for late reply 🙇

Hello, if I implement this feature would you like to accept it @liquidz ? :)

It depends on the policy of implementation.

vim-iced already has a Stdout buffer, and I want to avoid a situation where multiple similar features exist. So, the policy should either completely replace the Stdout buffer, or extend the Stdout buffer.

But, it is currently possible to output evaluation code and evaluation results to the Stdout buffer using the Hook feature, so if the policy is to extend the Stdout buffer, we also need to consider conflicts with the Hook feature.

call iced#hook#add('eval_prepared', {
    \ 'type': 'function',
    \ 'exec': {v -> iced#buffer#stdout#append(printf(";; Eval:\n%s", v['code']))},
    \ })
call iced#hook#add('evaluated', {
   \ 'type': 'function',
   \ 'exec': {v -> iced#buffer#stdout#append(printf(";; Ret:\n%s", v['result']['value']))},
   \ })

How did you plan to implement this feature?