-
Notifications
You must be signed in to change notification settings - Fork 8
How to Contribute
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.
- Fork and clone your fork.
- Create a new branch for your changes, most often branching off of
develop
(the main branch). npm install
- Open the project root directory in VS Code.
You also want to switch off Calvas auto connect feature in Settings for this Workspace.
- In VS Code: Tasks -> Run Build Task… -> Watch CLJS. Wait for it to compile the CLJS code and start watching.
- In VS Code: Tasks -> Run Build Task… -> Watch TS. Wait for it to compile the TypeScript code and start watching.
- Start the extension in debug mode (the Extension Host):
F5
. - Connect Calva:
ctrl+alt+v c
and select the:calva-fmt-lib
build. - 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.)
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.
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.