feat(nix): add Nix list support#43
Conversation
Custom split/join handler for space-delimited list_expression nodes, since Nix lists use spaces instead of commas between items. Handles function calls with nested braces, string items, and properly skips single-element lists. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis pull request adds support for the Nix language to the splitjoin plugin. It introduces Nix-specific list split/join functions, configuration bindings, Tree-sitter query rules, and comprehensive test coverage. The implementation enables transforming between single-line and multi-line Nix list expressions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lua/splitjoin/languages/nix/functions.lua`:
- Around line 5-25: The Nix.split_list function currently always prefixes items
with options.default_indent and writes the closing ']' at column 0, and it
doesn't handle default_indent when provided as a function; update Nix.split_list
to detect and preserve the node's base indentation (e.g., read indentation of
the node's starting line or previous sibling), normalize options.default_indent
if it's a function (call it to get a string), then build lines that insert the
base indentation before each item indent and emit the closing ']' aligned with
the base indentation; finally call Node.replace and Node.goto_node as before so
the replaced text keeps the surrounding indentation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 99fab636-c0d1-441c-a2d0-c92884bd6628
📒 Files selected for processing (6)
lua/splitjoin/languages/nix/defaults.lualua/splitjoin/languages/nix/functions.luaqueries/nix/splitjoin.scmtest/bootstrap.luatest/helpers.luatest/nix_spec.lua
Summary
list_expressionnodes, which use space-delimited items instead of commas(callPackage ./foo.nix {})), string items, path identifiersTest plan
Assisted-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Summary by CodeRabbit
New Features