This commit is contained in:
David Wengier 2024-09-06 11:51:32 +10:00
Родитель d37da8b3de
Коммит b69b08cbe3
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -165,7 +165,6 @@ internal static class IServiceCollectionExtensions
services.AddHandler<WorkspaceSpellCheckEndpoint>();
}
services.AddHandlerWithCapabilities<DocumentDidChangeEndpoint>();
services.AddHandler<DocumentDidCloseEndpoint>();
services.AddHandler<DocumentDidOpenEndpoint>();

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

@ -39,12 +39,15 @@ internal sealed class LspCSharpSpellCheckRangeProvider(
delegatedParams,
cancellationToken).ConfigureAwait(false);
if (delegatedResponse is null)
if (delegatedResponse is not [_, ..] response)
{
return [];
}
using var ranges = new PooledArrayBuilder<SpellCheckRange>();
// Most common case is we'll get one report back from Roslyn, so we'll use that as the initial capacity.
var initialCapacity = response[0].Ranges?.Length ?? 4;
using var ranges = new PooledArrayBuilder<SpellCheckRange>(initialCapacity);
foreach (var report in delegatedResponse)
{
if (report.Ranges is not { } csharpRanges)
@ -69,6 +72,6 @@ internal sealed class LspCSharpSpellCheckRangeProvider(
}
}
return ranges.ToImmutable();
return ranges.DrainToImmutable();
}
}