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

feat(lsp): add --pipe parameter #76351

Merged
merged 5 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static Task<ExportProvider> CreateExportProviderAsync(
DevKitDependencyPath: devKitDependencyPath,
RazorSourceGenerator: null,
RazorDesignTimePath: null,
ExtensionLogDirectory: string.Empty);
ExtensionLogDirectory: string.Empty,
ServerPipeName: null);
var extensionManager = ExtensionAssemblyManager.Create(serverConfiguration, loggerFactory);
assemblyLoader = new CustomExportAssemblyLoader(extensionManager, loggerFactory);
return ExportProviderBuilder.CreateExportProviderAsync(extensionManager, assemblyLoader, devKitDependencyPath, cacheDirectory, loggerFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ static async Task RunAsync(ServerConfiguration serverConfiguration, Cancellation

var languageServerLogger = loggerFactory.CreateLogger(nameof(LanguageServerHost));

var (clientPipeName, serverPipeName) = CreateNewPipeNames();
string clientPipeName;
string serverPipeName;
if (serverConfiguration.ServerPipeName is null)
{
(clientPipeName, serverPipeName) = CreateNewPipeNames();
}
else
{
(clientPipeName, serverPipeName) = (serverConfiguration.ServerPipeName, serverConfiguration.ServerPipeName);
}
616b2f marked this conversation as resolved.
Show resolved Hide resolved

var pipeServer = new NamedPipeServerStream(serverPipeName,
PipeDirection.InOut,
maxNumberOfServerInstances: 1,
Expand Down Expand Up @@ -224,6 +234,12 @@ static CliRootCommand CreateCommandLineParser()
Required = false
};

var serverPipeNameOption = new CliOption<string?>("--pipe")
{
Description = "The name of the pipe used to connect to the server.",
616b2f marked this conversation as resolved.
Show resolved Hide resolved
616b2f marked this conversation as resolved.
Show resolved Hide resolved
Required = false,
};

var rootCommand = new CliRootCommand()
{
debugOption,
Expand All @@ -236,7 +252,8 @@ static CliRootCommand CreateCommandLineParser()
devKitDependencyPathOption,
razorSourceGeneratorOption,
razorDesignTimePathOption,
extensionLogDirectoryOption
extensionLogDirectoryOption,
serverPipeNameOption
};
rootCommand.SetAction((parseResult, cancellationToken) =>
{
Expand All @@ -250,6 +267,7 @@ static CliRootCommand CreateCommandLineParser()
var razorSourceGenerator = parseResult.GetValue(razorSourceGeneratorOption);
var razorDesignTimePath = parseResult.GetValue(razorDesignTimePathOption);
var extensionLogDirectory = parseResult.GetValue(extensionLogDirectoryOption)!;
var serverPipeName = parseResult.GetValue(serverPipeNameOption);

var serverConfiguration = new ServerConfiguration(
LaunchDebugger: launchDebugger,
Expand All @@ -261,6 +279,7 @@ static CliRootCommand CreateCommandLineParser()
DevKitDependencyPath: devKitDependencyPath,
RazorSourceGenerator: razorSourceGenerator,
RazorDesignTimePath: razorDesignTimePath,
ServerPipeName: serverPipeName,
ExtensionLogDirectory: extensionLogDirectory);

return RunAsync(serverConfiguration, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ internal record class ServerConfiguration(
string? DevKitDependencyPath,
string? RazorSourceGenerator,
string? RazorDesignTimePath,
string? ServerPipeName,
string ExtensionLogDirectory);

internal class LogConfiguration
Expand Down
Loading