atom / snippets

Atom snippets package
MIT License
206 stars 102 forks source link

Fix behavior when pressing Tab after a snippet reaches an explicit end stop. #280

Closed savetheclocktower closed 5 years ago

savetheclocktower commented 5 years ago

Fixes #278.

Description of the Change

Issue #278 describes the problem: when a snippet contains an explicit $0, and when the user cycles through the snippet to that end stop, the next press of Tab does nothing. This doesn’t have any benefit for the user and behaves differently from other implementations of snippets (Sublime Text, VSCode, etc.).

Alternate Designs

This behavior was introduced (inadvertently, I think) in #262, whose effect was to add an implied $0 at the end of every snippet that didn’t have its own $0. If I were doing a larger overhaul here, I’d want to refactor so as to remove the need for a goToEndOfLastTabStop method altogether. But I think that’d be touching a lot of code just to fix a pretty minor issue, so I went for the simpler fix.

Benefits

Brings the behavior of snippets more in line with other IDEs’ implementations. Annoys the user less.

Possible Drawbacks

The behavior change will perhaps be surprising to people the first time it happens. But nobody will mind unless they had grown particularly fond of pressing Tab and having it do nothing.

Applicable Issues

Reported in #278. #262 is the source of the unwanted behavior.