Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Can I have multiple variables? #19

Open
sagark1510 opened this issue Jul 31, 2017 · 3 comments
Open

Can I have multiple variables? #19

sagark1510 opened this issue Jul 31, 2017 · 3 comments

Comments

@sagark1510
Copy link

Hi extension works fine. I want to add more that one variables can it be possible right now if something like this it only asks for one variable.

   import React, {Component} from 'react';
   import {View, Text} from 'react-native';
   
   class #{component_name} extends Component {
       render() {
           return (
               <View>
                   <Text>#{label_name}</Text>
               </View>
           );
       }
   }

   export default #{component_name};
@avionbg
Copy link

avionbg commented Aug 24, 2017

I think this is a vscode bug, extension itself has support for multiple placeholders but the vscode.window.showInputBox command doesn't play nice when in Promise chain (only the first input is shown for some reason).
The only way I've managed to get around that is by having input accept all the variables at once (enter the substitution words separated by space)
Here is a gist that fixes multiple variables (fileFromTemplateCommand.js) https://gist.github.com/avionbg/b268b764ddae16a1dcb7aaf352059989

@brunetton
Copy link

Thanks for this gist.
Wouldn't it be possible to ask variables one by one ?

  • when there's many variables, this is hard to visually match "what variable am I filling ? Where am I in the list ?"
  • how to enter variables values with spaces ?

@avionbg
Copy link

avionbg commented Feb 26, 2018

For some reason when I was playing with it that didn't work as expected. If you would have multiple variables, they would be chained with promises, and that didn't work.. only the first input was shown.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants