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

Add Move Static Member To Existing Type #61519

Merged
merged 81 commits into from
Jun 6, 2022

Conversation

ryzngard
Copy link
Contributor

Ports #56131 and updates slightly. I did my best to keep the initial intent of the PR because @Soreloser2 did a great job with it :)

From the original PR:

Adds support for moving static members to existing types.
Searches for types that:

  1. Exist within the same project as the original type
  2. Are in the same or nested within the same namespace as the original type
    • Example: if we have Ns.Class1 as our original type, then Ns.Class2 and Ns.ExtraNs.Class3 will show, but DifferentNs.Class4 will not
  3. Are the same type kind as the original type
    • Will not show interfaces, only shows modules if triggered on a module for VB)
  4. Have the same or more restrictive static-ness
    • If the original type is a static class, then it will only show static classes. If the original type is non-static, it will show both static and non-static types (that fit the other criteria)

Types will be displayed with their full namespace qualification, any generic type parameters, and their file name (in case of partially declared types)

The user can select a pre-defined type using the dropdown menu, or type in a new, separate non-conflicting type to create a new type in a new file. New files will have an icon as well as a preview of the new type name, similar to the previous iteration of this feature. Currently existing types do not have any icon, but this is open to change based on feedback.

ExistingTypeDemo.mp4

Soren Dahl and others added 30 commits July 14, 2021 11:19
No behavior created after dialog exited
Still working on destination type/filename selection formatting
…ox, assuming new class (c# only, no automated tests yet)
…as the semantic model cannot get the symbol for VB declared fields from the node. Fields are added as part of the dialog box however.
…oveStaticMembers

Merge main to features/MoveStaticMembers
…ling due to the way AddMembers reuses syntax. Fixed a few bugs
… refactoring in VB, but unsure about extensions since we do not generate a module.
* WIP Dialog work

* Rename + refactor

* WIP rename, add xaml elements

* WIP dialog/VM work

* WIP, Reverted Pull Member up change, updated destination selection, not working bc of a few bugs

* Refactoring provider now shows up and launches dialog

No behavior created after dialog exited
Still working on destination type/filename selection formatting

* Rename/Refactor name to MoveStaticMembers. Feature working with textbox, assuming new class (c# only, no automated tests yet)

* Accessibility, theming, resources, and sizing retweaks

* Added VB refactoring provider. Currently does not trigger on fields, as the semantic model cannot get the symbol for VB declared fields from the node. Fields are added as part of the dialog box however.

* Addressing some of the feedback

* Fixed fields not being able to trigger dialog in VB

* Remove unnecessary usings

* Fixed nullable error

* Added test classes for view model and C# impl, made VB able to get dependents

* Finished Writing impl tests for C# and VB. VB tests are currently failing due to the way AddMembers reuses syntax. Fixed a few bugs

* Fixed resources and removed nullable disable annotation

* Adress small feedback points

* Small test fix. Works with generator changes (sepearate PR)

Co-authored-by: msftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com>
@ryzngard ryzngard marked this pull request as ready for review May 27, 2022 21:32
@ryzngard ryzngard requested a review from a team as a code owner May 27, 2022 21:32
Comment on lines +2543 to +2546
var initialDestinationMarkup = @"
public class Class1Helpers
{
}";
Copy link
Member

Choose a reason for hiding this comment

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

Would be interesting to have the destination use a different namespace to see the initial source document updated with either a using directive or qualified name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great idea, and I think good for follow up as a small fix/bug fix.

@ryzngard ryzngard enabled auto-merge (squash) May 31, 2022 19:49
@ryzngard ryzngard merged commit 74c3abe into dotnet:main Jun 6, 2022
@ghost ghost added this to the Next milestone Jun 6, 2022
ryzngard added a commit to ryzngard/roslyn that referenced this pull request Jun 8, 2022
@RikkiGibson RikkiGibson modified the milestones: Next, 17.3 P3 Jun 28, 2022
ryzngard added a commit to ryzngard/roslyn that referenced this pull request Jun 30, 2022
333fred added a commit that referenced this pull request Jul 5, 2022
…ures/semi-auto-props

* upstream/main: (887 commits)
  Ensure elastic trivia for reusable syntax in field generator (#62346)
  Fix typos in the incremental generators doc (#62343)
  Theme The "Generate Overrides" Dialog (#62244)
  Walk green-nodes in incremental-generator attribute-finding path (#62295)
  Cache the hash in compilation options (#62289)
  Respect dotnet_style_namespace_match_folder (#62310)
  Remove unreachable condition
  Specify builder capacities in incremental generation to avoid wasted scratch arrays. (#62285)
  Skip the test (#62287)
  Revert "Revert "Add Move Static Member To Existing Type (#61519)"" (#62284)
  Highlight the search term in the options page (#61301)
  Synch handlers with fix (#62209)
  Disable integration tests
  Fix
  Set capacity of builder to avoid expensive garbage.
  Add public APIs for opened and closed event handling for non-source documents
  Handle possible null symbols in `getAttributeTarget` (#62137)
  Perform a lookahead rather than a parsing attempt in order to determine if current token starts a conversion operator declaration. (#62240)
  Fix a race in CachingDictionary. (#62248)
  Simplify
  ...
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.

6 participants