3 ms·
I would like an IDE that can virtually inline code. That way we can write code like your top example and avoid jumping around like the second example. There co
by keanebean86 7y ago
I would like an IDE that can virtually inline code. That way we can write code like your top example and avoid jumping around like the second example.
There could be a + to the left and maybe a red box around the fake inline-ing.
- hinkley 7y agoI’ve wanted this too. Probably for most of my career. Particularly for code in other files. Although I’ve also found that memorizing the advanced navigation features of the IDE is a pretty good way to get around without upsetting your working memory.
- mark-r 7y agoMicrosoft Visual Studio has this. You can right-click on a function name and select "Peek Definition", and it will open an inline window with the code for that function.
- olejorgenb 7y agoNice, it actually render the definition inline without placing it in a floating window which is the normal way this feature is implemented: https://docs.microsoft.com/en-us/visualstudio/ide/media/peekwindow.png?view=vs-2019 https://docs.microsoft.com/en-us/visualstudio/ide/media/peek... In gnome-shell-mode [1] we can evaluate arbitrary expression and paste the content (virtually) into the buffer. Since javascript functions evaluate to their source it makes for a poor-mans peek-definition: https://imgur.com/a/7Ot7KFy https://imgur.com/a/7Ot7KFy It would maybe (sometimes) be nice to even intelligently "macro expanded" the call: function helper(a, b) { let c = a + b return a + c } function p(y) { let x = helper(1+y, 2) } --> function p(y) { // inlined x = helper(1+y, 2) let x { let c = (1+y) + 2 x = (1+y) + c } } Not the best example, but you get the idea. Expansion can be tricky when the arguments are non-trivial expression. Could fall back to assignment to a variable named after the corresponding parameter. [1]: https://github.com/paperwm/gnome-shell-mode https://github.com/paperwm/gnome-shell-mode
- stjohnswarts 7y agoVS Code has this in some of the more developed language plugins and so does eclipse (at least it does for the c++ and python plugins)