appulate / vscode-file-watcher

Extension for Visual Studio Code allows configuring commands that get run whenever a file is saved or folder is changed in vscode.
MIT License
39 stars 22 forks source link

Placeholder token for a workspace-relative directory #3

Closed edmundo096 closed 2 years ago

edmundo096 commented 4 years ago

I'm trying to follow https://stackoverflow.com/a/58429096/2012945 but a placeholder token for a possible "workspaceRelativeDirectory" path is missing.

Hopefully it isn't too much different from what the extension have of the workspace info internally so this token can be easily added.

VovanNet commented 4 years ago

Could you add example of the path and workspaceRelativeDirectory value for it ?

igor-sirotin commented 4 years ago

+1 It would also be great to have other "relative" placeholder tokens, like fileRelativePath.

For example, if in CMD I want to copy the file to another path, I would like to save the relative path to that file. Currently, I can't.

edmundo096 commented 4 years ago

@VovanNet Sure.

What we mean for a fileDirRelativePath (or fileRelativePath as @igor-sirotin suggested) is the file's relative path to the workspaceRoot.

For example, having:

workspaceRoot:      d:\projects\foo-proj
file:               d:\projects\foo-proj\src\app\app.component.ts
fileBasename:       app.component.ts
fileBasenameNoExt:  app.component
fileExtname:        ts
fileDirname:        d:\projects\foo-proj\src\app

fileDirRelativePath could be:

fileDirRelativePath:   src\app

Also, off-topic and personal thoughts but I could suggest the following renames.

Those are based a bit from the IntelliJ IDEs variables https://stackoverflow.com/questions/44802832/phpstorm-template-variables-documentation

current           -> new
------------------------------------
workspaceRoot     -> workspacePath        // d:\projects\foo-proj
file              -> filePath             // d:\projects\foo-proj\src\app\app.component.ts
fileBasename      -> fileName             // app.component.ts
fileBasenameNoExt -> fileNameNoExt        // app.component
fileExtname       -> fileExt              // ts
fileDirname       -> fileDirPath          // d:\projects\foo-proj\src\app
                     fileDirRelativePath  // src\app
VovanNet commented 4 years ago

Ok, we will add these variables soon

listgarten100 commented 2 years ago

@edmundo096 @igor-sirotin Hello! We have added a "workspaceRelativeDir" relative placeholder. More details in the README.md. If you have any other wishes - write, be sure to take note. Thanks)