![]() Manually collapsing every code blocks is a tedious task. OP and the people coming to this question are looking for shortcuts to do what you described. There are some things I still use key combinations for, but getting used to Cmd + P and Cmd + Shift + P is by far the best that ever happened to my VSCode workflow. Ĭmd + shift + p (then search for "fold" to find it or even select it) Most others, including the accepted answer, fail to resolve the ambiguity between the shortcuts and. This answer is both concise and also completely correct/clear. You can simply hold control while you press and release k and then press and release 1 to activate the shortcut. However, your statement that you need to release and re-press control in between the k and the 1 to activate the latter shortcut is wrong. :).Ģ years, 2 months Your statement that and are two different shortcuts is correct and usefully points out that this answer isn't as clear as it should be. Otherwise, you may find that the contents of each method are collapsed at the block level, requiring unfolding each block.īest answer for me too. THEN do one of the mentioned commands, to expand just the level(s) you want. If its already fully collapsed, first do Ctrl+ K, Ctrl+ J to "expand all". Use Ctrl + K + / to old all comments multiple lines. ![]() You can also press F1 whilst editing, and in the search bar, type fold or unfold and you will see clickable options to do everything below and more, it also shows the keyboard shortcuts. This should be the accepted answer as "fold all" is cleary not the same as "collapse all methods and properties", this anwers the question perfectly Thx, Ctrl+ K, Ctrl+ 2 do the job in May, 2020 and press&hold it again before each of the K and 1 keys! again is important here and makes the difference! See some answer below.Ĭorrect and precise answer for the current version 1.42.1, because it helps to understand, that you have to release Ctrl. then press K, release Ctrl, press&hold it again, and then press one of the other keys like O, 1, 2 and so on! Pressing Ctrl.+K, releasing everything and then pressing S for example does "Save all". Anyway - the posted picture still seems to be correct, because you have to Press&Hold Ctrl. ![]() Unfortunately this does not apply to current versions like 1.41+ (or even lower versions). " He's saying the suggestion will do (accomplish) close to (similar to) what the OP wants (the thing he wants to do). This is the best approach to be used for visual studio folding.ģ years, 3 months - In English, this construct basically resolves to " will what you want. This is the only answer that helped me change the keybind quickly. What do you mean by "will do close to what you want." (it seems incomprehensible)?ģ years, 6 months I disagree. This does not bring value as this is already discussed in other upvoted answers.įor those confused like I was, that's a ZERO, not an o. Good question however can you mark an answer? I think they deserve the credit.Ĥ years You can use Ctrl + Shift + to unfoldītw, for those of us on OSX, use cmd in place of ctrl See this link /questions/30067767/… 4 years, 3 months In a typescript file, Ctrl + K, 2 does exactly that for me. It's the best low-effort solution available that I've found. I don't know if getting fine grained on which types to open/close is feasible, but the answer above ( /a/43710782/4544328 ) will show you how to close all, and then you could use the command to open an individual block as needed while editing code. When I hover an interface I can see it's definition so I don't need them open and taking up real estate.Ĥ years, 8 months No problem. For example typescript interfaces at the top of files are annoying as hell. I wish there was a way to auto fold all blocks or specific types of code when you open the files. ![]() Not sure what folding does.Ĥ years, 8 months Thanks! That makes more sense. ![]() the indentation foldingStrategy seems to be the default, as I haven't changed that myself, so you didn't notice anything. This doesn't seems to accomplish closing or opening "all" blocks.Ĥ years, 8 months I think the first line just shows all those icons instead of only showing them when you hover over the thin space near line numbers. I notice more - symbol buttons, but that's it. I've tried messing with this several times. Thanks with Cmd+k Cmd+S to open the short key setting. Often it relates to Objects, if/else statements too - and suddenly all that is being collapsed too.Īdded a 'fold level' shortcut. When you have TypeScript, the symbols don't just signify functions/methods. Is there a way to make this work more intelligently. Where as in VS professional it just collapses methods. This one collapses everything, including the class itself, methods,if-else conditions and loops inside the methods. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |