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

Allow running Effekt programs directly from VS Code #12

Open
marzipankaiser opened this issue Nov 22, 2022 · 6 comments
Open

Allow running Effekt programs directly from VS Code #12

marzipankaiser opened this issue Nov 22, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@marzipankaiser
Copy link
Contributor

AFAICT, there is currently no way to run Effekt programs from the VS Code GUI. (Apart from opening the terminal and running it directly).

@marzipankaiser marzipankaiser added the enhancement New feature or request label Nov 22, 2022
@b-studios
Copy link
Collaborator

Yes, that's right. Of course, you could use the terminal built into vscode; probably that's what you meant.

Some languages (like Flix) have vscode support where run shows up as a codelens over a toplevel function.
For this, we would need some support from our compiler, I'd assume. At least, we could generate a main that calls this particular function and run it immediately (like it is done in the Repl).

https://github.com/effekt-lang/effekt/blob/master/effekt/jvm/src/main/scala/effekt/Repl.scala#L293-L321

@jiribenes
Copy link
Contributor

This would be already very helpful even if it worked only for def main(): Unit / {} and ran the whole file with the currently chosen backend.

@b-studios
Copy link
Collaborator

For all other functions that take no argument and don't have unhandled effects, it is very easy to generate main as a thin wrapper and can it immediately. In the Repl we do something very similar

@jiribenes
Copy link
Contributor

Sure, though it would be very interesting to have this for the Effekt practicals already (so within the next ~month), but I really don't have the time to do this myself.

@jiribenes
Copy link
Contributor

#28 has a crude version that greps for def main() in a file and shows a |> Run code lens above it that runs the whole file like effekt $CURRENT_FILE --backend $BACKEND.
There was also an attempt to open the REPL, but it fails on a few details mentioned in #28. Here's the relevant commit that reverts from REPL back to running a file (you can just apply it in reverse): 5a12148

That's why I don't consider this issue resolved (yet), please feel free to pick this up and continue with a better solution. :)

@jiribenes
Copy link
Contributor

Possible heuristic as an improvement: if there are two def main()s, do not show the run button (can we show some error there?)

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
Development

No branches or pull requests

3 participants