coq_nvim
coq_nvim copied to clipboard
Feature Request: UltiSnips integration
Hello! I hope that there will be more love and respect for this awesome project!
I know that we can add custom snippets already but I just want to know if there are plans on adding support with UltiSnips. I know I am not the only one who uses that plugin and I have invested a shit ton of time to configure it.
Sorry for my bad English. Drink more water and keep safe!
Is this not duplicate of #211?
now that coq has lua plugins, this might be possible?
i will need to look into it however
Thank you so much!
Is this not duplicate of #211?
I think it is.
However, the solution to the issue is the built-in custom snippet. I am hoping that we can integrate ultisnips to coq.
Here's my two cents:
I also had a bunch of UltiSnips snippets that I'd love to have retained, but to my knowledge, UltiSnips doesn't work well with neovim itself, let alone coq
. The author of UltiSnips has stated repeatedly that neovim support is "best-effort", and will continue to close all neovim-only bug reports until a maintainer that wants to step up and take control of the neovim side is found.
And, I can also personally attest that UltiSnips doesn't work well with neovim.
To me, this means that supporting UltiSnips via a "lua plugin" (which I take to mean a custom source), would be a bad idea.
Of course the other option is to extend the current snippet parser to the entirety of UltiSnips syntax, which would involve code interpolation, which I believe @ms-jpq is not in favor of supporting.
Thank you so much for clarifying this!
I've also read that thread from UltiSnips but didn't pay much attention. 😅 I am actually starting to migrate my snippets to coq now. I think my problem is solved since I also liked coq custom snippet.
Should I close this Issue or leave it alone for future reference? Since @ms-jpq might actually support it in the future.
@davidatbu you have a good point there.
However, I also want to note there (for @ms-jpq) that Ultisnips has the advantage of using Python evaluation in its snippets. As such, most of my snippets written and used in Ultisnips will fail to compile under Coq.
Thanks again for your work @ms-jpq !
Is it possible to add ultisnip as a source and will trigger it when select?
And is it possible to unbound default
With following steps could make coq_vim support ultisnip completion:
- Save following content as
lua/coq_3p/ultisnip/init.lua
:
-- Very simple case
-- Offers suggestions of `vim.lsp.protocol.CompletionItemKind`
return function(spec)
return function(args, callback)
local items = {}
-- label :: display label
-- insertText :: string | null, default to `label` if null
-- kind :: int ∈ `vim.lsp.protocol.CompletionItemKind`
-- detail :: doc popup
for key, val in pairs(vim.fn['UltiSnips#SnippetsInCurrentScope']()) do
local item = {
label = tostring(key),
insertText = key,
detail = tostring(val)
}
table.insert(items, item)
end
callback {
items = items
}
end
end
- Enable the custom source with following configuration:
require("coq_3p") {
{ src = "ultisnip", short_name = "US" },
}
Would also like this to be integrated. The current snippets are not really helpful sadly :(
Will try your solution tomorrow @hiberabyss
@hiberabyss Thanks for sharing the codes. However, it is not working with my configs.
I have already installed ultisnips
and vim-snippets
. Any thing I should add to the coq_nvim conifg? Thanks!