@@ -151,18 +151,17 @@ function M.encode_pos(line, col, winnr) return bit.bor(bit.lshift(line, 16), bit
151151function M .decode_pos (c ) return bit .rshift (c , 16 ), bit .band (bit .rshift (c , 6 ), 1023 ), bit .band (c , 63 ) end
152152
153153--- Get a list of registered null-ls providers for a given filetype
154- --- @param filetype string the filetype to search null-ls for
155- --- @param params table ? optional parameters to use for checking ` runtime_condition`
154+ --- @param params table parameters to use for null-ls providers
156155--- @return table # a table of null-ls sources
157- function M .null_ls_providers (filetype , params )
156+ function M .null_ls_providers (params )
158157 local registered = {}
159158 -- try to load null-ls
160159 local sources_avail , sources = pcall (require , " null-ls.sources" )
161160 if sources_avail then
162161 -- get the available sources of a given filetype
163- for _ , source in ipairs (sources .get_available (filetype )) do
162+ for _ , source in ipairs (sources .get_available (params . filetype )) do
164163 -- get each source name
165- local runtime_condition = params and vim .tbl_get (source , " generator" , " opts" , " runtime_condition" )
164+ local runtime_condition = vim .tbl_get (source , " generator" , " opts" , " runtime_condition" )
166165 for method in pairs (source .methods ) do
167166 local source_activated = true
168167 if runtime_condition then -- try to calculate runtime_condition with supported parameters
@@ -182,13 +181,11 @@ function M.null_ls_providers(filetype, params)
182181end
183182
184183--- Get the null-ls sources for a given null-ls method
185- --- @param filetype string the filetype to search null-ls for
186- --- @param method string the null-ls method (check null-ls documentation for available methods )
187- --- @param params table ? optional parameters to use for checking ` runtime_condition`
184+ --- @param params table parameters to use for checking null-ls sources
188185--- @return string[] # the available sources for the given filetype and method
189- function M .null_ls_sources (filetype , method , params )
186+ function M .null_ls_sources (params )
190187 local methods_avail , methods = pcall (require , " null-ls.methods" )
191- return methods_avail and M .null_ls_providers (filetype , params )[methods .internal [method ]] or {}
188+ return methods_avail and M .null_ls_providers (params )[methods .internal [params . method ]] or {}
192189end
193190
194191--- A helper function for decoding statuscolumn click events with mouse click pressed, modifier keys, as well as which signcolumn sign was clicked if any
0 commit comments