Closed Rizhiy closed 9 months ago
Unfortunately, this would not help much, since it is not only a snippet directory, but also a package.json and at least one snippet file for vs code snippets to work. And that, in turn, is not something this plugin can easily automate for the user.
Considering your other issues, I'd suggest reading up on the docs how the vs code snippet format works.
One directory and two files are not easy?
Not easy in the sense that strictly speaking it requires user input. Though I suppose bootstrapping with some default values could probably work
With all the necessary validation and covering all cases, this "easy" implementation took a total of ~120 lines.
Anyway, the last update now adds bootstrapping capabilities if the snippet directory, the package.json
, or a snippet file is missing.
Adding snippets works fine, thank you. If I try to edit snippets without directory/package.json it still errors out, would be great to also create those files on edit snippets call.
Also, might be a good idea to ask the user if they want to create the files if they don't exists. In case someone mistyped the snippetsDir by accident.
Adding a snippet file when you are trying to edit existing snippets feels a bit unintuitive for me, tbh.
But validating that a package.json exists before you try to edit snippet files is indeed something that is missing and that I'll add in a moment.
Feature Requested
After install, if the default snippet directory doesn't exist, the following error is raised:
Would be great if the default directory is created automatically.
Relevant Screenshot
No response
Checklist