I am trying to create a VS code snippet that scaffolds the namespace based on the current folder in a project.
The current path provied by the TM_DIRECTORY variable could be something like this.
/Users/bernhardrichter/GitHub/heatkeeper2000/src/HeatKeeper.Server/Mapping
What I would like to end up with is namespace HeatKeeper.Server.Mapping based upon my root source folder being src
So I need to strip away everything before and including src so that we are left with HeatKeeper.Server/Mapping. And then I need to replace(transform) the / into . so that the final result is HeatKeeper.Server.Mapping.
Is it possible to do this in a single transform? If not is it possible to have multiple transforms?
This is what I have so far
"namespace ${TM_DIRECTORY/(.*src.)(.*).*$/$2/}"
This outputs namespace HeatKeeper.Server/Mapping which is almost what I want. I just need to replace all / with .
The problem is that I don't know where to put this transform.
The transform looks like this.
"${TM_DIRECTORY/[\\/]/./g}"
which gives me
.Users.bernhardrichter.GitHub.heatkeeper2000.src.HeatKeeper.Server.Mapping
I just don't know how to combine these two?