OmniSharp / OmniSharp/csharp-language-server-protocol

LSP Client Initialize should return after capabilities response and not wait until server Initialized Message

Open
#1,408 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
638
Forks
109
Avg merge
1m
Merged PRs (30d)
2

Description

The Debug Adapter Protocol spec states:

Initialization happens first, and the debug adapter must respond to the initialize request with any capabilities before any further communication can take place.
At any point after the client receives the capabilities, it sends a launch or attach request.
Once the debug adapter is ready to receive configuration from the client, it sends an initialized event to the client. As described above, the client sends zero or more configuration-related requests before sending a configurationDone request.

It is valid for the client to send launch/attach requests prior to initialized being received from the server, and this is required for some DAP extensions (PowerShell), but without getting the client adapter back from the await, this is currently not possible with the client.

Workaround

Add a OnInitialized handler that completes a TaskCompletionSource with the client early, and don't wait on the From or InitializeClient Tasks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the DAP initialization flow, especially the From and InitializeClient tasks and the OnInitialized handler described in the workaround. Compare when capabilities are received with when the client becomes available; done means launch or attach can be sent before the server's initialized event without waiting for that event.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.