Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Snippet triggers are missing colons/periods in front of tags #2

Open
johnarwe opened this issue Sep 8, 2017 · 1 comment
Open

Snippet triggers are missing colons/periods in front of tags #2

johnarwe opened this issue Sep 8, 2017 · 1 comment

Comments

@johnarwe
Copy link
Member

johnarwe commented Sep 8, 2017

For example, "paragraph" triggers on "p" instead of ":p".

 'paragraph':
    'prefix': 'p'
    'body': ":p."

This is currently the case because Atom's snippet support does not work correctly when certain characters are in the prefix (which is what Atom triggers auto-complete on).

Based on atom/snippets#154 , this is a problem in Atom's autocomplete-snippets package. The latter has at least 2 open issues from this dating from mid-2015: atom/autocomplete-snippets#67 and atom/autocomplete-snippets#56 . The autocomplete-snippets provider https://github.com/atom/autocomplete-snippets/blob/master/lib/snippets-provider.coffee appears to take the default prefix as input, which likely is based on the editor's settings for "word characters" (typically, alphanumeric plus a handful of specials like underscore, but certainly not colon or period). The Provider API does supply a way to override this (and the snippets package already has code to collect all the unique characters in prefixes, carefully escaping regex-special characters), but autocomplete-snippets is not using the override (see https://github.com/atom/autocomplete-plus/wiki/Provider-API "Tips" near/at bottom of page).

Opening this issue simply to document current state, including the research above, so there is something to point to from this package's snippets file and some repeat work can be avoided.

@johnarwe
Copy link
Member Author

johnarwe commented Sep 8, 2017

If that's too abstract, add the following to your personal snippets (File > Snippets ...) and try some of the expansions. arwe2 will actually expand (hit Tab) even though you don't get the autocomplete dialog, for example. Then add the string "arwe" somewhere in your file, and try the same experiments again.

'.source.GML':
  'arwe1':
    'prefix': ':arwe'
    'body': ":arweFooBarBlah1."
  'arwe2':
    'prefix': '\:arwe'
    'body': ":arweFooBarBlah2."
  'arwe3':
    'prefix': '\\:arwe'
    'body': ":arweFooBarBlah3."
  'arwe4':
    'prefix': '-arwe'
    'body': ":arweFooBarBlah4."
  'arwe5':
    'prefix': 'xyz'
    'body': ":arweFooBarBlah5."

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant