summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp/init.lua
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/lsp/init.lua
parent99d00f47fe780dbb021149db2f93d202a2b8b025 (diff)
Updates to nvim lsp
Diffstat (limited to '.config/nvim/lua/lsp/init.lua')
-rw-r--r--.config/nvim/lua/lsp/init.lua28
1 files changed, 21 insertions, 7 deletions
diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua
index 0c830f5..067375f 100644
--- a/.config/nvim/lua/lsp/init.lua
+++ b/.config/nvim/lua/lsp/init.lua
@@ -1,10 +1,14 @@
local M = {}
local Log = require "core.log"
+
function M.config()
vim.lsp.protocol.CompletionItemKind = options.lsp.completion.item_kind
for _, sign in ipairs(options.lsp.diagnostics.signs.values) do
- vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
+ vim.fn.sign_define(
+ sign.name,
+ { texthl = sign.name, text = sign.text, numhl = sign.name }
+ )
end
require("lsp.handlers").setup()
@@ -107,10 +111,18 @@ function M.common_on_init(client, bufnr)
end
local formatters = options.lang[vim.bo.filetype].formatters
- if not vim.tbl_isempty(formatters) and formatters[1]["exe"] ~= nil and formatters[1].exe ~= "" then
+ if
+ not vim.tbl_isempty(formatters)
+ and formatters[1]["exe"] ~= nil
+ and formatters[1].exe ~= ""
+ then
client.resolved_capabilities.document_formatting = false
Log:get_default().info(
- string.format("Overriding language server [%s] with format provider [%s]", client.name, formatters[1].exe)
+ string.format(
+ "Overriding language server [%s] with format provider [%s]",
+ client.name,
+ formatters[1].exe
+ )
)
end
end
@@ -127,21 +139,23 @@ function M.common_on_attach(client, bufnr)
end
function M.setup(lang)
+ local lsp_utils = require "lsp.utils"
local lsp = options.lang[lang].lsp
- if require("utils").check_lsp_client_active(lsp.provider) then
+ if lsp_utils.is_client_active(lsp.provider) then
return
end
local overrides = options.lsp.override
-
if type(overrides) == "table" then
if vim.tbl_contains(overrides, lang) then
return
end
end
- local lspconfig = require "lspconfig"
- lspconfig[lsp.provider].setup(lsp.setup)
+ if lsp.provider ~= nil and lsp.provider ~= "" then
+ local lspconfig = require "lspconfig"
+ lspconfig[lsp.provider].setup(lsp.setup)
+ end
end
return M