Thanks for your interest in contributing! Here's how to get involved.
- Bug reports: Open an issue with reproduction steps
- Feature ideas: Open an issue to discuss first
- Documentation: PRs welcome for README, examples, etc.
Want to add support for a language like Clojure, Elixir, Scala, etc.? Here's what's needed:
In .github/workflows/release.yml, add a line to the GRAMMARS env var:
env:
GRAMMARS: |
go:tree-sitter/tree-sitter-go:master:src
# ... existing grammars ...
clojure:sogaiu/tree-sitter-clojure:main:src # <- add yoursFormat: name:github_org/repo:branch:src_dir
Most grammars use src as the source directory, but check the repo structure.
Create scanner/queries/<lang>.scm to define what to capture:
; Functions - capture function/method definitions
(function_definition
name: (identifier) @function)
; Imports - capture import/require statements
(import_clause
(identifier) @import)Finding the right node types:
- Use tree-sitter playground
- Check the grammar repo's
grammar.jsfor node names - Look at existing queries in
scanner/queries/for examples
In scanner/grammar.go, add to the extToLang map:
var extToLang = map[string]string{
// ... existing mappings ...
".clj": "clojure",
".cljs": "clojure",
".cljc": "clojure",
}That's it from your side! Open a PR with these 3 changes.
What happens next:
- Maintainer reviews the PR
- Maintainer updates the Homebrew formula (
codemap.rb) with the new grammar - On next release, all platforms get the new language automatically
git clone https://github.com/JordanCoin/codemap.git
cd codemap
# Build the binary
go build -o codemap .
# Build grammars for --deps mode (requires clang/gcc)
make deps
# Test it
./codemap .
./codemap --deps .- Keep it simple - this is a CLI tool, not a framework
- Run
go fmtbefore committing - Test your changes with
./codemapon a real project
Open an issue or reach out. We're happy to help!