0
0
0272018-10-05 11:32:37
Snippets
027, 2018-10-05 11:32:37

VS Code: Why don't snippets work in javascript files?

VS Code version 1.27.2
Created a global snippet file, created about a dozen of them, everything works as I need, except for one problem: snippets do not work in *.js files.
Snippet example:

"insert.nbsp": {
  "scope": "html,php,javascript",
  "prefix": "nb",
  "body": [
    " ",
  ],
  "description": "Мнемоник  "
},

It works in html, it works in php, it doesn't work in javascript.
If you remove the scope parameter, it works everywhere, but I would like it to be targeted, and not litter the entire autocomplete.
PS At the beginning of the ordeal, purely intuitively, I added js to the end of the enumeration, and it suddenly started working. O_o
Then I began to experiment with options, and that's it. Refocusing failed in any combination of names in scope.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2020-11-20
@moshatin

Had a similar issue in VS Code. We didn't want snippets to work for js either in custom fragments in javascript.json or in new global fragments created. I started disabling installed extensions one by one, tk. I thought that there was a conflict with some of them. In my case, after disabling the Sublime Babel extension, everything worked, my snippets became available for use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question