SublimeText / jQuery

Sublime Text package bundle for jQuery
323 stars 98 forks source link

Convert single to double quotes? #18

Closed ghost closed 9 years ago

ghost commented 9 years ago

I know this is probably an age old debate as to whether to use single or double quotes in JQuery, my personal preference is for double. However, I note that the snippets in this package use single quote notation. Is there a setting available to switch it? Thanks

mrmartineau commented 9 years ago

Yup, an age old debate and one that cannot be fixed by a mere snippet setting I'm afraid. Sorry buddy, gonna stick with the single quotes unless there's good reason to change it.

FichteFoll commented 9 years ago

Actually, it can. See https://github.com/SublimeTextIssues/Core/issues/112 and https://github.com/makopo/sublime-text-lsl

ghost commented 9 years ago

@FichteFoll that's great to hear - thanks for the link but being the noob that I am with Sublime customisation its not clear what I would need to do to reverse quote notation, given these resources talk about indentation - are you able to provide some guidance? Many thanks

FichteFoll commented 9 years ago

Basically, you define a metadata shellVariable for the javascript scope that contains a quote character, either " or '. That quote character is switchable with a plugin for example. In the snippets you then replace all occurences of ' with ${JQ_QUOTING_CHARACTER} or whichever name you chose and ST will replace that with the selected quote character.

Edit: links

Note that the plistlib.readPlist does not work on some Linux distributions but that may be ST2-only.

ghost commented 9 years ago

Thank you kindly for responding but I have no clue how to do that! I’ve only recently started working with JQuery which is a necessity for front-end dev (my forte is in HTML and CSS). I know basic concepts but beyond that it’s a minefield to me…

FichteFoll commented 9 years ago

I have edited my comment with links to how the referenced package did it. This was mainly intended as information for @mrmartineau anyway.

ghost commented 9 years ago

Thank you very much :o)

mrmartineau commented 9 years ago

Thanks for your help @FichteFoll, I was not aware of this feature. @stevebhcc I don't have time to develop this feature but if you do, please submit a pull request for it so we can add it to the package.