OmniSharp / omnisharp-roslyn

OmniSharp server (HTTP, STDIO) based on Roslyn workspaces
MIT License
1.78k stars 419 forks source link

Duplicate `client/registerCapability` requests #2119

Open kit494way opened 3 years ago

kit494way commented 3 years ago

It seems like client/registerCapability requests with same id are sent multiple times from v1.37.7.

There is a warning from OmniSharp which is not output in v1.37.6.

[Warn - 11:58:26 PM] OmniSharp.Extensions.LanguageServer.Server.LspServerOutputFilter: Tried to send request or notification before initialization was completed and will be sent later OmniSharp.Extensions.JsonRpc.Client.OutgoingNotification | @Request='OmniSharp.Extensions.JsonRpc.Client.OutgoingNotification'

When I tried to use omnisharp-roslyn from neovim with coc-omnisharp, I have the issue https://github.com/coc-extensions/coc-omnisharp/issues/53 . I think duplicate client/registerCapability requests is the one of the causes of the issue.

CGNonofr commented 3 years ago

I have the same issue, every capability is registered twice.

It has consequences on the client side: Capture d’écran du 2021-09-17 15-44-51

C-Rmoser commented 3 years ago

Same issue here, any news on this one?

janivo commented 3 years ago

Same issue here.

Additionally, the omnisharp server sends diagnostics to the client even though it has not send initialized yet. Might be also related to this problem.

Namanl2001 commented 8 months ago

This is still an issue in omnisharp v1.39.11 below is the workaround

const existingRegistrations = new Set<string>()
...
if (message.method === 'client/registerCapability'){
    message.params.registrations = message.params.registrations.filter((registration:any) => {
         return !existingRegistrations.has(registration.id)
    })
    message.params.registrations.forEach((registration:any) => {
       existingRegistrations.add(registration.id)
     })
}