fix(luasnip): only use user snippets if the folder exists (#2481)

This commit is contained in:
Abouzar Parvan 2022-04-18 14:00:18 +04:30 committed by GitHub
parent 10c7753d8e
commit 1ae89bee93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,12 +70,16 @@ local core_plugins = {
"L3MON4D3/LuaSnip",
config = function()
local utils = require "lvim.utils"
local paths = {
utils.join_paths(get_runtime_dir(), "site", "pack", "packer", "start", "friendly-snippets"),
}
local user_snippets = utils.join_paths(get_config_dir(), "snippets")
if utils.is_directory(user_snippets) then
paths[#paths + 1] = user_snippets
end
require("luasnip.loaders.from_lua").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load {
paths = {
utils.join_paths(get_config_dir(), "snippets"),
utils.join_paths(get_runtime_dir(), "site", "pack", "packer", "start", "friendly-snippets"),
},
paths = paths,
}
require("luasnip.loaders.from_snipmate").lazy_load()
end,