Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think JetBrains actually does something like this. When writing Rust or Kotlin or C++ (these are the ones I have used) the editor will annotate the inferred types with the actual type and you can see it in the editor (with a slightly different font to differentiate).


VS Code also supports inlay hints for both inferred types, and parameter names https://code.visualstudio.com/docs/typescript/typescript-edi...

I think it's turned off by default for most languages though - probably considered unnecessary, as you can always just hover over the variable. Also, unlike the JetBrains IDEs, I don't think you can Ctrl+Click on such a hint to navigate to its definition in VS Code (like you can in normal code).


You can if the LSP enables it, I believe. In rust-analyzer, it's definitely possible to do this, for example, but I think that was a new feature added somewhere in the last few releases.


Regular Visual Studio has this now too, at least for C++.


Yeah, it is definitely nice to have inferred types surfaced to you, but in these systems they are still re-computed on every textual edit, as opposed to being "sticky" (persisted in the source tree).


Lots of IDEs do that for lots of languages these days, and it's wonderful, but I don't think that's the kind of thing they're talking about here in the article


Yeah they're talking about recording the type inferences in the source code. Interesting idea but I feel like it might fall down the same way all "not just text" ideas fall down - the whole coding world is built around plain text. Git, diff, GitHub, IDEs, etc.

Some inferred types in Rust can be pages long. Have fun with those merge conflicts!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: