Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trim_scope = "center" #393

Open
Tetrapak0 opened this issue Feb 14, 2024 · 1 comment
Open

Add trim_scope = "center" #393

Tetrapak0 opened this issue Feb 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Tetrapak0
Copy link

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.

@lewis6991 lewis6991 added the enhancement New feature or request label Feb 14, 2024
@lewis6991 lewis6991 changed the title Feature request: Add trim_scope = "center" Add trim_scope = "center" Feb 14, 2024
@topolarity
Copy link

I would also love to see this feature, or have it be the default for the 'inner' trim behavior.

To be honest, I feel a bit "lied to" in the inner trim mode, because it strongly suggests I'm in an if-else / switch branch that I actually am not. My preferred behavior would be to have the "prior cases" of if-elses and switches trimmed first, and only resort to pruning scope context afterward (with the direction depending on your inner / outer setting).

As-is, I'm forced to use max_lines: 1 with the inner mode, because I can be reasonably sure it will be a function context that will not have had the most relevant syntax chopped off already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants