Skip to content

LanguageClient get stuck in starting state with socket transport kind #1586

@SciCed

Description

@SciCed

I'm writing an LSP extension that uses socket transport kind.
When the command in the server option exits with a nonnull code, the LanguageClient gets stuck in start().

const serverOptions = {
	"command": "node",
	"args": ["-e", "process.exit(42)"],
	transport: {
		kind: TransportKind.socket,
		port: 8080
	}
}
const clientOptions = {}

lspClient = new LanguageClient(
	"MylanguageServer",
	"My Language Server",
	serverOptions,
	clientOptions
);

lspClient.onDidChangeState((state) => {
	const states = ["Stopped", "Running", "Starting"];
	console.log(`State change from ${states[state.oldState-1]} to ${states[state.newState-1]}`)
})

lspClient.start();

I expect that the start fails if the command fails.
I tried to investigate. The start() seems to be waiting for a connection before registering on the exit event of the spawned process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions