Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a class to the text editor when we're expanding snippets #19

Open
1 task done
mauricioszabo opened this issue Feb 8, 2024 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@mauricioszabo
Copy link

Have you checked for existing feature requests?

  • Completed

Summary

When expanding snippets, we can add a class to the editor inserting-snippets or even only snippets-active.

What benefits does this feature provide?

First, we can simplify this file: https://github.com/pulsar-edit/snippets/blob/master/keymaps/snippets-2.cson and its implementations by registering keymaps only to atom-text-editor.inserting-snippets for example.

Second, we can provide visual cues when a snippet is expanding (either by user-defined keymaps and/or themes).

Third, package authors could query for this class on the text editor to avoid doing things that might break snippet expansion - for example, formatting the source code. Two packages that suffers from this is parinfer and parinfer-plus (they try to infer parenthesis just after someone types in the editor, and the snippets package understands that there was an user action, terminating the snippet insertion)

Any alternatives?

Callbacks, or using some "provider/consumer" pair, but I feel these are less powerful (they don't allow for visual customization nor themes)

Other examples:

No response

@mauricioszabo mauricioszabo added the enhancement New feature or request label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant