efm-langserver: Cannot enable linting with eslint on JS files using native nvim lsp.

I’m using neovim’s native LSP and I’m getting 2020/11/28 08:18:39 lint for LanguageID not supported: on the server logs. Notice that the LanguageID in the logs is empty. I tried tweaking the log level via the -loglevel cli option with no effect. How can I debug this?

Here’s my configuration for reference:

lspconfig.efm.setup {
   cmd = {"efm-langserver", "-logfile", log_dir .. "/efm.log"},
   on_attach = on_attach(log_dir .. "/efm.log"),
   -- Fallback to .bashrc as a project root to enable LSP on loose files
   root_dir = lspconfig.util.root_pattern(".git/", ".bashrc"),
   -- Enable document formatting (other capabilities are off by default).
   init_options = {documentFormatting = true},
   settings = {
     rootMarkers = {".git/", ".bashrc"},
     languages = {
       javascript = {
        {
          lintCommand = "eslint -f unix --stdin",
          lintIgnoreExitCode = true,
          lintStdin = true,
        }
       },
     },
   },
 }

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

@mattn Actually it would be very helpful if efm was more chatty. At the very least send the stderr to the server’s log file.

Also helpful would be to support different log levels. I see a -loglevel cli option but changing it has no effect on the server log. It would be much easier to debug if I could increase it and see all incoming requests from nvim.

I don’t see anything obvious in your config.

I think know what your problem is, but I don’t know why it’s happening. For some reason, Neovim doesn’t resolve the filetype correctly when first attaching the buffer to LSP. Afterwards efm just has an empty string as the languageID, and your config doesn’t get resolved. This is an issue with Neovim.

I had the same thing happen as well, but I refactored a bunch of things and it went away. I never figured out what was wrong. The place in Neovim source is not that complicated https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp.lua#L281 really not sure what is causing this.

I think you can close the issue here and open one in Neovim. Or ask in the Gitter channel if someone has an idea.