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

[suggestion] use languageId instead of file extension #2

Closed ctf0 closed 5 years ago

ctf0 commented 5 years ago

which would make it easier for the extension to differentiate between .php & .blade.php

ctf0 commented 5 years ago

btw the usage of "pattern": "*.js", is not really needed because its already handled by the package https://github.com/Gruntfuggly/auto-snippet/blob/78db4957e30da3bcd8689a8a68cd6814b16f310d/extension.js#L15

so really it should be just { "pattern": "js", "snippet": "template" }

Gruntfuggly commented 5 years ago

Unfortunately, I use the extension for C++ work which uses different headers for .h and .cpp files which are both considered the same language.

I'll see if I can make it an alternative option though.

ctf0 commented 5 years ago

okay, maybe the pattern key could become an object of either a languageId or an extension

Gruntfuggly commented 5 years ago

I've just uploaded a new version which can also use the language ID - see the README.md for an example.

ctf0 commented 5 years ago

thanx for the new update