[FEATURE]: Add Nix syntax highlighting #3974

Closed
opened 2026-02-16 17:42:09 -05:00 by yindo · 2 comments
Owner

Originally created by @anntnzrb on GitHub (Dec 29, 2025).

Originally assigned to: @thdxr on GitHub.

Summary

Add tree-sitter based syntax highlighting for Nix files (.nix).

Challenge

The official tree-sitter-nix repository (nix-community/tree-sitter-nix) does not publish WASM binaries:

  • Issue requesting WASM: nix-community/tree-sitter-nix#66 (open since Aug 2024, no maintainer response)
  • npm package: Only v0.0.2 from 2023, no WASM included
  • The repo has code to publish WASM (prepublishOnly script added Aug 2025), but no new npm release has been made

Solution

Use WASM from ast-grep/ast-grep.github.io (pinned to commit SHA):

  • ast-grep is a reputable project (11k+ stars, active development)
  • WASM added Nov 2025 by main maintainer
  • Pinned to specific commit for stability: 40b84530640aa83a0d34a20a2b0623d7b8e5ea97
  • TODO comment added linking to upstream issue for future replacement

Highlight queries from nvim-treesitter (same source as other parsers).

Originally created by @anntnzrb on GitHub (Dec 29, 2025). Originally assigned to: @thdxr on GitHub. ## Summary Add tree-sitter based syntax highlighting for Nix files (`.nix`). ## Challenge The official `tree-sitter-nix` repository (nix-community/tree-sitter-nix) does not publish WASM binaries: - Issue requesting WASM: nix-community/tree-sitter-nix#66 (open since Aug 2024, no maintainer response) - npm package: Only v0.0.2 from 2023, no WASM included - The repo has code to publish WASM (`prepublishOnly` script added Aug 2025), but no new npm release has been made ## Solution Use WASM from ast-grep/ast-grep.github.io (pinned to commit SHA): - ast-grep is a reputable project (11k+ stars, active development) - WASM added Nov 2025 by main maintainer - Pinned to specific commit for stability: `40b84530640aa83a0d34a20a2b0623d7b8e5ea97` - TODO comment added linking to upstream issue for future replacement Highlight queries from nvim-treesitter (same source as other parsers).
yindo added the nix label 2026-02-16 17:42:09 -05:00
yindo closed this issue 2026-02-16 17:42:09 -05:00
Author
Owner

@anntnzrb commented on GitHub (Dec 29, 2025):

PR: #6386

@anntnzrb commented on GitHub (Dec 29, 2025): PR: #6386
Author
Owner

@github-actions[bot] commented on GitHub (Dec 29, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #6379: [FEATURE]: Add nixfmt formatter for Nix files - This is a related feature request for Nix support (formatting rather than syntax highlighting)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 29, 2025): This issue might be a duplicate of existing issues. Please check: - #6379: [FEATURE]: Add nixfmt formatter for Nix files - This is a related feature request for Nix support (formatting rather than syntax highlighting) Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3974