Move to namespace UI and Implementation#34223
Merged
ryzngard merged 53 commits intodotnet:masterfrom Apr 4, 2019
Merged
Conversation
added 13 commits
March 18, 2019 14:45
Move to namespace allows a user to move all symbols in a context to a different namespace, whether it's a new one or existing. This is different from renaming a namespace as not all symbols in the namespace are moved, only ones within the current document. It relies on the IChangeNamespaceService implementation to do the heavy lifting. Since the current implementation only supports C#, this new feature will as well. After this is checked in, when a user has the cursor inside a namespace declaration that has no nested namespace declarations within it, a code fix will be suggested to pop up a dialog and help the user choose a new namespace.
333fred
reviewed
Mar 19, 2019
src/Compilers/Core/Portable/InternalUtilities/UnicodeCharacterUtilities.cs
Outdated
Show resolved
Hide resolved
ryzngard
commented
Mar 19, 2019
src/VisualStudio/Core/Def/Implementation/MoveToNamespace/MoveToNamespaceDialogViewModel.cs
Outdated
Show resolved
Hide resolved
Contributor
|
Integration test hit this: |
Contributor
Author
Thanks, this is a bug on my end. I need to handle cases where a type isn't enclosed in a namespace declaration. Glad the integration tests are running :) thanks @sharwell ! |
…rs of a type declaration
gafter
reviewed
Mar 20, 2019
src/Compilers/Core/Portable/InternalUtilities/UnicodeCharacterUtilities.cs
Outdated
Show resolved
Hide resolved
JoeRobich
reviewed
Apr 2, 2019
JoeRobich
reviewed
Apr 2, 2019
src/EditorFeatures/TestUtilities/MoveToNamespace/AbstractMoveToNamespaceTests.cs
Outdated
Show resolved
Hide resolved
Contributor
JoeRobich
reviewed
Apr 2, 2019
src/Features/Core/Portable/MoveToNamespace/MoveToNamespaceAnalysisResult.cs
Outdated
Show resolved
Hide resolved
JoeRobich
reviewed
Apr 2, 2019
src/Features/Core/Portable/MoveToNamespace/MoveToNamespaceResult.cs
Outdated
Show resolved
Hide resolved
JoeRobich
reviewed
Apr 2, 2019
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/MoveToNamespaceDialog_OutOfProc.cs
Outdated
Show resolved
Hide resolved
dpoeschl
reviewed
Apr 2, 2019
src/EditorFeatures/TestUtilities/MoveToNamespace/AbstractMoveToNamespaceTests.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/TestUtilities/MoveToNamespace/AbstractMoveToNamespaceTests.TestState.cs
Show resolved
Hide resolved
src/EditorFeatures/TestUtilities/MoveToNamespace/AbstractMoveToNamespaceTests.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs
Show resolved
Hide resolved
src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/MoveToNamespace/MoveToNamespaceDialog.xaml
Outdated
Show resolved
Hide resolved
added 7 commits
April 2, 2019 14:44
JoeRobich
reviewed
Apr 3, 2019
|
|
||
| Example: | ||
|
|
||
added 2 commits
April 3, 2019 15:53
Contributor
|
👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements 'MoveToNamespace' as a feature. See this comment for context on the design.
Note: all screenshots have a black bar for the XAML debugger since they are taken from running under the VS debugger. That will not be in the final UI.
Case 1: Move and individual type
Class "Bar" is being targetted. Suggestion is provided as a code action.
Ctrl + .or clicking on the indicator in the left margin will invoke the menu shown. Selecting the option will show the dialogCode Action Suggestion
Dialog
Case 2: Move all items in a namespace scope
Namespace "Foo.Bar.Namespace" is being targetted. Suggestion is provided as a code action.
Ctrl + .or clicking on the indicator in the left margin will invoke the menu shown. Selecting the option will show the dialog. Expected result would be that all items in the current scope (indicated by the opening{and closing}) would be moved. Currently the only class that would be moved isBar. Implementation is incomplete, so finished result is not shown.Code Action Suggestion
Dialog
General Dialog Usage
Dialog AutoComplete
Uses default autocomplete for the control with a list of namespaces from the project.
Dialog Dropdown
Same list as autocomplete in dropdown form.
Dialog Error State
Used to indicate that the current namespace suggestion is not valid.
New Name Information
Used to indicate that the user is creating a namespace that doesn't currently exist. This is allowed, but may be harder to spot with a dropdown/autocomplete control. Purely informational