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

Extension API: Evaluate via Calva's REPL connection #1719

Closed
orestis opened this issue May 9, 2022 · 4 comments
Closed

Extension API: Evaluate via Calva's REPL connection #1719

orestis opened this issue May 9, 2022 · 4 comments

Comments

@orestis
Copy link

orestis commented May 9, 2022

Calva doesn't have an API that extensions can use. With Joyride around, having a proper API that extensions can use is very useful.

At the minimum evaluating code within an active nREPL connection and getting back a Promise with results would be extremely helpful.

@PEZ PEZ changed the title Extension API Extension API: Evaluate via Calva's REPL connection May 9, 2022
@PEZ
Copy link
Collaborator

PEZ commented May 9, 2022

Thanks for this issue. It is about time we think about some important extension points. Evaluations being the most interesting to start with I think. (I renamed the issue to have something we can close in anything like the near future.)

A thing to consider here is Joyride, of course. When working with Joyride scripts that's where the REPL is connected. Maybe that is fine for many purposes, but at least could be good to contemplate... I find it hard to think about it without my brain frying, actually.

Related: What Calva really needs is some way to create more than the two REPL sessions it has today, as #76 has suggested for very long now.

@seancorfield
Copy link
Contributor

My use case is for a Joyride script to be able to direct Calva to take the currently-selected form in the editor and submit it to the nREPL for that editor and get back (a promise of) the result of the evaluation to use in the next step of the Joyride script. I don't mind whether that's just a string of the result, such as nREPL returns, or whether it's a hash map containing that string -- the string is the important part for my use case.

But I hadn't considered how you might develop such a script, using Joyride's nREPL, since that would not be the nREPL session in which I wanted the code evaluated -- it must be the main project's nREPL since it will be JVM-based code that needs the project context, not the Joyride context.

@PEZ
Copy link
Collaborator

PEZ commented May 24, 2022

But I hadn't considered how you might develop such a script, using Joyride's nREPL, since that would not be the nREPL session in which I wanted the code evaluated

Yes, that's going to be a problem as long as we don't fix #76. We might need some convenient ways to run Joyride code in the meantime. For now you can select some code (e.g. the current form), copy it, and paste it in the Joyride: Run Clojure Code.... I also find myself having a few rcf-x, rcf-y forms in a Joyride library bound to keyboard shortcuts. Then I make these call some entrypoints in my script that can test various aspects of it while I am tweaking it.

@PEZ
Copy link
Collaborator

PEZ commented May 24, 2022

Regarding Joyride vs Clojure REPL: I just pasted some Joyride code in my Joyride thread over at ClojureVerse that should make it more convenient to use the Joyride REPL without starting its nREPL server.

PEZ added a commit that referenced this issue May 26, 2022
@PEZ PEZ mentioned this issue May 26, 2022
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants