Home Download Buy Blog Forum Support

How to hide comments

How to hide comments

Postby jesseatkinson on Fri Jan 13, 2012 8:10 pm

Is there a way to hide comments? I have to heavily comment my code. I'd love to be able to turn comments on and off so that it would show or hide comments. Is this possible?
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit

Re: How to hide comments

Postby facelessuser on Fri Jan 13, 2012 8:43 pm

It is possible, but not out of the box. You could write a plugin that finds all comments, and then fold all of those regions with one command, and then with another command unfolds all of those comments.
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: How to hide comments

Postby jesseatkinson on Mon Jan 16, 2012 2:35 pm

Hm... I can't be the only human being to want this functionality. I guess I got to start researching how to write a Sublime Text 2 plugin.
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit

Re: How to hide comments

Postby bizoo on Mon Jan 16, 2012 3:05 pm

Basically, it is:
Code: Select all
view.fold(view.find_by_selector('comment'))

Now if you want a nice result, you must probably tweak a little bit the regions returned by find_by_selector (join adjacent regions, add/remove line ending, ...)
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: How to hide comments

Postby jbrooksuk on Mon Jan 16, 2012 4:04 pm

bizoo wrote:Basically, it is:
Code: Select all
view.fold(view.find_by_selector('comment'))

Now if you want a nice result, you must probably tweak a little bit the regions returned by find_by_selector (join adjacent regions, add/remove line ending, ...)

Do you happen to have that in a nice package already? ;)
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: How to hide comments

Postby jesseatkinson on Mon Jan 16, 2012 4:13 pm

jbrooksuk wrote:
bizoo wrote:Basically, it is:
Code: Select all
view.fold(view.find_by_selector('comment'))

Now if you want a nice result, you must probably tweak a little bit the regions returned by find_by_selector (join adjacent regions, add/remove line ending, ...)

Do you happen to have that in a nice package already? ;)

Yeah, I don't know Python at all... :roll:
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit

Re: How to hide comments

Postby facelessuser on Mon Jan 16, 2012 4:27 pm

jesseatkinson wrote:Yeah, I don't know Python at all... :roll:


If I get some time in the next couple of days (and someone else hasn't beaten me to the punch), I may take a swing at this; we shall see.

If you end up giving it a try and have issues, just post your questions here, and I am sure you will get help; there are a lot of people here with python/plugin experience, and most are pretty helpful.
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: How to hide comments

Postby weslly on Mon Jan 16, 2012 4:40 pm

actually this is pretty easy, this plugin should solve the problem :)

http://cl.ly/312l47310A181h3f1116
weslly
 
Posts: 203
Joined: Sun Aug 28, 2011 3:57 am
Location: Brazil

Re: How to hide comments

Postby facelessuser on Mon Jan 16, 2012 4:43 pm

weslly wrote:actually this is pretty easy, this plugin should solve the problem :)

http://cl.ly/312l47310A181h3f1116


Nice!
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: How to hide comments

Postby jesseatkinson on Mon Jan 16, 2012 4:50 pm

facelessuser wrote:
weslly wrote:actually this is pretty easy, this plugin should solve the problem :)

http://cl.ly/312l47310A181h3f1116


Nice!

Wow! Super nice community! Thank you!

Now... I'm kind of a n00b to this Sublime Text 2 thing. How do I install & use this? :D I'm used to installing things with the package explorer.
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit

Next

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 23 guests