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

Language server doesn't work with Visual Studio LSP client #282

Open
racz16 opened this issue May 10, 2023 · 0 comments
Open

Language server doesn't work with Visual Studio LSP client #282

racz16 opened this issue May 10, 2023 · 0 comments

Comments

@racz16
Copy link

racz16 commented May 10, 2023

Installed products

  • Visual Studio: Community 2022 (17.5.5)

Description

I would like to use a Node-based language server with a Visual Studio LSP client. I'm trying to use the Visual Studio and VS Code samples since this should be the easiest way to start, but it doesn't work.

Steps to recreate

  1. Download the VS Code extension samples
  2. Build the server of the lsp-sample
  3. Download the Visual Studio Extensibility Samples
  4. Change the ActivateAsync function in the LanguageServerProtocol sample to run the server
public async Task<Connection> ActivateAsync(CancellationToken token)
{
    Process process = new Process
    {
        StartInfo = new ProcessStartInfo
        {
            FileName = "node",
            Arguments = "server.js --stdio",
            RedirectStandardInput = true,
            RedirectStandardOutput = true,
            RedirectStandardError = true,
            UseShellExecute = false,
            CreateNoWindow = true
        }
    };

    if (process.Start())
    {
        return new Connection(process.StandardOutput.BaseStream, process.StandardInput.BaseStream);
    }

    return null;
}
  1. Build the LanguageServerProtocol sample
  2. Run the extension, open the TestFiles folder, and open one of the files

Current behavior

When I open the file, I get the following error:

ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete.

If I set the CreateNoWindow to false I can see opening the terminal, but it closes immediately.

Expected behavior

When I press ctrl+space in the file, I should see the code completion items from the server.

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

No branches or pull requests

1 participant