atom / autocomplete-snippets

Adds snippets to autocomplete+ suggestions
MIT License
46 stars 50 forks source link

Special characters in snippets #56

Open kankaristo opened 9 years ago

kankaristo commented 9 years ago

(Continuing from https://github.com/atom/snippets/issues/154)

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?

benogle commented 9 years ago

This is probably because * is not a word character, so autocomplete thinks there is no prefix. The solution might be to change the prefix substring to allow any non-space char. Though that might create other issues. Marking as an enhancement for now.

TimvdLippe commented 9 years ago

:+1:

PaulEcoffet commented 8 years ago

It would be also great for LaTeX autocompletion. I have tried to do a \fig to autocomplete for \begin{figure}\end{figure} without any success.

PierBover commented 8 years ago

+1

I want to create a number of snippets that begin with : or @. The snippets do work, but without autocomplete those are almost useless.

cblp commented 8 years ago

:+1:

lucascosti commented 8 years ago

+1

I'm creating a snippet with stating with &, and no autocomplete really hurts remembering it's there.

AgamlaRage commented 5 years ago

Any news for this issue ? Thx