15

User Snippets are an awesome feature of Code, however, I can't get them to work for Markdown files. A markdown.json file exists and is editable, but I can't get snippets defined in that file to activate (using Tab like for other languages). Is there a different activation method for these snippets or are they just not supported yet?

EDIT: Here's the contents of the markdown.json file just in case I'm doing something wrong there.

{
    "Markdown comment": {
        "prefix": "comment",
        "body": [
            "<!--- \n --->"
        ],
        "description": "A Markdown comment"
    }
}

4 Answers 4

22
  • Open the editor
  • Go to File -> Preferences -> User Snippets
  • Select Markdown. The file C:\Users\YOU\AppData\Roaming\Code\User\snippets\markdown.json will be opened
  • Paste your snippet into the file and save it
  • From now on you can use the snippet in all .md files.

In case the snippet suggestion doesn't popup when you type "comment" then you should type CTRL + Space to force it.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I think it was the CTRL + Space that made it register for me. That was the step I was stuck on. Thanks very much!
for mac users, the ctrl+space shortcut for autocomplete in vscode is option+esc
11
  1. Open VS Code
  2. On the top left File -> Preferences -> Settings
  3. In the settings search bar type @lang:markdown quicksuggestion
  4. Change the value of other to on if it is set to off

Alternatively, after step 2 above, you can search for quicksuggestion in the search bar and then scroll down a little. There you will see the markdown section among others (like dockercompose, dockerfile, JSON, jsonc etc. in my case). Clicking the markdown section will take you to step 4 above.

1 Comment

This setting is present in both User and Workspace tab of Markdown settings. I was able only to modify (other->on) in the Workspace settings but it works.
7

https://github.com/Microsoft/vscode/issues/26108

in case you mean no popup quick suggestion, the link is the cure.

"editor.quickSuggestions": true

add this to user setting then you should be able to see the popup snippet suggestions

3 Comments

Adding this to user settings.json works: "[markdown]": { "editor.quickSuggestions": true }
omg, i finally found a helpful method for me to use a snippet with a trigger, thx so much!!!
The settings seems to have changed to "[markdown]": { "editor.quickSuggestions": { "other": "on" }}. The toggles for comments and strings can usually be left off.
2

https://github.com/Microsoft/vscode/issues/1617#issuecomment-166999086

Full extensions get auto (7x24) completion by default (e.g. latex, cake), some built-in extensions like Markdown do not.

You have to type CTRL + Space to force it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.