atom / snippets

Atom snippets package
MIT License
205 stars 100 forks source link

Snippets in plain text files are not suggested? #180

Closed peteruithoven closed 5 years ago

peteruithoven commented 8 years ago

I've added a gitignore snippet, but it's not auto suggested like snippets usually are. It does show up in the Snippets: Available menu. I've added my snippet under two selectors. I've started Atom in safe mode.

'.text.plain':
  'Git ignores':
    'prefix': 'gitignore'
    'body': """
    jspm_packages
    node_modules
    bundle.js
    bundle.js.map
    dist
    """
'.text.generic-config':
  'Git ignores':
    'prefix': 'gitignore'
    'body': """
    jspm_packages
    node_modules
    bundle.js
    bundle.js.map
    dist
    """

Why wouldn't this snippet be auto suggested? Also see: https://discuss.atom.io/t/solved-cant-get-this-snippet-for-text-plain-working/21389/8

mnquintana commented 8 years ago

Can you paste the full contents of your snippets.cson file? Do you happen to have another entry for `'.text.plain' in there?

peteruithoven commented 8 years ago

I added the full contents below, I don't seem to have another .text.plain.

# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
#   'Console log':
#     'prefix': 'log'
#     'body': 'console.log $1'
#

'.text.html':
  'JSPM html':
    'prefix': 'html-jsmp'
    'body': """
      <!DOCTYPE html>
      <html>
        <head>
          <meta charset="utf-8">
          <title>$3</title>
          <script src="jspm_packages/system.js" charset="utf-8"></script>
          <script src="config.js" charset="utf-8"></script>
          <script type="text/javascript">
            System.import('$1');
          </script>
        </head>
        <body>
          $2
        </body>
      </html>
    """
'*':
  'Git ignores':
    'prefix': 'gitignore'
    'body': """
    jspm_packages
    node_modules
    bundle.js
    bundle.js.map
    dist
    """

'.source.js':
  'use strict':
    'prefix': 'usestrict'
    'body': "'use strict'\n"
  'importfrom':
    'prefix': 'imporfrom'
    'body': "import $1 from '$2';\n"
  'export default class':
    'prefix': 'exportdefaultclass'
    'body': """
      export default class ${1:ClassName} {
        constructor($2) {
          $3
        }
      }
    """
  'console log labeled value':
    'prefix': 'loglabeled'
    'body': "console.log('$1: ', $1);"
  'console debug value':
    'prefix': 'debug'
    'body': "debug($1);"
  'console debug labeled value':
    'prefix': 'debuglabeled'
    'body': "debug('$1: ', $1);"
  'React component':
    'prefix': 'rc'
    'body': """
      import React, {PropTypes} from 'react';

      export default class $1 extends React.Component {
        static propTypes = {

        }
        static defaultProps = {

        }
        render () {
          return (
            $2
          );
        }
      }
    """
  'Redux action creator':
    'prefix': 'redux-action'
    'body': """
    export const $1 = '$1';

    export function $2 ($3) {
      return { type: $1, $3 };
    }
    """
savetheclocktower commented 5 years ago

I can’t reproduce this. If this is still an issue:

  1. Check the name of your file and make sure it doesn’t match a pattern excluded by the blacklist in the autocomplete-plus settings.
  2. Check the scope blacklist in the settings and make sure you’re not blacklisting text.plain.

If you can reproduce, please reopen and include a reduced test case. Thanks!