-
Notifications
You must be signed in to change notification settings - Fork 8
How to Contribute
Calva Formatter is made using a mix or TypeScript and ClojureScript. Generally the integration with VS Code is done in TypeScript and the actual formatting is done in ClojureScript.
The CLJS code is compiled by shadow-cljs
into an npm module, @cospaia/calva-lib, that is then required from the TypeScript part.
Depending on what you want to contribute you might have to fork at least two repos: This one, and calva-lib.
Consider saying hello in #calva-dev at the Clojurians Slack.
Unless you know that your change is on the extension/TypeScript end only, start with:
- Clone your fork of https://github.com/BetterThanTomorrow/calva-lib
- Most often you'll be branching off of
master
(the main branch). -
npm install
(This will install, amongst other things,shadow-cljs
) - Open the project root directory in VS Code. (You are using VS Code and Calva, right? Not that it is a requirement for hacking on calva-lib, really)
The dev process is like so:
- Run the
npm watch
build task. (This will runshadow-cljs
and make it watch:test
and:calva-lib
.) - Check the task Output pane and notice 6 tests failing (all todo with top level indenting not working yet, please feel free to discuss with me ways to fix this.)
- Connect Calva and choose the
node-repl
for your CLJS repl (it won't work with any of the build repls, unfortunately). - Hack away. Every time you save, the tests are run.
- Add/remove/modify any relevant test.
- Test the changes in the actual extension (see below about that setup).
- Assuming it is setup this means switching to the
calva-fmt
window and restart the extension host process (then switch to the extension host window and do your manual testing).
- Assuming it is setup this means switching to the
For testing the changes to the actual extension you'll need to setup:
- Clone your fork (I'll assume you do so in a sibling directory to
calva-lib
). - Most often you'll be branching off of
develop
(the main branch). npm install
- Open the project root directory in VS Code.
The dev process depends a bit on wether you are hacking also on calva-lib
. If you are, then start with:
npm link ../calva-lib/packages
Regardless, this:
- Run the build task Watch TS. Wait for it to compile the TypeScript code and start watching. (Only takes a second).
- Start the extension in debug mode (the Extension Host):
F5
. - Hack away. The watch task will rebuild the extension really quickly.
- There are no automated tests for the extension, mainly because I don't know how to do it. Please consider setting that up to collect gold stars in heaven (as we say in Sweden).
- Restart the extension host when you have new code to test (regardless if it is
calva-lib
, or thecalva-fmt
, or both that has changed.
- Make sure all tests pass. Please add some basic unit tests for any functionality in the ClojureScript code that you add or change.
- If you have changed
calva-lib
, then build a release build:npm run release
- Restart the extension host in the
calva-fmt
window and test that things still work. (You need to add the^:export
meta-data to anything you want to be accessible from the requiring TypeScript code.) - Package a
vsix
file:-
vsce package
(you might need tonpm install -g vsce
first.) - Install the vsix it manually in your VS Code and do some testing that the production build works.
-
When you have issued your Pull Request it is best to ping me about it to catch my attention. The #calva-dev channel of the Clojurians Slack is a good place for this ping, mention @pez
even.