Home Download Buy Blog Forum Support

Show Scope "command" ala TextMate

Re: Show Scope "command" ala TextMate

Postby facelessuser on Tue Mar 27, 2012 9:17 pm

Where did you get that from? It isn't listed in the API.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Show Scope "command" ala TextMate

Postby C0D312 on Tue Mar 27, 2012 9:18 pm

Magic.

TBH, I don't remember where. I actually think Jon posted it. Someone asked about copying the scope to the clipboard and he stepped it with his undocumented black magic.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Show Scope "command" ala TextMate

Postby facelessuser on Wed Mar 28, 2012 1:37 am

C0D312 wrote:Magic.

TBH, I don't remember where. I actually think Jon posted it. Someone asked about copying the scope to the clipboard and he stepped it with his undocumented black magic.


Interesting. Well if someone was going to know hidden API stuff, it would be Jon.

Oh, and yes I concede to your victory :).
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Show Scope "command" ala TextMate

Postby jps on Wed Mar 28, 2012 10:40 am

syntax_name is deprecated, and only exists for backwards compatibility - use scope_name instead. They format the returned scope differently, with the version returned by scope_name() making more sense.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Show Scope "command" ala TextMate

Postby quodlibet on Wed Mar 28, 2012 11:34 am

I use the code provided by adzenith here: viewtopic.php?f=3&t=1646&p=7545&hilit=scope+clipboard#p7545

YMMV, but I find this plugin less intrusive as it prints the scope to the statusbar (allowing for quick inspection), but also to the console (which allows you to build lists as well as selective copy & paste). It's also faster if you want to inspect several sections, as you don't have to deal with the popup every time.

I general, I find this functionality to be super useful. Does anyone maybe want to round this out with a couple of options (e.g., disabling the pop-up) and throw it in Package Control?
quodlibet
 
Posts: 511
Joined: Sat Jun 18, 2011 5:53 pm

Re: Show Scope "command" ala TextMate

Postby sublimator on Wed Mar 28, 2012 11:51 am

C0D312 wrote: I'm still claiming this as a victory.


Image

This... is a knife...

hahaha :)
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Show Scope "command" ala TextMate

Postby C0D312 on Wed Mar 28, 2012 12:25 pm

castles_made_of_sand wrote:
C0D312 wrote: I'm still claiming this as a victory.


Image

This... is a knife...

hahaha :)

I'm sorry, you're too late. This competition has ended. You can submit your entry next year though. The judge has already ruled C0D312 to be victorious. Ruling still stands.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Show Scope "command" ala TextMate

Postby sublimator on Wed Mar 28, 2012 1:53 pm

C0D312 wrote:I'm sorry, you're too late.


Image
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Show Scope "command" ala TextMate

Postby facelessuser on Wed Mar 28, 2012 2:13 pm

quodlibet wrote:I use the code provided by adzenith here: viewtopic.php?f=3&t=1646&p=7545&hilit=scope+clipboard#p7545

YMMV, but I find this plugin less intrusive as it prints the scope to the statusbar (allowing for quick inspection), but also to the console (which allows you to build lists as well as selective copy & paste). It's also faster if you want to inspect several sections, as you don't have to deal with the popup every time.

I still find the status bar not a good option. Doesn't show long enough. But I do like the idea of logging it to the console. What I would probably do is put it in an output panel that pops up at the bottom. So you could do multi-select; which would be nice, the info would be separate from all the other console noise, it is at the bottom and fairly low profile, and you could even have it auto-popup (conditionally with an additional toggle scope panel command if you find it too intrusive).

quodlibet wrote:I general, I find this functionality to be super useful. Does anyone maybe want to round this out with a couple of options (e.g., disabling the pop-up) and throw it in Package Control?


I think the victor has "won" the right to throw this on Package Control. :) If no one really has any interest to do it, I will do it, but I will first leave it up to COD312.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Show Scope "command" ala TextMate

Postby nick. on Wed Mar 28, 2012 2:25 pm

This is a related plugin I wrote. It displays the scope in the status bar as you move the cursor around. Just thought I'd share it:
Code: Select all
import sublime, sublime_plugin

class PrintScopeNameCommand(sublime_plugin.EventListener):
   def on_selection_modified(self, view):
      sublime.status_message(view.scope_name(view.sel()[0].a))
Last edited by nick. on Wed Mar 28, 2012 2:27 pm, edited 2 times in total.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

PreviousNext

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 39 guests