1

I'm trying to create snippets that would work only when I'm in a particular scope within a file, and not be tied to file's language. Ex: I have an HTML file where I mix regular HTML tags and TWIG tags.

<h1>Page Title</h1>
{{ include('content.twig', { arg1: false } ) }}

And now, when I edit the h1 and type c I want it to expand to class="", but when I type it within twig's args object I'd like the c expand to class: placeholder instead.

I can identify the scope I'd like to limit my snippets to, and trying this:

"class": {
    "prefix": ["c"],
    "body": ["class: ${1:placeholder}"],
    "scope": "meta.function.arguments.twig" 
}

But the snippet is working everywhere within the file, not only within the defined scope.

Any ideas how to solve this?

xms
  • 11
  • 1

0 Answers0