public RunCodeActionsResponse RunCodeAction(RunCodeActionRequest req)
        {
            var actions = GetContextualCodeActions(req).ToList();
            if(req.CodeAction > actions.Count)
                return new RunCodeActionsResponse();

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

            return new RunCodeActionsResponse {Text = context.Document.Text};
        }
Exemple #2
0
        public RunCodeActionsResponse RunCodeAction(RunCodeActionRequest req)
        {
            var actions = GetContextualCodeActions(req).ToList();

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

            CodeAction action  = actions[req.CodeAction];
            var        context = OmniSharpRefactoringContext.GetContext(_bufferParser, req);

            using (var script = new OmniSharpScript(context))
            {
                action.Run(script);
            }

            return(new RunCodeActionsResponse {
                Text = context.Document.Text
            });
        }