hsnips icon indicating copy to clipboard operation
hsnips copied to clipboard

Random Snippets don't work

Open Yugeniki opened this issue 3 years ago • 7 comments

I have a couple of snippets, those who are automatically expanded still work but after adding global context for math environments in latex, all of non automatic ones have stopped working. I have started at the file hard and failed to find any problem with it so it must be Hsnips fault, or I am missing something again, in which case I would like some guidance on how to solve this problem.

Update: Even making them automatic doesn't make them work.

Yugeniki avatar Jun 22 '21 11:06 Yugeniki

Could you send me a snippet file which has snippets that don't work? That would be a great help in finding the issue.

draivin avatar Jun 24 '21 05:06 draivin

The basic setup is found by importing the hsnips from Einlar/latex_snippets then adding the math environment you created in one of these threads.

The problem is solved after I have specified the math environment using another user's code but honestly it felt like yours should have worked just fine @draivin

Yugeniki avatar Jun 28 '21 11:06 Yugeniki

Still, if you could share a snippet that does not work consistently, and the user's code that seems to have fixed it, that would be great to see where the problem lies.

draivin avatar Jun 30 '21 05:06 draivin

The basic setup is found by importing the hsnips from Einlar/latex_snippets then adding the math environment you created in one of these threads.

The problem is solved after I have specified the math environment using another user's code but honestly it felt like yours should have worked just fine @draivin

Would you be so kind and send me this user's code since I encountered the same problem?

Ubuntu-prog avatar Jul 06 '21 15:07 Ubuntu-prog

@draivin when I have something like $\text{}$, how can I make my snippets not trigger even though I'm in a math environment, since \text{} clearly implies that I only want to write some text?

Ubuntu-prog avatar Jul 29 '21 19:07 Ubuntu-prog

@draivin when I have something like $\text{}$, how can I make my snippets not trigger even though I'm in a math environment, since \text{} clearly implies that I only want to write some text?

global
function math(context) {
    return context.scopes.some(s => s.startsWith("meta.math")) && !context.scopes.some(s => s.startsWith("comment"));
}
endglobal

Yugeniki avatar Jul 30 '21 17:07 Yugeniki

Same problem! But I 'm not sure when it happens

yfzhao20 avatar Sep 30 '21 15:09 yfzhao20

I believe this was related to the scope cache getting stale, so it should be better as of the latest version. Please let me know if you still have these issues.

draivin avatar Dec 22 '22 10:12 draivin

does it fix in 0.2.8 or not?

i still have this issue

WetABQ avatar Feb 08 '23 23:02 WetABQ