How to get the base directory in visual studio code snippet? : <p>I am trying to get the file current directory in a snippet for visual studio code.</p>

<p><a href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables" rel="noreferrer">VSCode has a variable</a>: <code>TM_DIRECTORY</code>, which is the <strong>fullpath</strong>.</p>

<p>eg:</p>

<pre><code>{folder: "$TM_DIRECTORY"}
</code></pre>

<p>would be replaced by</p>

<pre><code>{folder: "/Volumes/my-project-path/ParentFolder/MyFolder"}
</code></pre>

<p>But I want only <code>MyFolder</code>.</p>

<p>Normally, we can use a <a href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variable-transforms" rel="noreferrer">transform as indicated in the docs</a>. Sublime Text works in the same way. But for as much as I try, the snippet simply outputs the whole regex.</p>

<p>Could someone answer with the magical variable/transform? :)</p>
