friendly-snippets icon indicating copy to clipboard operation
friendly-snippets copied to clipboard

[Feature Request] uuid snippet

Open GR3YH4TT3R93 opened this issue 1 year ago • 2 comments

I just converted from CoC and honza/snippets but one little feature I really miss is the ability to have a random uuid generator snippet like honza's UltiSnips uuid snippet.

Is it possible to add to LuaSnip rather than UltiSnip?

For reference, I checked out TrevorS/uuid-nvim but I'd like to have it as a snippet available for cmp rather than a keybind for dx consistency if at all possible.

Ps, thanks to all the contributors for the amazing work that has been put into this project!

GR3YH4TT3R93 avatar Jan 12 '24 20:01 GR3YH4TT3R93

Have a look at this PR I opened recently: https://github.com/rafamadriz/friendly-snippets/pull/386. It just adds an UUIDv4 snippet in the global scope. Is this what you're looking for?

ybc37 avatar Jan 14 '24 22:01 ybc37

Yes! This is exactly what I was looking for!

GR3YH4TT3R93 avatar Jan 15 '24 05:01 GR3YH4TT3R93

After testing, it doesn't seem to work

GR3YH4TT3R93 avatar Jan 24 '24 14:01 GR3YH4TT3R93

That's strange, I use it like that with Neovim + nvim-cmp + LuaSnip without issues. Do other LSP builtin variables ([1], [2]) work for you (e.g. date snippet)? I'm not an expert, so there could be something wrong with the snippet, too :smile:

[1] https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables [2] https://github.com/L3MON4D3/LuaSnip/blob/2dbef19461198630b3d7c39f414d09fb07d1fdd2/lua/luasnip/util/_builtin_vars.lua

ybc37 avatar Jan 24 '24 17:01 ybc37

It's not even showing up for me as a snippet tbh. As for other variable snippets like date, they work as expected. I would assume it would work if it were available but for some reason it's not even showing up lorem uuid date date

GR3YH4TT3R93 avatar Jan 24 '24 18:01 GR3YH4TT3R93

I think the problem is that you use the main branch of my fork. But the uuid snippet is in the branch feature/global-uuid: https://github.com/ybc37/friendly-snippets/tree/feature/global-uuid

I guess something like that should work (can't test it right now):

dependencies {
  -- [...]
  { 
    "ybc37/friendly-snippets",
    branch = "feature/global-uuid"
  },
  -- [...]
},

I hope the PR gets merged soon :)

ybc37 avatar Jan 24 '24 21:01 ybc37

Wow I'm dumb... lol sorry about that

It works perfectly now!

GR3YH4TT3R93 avatar Jan 24 '24 23:01 GR3YH4TT3R93

Closing this issue as 386 is merged!

@GR3YH4TT3R93 @ybc37

OkelleyDevelopment avatar Feb 12 '24 05:02 OkelleyDevelopment