coc-omnisharp icon indicating copy to clipboard operation
coc-omnisharp copied to clipboard

Multiple instances of the same autocompletion recommendation

Open bratpeki opened this issue 3 years ago • 8 comments

Preview:

image

Issue: Vim instantiates 4 instances of the same recommendation for autocompletion. Platform: Windows 10 Editor: GVim 8.2

bratpeki avatar Mar 09 '21 11:03 bratpeki

Update:

image

Vim offers quadruple keywords (using, using, using, using) and single statements (using).

bratpeki avatar Mar 09 '21 11:03 bratpeki

When I tried omisharp-roslyn v1.37.6, the duplication is 2, not 4. I also tried below, and got the same result.

{
  "languageserver": {
    "csharp": {
      "command": "/opt/omnisharp-1.37.7/run",
      "args": ["-lsp"],
      "filetypes": ["cs"]
    }
  }
}

:CocList sources shows duplicated sources.

  * snippets-source        [S]        $          90  snippets
  * snippets               [S]                   90
  * cs-4                   [LS]       .          99
  * cs-3                   [LS]       .          99
  * cs-2                   [LS]       .          99
  * cs-1                   [LS]       .          99
  * file                   [F]        /          10
  * buffer                 [B]                   1
  * around                 [A]                   1

kit494way avatar Mar 11 '21 04:03 kit494way

😱 it spawned 4 language servers

yatli avatar Mar 11 '21 05:03 yatli

This may be a problem of coc.nvim. I tried with coc.nvim v0.0.78, then this issue did not happen. But with coc.nvim v0.0.80, this issue happened. I tried omnisharp-vim (this also uses omnisharp-roslyn), but the issue like this did not happen.

kit494way avatar Mar 13 '21 02:03 kit494way

When I tried omisharp-roslyn v1.37.6, the duplication is 2, not 4. I also tried below, and got the same result.

{
  "languageserver": {
    "csharp": {
      "command": "/opt/omnisharp-1.37.7/run",
      "args": ["-lsp"],
      "filetypes": ["cs"]
    }
  }
}

:CocList sources shows duplicated sources.

  * snippets-source        [S]        $          90  snippets
  * snippets               [S]                   90
  * cs-4                   [LS]       .          99
  * cs-3                   [LS]       .          99
  * cs-2                   [LS]       .          99
  * cs-1                   [LS]       .          99
  * file                   [F]        /          10
  * buffer                 [B]                   1
  * around                 [A]                   1

Yup, disabling the three other language servers results in single autocompletion results. Any idea why multiple instances may be starting up?

bratpeki avatar Mar 13 '21 10:03 bratpeki

This change of coc.nvim is related. https://github.com/neoclide/coc.nvim/commit/190ebfcef93bad77407225ca17072339570f2ddb

It seems like omnisharp-roslyn send multiple client/registerCapability requests, and multiple sources are added. Before the change of coc.nvim, multiple sources are created but only one source is added.

kit494way avatar Mar 14 '21 11:03 kit494way

Having the exact same problem. I'm also using windows. Let me know if you find a solution please.

C-Rmoser avatar Mar 15 '21 16:03 C-Rmoser

Since I didn't manage to solve the problem I wrote a small function to disable the duplicate sources and put it in my vimrc.

" Toggle duplicate LS sources function Disable_ls_duplicates() :call CocAction('toggleSource', 'cs-2') :call CocAction('toggleSource', 'cs-3') :call CocAction('toggleSource', 'cs-4') endfunction

" Map the function call nnoremap dld :call Disable_ls_duplicates()<CR>

C-Rmoser avatar Mar 16 '21 18:03 C-Rmoser