question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stdio support broken on Windows?

See original GitHub issue

I have the following code that executes my language server and uses stdio as TransportKind: https://github.com/itmuckel/factor-lsp/blob/master/lsp-sample/client/src/extension.ts

        let serverOptions: ServerOptions = {
		command: "C:/factor/factor-lsp/factor-lsp.exe",
		transport: TransportKind.stdio,
	};

	// Options to control the language client
	let clientOptions: LanguageClientOptions = {
		// Register the server for plain text documents
		documentSelector: [{ scheme: 'file', language: 'Factor' }],
		synchronize: {
			// Notify the server about file changes to '.clientrc files contained in the workspace
			fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
		}
	};

	// Create the language client and start the client.
	client = new LanguageClient(
		'languageServerExample',
		'Language Server Example',
		serverOptions,
		clientOptions
	);

	// Start the client. This will also launch the server
	client.start();

This works on Linux (Ubuntu). My LS gets the “initialize” and “shutdown” requests, but no responses come back from it.
On Windows my LS won’t even get the requests from the Client.

Anyone else experienced this and/or have some ideas how to fix this? 🤔

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Jun 26, 2020

Does the LSP sample work for you under Windows using stdio. https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample

0reactions
xttttcommented, Aug 5, 2020

@dbaeumer This issue may be related to this phenomenon. I wrote a C program.

#include <stdio.h>
int main() {
   printf("test\n");
   return 0;
}

And I wrote a nodejs program to call this C program.

var cp = require('child_process');
var child = cp.spawn("a.exe");
child.stdout.on('data', function (data) {
    console.log(data);
});

when i get stdout output, \n characters will be replaced with \r\n

(0d 0a) means \r\n image

PS D:\Code> node index.js
<Buffer 74 65 73 74 0d 0a>

The same problem occurs in vscode extension.

image

LSP Message The header part includes the ‘\r\n’ separating the header and content part. When \n is converted to \r\n, the original \r\n is changed to \r\r\n. As a result, the format is incorrect, and the connection using the stdio process fails.

I don’t know why this happened, but it seems to be related to this issue. Can someone please explain it to me?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Repair Stdio.h Issues (How to Download and Fix)
How to Fix stdio.h Errors in 3 Steps (Time to complete: ~5-15 minutes) · Step 1: Restore your PC back to the latest...
Read more >
stdio.h errors - MSDN - Microsoft
I am using VS .NET 2005 Acemdemic Edition, and have been trying to learn C/C++ and everything I do works fine .
Read more >
Cannot open include file: 'stdio.h' - Visual Studio Community ...
Resolve: Run 'Visual Studio Installer'. Click button 'Modify'. Select 'Desktop development with C++'.
Read more >
July 2022 (version 1.70) - Visual Studio Code
Update 1.70.3: This update is only available for Windows 7 users and is the last release supporting Windows 7. Downloads: Windows: User System...
Read more >
Studio - InVision Support
Why does panning in Studio for Windows seem less smooth than it used to? ... broken auto-links for certain animations you created prior...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found