Skip to content

Commit

Permalink
Merge pull request #203 from lushang/master v3.5.8
Browse files Browse the repository at this point in the history
Release 3.5.8
  • Loading branch information
lushang authored Mar 27, 2020
2 parents ed412e4 + 8015298 commit d7dcd87
Show file tree
Hide file tree
Showing 10 changed files with 2,706 additions and 2,536 deletions.
4,516 changes: 2,263 additions & 2,253 deletions HISTORY.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions config/menus/Context.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@

{"caption": "View Code Coverage","command": "view_code_coverage"},
{"caption": "View Debug Log Detail","command": "view_debug_log_detail"},
{"caption": "View Apex Code Coverage","command": "view_code_coverage_after_sync_test"},
{"caption": "View Debug Only","command": "view_debug_only"},
{"caption": "View Id in Salesforce Web","command": "view_id_in_sfdc_web"},
{"caption": "View in Salesforce Web","command": "show_in_sfdc_web"},
Expand Down
8 changes: 8 additions & 0 deletions config/messages/3.5.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Build 3.5.8
-----------
Release Date: 28 Mar 2020

* Refined Code coverage functionality:
- View code coverage for certain Apex class/trigger file via context menu
- View code coverage from (async) Test Result via context menu
* Miscellaneous bug fix and update
2 changes: 1 addition & 1 deletion config/settings/package.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haoide",
"version": "3.5.6",
"version": "3.5.8",
"description": "haoide is a Sublime Text 3 plugin for Salesforce and used for swift development on Force.com",
"author": "Hao Liu",
"email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion config/settings/toolingapi.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"maximum_concurrent_connections": 30,

// API version
"api_version" : 35,
"api_version" : 46,

// Browser Path Setting,
// You should set a valid browser path, otherwise, it will have problem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* Object: $2
* Purpose: $3
* Author: $4 ($5)
* Create Date: 2019-${6:07-15}
* Create Date: 2020-${6:03-27}
* Modify History:
* 2019-${6:07-15} $4 ${7:Create this class}
* 2020-${6:03-27} $4 ${7:Create this class}
**************************************************************************************************/
]]></content>
<tabTrigger>ch</tabTrigger>
Expand Down
73 changes: 65 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def run(self, edit, mark):

class ViewCodeCoverageCommand(sublime_plugin.TextCommand):
def run(self, edit):
util.view_coverage(self.attributes["name"], self.file_name, self.body)
processor.handle_fetch_code_coverage(self.attributes["name"], self.body)

def is_enabled(self):
# Must Be File
Expand Down Expand Up @@ -740,8 +740,7 @@ def is_enabled(self):
return True

def is_visible(self):
# return self.is_enabled()
return False
return self.is_enabled()


class ViewSelectedCodeCoverageCommand(sublime_plugin.TextCommand):
Expand Down Expand Up @@ -973,15 +972,19 @@ def is_visible(self, files):

return True


class CancelDeployment(sublime_plugin.TextCommand):
def run(self, edit):
processor.handle_cancel_deployment_thread(self.sel_text)

def is_enabled(self):
sel = self.view.sel()[0]
self.sel_text = self.view.substr(self.view.word(sel.begin()))
if len(self.view.sel()) == 0:
return False
region = self.view.sel()[0]
self.sel_text = self.view.substr(self.view.word(region.begin()))
return self.sel_text.startswith("0Af")


class DestructFileFromServer(sublime_plugin.TextCommand):
def run(self, edit):
files = [self.view.file_name()]
Expand Down Expand Up @@ -1693,7 +1696,11 @@ def is_enabled(self):
def is_visible(self):
return self.is_enabled()


class RunAsyncTest(sublime_plugin.WindowCommand):
"""
@deprecated
"""
def __init__(self, *args, **kwargs):
super(RunAsyncTest, self).__init__(*args, **kwargs)

Expand All @@ -1718,7 +1725,11 @@ def is_enabled(self, files):
def is_visible(self):
return self.is_enabled()


class RunTestCommand(sublime_plugin.TextCommand):
"""
Run Async Test
"""
def run(self, view):
# Get component_attribute by file_name
attributes = util.get_file_attributes(self.view.file_name())
Expand Down Expand Up @@ -1800,21 +1811,67 @@ def on_done(self, index):
user_id = self.users[user_name]
processor.handle_fetch_debug_logs(user_name, user_id)


class ViewDebugLogDetail(sublime_plugin.TextCommand):
def run(self, view):
processor.handle_view_debug_log_detail(self.log_id)

def is_enabled(self):
# Choose the valid Id, you will see this command
sel = self.view.sel()[0]
self.log_id = self.view.substr(self.view.word(sel.begin()))
# make sure selection has region in it
if len(self.view.sel()) == 0:
return False
region = self.view.sel()[0]
self.log_id = self.view.substr(self.view.word(region.begin()))

if len(self.log_id) != 15 and len(self.log_id) != 18: return False
if not re.compile(r'^[a-zA-Z0-9]*$').match(self.log_id): return False
if not self.log_id.startswith("07L"): return False

return True


class ViewCodeCoverageAfterSyncTest(sublime_plugin.TextCommand):
def run(self, edit):
# get code coverage cache
settings = context.get_settings()
work_dir = os.path.join(settings["workspace"])
cache_file = os.path.join(work_dir, ".config", "coverage.json")
if not os.path.isfile(cache_file):
return
coverages = json.loads(open(cache_file).read())
record = coverages.get(self.file_name)

# get file content, may be apex class or trigger
class_path = os.path.join(work_dir, 'src',
'classes', self.file_name+'.cls')
trigger_path = os.path.join(work_dir, 'src',
'triggers', self.file_name + '.trigger')
_path = class_path if os.path.isfile(class_path) else trigger_path
with open(_path, encoding="utf-8") as fp:
file_content = fp.read()
if record and record.get("Coverage"):
util.view_coverage(self.file_name, record, file_content)

def is_enabled(self):
if len(self.view.sel()) == 0 or self.view.name() != 'Test Result':
return False
region = self.view.sel()[0]

# Make sure only enable for classes or triggers
start_reg = self.view.find('Trigger Or Class Code Coverage:', 0)
start_r, _ = self.view.rowcol(start_reg.begin())
r, _ = self.view.rowcol(region.begin())
if r - start_r < 4:
return False
self.file_name = self.view.substr(self.view.word(region.begin()))
if not re.compile(r'^[\w]+$').match(self.file_name):
return False
return self.file_name and self.file_name[0].isalpha()

def is_visible(self):
return self.view.name() == 'Test Result'

class ViewDebugOnly(sublime_plugin.TextCommand):
def run(self, view):
whole_region = sublime.Region(0, self.view.size())
Expand Down Expand Up @@ -1935,7 +1992,7 @@ class AboutCommand(sublime_plugin.ApplicationCommand):
def run(command):
package_info = sublime.load_settings("package.sublime-settings")

version_info = "\n%s\n\n%s\n\nCopyright © 2013-2016 By %s\n\tDev Channel, Build v%s" % (
version_info = "\n%s\n\n%s\n\nCopyright © 2013-2019 By %s\n\tDev Channel, Build v%s" % (
package_info.get("description"),
package_info.get("homepage"),
package_info.get("author"),
Expand Down
9 changes: 5 additions & 4 deletions messages.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"3.5.5": "config/messages/3.5.5.md",
"3.5.6": "config/messages/3.5.6.md",
"install": "config/messages/install.txt"
{
"3.5.6": "config/messages/3.5.6.md",
"3.5.7": "config/messages/3.5.7.md",
"3.5.8": "config/messages/3.5.8.md",
"install": "config/messages/install.txt"
}
Loading

0 comments on commit d7dcd87

Please sign in to comment.