Skip to content

Add lsp mapping service #11673

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

ryzngard
Copy link
Contributor

@ryzngard ryzngard commented Mar 28, 2025

This is mostly unintersting. The work in typescript will be to call to existing RazorMapToDocument{Ranges, Edits}Endpoint and translate the responses accordingly. Since this is calling from the Roslyn language server it doesn't know the mapping from csharp document uri to razor uri so we can't reuse the same params to call the endpoints "directly" (as in no translation logic in typescript).

Fixes #9369

@ryzngard ryzngard requested a review from a team as a code owner March 28, 2025 19:42
Debug.Assert(response.Spans.Length == spans.Count(), "The number of mapped spans should match the number of input spans.");
Debug.Assert(response.Ranges.Length == spans.Count(), "The number of mapped ranges should match the number of input spans.");

var builder = ImmutableArray.CreateBuilder<RazorMappedSpanResult>(response.Spans.Length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a PooledArrayBuilder<RazorMappedSpanResult>.

builder.Add(new RazorMappedSpanResult(filePath, range.ToLinePositionSpan(), span.ToTextSpan()));
}

return builder.ToImmutable();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use DrainToImmutable since you set the capacity to the exact length.

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

Successfully merging this pull request may close these issues.

Find All References - Showing razor__virtual.cs instead of actual References
3 participants