def run(self, edit): content = get_text(self.view) clear(self.view) self.view.run_command('insert_snippet', {'contents': TPL}) self.view.settings().set('syntax', 'Packages/XML/XML.tmLanguage') # Insert existing contents into CDATA section. We rely on the fact # that Sublime will place the first selection in the first field of # the newly inserted snippet. self.view.insert(edit, self.view.sel()[0].begin(), content)
def run(self, edit): content = get_text(self.view) clear(self.view) self.view.run_command('insert_snippet', {'contents': TPL}) self.view.set_syntax_file(XML_SYNTAX) # Insert existing contents into CDATA section. We rely on the fact # that Sublime will place the first selection in the first field of # the newly inserted snippet. self.view.insert(edit, self.view.sel()[0].begin(), content)