atom / snippets

Atom snippets package
MIT License
205 stars 100 forks source link

[Feature request] A service to add/remove/read snippets programmatically #190

Open dead-claudia opened 8 years ago

dead-claudia commented 8 years ago

Summary

What I'm proposing is a new provided service to manipulate snippets programmatically. Such a service would have to do the following:

Macro system

I want to implement a very powerful macro system for Atom on top of this package, to make it feel native. That's a feature that I know is in high demand. I also want to provide an eady way to manage existing macros, but the other facilities I need for that already exist.

This will require the following:

Intelligent autocomplete

This could be used to build a more powerful autocomplete, where someone could make snippets based on the type, or snippets that are only active in certain contexts. One example of this would be defining geti -> getElementById JavaScript snippet only when the parent is document, but not existing elsewhere since it's usually irrelevant in those places.

Also, Atom TypeScript could use this to do Eclipse-like autocomplete, where if you might autocomplete a function, it instead generates an anonymous snippet for that item, and inserts that with the correct arguments, denoting types as well, much like what an IDE would.

declare function func(buffer: Buffer, name: string): void;

func // <tab>
func(buffer, name) // filled in variable names, `buffer` is currently highlighted

This will require the following:

This is technically a partial duplicate of #100 and #181, but much more detailed and complete than either. It would also offer an indirect fix for #109, #107, #155, and probably others, and it is related to #33.

dead-claudia commented 8 years ago

On a tangentally related side note, I hate GitHub outages (this would've been filed two hours ago if that didn't happen right as I was about to submit...thank God for copy+paste).