diff options
author | Anže Vodovnik <anvod@microsoft.com> | 2019-03-06 16:44:22 +0300 |
---|---|---|
committer | Anže Vodovnik <anvod@microsoft.com> | 2019-03-06 16:44:22 +0300 |
commit | 8c46049b0fa47ff99c085281adb67afdfcc95be7 (patch) | |
tree | e3a7f750594d763835f8cfce8c59ba5e87719ccb /main | |
parent | 82d62d9b91304eccfc833315f780146188eaed13 (diff) |
Added Sort and Remove Imports command to the context, and adde the mapping so that it calls the Roslyn engine.
Diffstat (limited to 'main')
6 files changed, 50 insertions, 4 deletions
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml index 93f01bbc85..940db43069 100644 --- a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml +++ b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml @@ -336,5 +336,8 @@ <Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor/Analysis/C#"> <Panel id="CodeStylePanel" _label="Code Style" fill="true" class="MonoDevelop.CSharp.OptionProvider.CodeStylePage" grouping="Tab" icon="md-prefs-code-rules" insertbefore="CodeActions" /> </Extension> - + + <Extension path = "/MonoDevelop/TextEditor/CommandMapping"> + <Map id="MonoDevelop.CSharp.Refactoring.Commands.SortAndRemoveImports" argsType="@MonoDevelop.CSharp.Refactoring.CommandArgsFactories.CreateSortAndRemoveUnnecessaryImportsCommandArgs" /> + </Extension> </ExtensionModel> diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj index c2e674b0f2..94ef68c84d 100644 --- a/main/src/addins/CSharpBinding/CSharpBinding.csproj +++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj @@ -289,6 +289,7 @@ <Compile Include="MonoDevelop.CSharp\CSharpPathedDocumentExtension.cs" /> <Compile Include="MonoDevelop.Ide.Completion.Presentation\RoslynExperimentationService.cs" /> <Compile Include="MonoDevelop.CSharp.Debugger\RoslynDebugInfoProvider.cs" /> + <Compile Include="MonoDevelop.CSharp.Refactoring\CommandArgsFactories.cs" /> </ItemGroup> <ItemGroup> <None Include="MonoDevelop.CSharp.CodeRefactorings\ConvertToEnum\ConvertToEnumCodeRefactoringProvider.cs" /> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs new file mode 100644 index 0000000000..fb6c5850cd --- /dev/null +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs @@ -0,0 +1,39 @@ +// +// CommandArgsFactories.cs +// +// Author: +// anvod <anvod@microsoft.com> +// +// Copyright (c) 2019 Microsoft +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.CodeAnalysis.Editor.Commanding.Commands; + +namespace MonoDevelop.CSharp.Refactoring +{ + static class CommandArgsFactories + { + public static SortAndRemoveUnnecessaryImportsCommandArgs CreateSortAndRemoveUnnecessaryImportsCommandArgs(ITextView v, ITextBuffer b) => + new SortAndRemoveUnnecessaryImportsCommandArgs(v, b); + } +}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs index 7a407d3ed3..85d595a982 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs @@ -32,7 +32,7 @@ namespace MonoDevelop.Refactoring { static class CommandArgsFactories { - public static GoToImplementationCommandArgs CreateGoToImplementationCommandArgs(ITextView v, ITextBuffer b) => - new GoToImplementationCommandArgs(v, b); - } + public static GoToImplementationCommandArgs CreateGoToImplementationCommandArgs (ITextView v, ITextBuffer b) => + new GoToImplementationCommandArgs (v, b); + } } diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs index a3e35471db..a8f7586837 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs @@ -33,6 +33,7 @@ namespace MonoDevelop.Refactoring CurrentRefactoryOperations, GotoDeclaration, // in 'referenced' in IdeViMode.cs as string GotoImplementation, + SortAndRemoveUnnecessaryImports, FindReferences, FindAllReferences, FindDerivedClasses, diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml index b9c5d64ce5..a3a0e4f747 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml @@ -176,6 +176,8 @@ <Extension path = "/MonoDevelop/TextEditor/ContextMenu/Editor"> <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.QuickFix" /> <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Rename" /> + <CommandItem id = "MonoDevelop.CSharp.Refactoring.Commands.SortAndRemoveImports" /> + <SeparatorItem id = "Separator0" /> <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration" /> <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.GotoImplementation" /> <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.FindReferences" /> |