cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Fold/unfold don't work with decorated functions

Open codecat555 opened this issue 5 years ago • 3 comments

I've noticed that the fold and unfold commands don't seem to work when a function has been decorated, e.g.

# taken from https://talon.wiki/unofficial_talon_docs/#captures
@mod.capture(rule="all | ((north | south) [(east | west)] | east | west)")
def compass_direction(m) -> Direction:

I searched for existing issues and for settings that might affect this but didn't find anything.

codecat555 avatar Oct 30 '21 20:10 codecat555

Ah yeah that makes sense in retrospect. Thanks for filing. Not entirely sure easiest way to fix this one tbh. Will need to have a think. The way cursorless interacts with VSCode's folding mechanism is a bit less than ideal

pokey avatar Oct 30 '21 20:10 pokey

I ran into this problem while working on a big class and I wanted to fold every funk in order to get a better overview. All functions with a decorator remain unfolded and the entire class gets folded.

Andreas suggested using fold every function name which seems to be a fine workaround if anyone else also has this problem.

MartinRykfors avatar Apr 24 '23 07:04 MartinRykfors

Yeah good call. Should work as a workaround for folding a single function as well, eg just "fold funk name"

pokey avatar Apr 24 '23 11:04 pokey