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

Improve parameter type naming for generic types #343

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

olegKoshmeliuk
Copy link
Member

🤔 What's changed?

Changed RuntimeBindingType.FullName behavior for generic types.
Before it was simple Type.FullName which is not working good for generic and nullable types.
Now it's using custom logic to provide better value for autocomplete for generic types.

Example new placeholders:
image

⚡️ What's your motivation?

Current behavior :

  • List<string> => System.Collections.Generic.List`1[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
  • int? => System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

That is resulting bad autocomplete hints in VS Plugin. (it's using FullName as a Placeholder)
This PR will change autocomplete steps in VS to be more readable.
From placeholder: [0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]]
To placeholder: [List<String>]

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • Users should know about my change
    • I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.

This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.

@olegKoshmeliuk
Copy link
Member Author

olegKoshmeliuk commented Dec 6, 2024

@gasparnagy I open for suggestions.
I didn't add tests because I did't find good place.
Based on your suggestions I can create TestClass or Theory test for FullName getter.

@olegKoshmeliuk olegKoshmeliuk force-pushed the fix/binding-type-fullname branch 2 times, most recently from 8c7d28b to 343e289 Compare December 12, 2024 16:10
@gasparnagy
Copy link
Contributor

@olegKoshmeliuk Thx. Did you check if the VS extension code uses this for anything else than displaying it? Aren't we breaking any backwards compatibility?

@olegKoshmeliuk
Copy link
Member Author

olegKoshmeliuk commented Dec 16, 2024

Possible breaking this code for generic types: BindingReflectionExtensions.cs#L15C9-L38C10 because it's comparing with Type.FullName

From what I saw VS extension expects <Namespace>.<Type> format in FullName like in non generic types. example so it's mostly a bug fix for VS extension
I tested locally autocomplete and binding discovery was working fine.

@olegKoshmeliuk olegKoshmeliuk force-pushed the fix/binding-type-fullname branch from 343e289 to d868e39 Compare December 16, 2024 19:18
Copy link
Contributor

@gasparnagy gasparnagy left a comment

Choose a reason for hiding this comment

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

Thx!

@gasparnagy gasparnagy merged commit 642c8bc into main Dec 18, 2024
5 checks passed
@gasparnagy gasparnagy deleted the fix/binding-type-fullname branch December 18, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants