[feature] Auto-install quicklisp dependencies
Currently the extension requires you to have installed four packages (brodeaux-threads, usocket, cl-json, and flexi-streams). Particularly for new CL-users this can be a difficult on-ramp to using the extension. It would be nice if it worked out of the box. I had a few ideas for this:
First Solution - startup commands
One solution is to add command-line quicklisp code to grab the dependencies to the alive.ls.startCommand variable in package.json. I tested this on my system, and it works. When the packages are already installed, it doesn't seem to slowdown startup by too much:
"alive.lsp.startCommand": [
"sbcl",
"--eval",
"(ql:quickload :cl-json)",
"--eval",
"(ql:quickload :bordeaux-threads)",
"--eval",
"(ql:quickload :usocket)",
"--eval",
"(ql:quickload :flexi-streams)",
"--eval",
"(require :asdf)",
"--eval",
"(asdf:load-system :alive-lsp)",
"--eval",
"(alive/server:start)"
]
Another issue with this approach is it's still dependent on quicklisp being installed. I think it would be nice if all you had to do was install sbcl and then install the extension in VS code.
Second Solution - bootstrap system
Since the :alive-lsp system has dependencies on those packages, we can't put code in that system that would install them. It wouldn't run in time. We could create another system, alive-bootstrap that has code to (1) detect if quicklisp is installed, and install it if necessary, then (2) quickload all of the dependencies. Then change the startCommand to look like this:
"alive.lsp.startCommand": [
"sbcl",
"--eval",
"(require :asdf)",
"--eval",
"(asdf:load-system :alive-bootstrap)",
"--eval",
"(alive-bootstrap/setup)",
"--eval",
"(asdf:load-system :alive-lsp)",
"--eval",
"(alive/server:start)"
]
Third Solution - JS code The second setup has the downside of coupling the VS-code extension more closely with the language server. So perhaps walking through the console commands to download and install quicklisp could be done on the Javascript side somewhere in the VS-code extension. I don't know exactly how this would be done, but could look into it.
Doing it in the JS code might be the way to go. It's already tightly coupled, so that's not an issue. Several other extensions ask to install stuff they can't find, so there's precedence. It would be easier to prompt them from the JS code, which seems better than installing stuff without asking.
An original goal was to have the extension not be sbcl specific, which made it hard to do the installation. That ship has currently sailed, so might not be a problem if it makes the experience better.