neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.43k stars 953 forks source link

toggleCodeLens only works when codeLens.enable is set to true #5110

Closed shadowwa closed 1 month ago

shadowwa commented 2 months ago

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

~/.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?

fannheyward commented 2 months ago

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.