I'm trying to improve the log I sometimes write to check what variable I have at a certain point or what value a function return, and in certain case find a problematic line (when I don't use a debugger).
So I made the following live template (taking JS example):
console.log("Line $LINE$ in $FILE$");
$END$
$LINE$:
lineNumber()
$FILE$:
fileName()
So the output look like this: console.log("Line 17 in thisFile.js")
However I would like to print the whole line of code (the previous or the next one). Since I have the line number; I would basically want to duplicate the previous/next line and surround it with quote/parenthesis and my log function.
What I would like
// a bloc of code
function aFunction(something){
doSomething(something); // I want to log the value of something after after the doSomething function
console.log("Line X: doSomething(something);");
...
}
The only questions I found which could be related to this is this one but I don't want to just log variable, but a whole line of code and I didn't find the script equivalent of duplicating a line (which is a possibility in JetBrains IDE)