From 54bfd0de4f3e947552ce254bfb8cf10d83152fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Sun, 3 Aug 2025 15:03:14 -0700 Subject: [PATCH] docs(lsp): mention default enablement of document colors (#35153) --- runtime/doc/lsp.txt | 11 ++--------- runtime/lua/vim/lsp/document_color.lua | 9 --------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 716e141f62..d2d30f32f9 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -97,6 +97,8 @@ BUFFER-LOCAL DEFAULTS - To opt out of this use |gw| instead of gq, or clear 'formatexpr' on |LspAttach|. - |K| is mapped to |vim.lsp.buf.hover()| unless |'keywordprg'| is customized or a custom keymap for `K` exists. +- Document colors are enabled for highlighting color references in a document. + - To opt out call `vim.lsp.document_color.enable(false, args.buf)` on |LspAttach|. DISABLING DEFAULTS *lsp-defaults-disable* You can remove GLOBAL keymaps at any time using |vim.keymap.del()| or @@ -2126,15 +2128,6 @@ enable({enable}, {bufnr}, {opts}) *vim.lsp.document_color.enable()* Enables document highlighting from the given language client in the given buffer. - You can enable document highlighting when a client attaches to a buffer as - follows: >lua - vim.api.nvim_create_autocmd('LspAttach', { - callback = function(args) - vim.lsp.document_color.enable(true, args.buf) - end - }) -< - To "toggle", pass the inverse of `is_enabled()`: >lua vim.lsp.document_color.enable(not vim.lsp.document_color.is_enabled()) < diff --git a/runtime/lua/vim/lsp/document_color.lua b/runtime/lua/vim/lsp/document_color.lua index c259ec652c..2fdfe2697b 100644 --- a/runtime/lua/vim/lsp/document_color.lua +++ b/runtime/lua/vim/lsp/document_color.lua @@ -286,15 +286,6 @@ end --- Enables document highlighting from the given language client in the given buffer. --- ---- You can enable document highlighting when a client attaches to a buffer as follows: ---- ```lua ---- vim.api.nvim_create_autocmd('LspAttach', { ---- callback = function(args) ---- vim.lsp.document_color.enable(true, args.buf) ---- end ---- }) ---- ``` ---- --- To "toggle", pass the inverse of `is_enabled()`: --- --- ```lua