/// <summary> /// Arrange refactorings into groups. /// </summary> /// <remarks> /// Refactorings are returned in priority order determined based on <see cref="ExtensionOrderAttribute"/>. /// Priority for all <see cref="SuggestedActionSet"/>s containing refactorings is set to <see cref="SuggestedActionSetPriority.Low"/> /// and should show up after fixes but before suppression fixes in the light bulb menu. /// </remarks> private SuggestedActionSet OrganizeRefactorings(Workspace workspace, CodeRefactoring refactoring) { var refactoringSuggestedActions = ArrayBuilder <SuggestedAction> .GetInstance(); foreach (var action in refactoring.Actions) { refactoringSuggestedActions.Add(new CodeRefactoringSuggestedAction( _owner, workspace, _subjectBuffer, refactoring.Provider, action)); } return(new SuggestedActionSet( refactoringSuggestedActions.ToImmutableAndFree(), SuggestedActionSetPriority.Low)); }
/// <summary> /// Arrange refactorings into groups. /// </summary> /// <remarks> /// Refactorings are returned in priority order determined based on <see cref="ExtensionOrderAttribute"/>. /// Priority for all <see cref="SuggestedActionSet"/>s containing refactorings is set to <see cref="SuggestedActionSetPriority.Low"/> /// and should show up after fixes but before suppression fixes in the light bulb menu. /// </remarks> private SuggestedActionSet OrganizeRefactorings(Workspace workspace, CodeRefactoring refactoring) { var refactoringSuggestedActions = ImmutableArray.CreateBuilder <SuggestedAction>(); foreach (var a in refactoring.Actions) { refactoringSuggestedActions.Add(new CodeRefactoringSuggestedAction( workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator, a, refactoring.Provider, _owner._listener)); } return(new SuggestedActionSet(refactoringSuggestedActions.ToImmutable(), SuggestedActionSetPriority.Low)); }
public void TestSingleRefactoring <T>(String code, String expectedCode, TextSpan textSpan) where T : ICodeRefactoringProvider, new() { CreateWorkspace(code); ICodeRefactoringProvider codeRefactoringProvider = new T(); CodeRefactoring refactoring = codeRefactoringProvider.GetRefactoring(document, textSpan, cancellationToken); Assert.AreEqual(1, refactoring.Actions.Count()); ICodeAction codeAction = refactoring.Actions.First(); Assert.AreEqual(expectedCode, ExecuteAction(codeAction)); }
/// <summary> /// Arrange refactorings into groups. /// </summary> /// <remarks> /// Refactorings are returned in priority order determined based on <see cref="ExtensionOrderAttribute"/>. /// Priority for all <see cref="SuggestedActionSet"/>s containing refactorings is set to <see cref="SuggestedActionSetPriority.Low"/> /// and should show up after fixes but before suppression fixes in the light bulb menu. /// </remarks> private SuggestedActionSet OrganizeRefactorings( Workspace workspace, CodeRefactoring refactoring, Span applicableSpan) { var refactoringSuggestedActions = ArrayBuilder <SuggestedAction> .GetInstance(); foreach (var action in refactoring.Actions) { refactoringSuggestedActions.Add(new CodeRefactoringSuggestedAction( _owner, workspace, _subjectBuffer, refactoring.Provider, action)); } return(new SuggestedActionSet( PredefinedSuggestedActionCategoryNames.Refactoring, refactoringSuggestedActions.ToImmutableAndFree(), priority: SuggestedActionSetPriority.Low, applicableToSpan: applicableSpan)); }
/// <summary> /// Arrange refactorings into groups. /// </summary> /// <remarks> /// Refactorings are returned in priority order determined based on <see cref="ExtensionOrderAttribute"/>. /// Priority for all <see cref="SuggestedActionSet"/>s containing refactorings is set to <see cref="SuggestedActionSetPriority.Low"/> /// and should show up after fixes but before suppression fixes in the light bulb menu. /// </remarks> private SuggestedActionSet OrganizeRefactorings( Workspace workspace, CodeRefactoring refactoring, Span applicableSpan) { var refactoringSuggestedActions = ArrayBuilder <SuggestedAction> .GetInstance(); foreach (var action in refactoring.Actions) { if (action.NestedCodeActions.Length > 0) { var nestedActions = action.NestedCodeActions.SelectAsArray( na => new CodeRefactoringSuggestedAction( ThreadingContext, _owner, workspace, _subjectBuffer, refactoring.Provider, na)); var set = new SuggestedActionSet(categoryName: null, actions: nestedActions, priority: GetSuggestedActionSetPriority(action.Priority), applicableToSpan: applicableSpan); refactoringSuggestedActions.Add(new SuggestedActionWithNestedActions( ThreadingContext, _owner, workspace, _subjectBuffer, refactoring.Provider, action, set)); } else { refactoringSuggestedActions.Add(new CodeRefactoringSuggestedAction( ThreadingContext, _owner, workspace, _subjectBuffer, refactoring.Provider, action)); } } var actions = refactoringSuggestedActions.ToImmutableAndFree(); // An action set gets the the same priority as the highest priority // action within in. return(new SuggestedActionSet( PredefinedSuggestedActionCategoryNames.Refactoring, actions: actions, priority: GetSuggestedActionSetPriority(actions.Max(a => a.Priority)), applicableToSpan: applicableSpan)); }
/// <summary> /// Arrange refactorings into groups. /// </summary> /// <remarks> /// Refactorings are returned in priority order determined based on <see cref="ExtensionOrderAttribute"/>. /// Priority for all <see cref="SuggestedActionSet"/>s containing refactorings is set to <see cref="SuggestedActionSetPriority.Low"/> /// and should show up after fixes but before suppression fixes in the light bulb menu. /// </remarks> private SuggestedActionSet OrganizeRefactorings( Workspace workspace, CodeRefactoring refactoring, SuggestedActionSetPriority priority, Span applicableSpan) { var refactoringSuggestedActions = ArrayBuilder <SuggestedAction> .GetInstance(); foreach (var action in refactoring.Actions) { if (action.NestedCodeActions.Length > 0) { var nestedActions = action.NestedCodeActions.SelectAsArray( na => new CodeRefactoringSuggestedAction( ThreadingContext, _owner, workspace, _subjectBuffer, refactoring.Provider, na)); var set = new SuggestedActionSet(categoryName: null, actions: nestedActions, priority: SuggestedActionSetPriority.Medium, applicableToSpan: applicableSpan); refactoringSuggestedActions.Add(new SuggestedActionWithNestedActions( ThreadingContext, _owner, workspace, _subjectBuffer, refactoring.Provider, action, set)); } else { refactoringSuggestedActions.Add(new CodeRefactoringSuggestedAction( ThreadingContext, _owner, workspace, _subjectBuffer, refactoring.Provider, action)); } } return(new SuggestedActionSet( PredefinedSuggestedActionCategoryNames.Refactoring, refactoringSuggestedActions.ToImmutableAndFree(), priority: priority, applicableToSpan: applicableSpan)); }
public IntroduceVariableResult(CodeRefactoring codeRefactoring) { _codeRefactoring = codeRefactoring; }
internal GenerateDefaultConstructorsResult(CodeRefactoring codeRefactoring) : base(codeRefactoring) { }
public GenerateConstructorResult(CodeRefactoring codeRefactoring) : base(codeRefactoring) { }
protected AbstractCodeRefactoringResult(CodeRefactoring codeRefactoring) { _codeRefactoring = codeRefactoring; }
public GenerateConstructorFromMembersResult(CodeRefactoring codeRefactoring) : base(codeRefactoring) { }
public AddConstructorParametersResult(CodeRefactoring codeRefactoring) : base(codeRefactoring) { }
public GenerateEqualsAndGetHashCodeResult(CodeRefactoring refactoring) : base(refactoring) { }
protected AbstractCodeRefactoringResult(CodeRefactoring codeRefactoring) { this.codeRefactoring = codeRefactoring; }