Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant