-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CommandFold should be available in Normal mode #493
Conversation
@@ -1094,12 +1094,12 @@ class CommandDot extends BaseCommand { | |||
|
|||
@RegisterAction | |||
class CommandFold extends BaseCommand { | |||
modes = [ModeName.Visual, ModeName.VisualLine]; | |||
modes = [ModeName.Normal]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose zc
also works in Visual/Visual Line mode, so we just need to add Normal mode to the list.
BTW, per Vim's document, |
But why did you remove Visual and VisualLine from the list? |
@johnfn You are right it seems vim also supports @rebornix I think the current behavior of I'm also interested in implementing @rebornix i think this is another use case for having Apis for folded regions. related vscode discussion. |
Awesome, LGTM. re: |
@aminroosta I'll take a deep look into Vim folding doc and see what kind of API it requires then I'd like to create a separate issue for it. |
@rebornix Do you think if it's a bad idea to figure out folded origins by using #486 @sandy081 @rebornix |
@aminroosta Sandeep's solution is reasonable as we are always trying to avoid exposing View Model to users. The reason that we want to know if it's a folded area in the case of It's an open question. If there are more commands relying Fold Area information, I think providing this info directly will make everything simpler. |
@aminroosta lastly, I like the idea of moving up then down to detect whether it's inside a folded area. As this operation is real fast and it follows a heavy Fold/UnFold command, I think it's a good workaround. People wont' notice that you did the cursor movement back and forth. |
@rebornix I think having information on folding areas gives vim extension writers more power and control on how to move the cursor. I can assure you that there will be other cases where this will bee needed 😉
When do you think #486 will be ready, i will add support for |
I think in this case vscode should expose this information, to me it's one of the basic informations you should be able to ask the TextEditor, just like cursor postion or selection stop and end. |
@rebornix For example this workaround will not work for the above case. But it's better than nothing :) |
@rebornix @sandy081 Here is another example where folding area information is needed:
|
I see, folding info is a must in this case. Since we already held on feature implementation for July Iteration, I'll create a separate issue to track this and see if we can make it in August. Thanks again for your input, they help a lot for both Vim and Code! |
This PR changes CommandFold to be used in Normal mode, just like all other fold commands.
Note that i am explicitly setting
vimState.currentMode = ModeName.Normal
, the reason is that vscode sometimes changes to Visual mode when folding the block:Fore example this works fine.
But when the cursor is on the beginning line it goes to Visual mode!