示例#1
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};
        }
示例#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
            });
        }