Open jambag opened 1 year ago
There is currently no built-in API to get this information. You have to write some hacky python code to achieve this.
For an example for Neovim, have a look here to see how we're doing this in cmp_nvim_ultisnips
: https://github.com/quangnguyen30192/cmp-nvim-ultisnips/blob/main/autoload/cmp_nvim_ultisnips.vim.
This is where the Python code is called: https://github.com/quangnguyen30192/cmp-nvim-ultisnips/blob/f90ebb220306e39766ad0ec1f094e4e12bb2fdd4/lua/cmp_nvim_ultisnips/snippets.lua#L8
@smjonas well, or submit a PR that introduces a relevant public API, right?
@jambag at the moment there is no easy way to get regex snippets. Background is that the default python regex engine cannot report "partial matches", hence we do not know in a context if a regex trigger is actually potentially valid or not.
I was also just looking into this since I tried getting around the lack of aliases by using "or" regexes like "ns|namespace" but the regex snippets don't seem to play nice with other plugins (likely because they're not included in the snippets list).
I got the coc-snippets plugin to list my regex snippets but the string interpolation feature turned out problematic. More details in https://github.com/neoclide/coc-snippets/issues/323.
Currently using coc-ultisnips, which works as one would expect from UltiSnips - regex snippets aren't listed.
Thank you very much.
I hadn't thought about the complexity of partial matches, perhaps because the regexp I had in mind were very simple. I see now.
I only want to know if there is a way to list snippets created with option r (pyton regular expression). For example:
I've configured "g:UltiSnipsListSnippets", but this type of snippets don't appear on the list, and that's important for me to avoid remembering them.
Sorry I've not found the solution in docs and this list of issues.
Thank you very much