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 command to eval the ns macro of current ns #2725

Open
behrica opened this issue Feb 11, 2025 · 2 comments
Open

add command to eval the ns macro of current ns #2725

behrica opened this issue Feb 11, 2025 · 2 comments
Labels
evaluation shortcuts Related to keyboard shortcuts ux User experience related

Comments

@behrica
Copy link
Contributor

behrica commented Feb 11, 2025

In some situations like mixed Clojure / Java projects with Virgil
(see: PR #2724 )

we need to re-evaluate the ns macro of the current ns more often then in "usual Clojure coding",
as the (:import ...) of changed java classes needed to be re-evaluated in some situations to pickup changes.

Having a dedicated command which does so, and does not change cursor position, could be very useful.

@PEZ PEZ added evaluation ux User experience related shortcuts Related to keyboard shortcuts labels Feb 11, 2025
@PEZ
Copy link
Collaborator

PEZ commented Feb 11, 2025

I think it could be good for discoverability to have such a command.

For anyone who sets out to implement it. Calva has dev utilities for finding the current ns form. Currently I think it will find the closest ns or in-ns from the cursor and towards the beginning of the document. We would probably need a version of this that only finds ns forms.

@behrica behrica changed the title add command to eval teh ns macro of current ns add command to eval the ns macro of current ns Feb 11, 2025
@behrica
Copy link
Contributor Author

behrica commented Feb 11, 2025

Just to clarify more the "use case".
When working with Virgil, and some Java changes do not "refresh",
(I saw it on change of method signatures)

the simplest for the user would be to re-eval all "import" expressions of Java classes
which can be spread across the ns.
(instead of searching the one for the Java code he has changed, which is an other option)

I am not sure, if there is a way "to find those..." and dynamically re-evaluate them.
(so then we would talk about a Calva feature of 're-eval all import' statements

The second best practice is therefore to have all imports in the ns macro, and re-eval only that, when something in Java is not refreshed on Clojure side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluation shortcuts Related to keyboard shortcuts ux User experience related
Projects
None yet
Development

No branches or pull requests

2 participants