Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

How to Contribute

Peter Strömberg edited this page Oct 7, 2018 · 7 revisions

Calva Formatter is made using mainly ClojureScript. The CLJS code is compiled by shadow-cljs into a JavaScript library that is then used from TypeScript, which is used for the VS Code integration.

The setup:

  1. Fork and clone your fork.
  2. Create a new branch for your changes, most often branching off of develop (the main branch).
  3. npm install
  4. Open the project root directory in VS Code.

You also want to switch off Calvas auto connect feature in Settings for this Workspace.

The dev process:

  1. In VS Code: Tasks -> Run Build Task… -> Watch CLJS. Wait for it to compile the CLJS code and start watching.
  2. In VS Code: Tasks -> Run Build Task… -> Watch TS. Wait for it to compile the TypeScript code and start watching.
  3. Start the extension in debug mode (the Extension Host): F5.
  4. Connect Calva: ctrl+alt+v c and select the :calva-fmt-lib build.
  5. Switch back to the Watch CLJS task to see the test results when you save any cljs file.

As you edit code, shadow-cljs will recompile the extension really fast, as will the TypeScript compiler. The test runner is triggered and results printed in the terminal where the Watch CLJS task is running. Currently the TS code is not tested. Mainly because I do not know how to do it, but also because I try to keep the TS as thin a layer as possible.

You need to restart the Extension Host after each rebuild to test it. (If you know how to get live reload to work, please let me know.)

If you find yourself having to restart the CLJS task, you will need to also restart the TS task, once the CLJS code is compiled. (The reason is that the CLJS task starts by cleaning away the directories being watched by the TS task.)

Before sending pull requests

Make sure all tests pass. Please add some basic unit tests for any functionality in the ClojureScript code that you add or change.

Use the vsce tool to package a vsix file and install it manually in your VS Code and do some quick smoke testing that the production build works.

After sending pull requests

When you have issued your Pull Request it is best to ping me about it to catch our attention. The #calva-dev channel of the Clojurians Slack is a good place for this ping, mention @pez even.

Clone this wiki locally