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

Explaining why some LSP needs plugins #4993

Closed metal3d closed 2 months ago

metal3d commented 2 months ago

Is your feature request related to a problem? Please describe. I'm using Mason to install some LSP and sometimes they need plugins for some reasons that a standard user don't understand. For example, using sonarlint-language-server

"languageserver": {
    "sonarlint": {
      "command": "~/.local/share/nvim/mason/bin/sonarlint-language-server",
      "args": [
        "-stdio",
        "-analyzers",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonariac.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarlintomni",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarphp.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarpython.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarxml.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarjava.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarcfamily.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonargo.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarjs.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonartext.jar",
        "~/.local/share/nvim/mason/share/sonarlint-analyzers/sonarhtml.jar"
      ],
      "filetypes": [
        "go",
        "java",
        "javascript",
        "php",
        "python",
        "xml",
        "yaml",
        "html"
      ],
      "initializationOptions": {
        "extraArgs": [
          "-Dsonarlint.ls.javaHome=/usr/lib/jvm/java-19-openjdk-amd64"
        ]
      },
      "shell": true
    },

Checking the outputs from CocList services, I see that the LSP is running. But it doesn't give any information on the buffer.

Same for helm-ls.

For both, I needed to install a plugin (vim-helm, sonarlint.vim...)

It's unclear to know if we misconfigured the LSP and why nothing appears on the current file.

Note that some others LSP are OK, for example, even without coc-go, I can configure gopls in the CoC settings and it works.

Describe the solution you'd like Maybe explaining why some LSP are running but needs specific plugin to display information. Or, if there is actually a configuration to fix this, provide the explanation ;)

Describe alternatives you've considered At this time, no alternatives. I probably misunderstand some mechanisms of LSP and CoC.

fannheyward commented 2 months ago

First, sonarlint.nvim didn't use coc.nvim but nvim's built-in language client.

You don't need extensions to run language server with coc.nvim, just setup with languageserver in coc-settings.json is enough. But some servers, for example sonarlint-language-server, implements some off-spec requests like sonarlint/getJavaConfig, you need an extension to send off-spec request and handle the response.