summaryrefslogtreecommitdiff
path: root/lua/lsp/null-ls/services.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lsp/null-ls/services.lua')
-rw-r--r--lua/lsp/null-ls/services.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/lua/lsp/null-ls/services.lua b/lua/lsp/null-ls/services.lua
index a1e3a06c..ef9e7d22 100644
--- a/lua/lsp/null-ls/services.lua
+++ b/lua/lsp/null-ls/services.lua
@@ -4,8 +4,8 @@ local function find_root_dir()
local util = require "lspconfig/util"
local lsp_utils = require "lsp.utils"
- local status_ok, ts_client = lsp_utils.is_client_active "typescript"
- if status_ok then
+ local ts_client = lsp_utils.is_client_active "typescript"
+ if ts_client then
return ts_client.config.root_dir
end
local dirname = vim.fn.expand "%:p:h"
@@ -28,6 +28,7 @@ local local_providers = {
prettier_d_slim = { find = from_node_modules },
eslint_d = { find = from_node_modules },
eslint = { find = from_node_modules },
+ stylelint = { find = from_node_modules },
}
function M.find_command(command)
@@ -44,4 +45,19 @@ function M.find_command(command)
return nil
end
+function M.list_registered_providers_names(filetype)
+ local u = require "null-ls.utils"
+ local c = require "null-ls.config"
+ local registered = {}
+ for method, source in pairs(c.get()._methods) do
+ for name, filetypes in pairs(source) do
+ if u.filetype_matches(filetypes, filetype) then
+ registered[method] = registered[method] or {}
+ table.insert(registered[method], name)
+ end
+ end
+ end
+ return registered
+end
+
return M