mix86 / SublimeJira

Sublime Text 3 plugin for integration with Atlassian Jira
30 stars 16 forks source link

Update command from selected text #20

Open nexeh opened 8 years ago

nexeh commented 8 years ago

When the update command runs it selects the entire document and sends it to Jira. It would be a useful feature to also be able to make a selection in a document and have it update with just the selection. Consider the scenario of have multiple jira issues in a single document.

I just tried my theory out and it works. Maybe it could be a new command on the pallet if you want to leave the existing code

class UpdateJiraIssueCommand(sublime_plugin.TextCommand):
  def run(self, edit):

    # If the user has something selected then lets use that 
    if (len(self.view.substr(self.view.sel()[0])) == 0):
      self.view.run_command('select_all')

    text = self.view.substr(self.view.sel()[0])
    print ("text:", text)
    UpdateIssueApiCall(text, callback=self.put_result).start()