diff options
| author | kylo252 <[email protected]> | 2021-07-31 15:04:22 +0200 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-31 13:04:22 +0000 | 
| commit | 8157f50d1308f42f3db1c7f69c226eb2e5c0b796 (patch) | |
| tree | 86632f6bd85ab6400fa657e6e6dc41c751c7dc3c /lua/utils | |
| parent | f36082da0dccf4cfc50dd3fec271b7a5cd41aaea (diff) | |
feat: get null-ls registered providers by filetype (#1186)
Diffstat (limited to 'lua/utils')
| -rw-r--r-- | lua/utils/init.lua | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/lua/utils/init.lua b/lua/utils/init.lua index 9eb29ad8..1685c1ca 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -110,6 +110,32 @@ function utils.is_string(t)    return type(t) == "string"  end +--- Extends a list-like table with the unique values of another list-like table. +--- +--- NOTE: This mutates dst! +--- +--@see |vim.tbl_extend()| +--- +--@param dst list which will be modified and appended to. +--@param src list from which values will be inserted. +--@param start Start index on src. defaults to 1 +--@param finish Final index on src. defaults to #src +--@returns dst +function utils.list_extend_unique(dst, src, start, finish) +  vim.validate { +    dst = { dst, "t" }, +    src = { src, "t" }, +    start = { start, "n", true }, +    finish = { finish, "n", true }, +  } +  for i = start or 1, finish or #src do +    if not vim.tbl_contains(dst, src[i]) then +      table.insert(dst, src[i]) +    end +  end +  return dst +end +  function utils.unrequire(m)    package.loaded[m] = nil    _G[m] = nil | 
