Skip to content

Allow Razor files to be additional documents in a misc files project #78267

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

Merged

Conversation

davidwengier
Copy link
Member

Fixes a startup crash in VS Code if a .razor or .cshtml file is restored in the workspace.

Part of dotnet/razor#11759

@davidwengier davidwengier requested review from jasonmalinowski, dibarbet and a team April 23, 2025 01:39
@davidwengier davidwengier requested a review from a team as a code owner April 23, 2025 01:39
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 23, 2025
Comment on lines 72 to 73
var id = projectInfo.Documents.Single().Id;
return CurrentSolution.GetRequiredDocument(id);
Copy link
Member

Choose a reason for hiding this comment

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

I kinda wish this was an else block so it was more visually clear it's the same logic, but don't touch it unless you have to touch the PR for some other reason.

@@ -27,7 +27,11 @@ internal static ProjectInfo CreateMiscellaneousProjectInfoForDocument(
var fileExtension = PathUtilities.GetExtension(filePath);
var fileName = PathUtilities.GetFileName(filePath);

var languageServices = services.GetLanguageServices(languageInformation.LanguageName);
// For Razor files we need to override the language name to C# as thats what code is generated
var isRazor = languageInformation.LanguageName == "Razor";
Copy link
Member

Choose a reason for hiding this comment

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

Do we not have a constant for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not one accessible in this layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants