Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add highlighting to indicate which forms have not been changed since their last evaluation #573

Open
Olical opened this issue May 6, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Olical
Copy link
Owner

Olical commented May 6, 2024

As requested by rwaweber on Discord.

image

This behaviour can be found in Emacs + CIDER, we should borrow the idea.

It should not be implemented in a single client way, this is a generic feature that should work across all clients. We just need to find a way to track buffer changes to forms, a nice way to highlight those forms in the UI and then integrate our change watching with the eval commands with a kind of middleware.

This might be a great use for expanding the event / hook system.

@Olical Olical added the enhancement New feature or request label May 6, 2024
@practicalli-johnny
Copy link

The visual representation for highlighting evaluated code in Emacs is subtle (arguably so subtle that most do not notice this feature exists even though it's on by default)

Hopefully such a feature via Conjure can be configured to be less subtle if desired.

I like the visual design of https://github.com/folke/todo-comments.nvim although this maybe overkill for evaluation markers.

Ideally the evaluated highlight visuals would complement and not conflict with other visuals, especially from LSP clients & Todo comments.

@HoldenLucas
Copy link

Is there any additional information I would need to start working on this today?

@Olical
Copy link
Owner Author

Olical commented Dec 5, 2024

Not really! As long as you're on the main branch, have https://github.com/Olical/nfnl added to your plugins you can work on this. We'd need to look into nvim APIs for highlighting the lines and come up with some nice UX like "do they all start green and go red as we make changes?".

We will also need options and helptext around them to help users turn this off and on (probably start as off by default because people will be unhappy otherwise). It should also be structured as follows:

  • Main code for this should be in it's own module like conjure.change-highlights or something like that
  • The integration hooks should probably be in fnl/conjure/eval.fnl but should be minimal. So all of the heavy lifting is in it's own module that can be tested on it's own, then we add some small function calls in the eval functions to integrate this into every client in one go.
  • We should probably call from some common point in the eval call stack so we don't need to insert hooks in LOTS of places, so higher up the callstack would be better, some common place.
  • The config check to see if this is even enabled should probably be inside the conjure.change-highlights module in one or two common functions that everyone else calls to avoid the need to put feature flag checks all over the place.

@Olical
Copy link
Owner Author

Olical commented Dec 5, 2024

Oh and you might want to comment out (set vim.g.conjure#filetype#fennel "conjure.client.fennel.nfnl") in .nvim.fnl since that's enabling the new nfnl based Fennel client for those of us working on Conjure itself. That's getting there but not complete yet and you might be better off with the default aniseed client.

This option basically turns on the experimental client when you work on Conjure itself from within the directory. So it might get in your way if you want to work on Conjure too! It can evaluate Fennel, it's just not finished yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants