diff --git a/README.md b/README.md index 41a011acb4..d77ca47786 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,11 @@ lvim.lsp.diagnostics.virtual_text = false -- See the full default list `:lua print(vim.inspect(lvim.lsp.override))` vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) +-- remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!! +-- LvimInfo` lists which server(s) are skiipped for the current filetype +local tbl = require "lvim.utils.table" +tbl.remove(lvim.lsp.automatic_configuration.skipped_servers, "tailwindcss") + -- set a formatter, this will override the language server formatting capabilities (if it exists) local formatters = require "lvim.lsp.null-ls.formatters" formatters.setup { diff --git a/lua/lvim/utils/table.lua b/lua/lvim/utils/table.lua index 1ac5949ea4..efa3eef049 100644 --- a/lua/lvim/utils/table.lua +++ b/lua/lvim/utils/table.lua @@ -21,4 +21,18 @@ function Table.contains(t, predicate) return Table.find_first(t, predicate) ~= nil end +-- Remove item from table by it's value +-- @param t The table +-- @param value The item to remove +-- @return True if item was removed, false otherwise +function Table.remove(t, value) + for i, v in ipairs(t) do + if v == value then + table.remove(t, i) + return true + end + end + return false +end + return Table diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 61c2f9151b..8b496dfd77 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -93,9 +93,8 @@ lvim.builtin.treesitter.highlight.enabled = true -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!! -- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype --- vim.tbl_map(function(server) --- return server ~= "emmet_ls" --- end, lvim.lsp.automatic_configuration.skipped_servers) +-- local tbl = require "lvim.utils.table" +-- tbl.remove(lvim.lsp.automatic_configuration.skipped_servers, "emmet_ls") -- -- you can set a custom on_attach function that will be used for all the language servers -- -- See diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index c6bf470ece..3540f5c9c9 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -108,9 +108,8 @@ lvim.builtin.treesitter.highlight.enabled = true -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!! -- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype --- vim.tbl_map(function(server) --- return server ~= "emmet_ls" --- end, lvim.lsp.automatic_configuration.skipped_servers) +-- local tbl = require "lvim.utils.table" +-- tbl.remove(lvim.lsp.automatic_configuration.skipped_servers, "emmet_ls") -- -- you can set a custom on_attach function that will be used for all the language servers -- -- See