Skip to content

Commit

Permalink
fix(lazydev): only add configuration as necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jul 25, 2024
1 parent e7de18b commit c40c17b
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions lua/astrocommunity/neovim-lua-development/lazydev-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@ return {
"folke/lazydev.nvim",
ft = "lua",
cmd = "LazyDev",
opts = {
library = {
{ path = "luvit-meta/library", words = { "vim%.uv" } },
{ path = "astrocore", words = { "AstroCore" } },
{ path = "astrolsp", words = { "AstroLSP" } },
{ path = "astroui", words = { "AstroUI" } },
{ path = "astrotheme", words = { "AstroTheme" } },
{ path = "lazy.nvim", words = { "Lazy" } },
},
},
opts = function(_, opts)
if not opts.library then
opts.library = {
{ path = "luvit-meta/library", words = { "vim%.uv" } },
{ path = "astrocore", words = { "AstroCore" } },
{ path = "astrolsp", words = { "AstroLSP" } },
{ path = "astroui", words = { "AstroUI" } },
{ path = "astrotheme", words = { "AstroTheme" } },
{ path = "lazy.nvim", words = { "Lazy" } },
}
end
end,
specs = {
{ "folke/neodev.nvim", optional = true, enabled = false },
{ "Bilal2453/luvit-meta", lazy = true },
{
"hrsh7th/nvim-cmp",
optional = true,
opts = function(_, opts) table.insert(opts.sources, { name = "lazydev", group_index = 0 }) end,
opts = function(_, opts)
local lazydev_inserted
for _, source in ipairs(opts.sources or {}) do
if (type(source) == "table" and source.name or source) == "lazydev" then
lazydev_inserted = true
break
end
end
if not lazydev_inserted then table.insert(opts.sources, { name = "lazydev", group_index = 0 }) end
end,
},
},
}

0 comments on commit c40c17b

Please sign in to comment.