Snippet not working after 1.32 update



I have atom installed on Fedora 26, to the latest version. After the latest update, personalised snippets stopped working. They always worked fine, I had the same snippet file for a long time and I haven’t made any change to it for a while. Is there anything related to the 1.32.1 that could have cause this?

The grammar is being recognised correctly. I don’t get any error or warning.

I’ll put the top part here, it’s a bit large, I use all sorts of snippets:

'.source.c, .source.cpp':
    'prefix': 'std'
    'body': 'std::'
    'prefix': 'return'
    'body': 'return;'
    'prefix': 'break'
    'body': 'break;'
    'prefix': 'dbrief'
    'body': "/// \\\\brief "
    'prefix': 'dparam'
    'body': "/// \\\\param "
    'prefix': 'dreturns'
    'body': "/// \\\\returns "
    'prefix': 'dsa'
    'body': "/// \\\\sa "
    'prefix': 'dtodo'
    'body': "/// \\\\todo "
    'prefix': 'class'
    'body': """
      class ${1:className}
      \t~${1:className} ();
      \t${1:className} ();




Hmm, your snippets are working ok for me in 1.32.1 on Ubuntu 18.04. I copied the snippets to my snippets file, created a test.c and test.cpp file, and then tried a few of the snippets.

So things worked in 1.32.0 but stopped in 1.31.1 for you?


thanks for trying. I am noticing that it works ok in source files (.c, .cpp). The problem is with header files (.h). Strangely enough it seems pretty random behaviour: In the same file it works in some places and it doesn’t work in other places. This happens with most header files. I can’t quite figure out what the pattern or the cause is, it’s all very confusing.


It’s probably based on the scope at the cursor’s position. You can run the command Editor: Log Cursor Scope through the Command Palette (ctrl-shift-p, and start typing the command name). You’ll see a blue notification with a list of CSS selectors. The snippet will only apply if either .source.c or .source.cpp is in the list.


@DamnedScholar Thanks that is very interesting. The source.cpp scope is detected everywhere correctly, but whenever there is also the `comment.block’ scope, the snippets disappear. It seems that it thinks I am within a comment block, where it shouldn’t.


Can you give an example of this @paolotherocker?


This is one example:

class myClass_t
	~myClass_t ();

	/// \brief This is the constructor
	myClass_t ();

	/// \brief Add a tagged value to the output vector
	/// \param value_ The tagged value
	/// \sa outputs
	void addOutput (taggedValue_t const &value_);



snippets don’t work between the constructor and the method


Ok I think it’s solved with version 1.32.2, I cannot reproduce the issue anymore



Ok I think it’s solved with version 1.32.2, I cannot reproduce the issue anymore

The team is fixing a number of Tree-sitter related issues in the latest hotfixes so glad this is resolved :+1:

If you run into other issues let us know :v: