atom / snippets

Atom snippets package
MIT License
206 stars 102 forks source link

Snippet not working without space. #301

Open vvasuki opened 4 years ago

vvasuki commented 4 years ago

Prerequisites

Description

My snippet works when preceded by a space, but not otherwise.

Steps to Reproduce

Illustrated here: atom-snippet-without-space

Snippet code:

  'Sanskrit doc emphasis comment':
    'prefix': 'ccc'
    'body': '+++($1)+++'

Versions

Atom 1.44.0

Arch Linux

Additional Information

I have seen https://github.com/atom/snippets/issues/272 as well as https://github.com/atom/snippets/issues/151 . Seems non-duplicate.

levipmartin commented 2 years ago

I have the same problem. I believe this is intentional but problematic for postfix snippets, where you have alternating words preceded by a common postfix. Now I want to shorten the postfix as a snippet to complete it. This is not possible since I have to insert a space to trigger the snippet first.

Possible solution 1: Add regex support for snippets, 'Sanskrit doc emphasis comment': 'prefix': '.*ccc' 'body': '+++($1)+++' Something like this, maybe it has to be escaped.

Alternatively I wouldn't mind pressing the space to trigger my snippet, if I can delete the space when inserting the snippet, but I have not found a way to do so yet.