Skip to content

Commit

Permalink
automatically update first letter to lowcase for lwc name
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Jul 14, 2019
1 parent b28cdff commit 5ae5371
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions lwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ def run(self):
"", self.on_input, None, None)

def on_input(self, lwc_name):
if not lwc_name or lwc_name[0].isupper():
message = "The folder name must start with a lowercase character, "+\
"do you want to try again?"
if not sublime.ok_cancel_dialog(message):
return
return self.window.show_input_panel(
"Please Input Your Component Name: ",
"", self.on_input, None, None
)

# Create component to local according to user input
if not re.match('^[a-zA-Z]+\\w+$', lwc_name):
message = 'Invalid format, do you want to try again?'
Expand All @@ -37,6 +27,9 @@ def on_input(self, lwc_name):
"", self.on_input, None, None
)

# Update first letter to lower case
lwc_name = lwc_name[0].lower() + lwc_name[1:]

# Get settings
settings = context.get_settings()
workspace = settings["workspace"]
Expand Down

0 comments on commit 5ae5371

Please sign in to comment.