Skip to content

Conversation

@eureka928
Copy link
Contributor

Summary

  • Add Clojure/ClojureScript tree-sitter AST node types to token_weights.json
  • Fixes all .clj, .cljc, and .cljs files scoring 0 token score despite being parsed correctly

Related Issues

Clojure's tree-sitter parser produces node types (list_lit, sym_lit, vec_lit, etc.) that are fundamentally different from imperative languages. None of these were present in token_weights.json, so every Clojure AST node received a weight of 0.0 — causing all Clojure PRs to get 0 base score.

For example, penpot/penpot#8301 modifies a .cljs file with 66 additions and 32 deletions but scores 0.

Clojure AST vs configured weights:

Expected (imperative) Clojure actual
function_definition, call_expression list_lit (everything is a list in Lisps)
identifier sym_lit / sym_name
string str_lit
number num_lit

Added weights:

  • Structural: list_lit (0.4), vec_lit (0.2), map_lit (0.3), anon_fn_lit (0.5), kwd_lit (0.15), sym_lit (0.1)
  • Leaf: sym_name (0.07), kwd_name (0.07), num_lit (0.03), str_lit (0.03), nil_lit (0.1), sym_ns (0.05)

Verified with a test diff: score went from 0.00 → 3.61 after the fix.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

Clojure's tree-sitter parser produces node types (list_lit, sym_lit,
vec_lit, etc.) that were not present in token_weights.json, causing
all .clj/.cljc/.cljs files to score 0 despite being parsed correctly.

Adds structural weights: list_lit, vec_lit, map_lit, anon_fn_lit,
kwd_lit, sym_lit. Adds leaf weights: sym_name, kwd_name, num_lit,
str_lit, nil_lit, sym_ns.
Copy link
Collaborator

@anderdc anderdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjust structural weights to what I commented

Lower structural weights as requested: list_lit 0.15, vec_lit 0.1,
map_lit 0.15, kwd_lit 0.05, sym_lit 0.05.
@eureka928 eureka928 requested a review from anderdc February 10, 2026 16:45
@anderdc anderdc merged commit e5f021b into entrius:test Feb 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants