commit d08b265111548a40924acdbc2dcb2e4cbd901188
parent 628d569a594c762952b769776b9c79221fdb23d0
Author: Maria José Solano <majosolano99@gmail.com>
Date: Sun, 27 Jul 2025 17:11:28 -0700
feat(lsp): enable document_color by default #35086
Diffstat:
3 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
@@ -119,6 +119,8 @@ To remove or override BUFFER-LOCAL defaults, define a |LspAttach| handler: >lua
vim.bo[args.buf].omnifunc = nil
-- Unmap K
vim.keymap.del('n', 'K', { buffer = args.buf })
+ -- Disable document colors
+ vim.lsp.buf.document_color.enable(false, args.buf)
end,
})
<
@@ -2242,6 +2244,10 @@ is_enabled({filter}) *vim.lsp.semantic_tokens.is_enabled()*
==============================================================================
Lua module: vim.lsp.document_color *lsp-document_color*
+This module provides LSP support for highlighting color references in a
+document. Highlighting is enabled by default.
+
+
color_presentation() *vim.lsp.document_color.color_presentation()*
Select from a list of presentations for the color under the cursor.
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
@@ -779,6 +779,7 @@ function lsp._set_defaults(client, bufnr)
if client:supports_method(ms.textDocument_diagnostic) then
lsp.diagnostic._enable(bufnr)
end
+ lsp.document_color.enable(true, bufnr)
end
--- @deprecated
diff --git a/runtime/lua/vim/lsp/document_color.lua b/runtime/lua/vim/lsp/document_color.lua
@@ -1,3 +1,6 @@
+--- @brief This module provides LSP support for highlighting color references in a document.
+--- Highlighting is enabled by default.
+
local api = vim.api
local lsp = vim.lsp
local util = lsp.util