diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index c7098bc9af..0414631204 100644 --- 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 index 2a4b96c8a4..c56aecbb0e 100644 --- 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 index d37c5ed475..c259ec652c 100644 --- 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