@@ -53,6 +53,7 @@ const askForComponentName = async () => {
5353 let name = await window . showInputBox ( {
5454 prompt : "Choose a name for the new component" ,
5555 ignoreFocusOut : true ,
56+
5657 placeHolder : "New component name..." ,
5758 } ) ;
5859
@@ -150,10 +151,8 @@ const removeUnusedImports = async () => {
150151 const { document } = editor ;
151152 const code = document . getText ( ) ;
152153 const codeLines = _ . split ( code , "\n" ) ;
153- const {
154- firstImportLineIndex,
155- lastImportLineIndex,
156- } = getFirstAndLastImportLineIndexes ( codeLines ) ;
154+ const { firstImportLineIndex, lastImportLineIndex } =
155+ getFirstAndLastImportLineIndexes ( codeLines ) ;
157156
158157 const importsString = _ . chain ( codeLines )
159158 . slice ( firstImportLineIndex , lastImportLineIndex + 1 )
@@ -186,9 +185,8 @@ const updateOriginalComponent = async ({ newComponent }) => {
186185
187186const generateReactElement = ( { name, props, jsx } ) => {
188187 const numberOfProps = _ . size ( props ) ;
189- const numberOfLeadingSpacesFromStart = parseUtils . getNumberOfLeadingSpaces (
190- jsx
191- ) ;
188+ const numberOfLeadingSpacesFromStart =
189+ parseUtils . getNumberOfLeadingSpaces ( jsx ) ;
192190 const leadingSpacesFromStart = _ . repeat ( " " , numberOfLeadingSpacesFromStart ) ;
193191 let propsString = "" ;
194192
@@ -220,11 +218,13 @@ const extractRelevantImportsAndPropsAndStylesheet = () => {
220218 ` ;
221219 const props = parseUtils . getUndefinedVars ( selectionAndImports ) ;
222220 const imports = parseUtils . getUsedImports ( selectionAndImports ) ;
223- const stylesheet = regexNormalizeResult ( parseUtils . getStylesheet ( code , selection ) ) ;
221+ const stylesheet = regexNormalizeResult (
222+ parseUtils . getStylesheet ( code , selection )
223+ ) ;
224224 return {
225225 props,
226226 imports,
227- stylesheet
227+ stylesheet,
228228 } ;
229229} ;
230230
@@ -259,18 +259,20 @@ const createNewComponent = async (componentName: any) => {
259259 const uri = editor . document . uri ;
260260 const fileExtension = parseUtils . getUriExtension ( uri . fsPath ) ;
261261 const selection = editor . document . getText ( editor . selection ) ;
262- const { imports, props, stylesheet } = extractRelevantImportsAndPropsAndStylesheet ( ) ;
262+ const { imports, props, stylesheet } =
263+ extractRelevantImportsAndPropsAndStylesheet ( ) ;
263264
264265 const newComponent = {
265266 code : parseUtils . pretify (
266267 `${ buildImportsString ( imports ) } \n\n` +
267- `const ${ componentName } = (${ buildPropsString ( props ) } ) => (\n` +
268- `${ shouldWrapCodeWithEmptyTag ( selection )
269- ? `<View>\n${ selection } \n</View>`
270- : selection
271- } \n` +
272- `);\n\n` +
273- `export default ${ componentName } ;\n\n${ stylesheet } \n`
268+ `const ${ componentName } = (${ buildPropsString ( props ) } ) => (\n` +
269+ `${
270+ shouldWrapCodeWithEmptyTag ( selection )
271+ ? `<View>\n${ selection } \n</View>`
272+ : selection
273+ } \n` +
274+ `);\n\n` +
275+ `export default ${ componentName } ;\n\n${ stylesheet } \n`
274276 ) ,
275277 reactElement : generateReactElement ( {
276278 name : componentName ,
0 commit comments