nvim-treesitter / nvim-treesitter/nvim-treesitter-context

feat: per-depth highlighting for context lines

Open
#655 0 comments 2 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.