nvim-treesitter / nvim-treesitter/nvim-treesitter-context
feat: per-depth highlighting for context lines
Nobody has claimed this yet.
- Dominant language
- Janet
- Stars
- 3.2k
- Forks
- 241
- PR merge metrics
- No merged PRs in 30d
Description
When multiple context entries are displayed, it can be difficult to visually distinguish between nesting levels, particularly when a single entry can span multiple lines, since everything shares the same TreesitterContext highlight group.
Proposed Solution: per-depth highlight groups
- Expose highlight groups like TreesitterContextLevel1, TreesitterContextLevel2, etc., allowing users to set distinct background colors per nesting level.
Implementation Notes
- I have not looked at the code too deeply, but the depth information seems to already available during tree-sitter traversal.
- Mostly use nvim_buf_add_highlight() with depth-based highlight groups?
Would this be helpful and feasible?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the tree-sitter traversal where context depth is available and the existing nvim_buf_add_highlight() calls. Confirm the design for depth-based highlight group names, then verify that displayed context entries use the corresponding group for each nesting level.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100