Skip to content

Commit

Permalink
Miscellaneous refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
lushang committed Mar 30, 2020
1 parent 79b1a09 commit fc78179
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
5 changes: 3 additions & 2 deletions aura.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def is_visible(self):
class RetrieveLightningFromServer(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(RetrieveLightningFromServer, self).__init__(*args, **kwargs)
self.settings = context.get_settings()

def run(self, dirs):
message = "Are you sure you really want to continue refreshing"
Expand All @@ -157,6 +156,7 @@ def run(self, dirs):
)

def is_visible(self, dirs):
self.settings = context.get_settings()
self.types = {}
if len(dirs) == 0:
return False
Expand Down Expand Up @@ -196,7 +196,8 @@ def __init__(self, *args, **kwargs):
super(DestructLightningFromServer, self).__init__(*args, **kwargs)

def run(self, dirs):
if sublime.ok_cancel_dialog("Confirm to continue?"):
if sublime.ok_cancel_dialog("This will Delete the whole folder both from the server and local!" +
" Confirm to continue?"):
processor.handle_destructive_files(dirs, ignore_folder=False)

def is_visible(self, dirs):
Expand Down
3 changes: 2 additions & 1 deletion completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,8 @@ def on_query_completions(self, view, prefix, locations):
meta_type = None
else:
is_lightning = True if file_name.split(".")[-1] in ["app", "cmp", "evt", "html", "js"] else False
meta_type = util.get_meta_type(file_name)
attributes = util.get_file_attributes(file_name)
meta_type = attributes["metadata_folder"]

# Get tag definition of Visualforce page or Lightning aura component or Lightning Web component
tag_defs = []
Expand Down
10 changes: 6 additions & 4 deletions salesforce/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MetadataApi:
def __init__(self, settings, **kwargs):
self.settings = settings
self.api_version = settings["api_version"]
self.deploy_options = settings["deploy_options"]
self.soap = SOAP(settings)
self.session = None
self.result = None
Expand Down Expand Up @@ -550,14 +551,15 @@ def deploy(self, base64_zip, test_classes=[]):
start_time = datetime.datetime.now()

# Populate the soap_body with actual options
deploy_options = self.settings["deploy_options"]

# move the deploy options in to class attributes from better manipulate
# deploy_options = self.settings["deploy_options"]

# If just checkOnly, output VALIDATE, otherwise, output DEPLOY
deploy_or_validate = "validate" if deploy_options["checkOnly"] else "deploy"
deploy_or_validate = "validate" if self.deploy_options["checkOnly"] else "deploy"

# [sf:deploy]
Printer.get('log').write_start().write("[sf:%s] Start request for a deploy..." % deploy_or_validate)
options = deploy_options
options = self.deploy_options
options["zipfile"] = base64_zip

# If testLevel is Run Specified Test,
Expand Down
17 changes: 0 additions & 17 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3751,20 +3751,3 @@ def convert_csv_to_json(csvfile, xmlNodes):
os.remove(tempjson)

return rjson


def get_meta_type(file_name):
"""
Get Metadata type from file name
return: aura/lwc/classes/objects etc.
"""
paths = []
path, file_name = os.path.split(file_name)
while os.path.isdir(path):
path, crr_dir = os.path.split(path)
if crr_dir == 'src':
break
paths.append(crr_dir)

# return the sub-directory of src, that is the meta type
return paths[-1]

0 comments on commit fc78179

Please sign in to comment.