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

Do not offer string (or other type-keywords) after ref/readonly inside namespace member declaration #67097

Merged
merged 6 commits into from
Mar 6, 2023

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #67061

This is both not legal, and interferes with typing ref struct since string sorts above struct.

@DoctorKrolic
Copy link
Contributor

Wait a minute, why is string special here? I thought, such logic can be applied to all type names, string is just the most noticeable one due to interfering with struct, isn't it?

@CyrusNajmabadi
Copy link
Member Author

Wait a minute, why is string special here? I thought, such logic can be applied to all type names, string is just the most noticeable one due to interfering with struct, isn't it?

Because the others don't interfere with typing. So i'm only addressing the core case that is problematic.

@DoctorKrolic
Copy link
Contributor

Maybe pull that logic up to AbstractSpecialTypePreselectingKeywordRecommender to achieve consistency at least among special-type keywords?

@CyrusNajmabadi
Copy link
Member Author

Sure. i can try that.

@CyrusNajmabadi
Copy link
Member Author

Moved up. Thanks :)

if (token.Kind() is SyntaxKind.ReadOnlyKeyword)
token = syntaxTree.FindTokenOnLeftOfPosition(token.SpanStart, cancellationToken);

// if we're not after `ref` or `ref readonly` then don't offer `string` here.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// if we're not after `ref` or `ref readonly` then don't offer `string` here.
// if we're not after `ref` or `ref readonly` then don't offer keyword here.

CyrusNajmabadi and others added 2 commits March 1, 2023 08:25
…stractSpecialTypePreselectingKeywordRecommender.cs
Co-authored-by: DoctorKrolic <70431552+DoctorKrolic@users.noreply.github.com>
@CyrusNajmabadi CyrusNajmabadi changed the title Do not offer string afer ref/readonly inside namespace member declaration Do not offer string (or other type-keywords) after ref/readonly inside namespace member declaration Mar 1, 2023
@CyrusNajmabadi CyrusNajmabadi merged commit 5f38bc8 into dotnet:main Mar 6, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the stringRecommender branch March 6, 2023 17:37
@ghost ghost added this to the Next milestone Mar 6, 2023
@allisonchou allisonchou modified the milestones: Next, 17.6 P3 Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C# auto-completion should not show type names after readonly and ref in namespace scope.
4 participants