Ensure that the `RazorLanguageServerHost` is disposed

This commit is contained in:
Dustin Campbell 2024-06-06 10:10:04 -07:00
Родитель 29a48005ce
Коммит b5158d7b7b
1 изменённых файлов: 18 добавлений и 15 удалений

Просмотреть файл

@ -128,6 +128,24 @@ internal class RazorLanguageServerClient(
}
}
private async Task EnsureCleanedUpServerAsync()
{
if (_host is null)
{
// Server was already cleaned up
return;
}
if (_host is not null)
{
// Server still hasn't shutdown, wait for it to shutdown
await _host.WaitForExitAsync().ConfigureAwait(false);
_host.Dispose();
_host = null;
}
}
internal static IEnumerable<Lazy<ILanguageClient, LanguageServer.Client.IContentTypeMetadata>> GetRelevantContainedLanguageClientsAndMetadata(ILanguageServiceBroker2 languageServiceBroker)
{
var relevantClientAndMetadata = new List<Lazy<ILanguageClient, LanguageServer.Client.IContentTypeMetadata>>();
@ -186,21 +204,6 @@ internal class RazorLanguageServerClient(
_lspServerActivationTracker.Activated();
}
private async Task EnsureCleanedUpServerAsync()
{
if (_host is null)
{
// Server was already cleaned up
return;
}
if (_host is not null)
{
// Server still hasn't shutdown, wait for it to shutdown
await _host.WaitForExitAsync().ConfigureAwait(false);
}
}
public Task AttachForCustomMessageAsync(JsonRpc rpc) => Task.CompletedTask;
public Task<InitializationFailureContext?> OnServerInitializeFailedAsync(ILanguageClientInitializationInfo initializationState)