0

I have been using the same Neovim config on my desktop and laptop computers for a while now (it's actually based on LazyVim, but I can reproduce the issue without it as well) without any problems.

Now that we have started incorporating TypeScript into our JavaScript project, I have noticed that the XO diagnostics I have previously set up through null-ls (and still work for JavaScript files) don't appear on my laptop for TypeScript files.

The strange thing is that the output of :LspInfo, :NullLsInfo, :LspLog and :NullLsLog looks perfectly fine. I've tried installing XO globally and locally as well, and the diagnostics didn't show up, but it runs perfectly well from the command line in both cases.

2
  • Would you mind sharing your configuration for xo and null-ls? I have been using Neovim with NvChad but I just have to run xo from the command line (instead of on save).
    – user49605
    Commented Nov 20, 2023 at 19:24
  • @user49605 I don't think that this comment section is necessarily the right place to ask, also, given that I don't use NvChad and null-ls has been archived since then I might not even be the right person to ask, but with a quick search for "nvchad null-ls" I found this documentation page, which might help: nvchad.com/docs/config/format_lint To use it with XO, just enable the builtins.diagnostics.xo and builtins.code_actions.xo sources.
    – Isti115
    Commented Nov 23, 2023 at 17:03

1 Answer 1

0

I was really weirded out by this mysterious issue, but decided to keep investigating, so I put a print statement into the code of null-ls for debugging, and strangely enough after reading the output and pressing Enter to continue the missing diagnostics appeared to my great surprise! 😮 This behavior wasn't consistent, but after a bit of experimenting I have managed come to the conclusion that it only works if I spend enough time reading the output, but doesn't, when I dismiss it too quickly. At first I thought that it might be some sort of weird race condition.

It turned out that the reason for it working on my desktop with identical config is simply a question of performance, as XO was timing out while checking TypeScript files on my laptop.

TL;DR:
I needed to extend or completely turn off (set to -1) the timeout for XO diagnostics in null-ls.

require("null-ls").builtins.diagnostics.xo.with({
  -- milliseconds
  timeout = 10000,
}),

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.