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

Collapsing non C-style code sections? #3

Open
rnorth opened this issue May 6, 2017 · 1 comment
Open

Collapsing non C-style code sections? #3

rnorth opened this issue May 6, 2017 · 1 comment

Comments

@rnorth
Copy link

rnorth commented May 6, 2017

The automatic collapsing of unchanged curly brace-wrapped blocks is working well for Java and Groovy code.

I just wondered if it would be possible to add support for collapsing blocks that begin with a trailing :? In our case this would help with YAML-format config files and presumably with Python code as well.

Would you like me to have a go at a PR for this?

I notice https://github.com/yjerem/leg/blob/master/lib/snaptoken/diff.rb#L193 is where the start of section detection happens, based on a trailing brace. I imagine the start detection could be quite easily modified to also detect a trailing colon. Detecting the end of the section would be more challenging, I'd imagine!

What do you think?

@paigeruten
Copy link
Contributor

That sounds good to me! You can go ahead with working on a PR.

You'll probably want to give it a different section type, like :colon instead of :braces. Since both YAML and Python use indentation to denote blocks, maybe the end of the section would be the next line that starts with a non-whitespace character? I don't know, it might not be that simple. Whatever works for your use case should be fine.

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

No branches or pull requests

2 participants