summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/utils
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
commit977990584331307dd5e71ebbbbd6b45b9c961996 (patch)
treea8b3d78e80f586da192a576dd678e2fbc8ac8e00 /.config/nvim/lua/utils
parent99d00f47fe780dbb021149db2f93d202a2b8b025 (diff)
Updates to nvim lsp
Diffstat (limited to '.config/nvim/lua/utils')
-rw-r--r--.config/nvim/lua/utils/init.lua50
1 files changed, 2 insertions, 48 deletions
diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua
index 1176e3b..3cea053 100644
--- a/.config/nvim/lua/utils/init.lua
+++ b/.config/nvim/lua/utils/init.lua
@@ -99,57 +99,11 @@ function utils.reload_config()
vim.cmd ":PackerCompile"
vim.cmd ":PackerInstall"
-- vim.cmd ":PackerClean"
+ local null_ls = require "lsp.null-ls"
+ null_ls.setup(vim.bo.filetype, { force_reload = true })
Log:get_default().info "Reloaded configuration"
end
-function utils.check_lsp_client_active(name)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == name then
- return true
- end
- end
- return false
-end
-
-function utils.get_active_client_by_ft(filetype)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == options.lang[filetype].lsp.provider then
- return client
- end
- end
- return nil
-end
-
--- TODO: consider porting this logic to null-ls instead
-function utils.get_supported_linters_by_filetype(filetype)
- local null_ls = require "null-ls"
- local matches = {}
- for _, provider in pairs(null_ls.builtins.diagnostics) do
- if vim.tbl_contains(provider.filetypes, filetype) then
- local provider_name = provider.name
-
- table.insert(matches, provider_name)
- end
- end
-
- return matches
-end
-
-function utils.get_supported_formatters_by_filetype(filetype)
- local null_ls = require "null-ls"
- local matches = {}
- for _, provider in pairs(null_ls.builtins.formatting) do
- if provider.filetypes and vim.tbl_contains(provider.filetypes, filetype) then
- -- table.insert(matches, { provider.name, ft })
- table.insert(matches, provider.name)
- end
- end
-
- return matches
-end
-
function utils.unrequire(m)
package.loaded[m] = nil
_G[m] = nil