Sublime Forum

[SOLVED]Create comment based on language being used

#1

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!

0 Likes

#2

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

I think this might be of help to me!

0 Likes

#3

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 :smile:

0 Likes