1

I have an NvChad configuration for NeoVim, and I was trying to configure a LuaSnip plugin, but for some reason my Lua snippets are working correctly, but the json ones do not, and I want to figure out the reason for this

My cpp.json file is located at:

~/.config/nvim/snippets/vscode/cpp.json

My cpp.lua file is located at:

~/.config/nvim/snippets/lua/cpp.lua

Here is my configuration for LuaSnip:

return {
    "L3MON4D3/LuaSnip",
    dependencies = { 
        "rafamadriz/friendly-snippets", 
        "nvim-treesitter/nvim-treesitter", 
    },

    config = function()
        local ls = require("luasnip")
        local base = vim.fn.expand("~/.config/nvim/snippets/")
        
        require("luasnip.loaders.from_lua").load({ 
            paths = { base .. "lua" } 
        })

        -- require("luasnip.loaders.from_vscode").lazy_load()
        require("luasnip.loaders.from_vscode").lazy_load({ 
            paths = { base .. "vscode" } 
        })
        
        ls.config.set_config({
            keep_roots = true,
            link_roots = true,
            link_children = true,

            update_events = "TextChanged, TextChangedI",
            delete_check_events = "TextChanged",
        })
    end,
}

Here is the body of my cpp.json file:

{
    "simpleTest": {
        "prefix": "ttest",
        "body": ["123"]
    }
}

OS: Arch Linux, WM: Hyprland

New contributor
dvb1r is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.