Few SNIPPETS when using TREE SITTER


#1

Hello.

The following shows how many snippets are available with Tree Sitter parsing off and on. The demonstrated behaviour is shown for Atom V1.29-Beta0. The same behaviour is seen for Atom V1.28.0.



Available snippets when Tree Sitter = off:



Available snippets when Tree Sitter = on:



Why are regular snippets not available when using Tree Sitter parsing? Is it because this function is still experimental and not intended for use?

Regards.


#2

Because the scopes are different, so the old selectors aren’t working.


#3

Thank you for your reply!

I totally forgot about that little detail: the scope names being different. Strange however that the Atom team did not just duplicate the standard snippets into the “Tree Sitter twin” scope.


To continue this conversation, please allow some questions:

  1. Is there a convenient way
    to reveal the scope name (like “source.js” vs “source.javascript”) of an active editor?
    I would expect it in grammar-selector:show.

  2. How do we know what is the scope name for the Tree Sitter powered version of a grammar?

Bonus question -
Is there any helpful build-up-from-ground-level instructions on how to convert my regular grammar package to the Tree Sitter powered version?

Thanks in advance and best regards.


#4

Editor: Log cursor scope still works. It will tell you the path from the root node of the syntax tree. I’m not sure how the scope selectors work, but the grammar file also has a bunch of rules about tree nodes to old style selectors (that’s how syntax highlighting is applied).

I would guess that’s impossible. The two are very different styles. Of course, you could use a textmate one to help design a tree sitter grammar, but regardless of the method it won’t be easy.