Skip to content

Commit

Permalink
Fix spell check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz committed Dec 11, 2023
1 parent ae0914c commit cd8cf20
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,14 @@ private async Task AddCSharpSpellCheckRangesAsync(List<SpellCheckRange> ranges,

// We need to map the start index to produce results, and we validate that we can map the end index so we don't have
// squiggles that go from C# into Razor/Html.
if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentIndex) &&
_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var _3))
if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentStartIndex) &&
_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var hostDocumentEndIndex))
{
ranges.Add(new(kind, hostDocumentIndex, length));
var mappedLength = hostDocumentEndIndex - hostDocumentStartIndex;
if (mappedLength > 0)
{
ranges.Add(new(kind, hostDocumentStartIndex, mappedLength));
}
}

absoluteCSharpStartIndex += length;
Expand Down

0 comments on commit cd8cf20

Please sign in to comment.