jay-babu / mason-null-ls.nvim

GNU Affero General Public License v3.0
549 stars 22 forks source link

fix: enable default_setup during reload #62

Closed ghost closed 1 year ago

ghost commented 1 year ago

The mason-null-ls.automatic_setup function has no return value and so can't be memoized effectively -- it exists strictly for its side-effects. This change is necessary to make mason-null-ls cooperate during a reload of configuration.

Previously the below code would work on initial executtion but noop subsequently, resulting in no null-ls diagnostics. Now it behaves as expected.

require("null-ls.config").reset()
require("null-ls").setup({ on_attach = M.on_attach_null_ls })
require("mason-null-ls").setup({
  handlers = { require("mason-null-ls").default_setup },
})

Without this change I have to work around, using an un-memoized copy-paste of the automatic-setup function as my handler.