0

I want to make all my tools into one extension including snippets, I know how to add snippets by steps operations, and how to make an extension, but how can we add snippets by making and installing an extension?

1
  • 1
    you can add a contribution point for a snippets file, you can add snippets in CompletionItemProvider and you can add a snippet in the editor Commented Sep 14, 2022 at 8:37

1 Answer 1

1

You can add contribution point 'snippets' in package.json .

{
  "contributes": {
    "snippets": [
      {
        "language": "go",
        "path": "./snippets/go.json"
      }
    ]
  }
}
  • The language attribute is the language identifier.
  • The path is the relative path to the snippet file.

Here are official references : https://code.visualstudio.com/api/references/contribution-points#contributes.snippets

or

You can also choose New Code Snippets when creating an extension project with yo code command. This way is useful to create an extension just for snippets.

Hope this helps!

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

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.