Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable default_setup during reload #62

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

ghost
Copy link

@ghost ghost commented Apr 19, 2023

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.

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.

```lua
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.
@ghost ghost changed the title fix: don't memoize default_setup fix: enable default_setup during reload Apr 19, 2023
@jay-babu jay-babu merged commit 0bf4c84 into jay-babu:main Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants