Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Prefill test method names with selection #848

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mavensmate.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,13 @@ def is_enabled(command):
#runs apex unit tests using the async api
class RunAsyncApexTestMethodCommand(sublime_plugin.TextCommand):
def run(self, edit):
sublime.active_window().show_input_panel("Comma Delimited Test Method Names", "MyTestMethodName", self.finish, None, None)
commaDelimitedTestMethods = "MyTestMethodName"
selectedTests = util.get_selected_texts();

if len(selectedTests) != 0:
commaDelimitedTestMethods = ','.join(selectedTests)

sublime.active_window().show_input_panel("Comma Delimited Test Method Names", commaDelimitedTestMethods, self.finish, None, None)

def finish(self, test_method_names):
active_file = util.get_active_file()
Expand Down
11 changes: 11 additions & 0 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,14 @@ def get_version_number():
return version
except:
return ''

def get_selected_texts():
selected = []
active_view = sublime.active_window().active_view()

for region in active_view.sel():
text = active_view.substr(region)
if text != '':
selected.append( text )

return selected