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

Cohost wireup #11412

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Cohost wireup #11412

wants to merge 5 commits into from

Conversation

chsienki
Copy link
Contributor

@chsienki chsienki commented Jan 23, 2025

This wires up tooling to use the generator as the provider of documents.

It enables the generator in the cohosting tests and skips various tests that now fail (mostly because the mapping from the source-generated URI document format is missing back to the original razor doc).

I've kept some of the generation logic in tooling around as its still used by the formatting engine, but I've moved all of those parts under !#FORMAT_FUSE so we can verify that's all they are used for.

It also updates the cohosting flag in VS to completely disable the original language server if it's turned on, so there is only two states: co-hosting or not.

@chsienki chsienki added area-compiler Umbrella for all compiler issues New Feature Cohosting labels Jan 23, 2025
Copy link
Member

@jjonescz jjonescz left a comment

Choose a reason for hiding this comment

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

Compiler LGTM


namespace Microsoft.NET.Sdk.Razor.SourceGenerators
{
internal class RazorGeneratorResult(IReadOnlyList<TagHelperDescriptor> tagHelpers, ImmutableDictionary<string, (string hintName, RazorCodeDocument document)> documents)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
internal class RazorGeneratorResult(IReadOnlyList<TagHelperDescriptor> tagHelpers, ImmutableDictionary<string, (string hintName, RazorCodeDocument document)> documents)
internal sealed class RazorGeneratorResult(IReadOnlyList<TagHelperDescriptor> tagHelpers, ImmutableDictionary<string, (string hintName, RazorCodeDocument document)> documents)

{
var (documents, tagHelpers) = pair;

var documentDictionary = documents.Select(p => new KeyValuePair<string, (string, RazorCodeDocument)>(p.codeDocument.Source.FilePath!, (p.hintName, p.codeDocument))).ToImmutableDictionary();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var documentDictionary = documents.Select(p => new KeyValuePair<string, (string, RazorCodeDocument)>(p.codeDocument.Source.FilePath!, (p.hintName, p.codeDocument))).ToImmutableDictionary();
var documentDictionary = documents.Select(p => KeyValuePair.Create(p.codeDocument.Source.FilePath!, (p.hintName, p.codeDocument))).ToImmutableDictionary();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues New Feature Cohosting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants