Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey! This is fundamentally an issue with null-ls, since (as far as I know) we are the only LSP that will attempt to attach to any buffer, regardless of filetype, but it should (hopefully) be a simple fix.
Steps to reproduce:
filetypes
set to{ "*" }
, such as the new misspell source.misspell
will catch, e.g. "langauge".I was surprised by this, since
:set buftype?
in the Trouble buffer correctly showsnofile
, and that should mean that nvim-lspconfig'stry_add
won't attach.I think the issue is that Trouble sets
filetype
beforebuftype
, so when theFileType
event is triggered and null-ls callstry_add
on the Trouble buffer, it goes through. This PR simply switches the order of the two lines, which aligns with lspconfig's expectations and fixes the issue.Let me know if there was a reason for the original order or if there's something I'm overlooking by attempting to fix it in this way. (I think we also have to be a bit more aggressive about filtering out non-file buffers on the null-ls side, but either way we'll have to check
buftype
, so the issue would remain.)