Live data from Hacker News

A Missing IDE Feature

matklad.github.io

41–50 of 54 posts

Re: A Missing IDE Feature

#41
Depending on your language you might be able to have it both ways - summary at the top, and implementation details down below. And it's just in the text itself, so it's as readable in Github as it is in an IDE.

  -- Top of file:

  data Indexer =
    Indexer { indexDocuments     :: !(CollectionName -> [Doc]    -> IO (Either String Int))
            , indexLocalWarcFile :: !(CollectionName -> FilePath -> IO (Either String ()))
            , deleteDocument     :: !(CollectionName -> String   -> IO (Either String ()))
            , isDocDeleted       :: !(CollectionName -> String   -> IO (Either String (Map Text Int)))
            }

  -- Further down:

  indexDocumentsImpl env writer metadataApi compactor registry collectionName unsortedDocs = do
    let ds = sort unsortedDocs
    let nDocs = length ds
  ...

  newLocalWarcFileIndex env warcFileReader writer metadataApi compactor registry collectionName warcFile =
    batchedRead warcFileReader
                warcFile
                newIndexify
    where
    newIndexify :: Vector WarcEntry -> IO ()
    newIndexify ds = do
  ...

  etc.

Re: A Missing IDE Feature

#42
post #26

Earlier quoted context omitted.

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.

It being preference (recommended default: off) was also covered in the article :/

Re: A Missing IDE Feature

#44
post #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)

Weird. OK well you can absolutely do this in vim should you ever want to ':help foldlevel' and ':help foldexpr' will tell you how. Also 'conceallevel', although whoever came up with that I hope they suffer endless torment. I really hate that feature with a passion.

Re: A Missing IDE Feature

#47
It is unclear what is the condition of automatic folding of the second level and below.

If you are using "Go to..." a struct declaration or impl in Rust (or a class in other languages) it actually makes a lot of sense. If I'm going to a struct/impl/class I don't know yet which method do I won't to see. If you are just opening a file that you haven't open before though... I'm not so sure.

Re: A Missing IDE Feature

#48
I think that people who suggest to "just write cleaner code" are missing the point entirely.

Of course, we all are trying to write clear code. It doesn't mean that your tool should make working with less than perfect codebases unbearable.

Re: A Missing IDE Feature

#49
post #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)

And the folding will hide parameters if they flow to a second line, ime.

Whether this is on by default or not is not the issue. It's just getting "smart" folding in vscode that would be the feature win.

Re: A Missing IDE Feature

#50
Hard disagree but it'd be fine to have it as an option, of course. The author mentioned an outline -- if we could have that as a separate page, easily toggled with a key combination, that'd be sweet.

Code folding by default triggers thoughts of the annoying, mostly useless TypeScript d files that VSCode dumps you in to when you ctrl/cmd click into a function. The only reason I do that is to see implementation details so I can figure out why something's not working. If third-party library d files were replaced by pre-folded source, I guess that'd be OK.

Post reply on HN