Oskar-Idland / hsnips

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

Unable to get this working #2

Open Alex2134556 opened 1 week ago

Alex2134556 commented 1 week ago

Hello,

I am unable to get any snippet working with this extension. Whenever I "Hypersnips: Reload Snippets", it displays

"Command 'Hypersnips: Reload Snippets' resulted in an error: missing ) after argument list".

On the other hand, everything works fine with the draivin's version of Hypersnips.

PapierFliegr commented 1 week ago

You have to change the snippet file a bit, e.g. you don't need to write \\sum anymore to get \sum and the context query doesn't work anymore.

Try to comment out some snippets to find which don't work, or send your file (or at least some of it) so that we can take a look at it.

Alex2134556 commented 1 week ago

Wait the context query doesn't work anymore? Like things like "context math(context)" doesn't work?

PapierFliegr commented 1 week ago

Yes, instead of context math(context) just use the flag m. Example

snippet sum "sum" iAm
\sum
endsnippet

Currently there are no other context flags available.

Alex2134556 commented 1 week ago

Ahh, I do have some different contexts as well like block_math(context) and text(context). And what about editor queries? Things like "isInlineMath(editor)".

Also why was this changed? I remember, OrangeX4's fork didn't do this: It lets you have the context and greater flexibility with changing it if required.

PapierFliegr commented 1 week ago

As far as I know (and I understand the code) the fork of OrangeX4 didn't support context queries as well (at least not in the way as in the original from draivin). And @Oskar-Idland just added the fix for the tabstops until now.

But honestly I am just a user as well...

Alex2134556 commented 1 week ago

@Oskar-Idland I see. It might be best to just use draivin’s original code as it lets you use different contexts. You can just copy the OrangeX4’s hypersnips code in your latex hsnips file.

Oskar-Idland commented 1 week ago

@PapierFliegr is right! We use the math flag instead. As the original from draivin and fork from OrangeX4 has diverged, I would like to unify them to get the best from both. Maybe add more flags, or just context queries. That would be more flexible, but the flags are more neat.

I want to add draivin's improvements to this fork, or add OrangeX's code to draivins code. Whaterver is easiest. If you have something you want to implement, just make a PR!

Oskar-Idland commented 1 week ago

I found the commit from the original repo with the addition of context support. I'll experiment with adding it later, or you are welcome to add it in a PR:)