Live data from Hacker News

A Missing IDE Feature

matklad.github.io

31–40 of 54 posts

Re: A Missing IDE Feature

#32
post #26

Has 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?

That specific part of code folding is pure preference. I would rather my editor not just fold things on GoTo Definition. GoTo Definition already takes me to what I need to see. I use code folding to minimize large chunks of something in the way. Not to unload my visual workspace on every jump. Folding on specific commands means I’d have to unfold sometimes, extra commands.

Re: A Missing IDE Feature

#33
post #27

What 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

What you appear to be missing is a "symbols view / pane". Most IDEs have that!

Even the Atari 2600's Basic Programming had that. (It's an entire IDE in 4K of ROM.)

Re: A Missing IDE Feature

#34
I love the JetBrains code folding, but I would hate it being on by default. Lots of arguments here about “you shouldn’t need this feature, just write better code”, which is fair, but unrealistic for massive projects you’re doing surgery on. It’s in those cases that I may use code folding to make a terrible file visually scannable again (only collapse bodies, as author mentions), then selective unfold bodies (potentially nested) as I need to see them. It’s not the most important feature TBH, but it’s nice that it’s there. I prefer it to the hierarchy tree because I don’t have to leave the editor part of the UI, and can use only keyboard shortcuts for selecting and folding code.

Re: A Missing IDE Feature

#35
I find my self disagreeing quite strongly, I would hate that default :/

I 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

#37
FWIW... LSE (Language Sensitive Editor) on OpenVMS (an operating system probably older than most readers) did this in the 1980s.

I 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

#38
VIM already basically does this and can be configured to do it automatically with folding as the default, while providing pretty fine grained manual control on folding.

Re: A Missing IDE Feature

#39

In 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…

> I’m assuming vscode has it also.

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

#40

Sounds like the author would like Eclipse Mylyn (if it's still maintained :/)

I used Mylyn's focus feature quite a lot back in the day. And I think Mylyn was revived, I just tried and it still works. However, it only hides projects/files/folders in views, I don't think it was ever hiding code within a file (or I remember incorrectly). It is pretty cool until it is not. And if it is not helping, you are constantly manually resurfacing hidden parts, which is annoying. This made me turn off the part that hides items not used recently and only turn it on when really working on some isolated parts in a huge set of projects. The other cool thing about it is that it is coupled with issue management (which you could sync with your issue tracker) and you could store the "focus" (which items are currently visible) in the context of an issue. So if you switched working on issues, it would only show the items relevant to the issue again.

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.

Post reply on HN