How do I convert my file name company-controller.js
To this:
class CompanyController extends BaseController {
constructor() {
super(Company);
}
}
You have to transform the variable TM_FILENAME_BASE
"ctrl": {
"scope": "javascript",
"prefix": "base",
"body": [
"class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/} extends BaseController {",
"\tconstructor() {",
"\t\tsuper(${TM_FILENAME_BASE/(.*)-\\w+/${1:/pascalcase}/});",
"\t}",
"}"
],
"description": "Extend BaseController"
}
pascalcase to $1:/capitalize} to avoid confusion. While pascalcase does work here, it is really meant to deal with multiple words with separators between them, which isn't the case in the super line. I just think a new user might be confused why pascalcase is necessary in the second usage.company-wood-controller.js"\t\tsuper(${TM_FILENAME_BASE/(.*?)-|.*$/${1:/capitalize}/g});" will also work to strip off whatever is the last part of the filename and capitalize the other parts.