diff options
author | Christian Chiarulli <[email protected]> | 2021-07-25 00:13:35 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-25 00:13:35 -0400 |
commit | 1c3b80d0411e9a2a3594bde92ccecb8908402bf7 (patch) | |
tree | 796ddbd3c99c6f2b33191f98513a0ff2d15f235c /lua/lsp/init.lua | |
parent | 98f8a77819670ce6012216e01885c135a6d3a289 (diff) |
implement language overrides (#1081)
Co-authored-by: Chris <[email protected]>
Diffstat (limited to 'lua/lsp/init.lua')
-rw-r--r-- | lua/lsp/init.lua | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index b0511f0e..3f61a1e0 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -272,13 +272,46 @@ require("lv-utils").define_augroups { }, } +local function is_table(t) + return type(t) == "table" +end + +local function is_string(t) + return type(t) == "string" +end + +local function has_value(tab, val) + for index, value in ipairs(tab) do + if value == val then + return true + end + end + + return false +end + function lsp_config.setup(lang) - lang_server = lvim.lang[lang].lsp + local lang_server = lvim.lang[lang].lsp require("lsp.null-ls").setup "python" local provider = lang_server.provider if require("lv-utils").check_lsp_client_active(provider) then return end + + local overrides = lvim.lsp.override + + if is_table(overrides) then + if has_value(overrides, lang) then + return + end + end + + if is_string(overrides) then + if overrides == lang then + return + end + end + require("lspconfig")[provider].setup(lang_server.setup) require("lsp.null-ls").setup(lang) end |