#+title: 💐 VSCode is itself a JavaScript REPL 🔁
#+author: Musa Al-hassy
#+email: alhassy@gmail.com
#+date: <2022-08-17 Wed>
#+filetags: repl-driven-development vscode emacs javascript
#+fileimage: https://raw.githubusercontent.com/alhassy/easy-extensibility/main/graphics/repl.gif 90% 90%
#+description: A meta-extension for VSCode that makes VSCode into a living, breathing, JS interpreter: It can execute arbitrary JS that alters VSCode on-the-fly. A gateway into the world of Editor Crafting!

* Abstract :ignore:

A meta-extension for VSCode that makes VSCode into a living, breathing, JS interpreter: It can execute arbitrary JS that
alters VSCode on-the-fly. A gateway into the world of Editor Crafting!

| (Inspired by using Emacs and Lisp!) |

* How do people usually code?

Either you,

1. Use a code editor and edit multiple lines, then jump into a console to try
   out what you wrote⏳, or

2. You use an interactive command line, and work with one line at a time
   ---continuously editing & evaluating 🔄

The first approach sucks cause your code and its resulting behaviour occur in
different places 😢 The second is only realistic for small experimentation
---after all, you're in a constrained environment and don't generally have the
same features that your code editor provides 🧟‍♂️

* If only we could have our cake, and eat it too! 🍰

With the VSCode Easy-Extensibility extension, we get both approaches! No need to
switch between the two any more! Just select some code and press Cmd+E ---E for
Evaluate! 😉

Why the strange name? Why isn't this extension called something more
informative, such as JS-repl-to-the-moon? 👀 Take another look at the above gif
🔼 Besides plain old JavaScript, this extension let's us alter VSCode itself!!
(It's a meta-extension! 😲)

#+html: <center> <br> <em>Intro to Easy-Extensibility</em> <br> <iframe width="360" height="215" src="https://www.youtube.com/embed/HO2dFgisriQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></center>

* Technically speaking, how is VSCode itself the REPL?

Let's do what math-nerds call proof by definition-chasing:

1. Definition: REPL, an alias for command line, stands for Read-Evaluate-Print-Loop

2. Cmd+E will echo the results in the notification area, in the bottom right-corner of VSCode

3. So it retains each of the read, eval, and print parts of the Read-Evaluate-Print-Loop

4. Moreover, since the program doesn't terminate, you're still in the loop part until you close VSCode

Bye! 👋 🥳