public ContextActionRunner (MonoDevelop.CodeActions.CodeAction act, MonoDevelop.Ide.Gui.Document document, ICSharpCode.NRefactory.TextLocation loc) { this.act = act; this.document = document; this.loc = loc; }
public ContextActionRunner(MonoDevelop.CodeActions.CodeAction act, MonoDevelop.Ide.Gui.Document document, ICSharpCode.NRefactory.TextLocation loc) { this.act = act; this.document = document; this.loc = loc; }
public static void ApplyFix (CodeAction action, IRefactoringContext context) { using(var script = context.CreateScript ()) { action.Run (context, script); } }
internal static bool IsAnalysisOrErrorFix (CodeAction act) { return act is AnalysisContextActionProvider.AnalysisCodeAction || act.Severity == Severity.Error; }
public static void ApplyFix (CodeAction action, object context) { if (context is IScriptProvider) { using(var script = ((IScriptProvider)context).CreateScript ()) { action.Run (context, script); } } else { action.Run (context, null); } }
static CodeFixMenuEntry CreateFixMenuEntry(TextEditor editor, CodeAction fix) { int mnemonic = -1; return(CreateFixMenuEntry(editor, fix, ref mnemonic)); }
static void AddFixMenuItem(TextEditor editor, CodeFixMenu menu, ref int mnemonic, CodeAction fix) { var nested = fix as CodeAction.CodeActionWithNestedActions; if (nested != null) { AddNestedFixMenu(editor, menu, nested); return; } menu.Add(CreateFixMenuEntry(editor, fix, ref mnemonic)); }
public ContextActionRunner(TextEditor editor, CodeAction act) { this.editor = editor; this.act = act; documentContext = editor.DocumentContext; }
static void AddFixMenuItem(TextEditor editor, CodeFixMenu menu, CodeAction fix) { int _m = 0; AddFixMenuItem(editor, menu, ref _m, fix); }
public ContextActionRunner(CodeAction act, TextEditor editor, DocumentContext documentContext) { this.editor = editor; this.act = act; this.documentContext = documentContext; }
static void AddFixMenuItem(TextEditor editor, CodeFixMenu menu, CodeFixMenu fixAllMenu, ref int mnemonic, CodeAction fix, FixAllState fixState, CancellationToken token) { if (fix is CodeAction.CodeActionWithNestedActions nested) { // Inline code actions if they are, otherwise add a nested fix menu if (nested.IsInlinable) { int actionCount = nested.NestedCodeActions.Length; foreach (var nestedFix in nested.NestedCodeActions) { var nestedFixState = actionCount > 1 && nestedFix.EquivalenceKey == null ? null : fixState; AddFixMenuItem(editor, menu, fixAllMenu, ref mnemonic, nestedFix, nestedFixState, token); } return; } if (nested.NestedCodeActions.Length > 0) { AddNestedFixMenu(editor, menu, fixAllMenu, nested, fixState, token); } return; } menu.Add(CreateFixMenuEntry(editor, fix, ref mnemonic)); // TODO: Add support for more than doc when we have global undo. fixState = fixState?.WithScopeAndEquivalenceKey(FixAllScope.Document, fix.EquivalenceKey); var fixAllMenuEntry = CreateFixAllMenuEntry(editor, fixState, ref mnemonic, token); if (fixAllMenuEntry != null) { fixAllMenu.Add(new CodeFixMenuEntry(fix.Message, null)); fixAllMenu.Add(fixAllMenuEntry); } }
internal static bool IsAnalysisOrErrorFix(CodeAction act) { return(act is AnalysisContextActionProvider.AnalysisCodeAction || act.Severity == Severity.Error); }
public static void ApplyFix (CodeAction action, IRefactoringContext context) { if (!CheckUserSettings ()) return; using (var script = context.CreateScript ()) { action.Run (context, script); } }