public override void Apply(WorkspaceFixContext context) { var commandBinding = "{command: " + CommandName + "()}"; var value = new AttributeQuotedValueToken(0, "\"", commandBinding); Tag.AddOrUpdateAttribute(Name, value); }
public override void Apply(WorkspaceFixContext context) { if (!context.Tokens.Remove(Token)) { throw new InvalidOperationException("The token was already removed!"); } }
public override void Apply(WorkspaceFixContext context) { var commandBinding = "{value: " + ViewModelProperty + "}"; var value = new AttributeQuotedValueToken(0, "\"", commandBinding); Tag.AddOrUpdateAttribute(Name, value); }
public override void Apply(WorkspaceFixContext context) { var firstTokenIndex = context.Tokens.IndexOf(FirstToken); if (firstTokenIndex < 0) { throw new InvalidOperationException("Token to move not found!"); } var range = context.Tokens.GetRange(firstTokenIndex, TokenCount); context.Tokens.RemoveRange(firstTokenIndex, TokenCount); var targetIndex = context.Tokens.IndexOf(TargetPosition); if (targetIndex < 0) { throw new InvalidOperationException("Target token not found!"); } if (Placement == Placement.After) { targetIndex++; } context.Tokens.InsertRange(targetIndex, range); }
public override void Apply(WorkspaceFixContext context) { if (!Tag.Attributes.Remove(Attribute)) { throw new InvalidOperationException("The attribute doesn't belong to the tag."); } }
public override void Apply(WorkspaceFixContext context) { var file = context.GetViewModelFile(); file.AddOrExtendItem(new CsharpItem() { ItemType = CsharpItemType.PublicProperty, Name = Name, Type = Type }); }
public override void Apply(WorkspaceFixContext context) { var file = context.GetViewModelFile(); file.AddOrExtendItem(new CsharpItem() { ItemType = CsharpItemType.PublicMethod, Name = EventName, Type = ReturnType, Body = new List <string>() { Body } }); }
public override void Apply(WorkspaceFixContext context) { Attribute.ChangeName(NewName); }
public abstract void Apply(WorkspaceFixContext context);
public override void Apply(WorkspaceFixContext context) { Tag.ChangeTagName(NewName); EndTag?.ChangeTagName(NewName); }
private void ApplyFix(FixAction fix) { var context = new WorkspaceFixContext(null, fix, workspace.Tokens, workspace.CsharpFiles); fix.Apply(context); }