Any way of interacting with chunks/sections and folding behaviour in rstudioapi?

I would like to create an add-in that enables toggling folded state on chunks/sections in the editor.
(I would find it easier to do this with a single keyboard shortcut than the current options of fold and unfold that are separate actions).
My web searches haven't found an existing add-in for this.

I can't see anything in the rstudioapi reference that relates to this, but I'm here to ask if I'm missing anything. I'm guessing since folding is something that RStudio can do, there has to be code somewhere that controls this behaviour.

EDIT: Turns out this was in RStudio all along! Hence no add-in required. My bad.

PS On this forum when you search for "fold" you get a load of results to do with "folder", and using the quotes around the word to attempt an exact search doesn't seem to prevent this. Nor can you do a negative search with "-folder" or "!folder", it seems. Any chance this functionality can be improved?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.