Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update language server to use named pipe client #6351

Merged
merged 7 commits into from
Sep 14, 2023

Conversation

beccamc
Copy link
Contributor

@beccamc beccamc commented Sep 12, 2023

Current communication between client and server is writing to STDOUT. This makes the connection vulnerable to any code in the process writing to stdout stream and corrupting the data.

This PR uses a named pipe...

  • Start a child process that kicks off the rolsyn language server. The language server will start the named pipe.
  • Listen for the name of the named pipe to arrive over stdin/out.
  • When the name arrives, connect to the pipe using net.createConnection
  • When the connection is complete, pass the resulting MessageReader/MessageWriter to the VS Code language client.

NOTE: Need server PR to go in and then update the server version in this PR.

This has been tested on both windows and mac.

@beccamc beccamc requested a review from a team as a code owner September 12, 2023 19:26
@beccamc beccamc changed the title update language server to use client named pipe update language server to use named pipe Sep 12, 2023
@beccamc beccamc changed the title update language server to use named pipe Update language server to use named pipe client Sep 12, 2023

// Wait for the server to send back the name of the pipe to connect to.
_channel.appendLine('waiting for named pipe information from server...');
const pipeConnectionInfo = await namedPipeConnectionPromise;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably add a timeout here and show an error toast if it times out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's a good idea. Should probably do it for both receiving the name and making the named pipe connection

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to throw an error, which will log. The "couldn't create connection" toast will show.
image

@beccamc beccamc merged commit 1d20255 into dotnet:main Sep 14, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants