Parent directories (Snippet)

Greetings,

I need help writing a snippet

From here:
[[%d]] - the base directory of the current file

If file full path is …/modules/custom/modulename/src/Plugin/Block/MyBlock.php
How can i get the directory name “modulename”?

You cannot get that from a snippet tag, you want a very specific directory. However if you use projects and make modulename your project directory then you could use

%i	the active project base directory

It would help if we knew what your project base directory is. For this to be detected automatically there needs to be some type of constant.