jamescherti / ultyas

Convert Ultisnips snippets to YASnippet format
https://github.com/jamescherti/ultyas
GNU General Public License v3.0
10 stars 0 forks source link

Error in detecting math context for latex snippet #1

Open goodmorning-hwt opened 6 months ago

goodmorning-hwt commented 6 months ago

The repository aims to facilitate the transition from Ultisnips to Yasnippet. However, I encountered an issue related to detecting math context.

When utilizing the following Ultisnips code:

context "math()"
snippet "hat" "hat" riA
\hat{$1}$0
endsnippet

I received the following output:

Parse error: latex-snippets/tex.snippets: 104: 'context "math()"'

It seems that the detection of the math context is not functioning correctly. Any assistance in resolving this matter would be greatly appreciated.

goodmorning-hwt commented 6 months ago

According to ChatGPT, in YASnippet the line is described like # condition: (and (eq major-mode 'latex-mode) (texmathp))

jamescherti commented 6 months ago

Thank you for posting the issue and bringing this to my attention.

I have pushed a change to ignore context for now, as context is not yet supported by Ultyas. Please try the latest version of Ultyas and confirm that context is ignored. The latest version will at least allow you to generate Yasnippet snippets that contain contexts.

I plan to implement context support or a feature to add elisp code to Ultisnips snippets from Ultisnips comments and will let you know once it's available. Contributions are also welcome.