neoclide/coc.nvim

toggleCodeLens only works when codeLens.enable is set to true

shadowwa opened this issue · 1 comments

Result from CocInfo

Describe the bug

A clear and concise description of what the bug is.

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't
reproduce it

  • Create file mini.vim with:

    set nocompatible
    set runtimepath^=~/.vim/plugged/coc.nvim/
    filetype plugin indent on
    syntax on
    set hidden
  • Start (neo)vim with command: vim -u mini.vim

  • Operate vim.

~/.vim/coc-settings.json

{
      "codeLens.enable": false,
      "javascript.implementationsCodeLens.enabled": true,
      "javascript.referencesCodeLens.enabled": true,
      "javascript.referencesCodeLens.showOnAllFunctions": true,
      "suggest.virtualText": true
}

If "codeLens.enable": true is set in coc-settings.json, codeLens virtualtext is displayed correctly by default and if I use :CocCommand document.toggleCodeLens , the virtual text is switched on and off correcty.

Now I wanted to have codeLens disactivated by default and only displayed on demand.
I tried to set "codeLens.enable": false in coc-settings.json but after that :CocCommand document.toggleCodeLens has no effect at all.

Is is a bug or the correct behaviour? and in last case, how can I make coc not displaying codeLens by defaut and keep toggleCodeLens working?

This is expected behavior. The codeLens.enable configuration disables CodeLens feature, which prevents the toggle to work.

Maybe we can add something like inlayHint.display for codeLens to control display or not by default.