6 Commits

Author SHA1 Message Date
Timothy DeHerrera
7a7dc929b1 chore: attribute credit to helix 2026-02-05 14:31:13 -07:00
Timothy DeHerrera
136be19533 feat(highlight): migrate to tree-house with Helix queries
Replace tree-sitter-highlight dep with tree-house crate from Helix
editor. Add ropey dependency required by tree-house.

Reorganize query files from Helix's runtime/queries/ for all 14
supported languages:
- bash, c, css, go, html, javascript, json, markdown, nix, python,
  rust, toml, typescript, yaml
- Include ecma, _javascript, _typescript base dirs for JS/TS inheritance
- Copy highlights.scm, injections.scm, locals.scm where available

This commit establishes the foundation; highlight.rs implementation
will follow in subsequent commits.
2026-02-04 16:49:04 -07:00
Timothy DeHerrera
905897b3c4 fix(highlight): complete markdown syntax highlighting with injections
Fix markdown code block highlighting to properly support both markdown
structure (headings, frontmatter) and language injection (rust, bash).

The key fix uses `#set! injection.include-children` in the injection
query to override tree-sitter-md's internal tokenization, enabling
proper highlighting of embedded languages within code fences.

Changes:
- Use crate's HIGHLIGHT_QUERY_BLOCK for base markdown highlighting
- Add custom injection query with include-children directive
- Add YAML/TOML frontmatter and HTML block injection rules
- Add text.* highlight names (title, literal, uri, reference)
- Add string.escape highlight name
- Add CSS styles for new highlight classes
- Remove unused custom md-highlights.scm
2026-01-31 17:24:27 -07:00
Timothy DeHerrera
8c54882118 feat(highlight): add markdown syntax highlighting with injection
Add tree-sitter-md for markdown parsing with injection support for
fenced code blocks. Code inside markdown code fences (```rust, ```bash,
etc.) is now fully syntax highlighted.

Key fix: Use `#set! injection.include-children` directive in the
injection query to override tree-sitter-md's internal tokenization
of code_fence_content, allowing proper language injection.

- Add tree-sitter-md v0.5.2 dependency
- Add Markdown variant to Language enum (md, markdown aliases)
- Create queries/md-highlights.scm (minimal markdown highlights)
- Create queries/md-injections.scm (with include-children directive)
- Add test: test_markdown_injection_rust
2026-01-31 16:41:11 -07:00
Timothy DeHerrera
a7338f5418 feat: add Nix injection queries for embedded language highlighting
Adapted Helix nix/injections.scm for tree-sitter-highlight:
- Removed Helix-specific predicates
- Recognizes bash in buildPhase/installPhase, python in testScript,
  json in fromJSON, etc.
2026-01-26 23:54:59 -07:00
Timothy DeHerrera
b16246fba6 feat: use custom Nix highlight queries for richer syntax colors
- queries/nix-highlights.scm: Adapted from Helix editor queries.
  Properly identifies functions, properties, variable parameters,
  escape sequences, and string interpolation. Much richer than
  the bundled tree-sitter-nix query (99 lines vs 113 lines).

- src/highlight.rs: Load custom Nix query via include_str!
  instead of using bundled HIGHLIGHTS_QUERY.

- static/style.css: Fix variable (#e36209) and punctuation (#586069)
  colors to be distinct from text color.

Results: hl-function now appears (6 occurrences), hl-property
visible (17), hl-variable reduced from 43 to 17. Functions like
mkShell now render in purple/blue instead of orange.
2026-01-25 20:18:48 -07:00