Broken Visual Studio Code snippets do not work

I included the default "log" snippet in VS Code. I also added another snippet. None of them appear when I type their prefixes. I set editor.tabCompletionto true.

Any idea why they are not working?

+20
source share
10 answers

There are several ways to solve this problem. The problem is that Intellisense interferes or by default places your snippets at the bottom of the list.

At first I played with a delayed sentence, but then I decided that Intellisense would put my snippets at the top of the sentence list with user preference snippetSuggestions:

{
  "editor.tabCompletion": true,
  "editor.snippetSuggestions": "top"
}
+41
source

, . VSCode (Ctrl + N) , . VSCode, " ". .

;-)

+20

PHP, ,

<?php

.

+10

, , php intelliSense, , php , html.

   {
      "Open php tag": {
         "scope": "php, html",
         "prefix": "php",
         "body": [
           "<?php",
             "  $1",
           "?>"
        ],
        "description": "Opens php tags"
      }
   }

:)

+7

, . , .

VS, .

+2

, , - . (: JavaScript- )

, , ​​ filetype (im my case: *.blade.php)

UserSnippets blade.json .

  • , .
  • .
+2

, ()

log.json ( , Typescript).

: (""> ""> " "> " ") "clog" ( : "clog.code-snippets") , .

+2

, php , Robert Cooper , , .

!p <?php$1?> , HTML. html.json.

+1

,

{
  ...,
  "snippet name": { // it should be snippet_name. Notice the _
    ...
  }
}

, :

  1. {name}.code-snippets .vscode
  2. spaces
  3. . typescript typescriptreact.
0

. .

{
  "Print to console": {
        "scope": "javascript,vuex,vue",
        "prefix": "debes",
        "body": [
            "// eslint-disable-next-line",
            "debugger;"
        ],
        "description": "Log output to console"
    }
}
0

Source: https://habr.com/ru/post/1678382/


All Articles