codehike icon indicating copy to clipboard operation
codehike copied to clipboard

Add annotation to collapse lines

Open zentol opened this issue 3 years ago • 4 comments

When embedding somewhat larger pieces of code it can happen that the focused code is spread around quite a bit. Currently everything between focused lines is being rendered, which causes code blocks to be larger than necessary.

It would be nice to have an annotation to hide certain lines, similar to how focus works.

zentol avatar Aug 04 '22 08:08 zentol

Can you provide an example of your problem (a screenshot is ok)?

You want to collapse lines that are between other focused lines, right?

pomber avatar Aug 05 '22 09:08 pomber

In this example I'd like to hide the getEvent()/getMetaData() methods, but not out.collect(new EnrichedEvent(event, metadata, headers)); (below the first focused line).

I think collapsing all unfocused lines wouldn't be desirable; you'd lose some context unless you expand the focus. In the example above, the contents of of deserialize method are important for context, although we focus on a particular line. Meanwhile, the 2 methods aren't relevant anymore, because they are covered elsewhere.

zentol avatar Aug 05 '22 09:08 zentol

Ok, so you want something like:

```python hello.py focus=6,24:35 collapse=10:22
# ...
```

pomber avatar Aug 05 '22 09:08 pomber

yes, that would work.

zentol avatar Aug 05 '22 10:08 zentol