Skip to content

Contributing

Sepehr Ansaripour edited this page Feb 23, 2024 · 5 revisions

Contributing

VS Code extensions are built in good ol' JavaScript. This guide assumes you have some basic understanding of working with JS, Node, NPM, etc. Before you delve deeper, install the project's necessary dependencies with npm install!

ClojureScript

Much of this extension is written in ClojureScript code. This section will detail how to get a running ClojureScript REPL in which said Cljs code can be loaded and played with.

Make sure you're using VS Code and have the Calva extension installed.

To start a ClojureScript REPL:

  1. cmd + shift + p
  2. search for Calva: Start a Project REPL and Connect...
  3. Select the aforementioned command
  4. Select shadow-cljs
  5. Select :lib/dev checkbox [and the :test checkbox if you want the tests to autorun on save] and then click OK
  6. In the next prompt, select :lib/dev
  7. Once the CLJS files have finished compiling, open a new terminal and run npm run connect-repl
  8. Voila! Your code will now be re-compiled after every change. Try evaluating some code!
    1. You can hop into any Owlbear namespace and the use cmd + shift + p to find and select the Calva: Load Current File and... command

This video is a demonstration of the steps above.

Running the Extension

To run the extension in a sandbox VS Code window:

  1. Run npm run compile
  2. Press the green play button in your VS Code editor! This should open up a new sandbox VS Code window.
  3. I'd recommend opening the playground folder in the sandbox VS Code window, as the playground folder will have plenty of sample files to play around in!
  4. Look for owlbear commands with cmd + shift + p

Here's a video demonstrating the steps above!

Tree-sitter

Owlbear relies heavily on Tree-sitter to do all the necessary language parsing Owlbear needs. You can find the Tree-sitter grammars Owlbear relies on in the languages directory.

To get started with Tree-sitter:

  1. Install the Tree-sitter CLI tool, see here
  2. Run make build-wasms to init all the language submodules and build all of the necessary language WebAssembly files
  3. cd into one of the language directories
  4. Run tree-sitter playground to launch an in-browser editor for the language (should open on http://127.0.0.1:8000 by default); here you can write code and examine how Tree-sitter parses the code

Contact

You can contact me on Discord at sansarip.

Clone this wiki locally