3 ms·
Microsoft 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
by mark-r 7y ago
Microsoft 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)