From 8a1de2b90a699bdfee704f3d4422e2ced18ae0f3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 09:18:04 +0200 Subject: [PATCH] fix(elixir): only enable credo when installed. Fixes #1546 --- lua/lazyvim/plugins/extras/lang/elixir.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index dbd0e9a7..53454c37 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -33,6 +33,9 @@ return { "nvimtools/none-ls.nvim", optional = true, opts = function(_, opts) + if vim.fn.executable("credo") == 0 then + return + end local nls = require("null-ls") opts.sources = opts.sources or {} vim.list_extend(opts.sources, { @@ -43,10 +46,13 @@ return { { "mfussenegger/nvim-lint", optional = true, - opts = { - linters_by_ft = { + opts = function(_, opts) + if vim.fn.executable("credo") == 0 then + return + end + opts.linters_by_ft = { elixir = { "credo" }, - }, - }, + } + end, }, }