Is it possible to get the full path of the current file within a live template in IntelliJ? I've tried using groovyScript("new File('.').absolutePath")
function, but that returns /Applications/IntelliJ IDEA.app/Contents/bin/.
and not the file path as I was hoping for.
Thanks!
According to the docs (emphasis mine):
The
_editor
is an instance ofEditorImpl
which holds a reference to theVirtualFile
that represents the currently opened file.Therefore, the following script gets the full path of currently opened file.
Or if you want to get the path relative to the project's root: