This is such a nice feature in PhpStorm. I hope VSCode and other editors will add support for it too.
A Missing IDE Feature
31–40 of 54 posts
Re: A Missing IDE Feature
#32Has existed in Sublime Text for a very long time, no plugin required.
ST has code folding, but I don't think it has special automatic code folding when using Goto Definition?
Re: A Missing IDE Feature
#33What you appear to be missing is a "symbols view / pane". Most IDEs have that! https://www.google.com/search?q=ide+symbols+pane&tbm=isch
Even the Atari 2600's Basic Programming had that. (It's an entire IDE in 4K of ROM.)
Re: A Missing IDE Feature
#34Re: A Missing IDE Feature
#35I find all kind of code folding massively throws off my spatial sense of the code. And if I'm browsing random code, then I often need to see the body too, to see if this is the place the work is done, or is it behind some abstraction down the line.
Perhaps I don't need it as much on c++ codebases, as the headers in a sense are that already. And Rust codebases I've dabbled in haven't been quite that big or overwhelming.
The outlineview/(the popup on top of buffer in many editors that lists the outline) is enough to finding my place in a file I feel lost. And if just looking how to use a lib, there is often some API documentation that helps along finding the right things (even if just barebones doxygen or rustdoc).
I'm sure this is as much of a habit thing as other editor preferences. Still I find it surprising how many people like code-folding :)
Re: A Missing IDE Feature
#36Re: A Missing IDE Feature
#37I think what this article is getting at but doesn't quiet explicitly say is people look at code for different reasons. If you're fixing a defect and you think you know where the problem lies, you may want everything to come up folded so you can get to the function you think you want to look at quickly. If you're trying to get a handle on what the code in the file does, you may want everything to come up unfolded. Or maybe you want to unfold all functions that take a particular data structure as a parameter.
The global settings at my installation for the LSE (Language Sensitive Editor) I mentioned earlier were set to fold all .c files. I initially found it annoying, but quickly learned the "unfold everything" key sequence. And then the "unfold this function once" which didn't unfold the contents of loops or ifs and the "unfold everything in this function." I was able to quickly get used to it and spent a year replicating the functionality in emacs.
But... I completely agree with people saying this should be a configurable setting.
And... if you implement this, please allow selective unfolding of different parts of the code.
Re: A Missing IDE Feature
#38Re: A Missing IDE Feature
#39In what sense is this missing? You can absolutely do this in vim so it must (by the principle of duality) also be present in emacs. Since he shows it in IntelliJ it’s obviously not missing from there so I’m assuming vscode has it also. Automatic folding is something I almost always disable because I hate it when an editor tries to hide information from me. I strongly prefer to choose when I want things folded but by…
Sadly I believe this assumption is incorrect. VSCode supports folding, but not specifically method bodies (to my knowledge), and not by default (with or without a settings flag)
Re: A Missing IDE Feature
#40Sounds like the author would like Eclipse Mylyn (if it's still maintained :/)
BTW: In Eclipse JDT you can configure what kind of Java elements should be folded by default. The default config is that leading comments and imports are folded. Would be nice to be able to configure something like that via LSP.