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

Merge release/dev17.13 to main #11259

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add back null check to allow merge editor to load
This change adds a null check to ProjectCapabilityResolver.ContainingProjectHasCapability(...) that was incorrectly removed by 6cd5bd4. Without this null check, it is impossible to open a merge editor for a razor or cshtml file. The merge editor has a few editors within it, and some of them are not included in a project, so they have a null IVsHIerarchy.
  • Loading branch information
DustinCampbell committed Nov 25, 2024
commit 285d0dd579372de25305de0869ef559181f14bb8
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ private bool ContainingProjectHasCapability(string capability, string documentFi
return false;
}

// vsHierarchy can be null here if the document is not included in a project.
// In this scenario, the IVsUIShellOpenDocument.IsDocumentInAProject(..., ..., ..., ..., out int pDocInProj) call succeeds,
// but pDocInProj == __VSDOCINPROJECT.DOCINPROJ_DocNotInProject.
if (vsHierarchy is null)
{
_logger.LogWarning($"LSP Editor is not supported for file because it is not in a project: {documentFilePath}");
return false;
}

try
{
return vsHierarchy.IsCapabilityMatch(capability);
Expand Down
Loading