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

Offer 'field' when within a property accessor. #74956

Merged

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner August 30, 2024 17:24
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 30, 2024
@@ -7,222 +7,419 @@
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations;
Copy link
Member Author

Choose a reason for hiding this comment

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

view with whitespace off.

// version check here. We do not want to interfere with users trying to use/learn this feature. The user will
// get a clear message if they're not on the right lang version telling them about the issue, and offering to
// upgrade their project if they way.
if (context.IsAnyExpressionContext || context.IsStatementContext)
Copy link
Member

Choose a reason for hiding this comment

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

💭 Is there a case where IsAnyExpressionContext is false but IsStatementContext is true?

=> context.IsMemberAttributeContext(s_validTypeDeclarations, cancellationToken);
private static bool IsInPropertyAccessor(SyntaxToken targetToken)
{
for (var node = targetToken.Parent; node != null; node = node.Parent)
Copy link
Member

Choose a reason for hiding this comment

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

❔ Does this intentionally walk out of local functions? Even if so, it seems like static local functions should be skipped.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. it intentionally walks out of local functions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Even if so, it seems like static local functions should be skipped.

field is allowed ina static local/lambda if hte containing property is also static. We could consdier adding the logic to check for that. but i'm in the not-caring poitn currently.

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.

3 participants