Skip to content

Commit

Permalink
add first letter lowercase check for lwc name
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Jul 14, 2019
1 parent 93dda0b commit b28cdff
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,25 @@ 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?'
if not sublime.ok_cancel_dialog(message):
return
self.window.show_input_panel("Please Input Your Component Name: ",
"", self.on_input, None, None)
return
return self.window.show_input_panel(
"Please Input Your Component Name: ",
"", self.on_input, None, None
)

# Get settings
settings = context.get_settings()
Expand Down

0 comments on commit b28cdff

Please sign in to comment.