/ nvim / lua / plugins / luasnip.lua
luasnip.lua
 1  --- LuaSnip: snippets (LSP completion).
 2  --- Optional: for Variable/Placeholder LSP snippet transformations, install jsregexp:
 3  ---   luarocks install jsregexp   (or: task nvim:deps)
 4  --- See :help luasnip-lsp-snippets-transformations
 5  return {
 6    specs = {
 7      { src = 'https://github.com/L3MON4D3/LuaSnip', name = 'LuaSnip' },
 8    },
 9    config = function()
10      -- Preload jsregexp if installed (clears LuaSnip health warning for LSP snippet transformations)
11      pcall(require, 'jsregexp')
12      local luasnip = require('luasnip')
13      if type(luasnip) == 'table' and luasnip.setup then
14        luasnip.setup({})
15        local loader_ok, loader = pcall(require, 'luasnip.loaders.from_vscode')
16        if loader_ok and type(loader) == 'table' and loader.lazy_load then
17          loader.lazy_load()
18        end
19      end
20    end,
21  }