diff options
| author | Abouzar Parvan <[email protected]> | 2021-08-01 14:27:15 +0430 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-01 09:57:15 +0000 | 
| commit | 30ad4b81f5dbccb6d49eb28ffdd33cefcb758ee5 (patch) | |
| tree | a1b9784b7c3960bde6243e852ff624ea636460f8 | |
| parent | 326ac090453b302b35b5747ab9a66f86c70acfbe (diff) | |
Hotfix/eslint d (#1198)
| -rw-r--r-- | lua/lsp/handlers.lua | 6 | ||||
| -rw-r--r-- | lua/lsp/null-ls.lua | 23 | 
2 files changed, 13 insertions, 16 deletions
| diff --git a/lua/lsp/handlers.lua b/lua/lsp/handlers.lua index a25db3c1..849d2a03 100644 --- a/lua/lsp/handlers.lua +++ b/lua/lsp/handlers.lua @@ -27,7 +27,11 @@ function M.setup()      local diagnostics = params.diagnostics      for i, v in ipairs(diagnostics) do -      diagnostics[i].message = string.format("%s: %s", v.source, v.message) +      local source = v.source +      if string.find(v.source, "/") then +        source = string.sub(v.source, string.find(v.source, "([%w-_]+)$")) +      end +      diagnostics[i].message = string.format("%s: %s", source, v.message)        if vim.tbl_contains(vim.tbl_keys(v), "code") then          diagnostics[i].message = diagnostics[i].message .. string.format(" [%s]", v.code) diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua index 798c02ee..b8f9bfe6 100644 --- a/lua/lsp/null-ls.lua +++ b/lua/lsp/null-ls.lua @@ -34,18 +34,17 @@ end  local function is_provider_found(provider)    local retval = { is_local = false, path = nil } -  if vim.fn.executable(provider._opts.command) == 1 then -    return false, provider._opts.command -  end    if is_nodejs_provider(provider) then      vim.cmd "let root_dir = FindRootDirectory()"      local root_dir = vim.api.nvim_get_var "root_dir"      local local_provider_command = root_dir .. "/node_modules/.bin/" .. provider._opts.command      if vim.fn.executable(local_provider_command) == 1 then -      retval.is_local = true -      retval.path = local_provider_command +      return true, local_provider_command      end    end +  if vim.fn.executable(provider._opts.command) == 1 then +    return false, provider._opts.command +  end    return retval.is_local, retval.path  end @@ -78,23 +77,17 @@ function M.setup(filetype)      -- builtin_diagnoser._opts.args = linter.args or builtin_diagnoser._opts.args      -- builtin_diagnoser._opts.to_stdin = linter.stdin or builtin_diagnoser._opts.to_stdin      -- NOTE: validate before inserting to table -    if validate_provider(builtin_diagnoser) then -      table.insert(M.requested_providers, builtin_diagnoser) -    end      -- special case: fallback to "eslint"      -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/9b8458bd1648e84169a7e8638091ba15c2f20fc0/doc/BUILTINS.md#eslint      if linter.exe == "eslint_d" then -      table.insert(M.requested_providers, null_ls.builtins.diagnostics.eslint.with { command = "eslint_d" }) +      builtin_diagnoser = null_ls.builtins.diagnostics.eslint.with { command = "eslint_d" } +    end +    if validate_provider(builtin_diagnoser) then +      table.insert(M.requested_providers, builtin_diagnoser)      end      u.lvim_log(string.format("Using linter provider: [%s]", linter.exe))    end -  -- FIXME: why would we need to remove if we never add? -  for idx, provider in pairs(M.requested_providers) do -    if not validate_provider(provider) then -      table.remove(M.requested_providers, idx) -    end -  end    null_ls.register { sources = M.requested_providers }  end | 
