diff --git a/README.md b/README.md index 3a9c656..a6fdd9e 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,9 @@ local DEFAULT_SETTINGS = { -- This setting has no relation with the `ensure_installed` setting. ---@type boolean automatic_installation = true, + + -- Disables warning notifications about misconfigurations such as invalid linter entries and incorrect plugin load order. + quiet_mode = false, } ``` diff --git a/lua/mason-nvim-lint/auto_install.lua b/lua/mason-nvim-lint/auto_install.lua index a13f329..90ad56b 100644 --- a/lua/mason-nvim-lint/auto_install.lua +++ b/lua/mason-nvim-lint/auto_install.lua @@ -1,6 +1,7 @@ local registry = require "mason-registry" local nvim_lint = require "lint" local mapping = require "mason-nvim-lint.mapping" +local settings = require "mason-nvim-lint.settings" --@return unknown_linters string[] local function auto_install() @@ -17,7 +18,7 @@ local function auto_install() end end - if #unknown_linters > 0 then + if #unknown_linters > 0 and not settings.current.quiet_mode then vim.notify( ("Linters [%s] are absent in the mason's registry. Please, install them manually and remove from configuration.") :format(table.concat(unknown_linters, ", ")), vim.log.levels.WARN) diff --git a/lua/mason-nvim-lint/init.lua b/lua/mason-nvim-lint/init.lua index 391753a..e044727 100644 --- a/lua/mason-nvim-lint/init.lua +++ b/lua/mason-nvim-lint/init.lua @@ -8,7 +8,7 @@ local function check_and_notify_bad_setup_order() local nvim_lint_ok, nvim_lint = pcall(require, "lint") local is_bad_order = not mason_ok or mason.has_setup == false or not nvim_lint_ok local impacts_functionality = not mason_ok or #settings.current.ensure_installed > 0 - if is_bad_order and impacts_functionality then + if is_bad_order and impacts_functionality and not settings.current.quiet_mode then vim.notify( "mason.nvim has not been set up. Make sure to set up 'mason' and 'nvim-lint' before 'mason-nvim-lint'. :h mason-nvim-lint-quickstart", vim.log.levels.WARN diff --git a/lua/mason-nvim-lint/install.lua b/lua/mason-nvim-lint/install.lua index 7ee9148..eb185ba 100644 --- a/lua/mason-nvim-lint/install.lua +++ b/lua/mason-nvim-lint/install.lua @@ -1,4 +1,5 @@ local registry = require "mason-registry" +local settings = require "mason-nvim-lint.settings" local M = {} @@ -52,13 +53,15 @@ function M.try_install(mason_linter_identifier) end ) :if_not_present(function() - vim.notify( - ("[mason-nvim-lint] Linter %q is not a valid entry in ensure_installed. Make sure to only provide valid linter names.") - :format( - package_name - ), - vim.log.levels.WARN - ) + if not settings.current.quiet_mode then + vim.notify( + ("[mason-nvim-lint] Linter %q is not a valid entry in ensure_installed. Make sure to only provide valid linter names.") + :format( + package_name + ), + vim.log.levels.WARN + ) + end end) end diff --git a/lua/mason-nvim-lint/settings.lua b/lua/mason-nvim-lint/settings.lua index b61778a..22b2360 100644 --- a/lua/mason-nvim-lint/settings.lua +++ b/lua/mason-nvim-lint/settings.lua @@ -13,6 +13,9 @@ local DEFAULT_SETTINGS = { -- This setting has no relation with the `ensure_installed` setting. ---@type boolean automatic_installation = true, + + -- Disables warning notifications about misconfigurations such as invalid linter entries and incorrect plugin load order. + quiet_mode = false, } M._DEFAULT_SETTINGS = DEFAULT_SETTINGS