Skip to content

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #42543

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner July 28, 2025 20:19
@@ -12,8 +12,21 @@ namespace Microsoft.CodeAnalysis.LanguageService;

internal interface ISymbolDisplayService : ILanguageService
{
Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ISymbol symbol, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
Copy link
Member Author

Choose a reason for hiding this comment

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

no need for these to be on the interface. they just defer to the other two methods on the type. moved these to be extensions.

protected virtual (NullableAnnotation, NullableFlowState) GetNullabilityAnalysis(SemanticModel semanticModel, ISymbol symbol, SyntaxNode node, CancellationToken cancellationToken)
=> default;

protected ImmutableArray<ISymbol> BindSymbols(
Copy link
Member Author

Choose a reason for hiding this comment

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

Broke BindToken into BindSymbols (just tries to get teh symbols corresponding to a token). That way that helper can be used when we decide to rebind speculatively when inside a suppression

? analysis
: GetNullabilityAnalysis(semanticModel, symbol, bindableParent, cancellationToken);

bool TryGetNullabilityAnalysisForSuppressedExpression(out (NullableAnnotation, NullableFlowState) analysis)
Copy link
Member Author

Choose a reason for hiding this comment

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

meat of the change. when we try to get nullability info, we first see if we're in a suppressed context, and fork the code so that the suppressions are gone. so we can see waht the lang would think was going on originally.

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge July 28, 2025 22:08
@CyrusNajmabadi CyrusNajmabadi merged commit 2736f00 into dotnet:main Jul 28, 2025
24 of 25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the symbolDisplayWork branch July 28, 2025 23:01
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 28, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IntelliSense changes based on null suppression operator
3 participants