I am trying to create a snippet for a redux container file that takes an import of some react file of the same base name. TM_FILENAME_BASE works great for removing the .js from the file name but in this case, my component file's extension is fun-thing.component.js and the container will follow suit with an extension that is fun-thing.container.js.
The Regex I am using to select everything before the first period is ^([^.]+)
"Redux Container": {
"prefix": "rc",
"body": [
"// @flow",
"import { connect } from 'react-redux';",
"import { ${TM_FILENAME/^([^.]+)/${1:/pascalcase}/}Component } from './${TM_FILENAME/^([^.]+)/$1/}.component';",
"",
"const mapStateToProps = (state) => ({});",
"",
"const mapDispatchToProps = {};",
"",
"export const ${TM_FILENAME/^([^.]+)/${1:/pascalcase}/} = connect(",
" mapStateToProps,",
" mapDispatchToProps",
")(${TM_FILENAME/^([^.]+)/${1:/pascalcase}/}Component);"
],
"description": "Creates a normal container for a normal component"
}
expected
// @flow
import { connect } from 'react-redux';
import { FunThingComponent } from './fun-thing.component';
...
actual
// @flow
import { connect } from 'react-redux';
import { FunThing.container.jsComponent } from './FunThing.container.js.component';
...
As you can see, it is not omitting the file extensions.