feat(nix): add Nix language support for nested scope detection#179
Open
parkers0405 wants to merge 2 commits intoshellRaining:mainfrom
Open
feat(nix): add Nix language support for nested scope detection#179parkers0405 wants to merge 2 commits intoshellRaining:mainfrom
parkers0405 wants to merge 2 commits intoshellRaining:mainfrom
Conversation
added 2 commits
January 28, 2026 21:20
- Add node_type field to Scope class to track treesitter node type
- Pass node_type from chunkHelper to render function
- Add node_type_styles config option for pattern-based style mapping
- Create dynamic highlight groups based on node type patterns
- Also includes virt_text_repeat_linebreak fix for wrapped lines
Example config:
node_type_styles = {
["^func"] = { fg = "#99aee5" }, -- functions: blue
["^if"] = { fg = "#c2a2e3" }, -- conditionals: purple
["^for"] = { fg = "#fbdf90" }, -- loops: yellow
}
This allows different colored chunk indicators for different scope types
(functions, loops, conditionals, etc.) when use_treesitter is enabled.
- Add nix.lua with Nix-specific treesitter node types - Enables chunk indicators for let expressions, attrsets, lambdas, etc. - Provides better visual feedback for Nix flake structure This allows hlchunk to show arrows/indicators for all nested scopes in Nix files (inputs, outputs, let blocks, attribute sets, etc.) instead of just top-level scopes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Nix-specific treesitter node types for better chunk indicator support in Nix files.
Problem
Currently, hlchunk only shows chunk indicators for top-level scopes in Nix files. Nix has many nested scope types (let expressions, attribute sets, lambda functions, etc.) that weren't being detected.
Solution
Add
nix.luawith Nix-specific treesitter node types as a table (not array):let_expression-let ... in ...blocksattrset_expression-{ ... }attribute setsrec_attrset_expression-rec { ... }recursive setslist_expression-[ ... ]listslambda_expression-arg: bodyfunctionsfunction_expression-{ args }: bodyfunctionswith_expression-with ...; ...expressionsif_expression- conditionalsassert_expression- assertionsbinding-name = value;bindingsBenefits
Better visual feedback when editing Nix flakes and configurations. Users can now see chunk indicators for:
Especially useful for NixOS configurations and flake structures.
Testing
Tested on NixOS with Nix flakes and configuration files. Chunk indicators now appear for all nested scopes.