0

I've just recently started using CoC.nvim for TypeScript development.

Ideally I'd like the error to only be in the location list, which I have working as shown. The sign column and the location list is sufficient for me; I find the in-line error messages to be very distracting.

I've tried setting diagnostics.virtualText but that will display a truncated error message at the end of line 11. It does NOT remove the error text between lines 11 and 12.

How do I get rid of the error message between lines 11 and 12?

vim with coc.vim showing an error message in my code buffer

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
dpw
  • 109
  • 1

2 Answers2

0

coc.nvim configuration is specific.

To configure coc.nvim behavior you have to edit a dedicated config file ~/vimfiles/coc-settings.json.

coc.nvim provide the :CocConfig command to edit the file.

To disable diagnostic you can do:

{
    "diagnostic.enable": false,
}

To only disable diagnostic message you can do:

{
    "diagnostic.enable": true,
    "diagnostic.enableMessage": "never",
}

You can also have a folder specific settings ./.vim/coc-settings.json that you can edit using the :CocLocalConfig command.

You can also disable diagnostic temporarily using the following call

:call CocAction('diagnosticToggle')
Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
  • "diagnostic.enable": false turns off all diagnostics from coc.nvim, not just the red block in question. "diagnostic.enableMessage": false, throws an error of Value is not accepted. Valid values: "always", "jump", "never". Incorrect type. Expected "string". – dpw Dec 22 '23 at 18:24
  • Thanks for the feedback. Could you indicate m where/how do you get the error message about the valid values? The solution is working for me? It is working for you too? – Vivian De Smedt Dec 22 '23 at 18:30
  • 1
    I did :CocInstall coc-json coc-tsserver just like the QuickStart documentation suggests and CoC helpfully displayed the error in my CoC config file. – dpw Dec 22 '23 at 18:36
  • Thanks I can now reproduce the problem (I though coc-json was installed :-|). Is the solution I propose address your problem? – Vivian De Smedt Dec 22 '23 at 18:39
  • 1
    No. See my answer. It wasn't coc.nvim at all. – dpw Dec 22 '23 at 19:02
0

Well, the reason I was struggling to find the answer in the coc.nvim documentation was that the red block in question wasn't being added by CoC.

It turns out I had Plug 'mattn/vim-lsp-settings' in my .vimrc file also and that was the plugin that was creating the red text block.

dpw
  • 109
  • 1
  • It would be helpful to future readers to know if there was a specific setting or option in that plugin that created the virtual text issue so they can disable just that setting. – D. Ben Knoble Dec 22 '23 at 22:32