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

Allow variables in snippets #9

Closed
1 task done
savetheclocktower opened this issue Feb 8, 2023 · 1 comment · Fixed by #11
Closed
1 task done

Allow variables in snippets #9

savetheclocktower opened this issue Feb 8, 2023 · 1 comment · Fixed by #11
Labels
enhancement New feature or request

Comments

@savetheclocktower
Copy link

Have you checked for existing feature requests?

  • Completed

Summary

TextMate allows for certain variables to be defined in snippets that map to various things when the snippet is expanded. Most of these have also made it into the LSP specification for snippets.

Pulsar should support this entire list. This means not just substituting them during snippet expansion, but also allowing them to be transformed using the same syntax that already exists for transforming tab stops.

This enhancement does not depend on #8, but for reasons described in that issue, it would be odd to add support for variables without also making snippets triggerable via keystroke.

What benefits does this feature provide?

Aside from the new functionality it enables, it makes our snippets more compatible with the LSP specification, and with snippets as they've been implemented by VSCode, Sublime Text, and TextMate.

Any alternatives?

Not really. If this functionality is worth adding, it's worth doing it this way instead of introducing one that's purposefully incompatible.

Other examples:

See also the VSCode documentation for snippets.

@savetheclocktower savetheclocktower added the enhancement New feature or request label Feb 8, 2023
@savetheclocktower
Copy link
Author

I plan to tackle this enhancement myself, but probably not until we come to consensus on #8. Until then it's worth capturing in issue form.

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

Successfully merging a pull request may close this issue.

1 participant