diff --git a/lua/lazyvim/plugins/extras/lang/sql.lua b/lua/lazyvim/plugins/extras/lang/sql.lua index c9382942..cf6096c4 100644 --- a/lua/lazyvim/plugins/extras/lang/sql.lua +++ b/lua/lazyvim/plugins/extras/lang/sql.lua @@ -48,19 +48,21 @@ return { vim.api.nvim_create_autocmd("FileType", { pattern = sql_ft, callback = function() - local cmp = require("cmp") + if LazyVim.has("cmp") then + local cmp = require("cmp") - -- global sources - ---@param source cmp.SourceConfig - local sources = vim.tbl_map(function(source) - return { name = source.name } - end, cmp.get_config().sources) + -- global sources + ---@param source cmp.SourceConfig + local sources = vim.tbl_map(function(source) + return { name = source.name } + end, cmp.get_config().sources) - -- add vim-dadbod-completion source - table.insert(sources, { name = "vim-dadbod-completion" }) + -- add vim-dadbod-completion source + table.insert(sources, { name = "vim-dadbod-completion" }) - -- update sources for the current buffer - cmp.setup.buffer({ sources = sources }) + -- update sources for the current buffer + cmp.setup.buffer({ sources = sources }) + end end, }) end,