From 8ea48dddb69c017fa2490eee854fce253f267994 Mon Sep 17 00:00:00 2001 From: Joshua Tye <21010072+catgoose@users.noreply.github.com> Date: Sat, 21 Mar 2026 12:49:53 -0500 Subject: [PATCH] fix: correctly detect nightly api --- lua/colorizer.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/colorizer.lua b/lua/colorizer.lua index a66134c..e416ae7 100644 --- a/lua/colorizer.lua +++ b/lua/colorizer.lua @@ -89,18 +89,16 @@ local const = require("colorizer.constants") local matcher_mod = require("colorizer.matcher") local utils = require("colorizer.utils") ---- State and configuration dynamic holding information table tracking --- Disable vim.lsp.document_color for a buffer. ---- Handles both old (enable, bufnr) and new (enable, filter) Neovim APIs. +--- Handles both old `enable(enable, bufnr)` and new `enable(enable, filter)` Neovim APIs. local function disable_document_color(bufnr) if not vim.lsp.document_color then return end - -- Neovim nightly changed the signature to enable(enable, filter_table). - -- Detect by trying the new API first; fall back to the old one. + -- Try the new filter-table API first; fall back to the old plain-bufnr API. local ok = pcall(vim.lsp.document_color.enable, false, { bufnr = bufnr }) if not ok then - disable_document_color(bufnr) + vim.lsp.document_color.enable(false, bufnr) end end