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

Show static members of matching types in completion #52163

Merged
merged 6 commits into from
Mar 26, 2021

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Mar 26, 2021

image

image

image

image

Closes #28603

@sharwell sharwell requested a review from a team as a code owner March 26, 2021 05:05
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

Copy link

@heaths heaths left a comment

Choose a reason for hiding this comment

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

Thank you! This will be great for the many "extensible enums" we have in the Azure SDKs!

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

need clarification on potential behavioral change and if the new behavior is desirable.

@@ -174,6 +193,47 @@ private static async Task HandleSingleTypeAsync(CompletionContext context, Seman
filterText: memberDisplayName));
}
}
else if (enclosingNamedType is not null)
Copy link
Member

Choose a reason for hiding this comment

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

Does it work with top level statement?

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, at least for the case of typing this:

int.Parse(empty)

@sharwell sharwell marked this pull request as draft March 26, 2021 20:08
@sharwell
Copy link
Member Author

Experimentation revealed a whole bunch of cases where it's a problem to automatically show the completion list. For the new cases, will modify this to only show the completion list after a character is typed.

@sharwell sharwell merged commit c7bf6b2 into dotnet:main Mar 26, 2021
@ghost ghost added this to the Next milestone Mar 26, 2021
@sharwell sharwell deleted the static-members branch March 26, 2021 23:30
@heaths
Copy link

heaths commented Mar 29, 2021

For the new cases, will modify this to only show the completion list after a character is typed.

Would this work as designed if someone were to force the completion list using, for example (bindings vary), Ctrl+Space? I.e. the completion list would show, but would it initially show/have selected one of these well-known possible values?

@sharwell
Copy link
Member Author

sharwell commented Mar 29, 2021

@heaths Yes, explicit Ctrl+Space will bring up completion with these items included.

@heaths
Copy link

heaths commented Mar 29, 2021

included

Included, or selected by default. E.g. in the case of enums, the enum is selected automatically after the completion list is filled (seems to be a very short delay):

image

Just trying to understand the expectation here. The hope was that these work like enums, though I can imagine some of the issues you might've hit above, and appreciate having to workaround that to maintain development productivity and consistency.

@sharwell
Copy link
Member Author

@heaths They will be included, but do not influence the selection algorithm. Depending on other factors, an element from this collection may or may not be selected by default.

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 should suggest static members of target type
5 participants