Skip to content

Merge Move Static Members feature to 17.1#55964

Merged
Soreloser2 merged 13 commits intorelease/dev17.1-preview1from
features/MoveStaticMembers
Sep 2, 2021
Merged

Merge Move Static Members feature to 17.1#55964
Soreloser2 merged 13 commits intorelease/dev17.1-preview1from
features/MoveStaticMembers

Conversation

@Soreloser2
Copy link
Contributor

Move Static members (events, fields, properties, methods) of a type to a new type, as a refactoring that can be activated through a quick action. It involves a dialog to select a new type and the members. Works for both C# and Visual Basic.

Creates a new type in a new file containing all the moved static members, and removes the members from the original class. Refactors usages of those members elsewhere in the codebase.

Demo of activation + dialog box (in VB):

NewDestinationDisplayDemo.mp4

Soreloser2 and others added 10 commits August 10, 2021 10:40
* 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>
* 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)

* WIP untested, refactoring references to moved members

* Added tests for refactoring and extensions for C#. Will add tests for refactoring in VB, but unsure about extensions since we do not generate a module.

* Make module now for VB, add refactor tests

* Updated C# tests to a new framework. May need to rewrite VB test file in C# to set some readonly properties

* Changed VB tests to new Framework. Revealed an error in the way vb members are moved

* Fixed VB tests by removing shared modifier when moving to a module

* Fixed more tests to account for member spacing innaccuracy

* Refactored tests, added vb extension tests

* Added tests for file banner and moving from a static class/module

* Added tests to enure operator and static constructors are not able to be selected or trigger refactoring

* Make service field readonly

* Fixed some code warnings and reverted to before member refactoring, removing a few tests in the process

Co-authored-by: msftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com>
…ticMembers

Merge main to features/MoveStaticMembers
* 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)

* WIP untested, refactoring references to moved members

* Added tests for refactoring and extensions for C#. Will add tests for refactoring in VB, but unsure about extensions since we do not generate a module.

* Make module now for VB, add refactor tests

* Updated C# tests to a new framework. May need to rewrite VB test file in C# to set some readonly properties

* Changed VB tests to new Framework. Revealed an error in the way vb members are moved

* Fixed VB tests by removing shared modifier when moving to a module

* Fixed more tests to account for member spacing innaccuracy

* Refactored tests, added vb extension tests

* Added tests for file banner and moving from a static class/module

* Added tests to enure operator and static constructors are not able to be selected or trigger refactoring

* Make service field readonly

* Added support for alias refactoring + tests

* Refactored references on source type. Added simplifier annotation to remove unnecessary qualifications.

* Now correctly refactors references using symbol annotations and expansions for extension methods, should address conflicting imports issues

* Fixed simplifier incorrectly simplifying references inside moved members

* Added more tests, generic class refactoring currently isn't working

* Added support for generic class member access, copying only the type arguments we moved from the methods

* Fixed tests by adding accesibility modifier

* Addressed feedback, fixed multiple extension method bug by using docEditor

* Changed new type to create the same kind (class/Module) as the source type, refactored tests

Co-authored-by: msftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com>
* Now shows the fully qualified name when creating a new type.

Discovered an issue with duplicating a root namespace, not fixed here.

* Reformatted new type name message

* Write tests that utilize root namespace. One is failing as it depends on reference refactoring, and is not merged with the reference refactoring branch currently

* Changed way file names are generated so added namespaces aren't included, refactored options getting for tests

* Moved destination selection box a little bit to the right to align with message

* Changed tests to reflect module changes
* Added tests and changed root namespace filtering. Removes crash bug.

* Disabled "OK" button when destination is invalid. Added ability to select no members (will create a new empty class)
Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

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

Passed vendor validation

@Soreloser2 Soreloser2 merged commit 2f8126d into release/dev17.1-preview1 Sep 2, 2021
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.

4 participants