bmoren / p5js-snippets

p5js snippets for atom.io
GNU General Public License v3.0
23 stars 5 forks source link

Syntax default settings (spaces between commas in arguments, semi-colons) #15

Open neefrehman opened 5 years ago

neefrehman commented 5 years ago

Hi,

I always prefer to put spaces between arguments and always put semi-colons at the end of function calls, would it be possible to introduce a way to change the default behaviour for this?

So for example when autocompleting the torus() function, instead of:

torus([radius],[tubeRadius],[detailX],[detailY])

it would be:

torus([radius], [tubeRadius], [detailX], [detailY]);

Currently I'm manually going through and making the changes for each autocomplete but it would be great to have a way to change it per each users preferences.

Thanks

bmoren commented 5 years ago

This seems like a good idea, I think there would be a somewhat easy way to add a setting in the atom package.

It'll be a while before I can get to making any feature request changes to the package at the moment, but If you want to have a attempt or someone else following along wants to have a look I'll always welcome pull requests.

If you wanted to modify your version of the package to add this functionality, you can add the space after the comma on line 73 & the semi colon at the end on line 77 of the build script: https://github.com/bmoren/p5js-snippets/blob/master/build/build.js

neefrehman commented 5 years ago

@bmoren thanks for the quick reply! Sadly I'm not very experienced with package development so don't think I'll be of any help here, but will take a look.

Thanks also for the workaroud. I've just edited the build.js, and the changes aren't taking effect after reloading Atom, I've also tried cloning the repo, editing the file and then using apm link, still with no luck! Am I doing something wrong? Any help would be really appreciated!

image

bmoren commented 5 years ago

You'll have to re-build the snippets using node.js

you can build the new snippets file by cd ing into the build directory and then running

node build.js

this will update the p5js-snippets.json file inside of the snippets folder and then you can link the package and use the updated version.

neefrehman commented 5 years ago

Thanks! That worked perfectly 🙌🏾