none-ls-extras.nvim icon indicating copy to clipboard operation
none-ls-extras.nvim copied to clipboard

[Help] Use 1 eslint server for code actions, diagnostics and formatting

Open Ajaymamtora opened this issue 1 year ago • 0 comments

At the moment Ive setup my sources like:

    require("none-ls.diagnostics.eslint").with({
      command = "eslint",
      args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" },
      to_stdin = true,
      format = "json_raw",
      check_exit_code = function(code)
        return code <= 1
      end,
      cwd = function()
        return eslint_override_cwd
      end,
    }),

    require("none-ls.code_actions.eslint").with({
      generator_opts = {
        command = "eslint",
        args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" },
        to_stdin = true,
        format = "json_raw",
        check_exit_code = { 0, 1 },
        cwd = function()
          return eslint_override_cwd
        end,
      }
    }),

    null_ls.builtins.formatting.uncrustify.with({
      args = function(params)
        local config_path = _G.__os.home .. "/.config/uncrustify/config.cfg"
        local format_type = "-l " .. params.ft:upper()
        return { "-c", config_path, "-q", format_type }
      end,
    }),

But I dont want to spawn 3 eslint instances. Surely theres a way to use just one?

Ajaymamtora avatar Nov 03 '24 19:11 Ajaymamtora