Repository navigation
Add indent based code folding - #2971
Conversation
|
alexandrudima Alex, FYI |
Add indent based code folding
|
Is there a way for extensions to figure out which parts of code are folded? I think this is not possible right now and if that's the case, what do you think about exposing |
|
Martin Aeschlimann (@aeschli) atom editor uses the same indentation based folding but also includes the line after a fold-range with a For css: Some language extensions in vs code already have this pattern (php) but not all of them. Clearly this needs to be added to all language extensions but it doesn't seem to be easy. Do you think supporting C based languages with this approach is a good idea (just for now)? |
|
Amin Roosta (@aminroosta) There is currently no API in the extension host to find out about folded regions. But there is ongoing work for improving VIM support to enable cursor operations: see #9143 Supporting folding end patterns is a good suggestion. For now we have no work planned as other issues have higher priority. |
|
Amin Roosta (@aminroosta) we already have new APIs for cursor movement across visible lines, you can run to move across folded lines. |
|
Amin Roosta (@aminroosta) current implementation of VSCodeVim is not handling cursor moving correctly. We are changing cursor position ourselves, which breaks the cursor moving in folded code. There are several commands in Code for cursor moving, eg, Take below text as example, if you move cursor down twice, the result in Vim is while in VS Code with no extensions, the result will be This is mainly why we are calculating ourselves but not leveraging VS Code commands. If we keep using VS Code's commands, the result of cursor moving is not always correct. If we do it ourselves, we may need the information about folding area. Martin Aeschlimann (@aeschli) what do you think? |
|
Martin Aeschlimann (@aeschli) I just found another use case :-), implementing toggle-fold command. |
|
Peng Lyu (@rebornix) I am seeing following behavior in VS Code and it is similar to Vim behavior you mentioned in your example |
|
After discussing with Peng Lyu (@rebornix) fixing the issue #9619 will let Vim to completely use VS Code apis for cursor movements, thereby, fixing the folding issue automatically. |

No description provided.