Failed to load snippet


#1

I tried to make a snippet in snippets.cson, but when I try to save it, it shows “failed to load snippets from”. But the default snippet for console.log:
‘.source.js’:
‘Console log’:
‘prefix’: ‘log’
‘body’: ‘console.log($1);’
doesn’t show an error.
But when I tried to make this snippet:
‘.source.js’:
‘mousePresessed()’:
‘prefix’: ‘mous’
‘body’: ‘’’
function mousePresessed(){
$1
}
‘’’
It is showing an error, I am using atom version 1.28.0.


#2

Can you please edit or post below the same config, but marked as code so we can see exactly what you have. White space, quite characters, etc., are important and lost in markdown.


#3

Try the following:

'.source.js':
  'testing':
    'prefix': '\\1'
    'body': '# Hello world'
  'Console log':
    'prefix': 'log'
    'body': 'console.log($1);'
  'mousePresessed()':
    'prefix': 'mous'
    'body': '''
    function mousePresessed(){
      $1
    }
    '''

'.javascript':
  'testing':
    'prefix': '\\1'
    'body': '# Hello world'
  'Console log':
    'prefix': 'log'
    'body': 'console.log($1);'
  'mousePresessed()':
    'prefix': 'mous'
    'body': '''
    function mousePresessed(){
      $1
    }
  '''

The problem is that with tree-sitter activated in the settings:

  • All standard snippets that was part of the core language, is missing!!
  • The designation for the scope has changed to Javascript instead of source.js

Next - use ''' (3) instead of '' (2). Make sure it is normal quotes and not smart quotes.

To type code in this forum do the following:

```coffeescript
# code segment for the Coffeescript grammar
# start and end with 3 backtick characters
```

Cheers.