Browse Source

fix(statusline): display null-ls linters properly (#2921)

Akihiro Okuno 2 years ago
parent
commit
d259efd40b
1 changed files with 11 additions and 1 deletions
  1. 11 1
      lua/lvim/lsp/null-ls/linters.lua

+ 11 - 1
lua/lvim/lsp/null-ls/linters.lua

@@ -6,9 +6,19 @@ local null_ls = require "null-ls"
 local services = require "lvim.lsp.null-ls.services"
 local services = require "lvim.lsp.null-ls.services"
 local method = null_ls.methods.DIAGNOSTICS
 local method = null_ls.methods.DIAGNOSTICS
 
 
+local alternative_methods = {
+  null_ls.methods.DIAGNOSTICS,
+  null_ls.methods.DIAGNOSTICS_ON_OPEN,
+  null_ls.methods.DIAGNOSTICS_ON_SAVE,
+}
+
 function M.list_registered(filetype)
 function M.list_registered(filetype)
   local registered_providers = services.list_registered_providers_names(filetype)
   local registered_providers = services.list_registered_providers_names(filetype)
-  return registered_providers[method] or {}
+  local providers_for_methods = vim.tbl_flatten(vim.tbl_map(function(m)
+    return registered_providers[m] or {}
+  end, alternative_methods))
+
+  return providers_for_methods
 end
 end
 
 
 function M.list_supported(filetype)
 function M.list_supported(filetype)