draivin / hsnips

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

Include external files in .hsnips #124

Open DedZago opened 2 years ago

DedZago commented 2 years ago

Hello, I was wondering whether it would be possible to include external files in .hsnips file, so that we avoid copy-pasting when multiple filetypes share the same snippets. UltiSnips does this via the use of the extends keyword.

Use case: I have the same mathematical snippets for both quarto files (quarto.hsnips) and RMarkdown files (rmd.hsnips). It would be nice to be able to create an external math.hsnips file to contain the snippets that are shared between them:

math.hsnips:

# Mathematical snippets that are shared between multiple filetypes
snippet dm "math" iA
\[
    $1
\]$0
endsnippet

rmd.hsnips:

# Snippets that are specific for RMarkdown
#...

extends math

quarto.hsnips:

# Snippets that are specific for quarto
#...

extends math

Thank you for your time.