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

Double html snippets when extending with html snippets

Open allanabiud opened this issue 1 year ago • 4 comments

While trying to set up neovim for htmldjango files, I was unable to get my html-lsp working inside htmldjango files. Not really a issue with this repo of course.

The only solution I came across was extending htmldjango files with html snippets. However, upon doing so, I get double html snippets. I've tried uninstalling lsps to narrow down the issue and it seems to only happen after I extend these snippets like so:

local luasnip = require("luasnip")

-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
require("luasnip.loaders.from_vscode").lazy_load()

-- Include snippets not in global snippets for friendly-snippets
luasnip.filetype_extend("htmldjango", { "html", "loremipsum", "djangohtml" })
luasnip.filetype_extend("html", { "loremipsum" })
lluasnip.filetype_extend("python", { "django" })

Here is how it looks like: html

Is anyone else getting the same or is it just me?

allanabiud avatar Nov 30 '24 20:11 allanabiud

FWIW, I was unable to replicate this issue locally, but I have in the past had duplicate snippets. I'll leave this open for a few more days in the event I figure something out in my spare time OR if someone else encounters the issue too :thinking:

OkelleyDevelopment avatar Dec 02 '24 03:12 OkelleyDevelopment

I run into the exact same issue when adding luasnip.filetype_extend("htmldjango", { "html" }) to my config.

victordumetz avatar Dec 26 '24 02:12 victordumetz

This might or not be the same as I get, but I know why I am getting double, if it helps. If you look at the preview for each date snippet, you'll see that one is for markdown, and the other is for "all". This double list gets displayed on markdown files, and on non-markdown files I only get the "all". I am on the hunt for how to disable the "all" (I think this is the global option?) everywhere.

Image

Image

carlisia avatar Mar 26 '25 23:03 carlisia

I've encountered the same issue as well with the html snippets. Only html snippets that are doubled on auto completion. But all other snippets are fine, such as for Blade snippets as shown below

Image

raihankr avatar Apr 20 '25 03:04 raihankr