protected BaseCodeActionService(
            OmniSharpWorkspace workspace,
            IEnumerable <ICodeActionProvider> providers,
            ILogger logger,
            ICsDiagnosticWorker diagnostics,
            CachingCodeFixProviderForProjects codeFixesForProject)
        {
            Workspace                       = workspace;
            Providers                       = providers;
            Logger                          = logger;
            _diagnostics                    = diagnostics;
            _codeFixesForProject            = codeFixesForProject;
            OrderedCodeRefactoringProviders = new Lazy <List <CodeRefactoringProvider> >(() => GetSortedCodeRefactoringProviders());

            // Sadly, the CodeAction.NestedCodeActions property is still internal.
            var nestedCodeActionsProperty = typeof(CodeAction).GetProperty("NestedCodeActions", BindingFlags.NonPublic | BindingFlags.Instance);

            if (nestedCodeActionsProperty == null)
            {
                throw new InvalidOperationException("Could not find CodeAction.NestedCodeActions property.");
            }

            this._getNestedCodeActions = nestedCodeActionsProperty.GetGetMethod(nonPublic: true);

            if (this._getNestedCodeActions == null)
            {
                throw new InvalidOperationException("Could not retrieve 'get' method for CodeAction.NestedCodeActions property.");
            }
        }
Ejemplo n.º 2
0
 public GetCodeActionsService(
     OmniSharpWorkspace workspace,
     CodeActionHelper helper,
     [ImportMany] IEnumerable <ICodeActionProvider> providers,
     ILoggerFactory loggerFactory,
     ICsDiagnosticWorker diagnostics,
     CachingCodeFixProviderForProjects codeFixesForProjects)
     : base(workspace, providers, loggerFactory.CreateLogger <GetCodeActionsService>(), diagnostics, codeFixesForProjects)
 {
 }
 public RunCodeActionService(
     IAssemblyLoader loader,
     OmniSharpWorkspace workspace,
     CodeActionHelper helper,
     [ImportMany] IEnumerable <ICodeActionProvider> providers,
     ILoggerFactory loggerFactory,
     ICsDiagnosticWorker diagnostics,
     CachingCodeFixProviderForProjects codeFixesForProjects)
     : base(workspace, providers, loggerFactory.CreateLogger <RunCodeActionService>(), diagnostics, codeFixesForProjects)
 {
     _loader            = loader;
     _workspaceAssembly = _loader.LazyLoad(Configuration.RoslynWorkspaces);
 }
Ejemplo n.º 4
0
 protected BaseCodeActionService(
     OmniSharpWorkspace workspace,
     IEnumerable <ICodeActionProvider> providers,
     ILogger logger,
     ICsDiagnosticWorker diagnostics,
     CachingCodeFixProviderForProjects codeFixesForProject)
 {
     Workspace                       = workspace;
     Providers                       = providers;
     Logger                          = logger;
     _diagnostics                    = diagnostics;
     _codeFixesForProject            = codeFixesForProject;
     OrderedCodeRefactoringProviders = new Lazy <List <CodeRefactoringProvider> >(() => GetSortedCodeRefactoringProviders());
 }