This is the frontend of the tool.
Implemented as a VS Code extension in Elm
.
This is an approximate illustration of the setup of the extension.
- VS Code interface is connected to a thin JS-based client.
- This JS client connects itself to the background Elm workers.
- The Elm workers manage the incoming calls to perform the
shorthndr
tasks.- Since interacting with child processes from Elm is quite tricky,
the
shorthndr
CLI tool is also wrapped into a small JS client used as a "side-car" for the Elm workers.
- Since interacting with child processes from Elm is quite tricky,
the
The illustration below might be out of date, but should give a basic idea.
| ======= |
| VS Code |
| ======= |
A
|
V
| ============== | | ================== | | ================= |
| EXTENSION [Js] | | ExpandWorker [Elm] | | ShortHndrCli [Js] |
| ~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~ |
| commands | | ports | | child_process |
| | -[listen]-> (toExtensionSuccess)= | | | |
| | -[listen]---> (toExtensionError)= | | =(toShortHndr) <--------[listen]- | |
| | -[listen]----> (toExtensionInfo)= | | =(fromShortHndrSuccess) <-[send]- | |
| | -[send]--------> (fromExtension)= | | =(fromShortHndrError) <---[send]- | |
| | -[send]--> (fromExtensionExpand)= | | | ================= |
| ============== | | ================== |
src/
- contains all the Elm componentswiring/
- defines the JS wrappers and utilities for the Elm workers (andshorthndr
CLI)extension.js
- entrypoint of the VS Code extensiondebug.js
- a tool for manual debugging/sandboxing/integration of the Elm interfaces with node.vscode/launch.json
- defines a debugging entrypoint for a VS Code extensionpackage.json
- defines VS Code extension dependencies and development scriptselm.json
- defines configuration and dependencies of the Elm components.
NB: currently we only support the extension with
shorthndr
running on Unix systems.
Run npm install
to set up all the project dependencies (internal and external).
This will automatically (using the preinstall
and postinstall
scripts):
- Run
npm run setup:shorthndr
to install theshorthndr
CLI from the../backend/team-proj-abbr
directory to make sure that theshorthndr
CLI is available to use. It uses thestack install
under the hood and installs the project to$HOME/.local/bin
directory. - Run
npm install
resolving all the NPM (JavaScript/Node.js) dependencies for the project - Run
npm run make:elm
to compile the Elm components into JavaScript usingelm make
under the hood. The compilation results are placed in the./dist
directory.
If developing with VS Code, start a debugging session
with F5
, located also in the "Run" menu -> "Start Debugging"
(or for the successive runs, also via "Run and Debug" panel -> "Run Extension").
The command will open a new VS Code debug window, with the extension enabled.
Then, you can use the command palette Cmd/Ctrl + P
, write >ShortHndr
in the text field,
and you will see all our Replace
and Expand
commands!
Install Elm
following the oficial docs.
elm init
- initialize a new elm projectelm reactor
- start a reactive local server for your projectelm make
- build a given elm fileelm install <package name>
- install an external package