atom / snippets

Atom snippets package
MIT License
204 stars 102 forks source link

Special characters in snippets #154

Closed kankaristo closed 9 years ago

kankaristo commented 9 years ago

I'm trying to create snippets for documentation comments/docstrings.

For example, I'd like to create the following snippet for C++:

'.source.cpp':
  'C++ docstring':
    'prefix': '/**'
    'body': """
      /**
       * $1.
       *
       * @param $2  $3.
       *
       * @return $4.
       */
    """

However, the special characters in the prefix seem to break the snippet (it doesn't show up in autocomplete). At first I thought it might be because /* starts a comment, but changing the prefix to something like *** is also broken.

Changing the prefix to doc works, but if I set it to something like doc***, it breaks after typing the first * character.

I also tried escaping the characters with \ or \\, but neither of those helped. Any way to make this work? Is this a limitation in snippets or autocomplete-plus (or autocomplete-snippets)?

kankaristo commented 9 years ago

May be related to https://github.com/atom/snippets/issues/151.

izuzak commented 9 years ago

As far as I can tell, that snippet is working just fine -- if I type /** and press tab it expands correctly. For that reason, I suspect this is a problem with autocomplete-snippets. Can you please reopen the issue there (and also check the existing issues in case it's already reported)?

https://github.com/atom/autocomplete-snippets/issues

kankaristo commented 9 years ago

@izuzak, I actually hadn't noticed that it worked when pressing tab.

I'm quite happy with it working the way it is (I don't have many snippets with special characters in their prefixes, so I guess I can memorize them), but filed a bug in autocomplete-snippets anyway.