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

Add `trim_scope = "center"`

Open
#393 1 comment 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Janet
Stars
3.2k
Forks
241
PR merge metrics
No merged PRs in 30d

Description

When I'm handling a lot of if statements or switch cases, I often find myself either not knowing which function I'm in when dealing with others' codebases (outer), or which if/switch statement I'm in (inner). I'd love to see a feature to remove the context in the center, leaving only the appropriate number of inner and outer context lines, depending on how nested the code is, or how many if/switch statements there are and obviously the value of max_lines.

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

The issue names no files, tests, or entry points. Start by locating the existing handling for trim_scope and max_lines, then define how center trimming should behave for nested if and switch contexts and how the resulting context lines should be verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
vim
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.