Comments (19)
@rebelot I have updated the snippets.lua
file and it seems to working now for vsnip snippets :) Will create a PR later and hopefully the issue will be resolved then.
from cmp-nvim-ultisnips.
Hey, I would really like to solve your issue. However, I just tested with your config and it works for me.
This is how it looks like when using your config with vim-snippets
in a Java file and hitting <C-space>
:
Can you tell me the output of the following command?
:call UltiSnips#SnippetsInCurrentScope(1) | lua print(vim.inspect(vim.g.current_ulti_dict_info))
from cmp-nvim-ultisnips.
@rebelot could you check if the new updates resolve your issue? We completely got rid of the custom parser now :D
from cmp-nvim-ultisnips.
Everything seems to works nicely! Thank you very much! 👍
from cmp-nvim-ultisnips.
Hey, could you confirm if this is still the case with the latest version? Also, I will create a PR in a few minutes that should resolve some issues with snippets not showing up.
from cmp-nvim-ultisnips.
Yes, stopped working right after rebuilding latest neovim and updating plugins
not sure what caused the problem tho, could be nvim, cmp or this. But checking out the commit before the one I posted makes it work again
from cmp-nvim-ultisnips.
Sorry about that, I should have tested the new parser better. This should be fixed once #26 has been merged.
from cmp-nvim-ultisnips.
@quangnguyen30192 thank you for the fast merging, @rebelot could you pull the latest update and test again?
from cmp-nvim-ultisnips.
Still not working for me, but thanks for your super quick response!
from cmp-nvim-ultisnips.
any update? I'll share my minimal config. I can confirm ultisnips is working because <C-X><C-S>
lists snippets, they just won't show up in cmp
.
use({
"SirVer/ultisnips",
requires = {"honza/vim-snippets", rtp = "."},
config = function()
vim.g.UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
vim.g.UltiSnipsJumpForwardTrigger = "<Plug>(ultisnips_jump_forward)"
vim.g.UltiSnipsJumpBackwardTrigger = "<Plug>(ultisnips_jump_backward)"
vim.g.UltiSnipsListSnippets = "<c-x><c-s>"
vim.g.UltiSnipsRemoveSelectModeMappings = 0
end,
})
use({
"hrsh7th/nvim-cmp",
requires = {"quangnguyen30192/cmp-nvim-ultisnips"},
config = function()
local cmp = require('cmp')
cmp.setup {
snippet = {
expand = function(args) vim.fn["UltiSnips#Anon"](args.body) end
},
mapping = {
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), {'i', 'c'}),
['<CR>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }),
},
sources = {{ name = 'ultisnips' }}
}
end
})
from cmp-nvim-ultisnips.
this is the output of the command for a lua file (trying to complete date global snippet)
git checkout
78a9452 always works.
could there be any conflicting plugins? I have the lspconfig capabilities updated by cmp as per readme.
{
["#!"] = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:1"
},
AGPL = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:265"
},
AGPL3 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:86"
},
APACHE = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:219"
},
BEERWARE = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:235"
},
BSD2 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:112"
},
BSD3 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:140"
},
BSD4 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:167"
},
GMGPL = {
description = "linking exception",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:103"
},
GPL2 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:18"
},
GPL3 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:52"
},
ISC = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:281"
},
LGPL2 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:35"
},
LGPL3 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:69"
},
MIT = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:197"
},
MPL2 = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:260"
},
WTFPL = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:244"
},
["c)"] = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:4"
},
date = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:6"
},
datetime = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:14"
},
ddate = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:8"
},
diso = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:10"
},
elif = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:32"
},
for = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:10"
},
fori = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:18"
},
forp = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:14"
},
fun = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:6"
},
if = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:22"
},
ife = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:26"
},
im = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:45"
},
local = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:4"
},
lorem = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:16"
},
print = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:43"
},
repeat = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:35"
},
time = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:12"
},
while = {
description = "",
location = "/Users/laurenzi/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/lua.snippets:39"
}
}
from cmp-nvim-ultisnips.
Oh I think I know what's the issue. I was convinced that UltiSnips only supports snippets of the form snippet ... ensnippet
as one would guess when reading the helpdocs. As can be seen here https://github.com/SirVer/ultisnips/blob/2c83e40ce66814bf813457bb58ea96184ab9bb81/doc/UltiSnips.txt#L1768, apparently UltiSnips also supports snippets using vsnip syntax. I will update the parser for this, thank you for providing the details! We will let you know once this has been fixed, thanks for your patience.
EDIT: for now this can be fixed by
use({
"SirVer/ultisnips",
requires = {"honza/vim-snippets", rtp = "."},
config = function()
vim.g.UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
vim.g.UltiSnipsJumpForwardTrigger = "<Plug>(ultisnips_jump_forward)"
vim.g.UltiSnipsJumpBackwardTrigger = "<Plug>(ultisnips_jump_backward)"
vim.g.UltiSnipsListSnippets = "<c-x><c-s>"
vim.g.UltiSnipsRemoveSelectModeMappings = 0
vim.g.UltiSnipsEnableSnipMate = 0
end,
})
(see the last line)
from cmp-nvim-ultisnips.
thank you! but this raises another issue (for me...) why snippets are searched only in vim-snippets/snippets
folder and not also in vim-snippets/UltiSnips
?
EDIT: @smjonas fixed like that, something horrible happened to rtp and I still think they messed up....
use({
"SirVer/ultisnips",
requires = {{"honza/vim-snippets"}},
config = function()
vim.opt.rtp:append({vim.fn.stdpath('data') .. "/site/pack/packer/start/vim-snippets"})
vim.g.UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
vim.g.UltiSnipsJumpForwardTrigger = "<Plug>(ultisnips_jump_forward)"
vim.g.UltiSnipsJumpBackwardTrigger = "<Plug>(ultisnips_jump_backward)"
vim.g.UltiSnipsListSnippets = "<c-x><c-s>"
vim.g.UltiSnipsRemoveSelectModeMappings = 0
end,
})
from cmp-nvim-ultisnips.
That's actually a really good question, the issues with the rtp just happened to me also. Packer actually has some problems with setting rtp, I will test your solution and probably update the readme once it works.
from cmp-nvim-ultisnips.
@quangnguyen30192 I think we should not support vim-snipmate
-like snippets at the moment. That would be quite a lot of work and involve a few edge cases. But we should update the readme again for honza/vim-snippets
users.
Or maybe fallback to not using the custom parser if a snipmate snippet is found (then we will only have the tab_trigger and description info).
from cmp-nvim-ultisnips.
Or maybe fallback to not using the custom parser if a snipmate snippet is found (then we will only have the tab_trigger and description info).
I second this... I find snipmate snippets very useful (like licenses, date, author/program info)
from cmp-nvim-ultisnips.
While thinking about it, snipmate snippets only have a tab_trigger and description anyway (at least on the main branch). So there is no need to change the parser, we can simply use the info provided by UltiSnips.
from cmp-nvim-ultisnips.
Not all of them are shown on latest (i.e. box (this one is super useful imo), bbox, docs, MIT, ...). I'm reverting and locking for now. Thanks for the support, hope you'll find a way to implement that!
edit: FYI, regarding the box
snipmate snippet, something wierd happens. It seems that the description is passed to nvim-cmp as part of the item abbrev
from cmp-nvim-ultisnips.
Thanks @smjonas for your effort
from cmp-nvim-ultisnips.
Related Issues (20)
- Having issues with nested tabstop HOT 1
- No snippets in completion list? HOT 3
- Update support for new lua parser in treesitter HOT 3
- Strange error when trying to load ultisnips HOT 5
- Expand Snippet shows on the command line HOT 6
- When cmp is active, jump forward doesnt go forward. HOT 7
- Using tab to jump forward leaves a space before jumping forward HOT 6
- Snippetes with multiple options doesn't works HOT 1
- Possible bug when triggering snippet before the completion menu has opened for the first time
- Wrong context matching HOT 5
- If i set jump_forwards before expand, it has a lag before i can expand HOT 8
- Error detected while processing TextChangedI Autocommands for "*": HOT 16
- Not showing all honza/vim-snippets (but it still exists somehow) HOT 12
- Failed to load parser: uv_dlsym: dlsym(0x208d77c60, tree_sitter_Dockerfile): symbol not found HOT 1
- Many auto-snippets can not be trigger HOT 1
- E5108: Error executing lua Vim:E117: Unknown function: `UltiSnips#CanJumpForwards`, `UltiSnips#CanJumpBackwards`, and `UltiSnips#CanExpand` HOT 21
- Error detected while processing TextChangedI Autocommands for "*": HOT 4
- Ultisnips stopped working HOT 1
- Insert mode is slow and laggy with this source enabled HOT 12
- Load the wrong snippets source HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmp-nvim-ultisnips.