reddit / emacs
⌘+e: Bringing the power of Emacs’ C-x C-e to VSCode
moseswithhisbooks · 2022-07-07 11:03
moseswithhisbooks · 2022-07-07 11:20
Hello! Just as Emacs is a Lisp interpreter with `C-x C-e`, now with this [new VSCode Extension](https://marketplace.visualstudio.com/items?itemName=alhassy.easy-extensibility), VSCode becomes likewise a living JavaScript interpreter with `⌘+e`. Here is the [source repo](https://github.com/alhassy/easy-extensibility).
🔥 You can write normal JS functions and have them become immediate extensions to the editor itself! (No need to make a nodejs project, just to make a quick utility!)- Of-course Emacs' approach is more transparent; sadly VSCode has a wrapper api which is poorly documented and harder to work with: So I've introduced a more user-friendly api, dubbed `E` \--- in honour of *Emacs*.
* 🔥 This extension mimics Emacs' support for `init.el` files in the form of `init.js` files.
* [Here are some use cases](https://github.com/alhassy/easy-extensibility/blob/main/init.js) that I've been using since I've started working on this extension.
* You can get them by invoking `cmd+h find user's init.js file, or provide a template`.
* Also, `cmd+h tutorial` opens a tutorial to learn more about using `cmd+e` and this extension.
anaumann · 2022-07-07 11:36
So it's not emacs and it's not elisp? Why is this here? :D
And I think, a "region" in VSCode is something totally different from a region in emacs, this will probably confuse a lot of people on both sides.
And where is the cauliflower key on my keyboard, I can't find it! :D
ndamee · 2022-07-07 12:25
I also thought of this, but vscode's api is limited compared to emacs, so it won't be as powerful.
Regardless, it's nice that you made such an extension, you should post it in some vscode subreddit instead, if you want more feedback. Vscode users are its target, not emacs users.
anaumann · 2022-07-07 12:39
It's already there, that's why I was questioning the post in this subreddit :)
deaddyfreddy · 2022-07-07 13:26
besides that scope narrowing rules in non-lisps are not as unambiguous as in lisps, so it's hard to decide what to eval in general
deaddyfreddy · 2022-07-07 13:32
isn't it possible to script VS Code using something like https://github.com/babashka/nbb ?
Given Calva has NREPL support I think it's (in theory) possible to have a live ClojureScript environment in VSCode.
ambirdsall · 2022-07-07 16:33
Although using tree-sitter, one could do actual unambiguous AST navigation in any supported language, including js.
ambirdsall · 2022-07-07 16:36
Seeing this with snarky "why is this here" comments and downvotes is honestly a bit of a bummer: the best things about emacs are the ideas, not the implementation, and seeing one of the most powerful good ideas embodied by emacs spread beyond our little niche is absolutely a good thing. Nice work, OP!
The_L_Of_Life · 2022-07-07 20:25
This is really good, thanks for posting it :)
oantolin · 2022-07-08 21:32
This is fantastic, congratulations! I've often wondered whether VS Code supported this out of the box or not and no one seemed to know (at least no one ever answered me!). I'm guessing that the fact that you wrote this extension means the answer to my question is "no". It's good to finally have the question answered, but even better to have this extension changing the answer!
bitwize · 2022-07-10 17:50
I investigated extending Visual Studio Code not too long ago.
Without something like this, it's an enormous pain in the ass.