Skip to content

Commit

Permalink
edit_snippet_func: also present load_ft_func-filetypes.
Browse files Browse the repository at this point in the history
Maybe it should even exclusively consider load_ft_func-filetypes, since
the intent of the function, at least as I see it, is to add a snippet to
any filetype for this buffer, and thats exactly the association
load_ft_func is supposed to model.
  • Loading branch information
L3MON4D3 committed May 29, 2023
1 parent 5fbfed5 commit 73dff88
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/luasnip/loaders/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local Cache = require("luasnip.loaders._caches")
local util = require("luasnip.util.util")
local loader_util = require("luasnip.loaders.util")
local Path = require("luasnip.util.path")

local M = {}
Expand Down Expand Up @@ -93,8 +94,13 @@ function M.edit_snippet_files(opts)

local ft_filter = opts.ft_filter or util.yes

local all_fts = {}
vim.list_extend(all_fts, util.get_snippet_filetypes())
vim.list_extend(all_fts, loader_util.get_load_fts(vim.api.nvim_get_current_buf()))
all_fts = util.deduplicate(all_fts)

local filtered_fts = {}
for _, ft in ipairs(util.get_snippet_filetypes()) do
for _, ft in ipairs(all_fts) do
if ft_filter(ft) then
table.insert(filtered_fts, ft)
end
Expand Down

0 comments on commit 73dff88

Please sign in to comment.