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);
     }
 }
예제 #2
0
        public static void ApplyFix(CodeAction action, object context)
        {
            var scriptProvider = context as IScriptProvider;

            if (scriptProvider != null)
            {
                using (var script = scriptProvider.CreateScript()) {
                    action.Run(context, script);
                }
            }
            else
            {
                action.Run(context, null);
            }
        }
예제 #3
0
 public static void ApplyFix(CodeAction action, IRefactoringContext context)
 {
     if (!CheckUserSettings())
     {
         return;
     }
     using (var script = context.CreateScript()) {
         action.Run(context, script);
     }
 }
예제 #4
0
        public RunCodeActionsResponse RunCodeAction(CodeActionRequest req)
        {
            var actions = GetContextualCodeActions(req).ToList();

            if (req.CodeAction > actions.Count)
            {
                return(new RunCodeActionsResponse());
            }

            var context = OmniSharpRefactoringContext.GetContext(_bufferParser, req);

            using (var script = new OmniSharpScript(context, _config))
            {
                CodeAction action = actions[req.CodeAction];
                action.Run(script);
            }

            return(new RunCodeActionsResponse {
                Text = context.Document.Text
            });
        }
예제 #5
0
 public override void Run(IRefactoringContext context, object script)
 {
     act.Run((Script)script);
 }
예제 #6
0
 public static void ApplyFix(CodeAction action, IRefactoringContext context)
 {
     using (var script = context.CreateScript()) {
         action.Run(context, script);
     }
 }