neoclide / coc.nvim

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

FEAT: Disable all formatting and linting except for what is output by the `languageservers` in coc-settings.json #5034

Closed tecfu closed 3 weeks ago

tecfu commented 3 weeks ago

As a coc.nvim user, I want to stop using coc extensions for linting/formatting because they may go unmaintained or become inferior to language servers that do not have a coc-extension.

Instead I want to exclusively use the languageservers property in coc-settings.json to invoke external language servers.

However, I notice that coc has some built-in linting/formatting that shows up in :CocDiagnostics. I want to be able to disable all formatting and linting except for what is output by the languageservers I have enabled.

For example, even with no extensions and no language servers loaded, coc.nvim will still show diagnostics for typescript files with ts as the language server origin. I don't want this.

Below is an example of what I'm trying to accomplish through configuration. I've seen a bunch of people chasing other libraries that are newer than coc.nvim because they don't understand that they can simply add language servers without using coc extensions. I think more emphasis is needed on promoting this option.

{
  "languageserver": {
    "vtsls": {
      "filetypes": ["typescript"],
      "command": "vtsls",
      "args": ["--stdio"]
    },
    "external-coc-efm-langserver-ts": {
      "filetypes": ["typescript"],
      "command": "efm-langserver",
      "args": [],
      "rootPatterns": [".git/"],
      "trace.server": "verbose",
      "initializationOptions": {
        "documentFormatting": true,
        "documentRangeFormatting": true,
        "documentSymbol": true,
        "codeAction": true,
        "completion": true
      }
    }
  }
}
tecfu commented 3 weeks ago

Another thought is to create a CocCommand that shows the enabled sources of linting/formatting for each filetype.

tecfu commented 3 weeks ago

This problem isn't what I thought it was.

The problem is that CocDiagnostics doesn't always show the the key in the languageservers property of coc-settings.json value as the language server name.

That confuses the user as to which language server is showing the output.