public static void Run(DTE dte, VsError selectedError) { selectedError.Navigate(); var ep = ErrorUtilities.GetEditPoint(dte); ep.LineDown(); ep.Delete(1); }
public static void Run(DTE dte, VsError selectedError) { selectedError.Navigate(); EditPoint2 ep = ErrorUtilities.GetEditPoint(dte); ep.LineDown(); ep.StartOfLine(); ep.InsertNewLine(); }
public static void Run(DTE dte, VsError selectedError) { selectedError.Navigate(); var ep = ErrorUtilities.GetEditPoint(dte); ep.LineUp(); while (ep.LineLength == 0) { ep.Delete(1); ep.LineUp(); } }
public static void Run(DTE dte, VsError error) { error.Navigate(); EditPoint2 ep = ErrorUtilities.GetEditPoint(dte); ep.StartOfLine(); string variableName = error.Description.Split(" ".ToCharArray())[7]; string replaceString = ep.GetLines(ep.Line, ep.Line + 1); replaceString = Regex.Replace(replaceString, string.Format(@"(\s|\(|\!)({0})(\W)", variableName), "$1this.$2$3", RegexOptions.None); ep.ReplaceText(ep.LineLength, replaceString, (int )vsEPReplaceTextOptions.vsEPReplaceTextAutoformat); }
/// <summary> /// Fix error SA1600 /// </summary> /// <param name="dte">Current design environment</param> /// <param name="selectedError">Error selected by the user to fix.</param> public static void Run(DTE dte, VsError selectedError) { EditPoint2 ep = ErrorUtilities.GetEditPoint(dte); selectedError.Navigate(); var selection = (TextSelection)dte.ActiveDocument.Selection; var propertyElement = (CodeProperty)selection.ActivePoint.CodeElement[vsCMElement.vsCMElementProperty]; if (propertyElement != null) { ProcessPropertyUpdate(propertyElement, ep); } }
public static void Run(DTE dte, VsError selectedError) { selectedError.Navigate(); EditPoint2 ep = ErrorUtilities.GetEditPoint(dte); ep.StartOfLine(); string testString = ep.GetLines(ep.Line, ep.Line + 1); if (Regex.Match(testString, @"\t").Success) { testString = Regex.Replace(testString, @"\t", @" "); ep.ReplaceText(ep.LineLength, testString, (int)vsEPReplaceTextOptions.vsEPReplaceTextAutoformat); } }
public static void Run(DTE dte, VsError selectedError) { selectedError.Navigate(); EditPoint2 ep = ErrorUtilities.GetEditPoint(dte); ep.StartOfLine(); string editLine = ep.GetLines(ep.Line, ep.Line + 1); editLine = editLine.Replace(";", ""); string varName = string.Empty; if (editLine.IndexOf("=") > -1) { varName = editLine.Split("=".ToCharArray()).First().Split(" ".ToCharArray()).Where(item => item.Length > 0).Last(); } else { varName = editLine.Split(" ".ToCharArray()).Last(); } ep.Parent.Selection.CharRight(Count: editLine.IndexOf(varName)); dte.ExecuteCommand("Refactor.Rename"); //// todo }
public static void Run(DTE dte, VsError selectedError) { selectedError.Navigate(); EditPoint2 editPoint = ErrorUtilities.GetEditPoint(dte); editPoint.StartOfDocument(); string fileName = selectedError.FileName.Substring( selectedError.FileName.LastIndexOf(@"\") + 1, selectedError.FileName.Length - (selectedError.FileName.LastIndexOf(@"\") + 1)); editPoint.InsertNewLine(); editPoint.StartOfDocument(); editPoint.Insert( string.Format( @"//----------------------------------------------------------------------- // <copyright file=""{0}"" company=""{1}""> // {2} // </copyright> //-----------------------------------------------------------------------", fileName, StyleRepair.Properties.StyleRepair.Default.CompanyName, StyleRepair.Properties.StyleRepair.Default.CopyrightMessage)); }