Home Download Buy Blog Forum Support

How to obtain the current scope under the cursor

How to obtain the current scope under the cursor

Postby shagwana on Tue Jan 17, 2012 8:03 am

I am trying to learn how to write plug-ins in Sublime Text 2 and now having a little issue beyond my current knowledge.

How do I get the scope of the current text at the edit cursor?.
The same text that can be seen on the Status bar when you press Ctrl+Alt+Shift+P
shagwana
 
Posts: 17
Joined: Mon Jul 11, 2011 8:37 pm

Re: How to obtain the current scope under the cursor

Postby blalor on Tue Jan 17, 2012 2:39 pm

Thanks for the ⌘-⌥-P trick; that answered a question I had. What you're looking for is here: viewtopic.php?f=2&p=20665
blalor
 
Posts: 2
Joined: Tue Jan 17, 2012 2:31 pm

Re: How to obtain the current scope under the cursor

Postby shagwana on Tue Jan 17, 2012 6:01 pm

Thank you, looks like the answer to my problem is;

in the ctrl+' key (show console) i can type...
Code: Select all
print (view.syntax_name(view.sel()[0].b))


gives me what I want
shagwana
 
Posts: 17
Joined: Mon Jul 11, 2011 8:37 pm


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 6 guests