-
Notifications
You must be signed in to change notification settings - Fork 33k
Add indent based code folding #2971
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
Conversation
@alexandrudima Alex, FYI |
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 |
@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)? |
@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. |
@aminroosta we already have new APIs for cursor movement across visible lines, you can run
to move across folded lines. |
@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. @aeschli what do you think? |
@aeschli I just found another use case :-), implementing toggle-fold command. |
@rebornix I am seeing following behavior in VS Code and it is similar to Vim behavior you mentioned in your example |
No description provided.