Gruntfuggly / auto-snippet

A vscode extension to automatically insert a predefined snippet when a file is created, or an empty file is opened.
Other
14 stars 1 forks source link

[Feature Request] Add support to scoped snippets in .vscode #17

Closed RodrigoTomeES closed 2 years ago

RodrigoTomeES commented 2 years ago

Hi,

It would be awesome if this extension can be detect snippets from .vscode. This snippets has the extension .code-snippets.

Now it throws this error: Snippet doesn't found

I also add my configuration in case it was my mistake. Thank you for your work!

My .vscode configuration

{
  "autoSnippet.snippets": [
    { "pattern": "**/components/**/index.ts", "snippet": "functional-component" }
  ]
}

My Snippet in .vscode/story.code-snippets

{
  "index": {
    "prefix": ["i"],
    "description": "Create a index with the component and the type.",
    "scope": "javascript, typescript",
    "body": [
      "import { ${RELATIVE_FILEPATH/.*\\/(.*)\\/.*/${1:/pascalcase}/} } from './${RELATIVE_FILEPATH/.*\\/(.*)\\/.*/${1:/pascalcase}/}';",
      "",
      "export type { Type${RELATIVE_FILEPATH/.*\\/(.*)\\/.*/${1:/pascalcase}/}Props } from './types';",
      "export default ${RELATIVE_FILEPATH/.*\\/(.*)\\/.*/${1:/pascalcase}/};",
      ""
    ]
  }
}
RodrigoTomeES commented 2 years ago

Now it seems that it works without having touched anything, maybe it was necessary to restart vscode. Sorry.