draivin / hsnips

HyperSnips: a powerful snippet engine for VS Code, inspired by vim's UltiSnips
MIT License
148 stars 23 forks source link

Feature Request: Allow multiple files per language to facilitate sharing of hsnips files separated by functionality #154

Open universemaster opened 1 year ago

universemaster commented 1 year ago

Many of the .hsnips files shared publicly on github are very long and with many different types of functionality.

I would like to seperate my .hsnips into categories such as:

Currently hsnips allows one file per language:

The file should be named based on the language the snippets are meant for (e.g. latex.hsnips for snippets which will be available for LaTeX files). Additionally, you can create an all.hsnips file for snippets that should be available on all languages.

My feature request is to allow multiple files per language to facilitate sharing of hsnips files separated by functionality.

I possible way to achieve allow multiple files by language is to allow globbing of file names like this:

The end of the file names should be based on the language the snippets are meant for (e.g. xxxxxlatex.hsnips for snippets which will be available for LaTeX files). Additionally, you can create files that end with xxxxxall.hsnips for snippets that should be available on all languages.

Then, we would be able to create and share .hsnips files with file names that indicate the functionality. If globals from a different file are used, maybe the author should leave a comment to direct someone else to also use the other file?

The extension and repository could also list good files, or suggest that people search github like this.

I don't have time right now to do a pull request for this, but I suspect for someone familiar with the code base it won't be too difficult?

draivin commented 1 year ago

Would this issue be solved by the feature proposed here? This way you could name your files however you want and use the main language file to include the relevant snippets.

universemaster commented 1 year ago

@draivin , yes, that would work well!