File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7676--- @param client vim.lsp.Client The LSP client details when attaching
7777--- @param bufnr integer The buffer that the LSP client is attaching to
7878function M .on_attach (client , bufnr )
79- if client :supports_method (" textDocument/codeLens" , bufnr ) and M .config .features .codelens then
79+ -- TODO: remove check when dropping support for Neovim v0.11
80+ if
81+ client :supports_method (" textDocument/codeLens" , bufnr )
82+ and not vim .lsp .codelens .enable
83+ and M .config .features .codelens
84+ then
8085 vim .lsp .codelens .refresh { bufnr = bufnr }
8186 end
8287
@@ -289,6 +294,8 @@ function M.setup(opts)
289294 if vim .lsp .linked_editing_range then
290295 vim .lsp .linked_editing_range .enable (M .config .features .linked_editing_range ~= false )
291296 end
297+ -- TODO: remove check when dropping support for Neovim v0.11
298+ if vim .lsp .codelens .enable then vim .lsp .codelens .enable (M .config .features .codelens ~= false ) end
292299
293300 -- Set up tracking of signature help trigger characters
294301 local augroup = vim .api .nvim_create_augroup (" track_signature_help_triggers" , { clear = true })
Original file line number Diff line number Diff line change 9898--- Toggle codelens
9999--- @param silent ? boolean if true then don ' t sent a notification
100100function M .codelens (silent )
101- features .codelens = not features .codelens
102- if not features .codelens then vim .lsp .codelens .clear () end
103- ui_notify (silent , (" CodeLens %s" ):format (bool2str (features .codelens )))
101+ -- TODO: remove check when dropping support for Neovim v0.11
102+ if vim .lsp .codelens .enable then
103+ vim .lsp .codelens .enable (not vim .lsp .codelens .is_enabled ())
104+ ui_notify (silent , (" CodeLens %s" ):format (bool2str (vim .lsp .codelens .is_enabled ())))
105+ else
106+ features .codelens = not features .codelens
107+ if not features .codelens then vim .lsp .codelens .clear () end
108+ ui_notify (silent , (" CodeLens %s" ):format (bool2str (features .codelens )))
109+ end
104110end
105111
106112--- Toggle automatic signature help
You can’t perform that action at this time.
0 commit comments