diff --git a/lua/tailwind-tools/init.lua b/lua/tailwind-tools/init.lua index a0f29e8..0bafeac 100644 --- a/lua/tailwind-tools/init.lua +++ b/lua/tailwind-tools/init.lua @@ -11,6 +11,9 @@ local motions = require("tailwind-tools.motions") M.setup = function(options) config.options = vim.tbl_deep_extend("keep", options, config.options) + state.conceal.enabled = config.options.conceal.enabled + state.color.enabled = config.options.document_color.enabled + if vim.version().minor < 10 and config.options.document_color.kind == "inline" then log.warn( "Neovim nightly is required for inline color hints, using fallback option." @@ -43,14 +46,12 @@ M.setup = function(options) callback = lsp.on_attach, }) - if config.options.conceal.enabled then - vim.api.nvim_create_autocmd("BufEnter", { - group = vim.g.tailwind_tools.conceal_au, - callback = function() - if not state.conceal.enabled then conceal.enable() end - end, - }) - end + vim.api.nvim_create_autocmd("BufEnter", { + group = vim.g.tailwind_tools.conceal_au, + callback = function() + if state.conceal.enabled then conceal.enable() end + end, + }) end return M diff --git a/lua/tailwind-tools/lsp.lua b/lua/tailwind-tools/lsp.lua index 19d4936..9e9acb4 100644 --- a/lua/tailwind-tools/lsp.lua +++ b/lua/tailwind-tools/lsp.lua @@ -92,7 +92,7 @@ M.on_attach = function(args) end, }) - M.color_request(bufnr) + if state.color.enabled then M.color_request(bufnr) end end ---@param bufnr number diff --git a/lua/tailwind-tools/state.lua b/lua/tailwind-tools/state.lua index 83f565e..35fa6c9 100644 --- a/lua/tailwind-tools/state.lua +++ b/lua/tailwind-tools/state.lua @@ -1,5 +1,3 @@ -local config = require("tailwind-tools.config") - return { conceal = { enabled = false, @@ -7,7 +5,7 @@ return { }, color = { request_timer = nil, - enabled = config.options.document_color.enabled, + enabled = false, active_buffers = {}, }, }