-
Notifications
You must be signed in to change notification settings - Fork 100
Ability to import multiple snippets.cson files #124
Comments
I say we cannot implement the suggestions; CSON is nothing more than JSON. Why not simply support what was previously (or still is?) documented regarding a snippets folder, e.g. Should be pretty trivial to implement as well, so might be candidate for good-first label. |
Can I just have multiple snippets.cson files within |
Not currently available. It was incorrectly documented that way in the
|
Ah. Well in that case, I do prefer your version. Managing imports would be a pain. Auto importing all files from |
+1 for auto importing but just having anything at all available to manage snippets in partials would be so much better |
+1 this is a real must as my .cson file is becoming unmanageable. A simple ./snippets folder would be an ideal solution... |
+1 it's getting difficult to manage all my snippets, especially for different languages. |
The solution, for now, I am using is my own package. Within the package there is a ./snippets folder and within this I am currently creating multiple .cson files. Not ideal as any additional snippets added while working only show after reloading Atom. Therefore I'm using the default snippet.cson while working and then, at then end of the day, pasting any new snippets into my package - ready for start up next day. Hopefully this solution means that if a ./snippets folder is ever added, as discussed above, I can just copy my .cson files into this... |
@castlefields Would be great if you published that package to APM so we can use that method for now. 😉 |
@castlefields I created a similar solution to yours because I really got tired of the long snippets file. Install with |
👍 |
It would be awesome to have project-specific snippet files as well. That way teams/repositories could have version-tracked |
👍 to project-specific snippets, as @adammagana proposed. It's particularly annoying when working across projects (sometimes across organizations) with different conventions/linting rules. |
👍 Auto-importing would be awesome and so would project specific snippets |
+1 |
1 similar comment
+1 |
+10 project-specific snippets, really a must have |
+9001 for project-specific snippets |
My modular-keymaps package does exactly this, but for keymaps. It automatically reloads them on any change too. I'd imagine the code would be very similar for snippets. I also had the idea of adding the option to synchronise your |
$ ln -s snippets.cson $HOME/.atom/snippets/$(basename $PWD).cson Edit: didn't take into consideration that snippets shouldn't intersect |
Well it turned out the code wasn't too similar after all due to the lack of an equivalent API for snippets, but I managed to work around it and now I have a proper modular-snippets package working locally. Project specific snippets are implemented too; they are live reloaded for each project (and exist only while that project is open), and take precedence over any global snippets in your new Local project snippets are loaded from the first file found in your project root in the order: @thibmaek I sent you a PM on the Atom #Slack asking if you'd possibly like to remove your Edit: I devised a way to add to existing scope selectors rather than override them, and even prefix each snippet name key with it's file name, so any clashes should be minimal, but in the rare case they do then the local snippet will take precedence. |
@danielbayley awesome! |
@danielbayley awesome indeed! Thanks! |
any package that we can install it to get multi snippets files loaded from '.atom/snippets' folder? |
@phpgit Yep, I'll be releasing my modular-snippets package very shortly… just ironing out a couple of last-minute bugs. I'll announce it here when it's up. |
Well I wanted to get this out a little sooner but life kept getting in the way 😄 |
|
@kaytrance yup, too bad though. There's an issue filed in there and a PR submitted too I think but @danielbayley seems to have left this project. I'll see if I can whip something up. |
@kaytrance @thibmaek Hi, sorry no it's not dead… actually, I have a complete re-write of it running locally. It's just dependent a few other Atom packages I haven't published yet! |
I have error 👎
���⠪����᪠� �訡�� � ����� 䠩��, ����� ����� ��� ��⪥ ⮬�. npm ERR! modular-snippets@0.1.3 preinstall: 'mkdir -p "${ATOM_HOME:-$HOME/.atom}"/snippets' npm ERR! Please include the following file with any support request: |
@Bogdan808 see: danielbayley/atom-modular-snippets#1 |
I was able to install modular-snippets (and its requirements if not installed) by hand:
In my case, it asked for two packages: "glob-all" (npm install --save glob-all), and "require-cson" (npm install --save require-cson). Clear skies! |
From @morseldesign on March 29, 2015 19:51
Feature
Ability to do an
@import
orrequire()
syntax for breaking up snippets into multiple files. For example@import "/snippets/documentation-snippets.cson"
orrequire('snippets/javascript-snippets.cson')
.Why
After awhile, snippet files can become pretty overwhelming to manage. Having multiple files would not only help with organization, but make it a little easier to manage changes to certain snippets.
Example
Given a file called
snippets/javascript-snippets.cson
with contents like:We could import it lnto
~/.atom/snippets.cson
like:Copied from original issue: atom/atom#6155
The text was updated successfully, but these errors were encountered: