[quote=“C0D312”]Even MORE betterer:
[code]import sublime, sublime_plugin
class ScopeToClipboardCommand(sublime_plugin.TextCommand):
def run(self, edit):
scope = self.view.syntax_name(self.view.sel()[0].b)
if sublime.ok_cancel_dialog(‘Scope:\n’+scope, ‘Copy’):
sublime.set_clipboard(scope)[/code]
Click ‘copy’ to copy the scope to clipboard
I WIN![/quote]
Almost, you got get the code right to win . scope_name not syntax_name. But well done. I would also add something to that asks if you want to copy. On windows the ‘Copy’ button does not change, it just says ‘OK’, but that one is easy to miss if you are not using windows.
[code]import sublime, sublime_plugin
class ScopeToClipboardCommand(sublime_plugin.TextCommand):
def run(self, edit):
scope = self.view.scope_name(self.view.sel()[0].b)
if sublime.ok_cancel_dialog(‘Scope:\n’ + scope + ‘\n\nCopy to clipboard?’, ‘Copy’):
sublime.set_clipboard(scope)[/code]