Home Download Buy Blog Forum Support

[SOLVED]Create comment based on language being used

[SOLVED]Create comment based on language being used

Postby jtwebb on Sat Jul 20, 2013 5:23 am

I'm creating my first plugin for Sublime (having fun doing it too) and I've come across something that I think should be easy. I need to be able to detect the syntax being used and create a comment based on that language. I think it could have something to do with the Comments.tmPreferences file, but I'm not quite sure how to determine the language and then grab that file. If someone could point me in the right direction I would really appreciate it!
Last edited by jtwebb on Sat Jul 20, 2013 4:47 pm, edited 1 time in total.
jtwebb
 
Posts: 14
Joined: Sat Jul 20, 2013 5:19 am

Re: Create comment based on language being used

Postby jtwebb on Sat Jul 20, 2013 5:32 am

I just found:
Code: Select all
view.meta_info("shellVariables", pt)


I think this might be of help to me!
jtwebb
 
Posts: 14
Joined: Sat Jul 20, 2013 5:19 am

Re: Create comment based on language being used

Postby jtwebb on Sat Jul 20, 2013 4:47 pm

I have it figured out! I took a look at the default package's comment.py file in Sublime to see how they were creating comments. I used some of that logic in my plugin. Now I have my first plugin! It's a very simple one (obviously, for a first one) that adds the path and file name of the file your working on as a comment wherever your cursor is. You can check it out at https://github.com/jtwebb/WPath. Feedback is always welcome :)
jtwebb
 
Posts: 14
Joined: Sat Jul 20, 2013 5:19 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests