How do I get the current source type? I can get the whole line, punctuation, numbers etc, but how about just "source.json" or "source.php" say?
- Code: Select all
import sublime, sublime_plugin
class GetSyntaxCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
syntax = self.view.syntax_name(region.begin())
sublime.status_message(syntax)
I guess I could regex it out, but I'm intrigued to know if there is a better way?
James