3 ms·
Nice, it actually render the definition inline without placing it in a floating window which is the normal way this feature is implemented: https://docs.microso
by olejorgenb 7y ago
Nice, 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