fix: load standalone snippets
This commit is contained in:
+5
-7
@@ -16,7 +16,7 @@ end
|
|||||||
local function get_snippet_path()
|
local function get_snippet_path()
|
||||||
-- Look for the specific file or folder within the runtimepath
|
-- Look for the specific file or folder within the runtimepath
|
||||||
-- 'vscode' is the folder name in your snippet repo
|
-- 'vscode' is the folder name in your snippet repo
|
||||||
local paths = vim.api.nvim_get_runtime_file("vscode/", true)
|
local paths = vim.api.nvim_get_runtime_file("vitruvio.code-snippets", true)
|
||||||
|
|
||||||
if #paths > 0 then
|
if #paths > 0 then
|
||||||
return paths[1] -- Returns the full path to the first match found
|
return paths[1] -- Returns the full path to the first match found
|
||||||
@@ -24,8 +24,6 @@ local function get_snippet_path()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
print(get_snippet_path())
|
|
||||||
|
|
||||||
local function main()
|
local function main()
|
||||||
vim.api.nvim_create_user_command("VitruvioURL", function(opts)
|
vim.api.nvim_create_user_command("VitruvioURL", function(opts)
|
||||||
vim.b.vitruvio_url = opts.fargs[1]
|
vim.b.vitruvio_url = opts.fargs[1]
|
||||||
@@ -60,10 +58,10 @@ local function setup()
|
|||||||
callback = main,
|
callback = main,
|
||||||
})
|
})
|
||||||
|
|
||||||
local snippet_dir = get_snippet_path()
|
local snippet_path = get_snippet_path()
|
||||||
if snippet_dir then
|
if snippet_path then
|
||||||
require("luasnip.loaders.from_vscode").lazy_load({
|
require("luasnip.loaders.from_vscode").load_standalone({
|
||||||
paths = { snippet_dir },
|
paths = { snippet_path },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user