public ProjectSystemController(DnxContext dnxContext, MSBuildContext msbuildContext, ScriptCsContext scriptCsContext,
     OmnisharpWorkspace workspace)
 {
     _dnxContext = dnxContext;
     _msbuildContext = msbuildContext;
     _scriptCsContext = scriptCsContext;
     _workspace = workspace;
 }
Ejemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            Workspace = CreateWorkspace();
            services.AddMvc();

            services.Configure<MvcOptions>(opt =>
            {
                opt.Conventions.Add(new FromBodyApplicationModelConvention());
                opt.Filters.Add(new UpdateBufferFilter(Workspace));
            });

            // Add the omnisharp workspace to the container
            services.AddInstance(Workspace);

            // Caching
            services.AddSingleton<IMemoryCache, MemoryCache>();
            services.AddSingleton<IMetadataFileReferenceCache, MetadataFileReferenceCache>();

            // Add the project systems
            services.AddInstance(new DnxContext());
            services.AddInstance(new MSBuildContext());
            services.AddInstance(new ScriptCs.ScriptCsContext());

            services.AddSingleton<IProjectSystem, DnxProjectSystem>();
            services.AddSingleton<IProjectSystem, MSBuildProjectSystem>();

#if DNX451
            services.AddSingleton<IProjectSystem, ScriptCs.ScriptCsProjectSystem>();
#endif

            // Add the file watcher
            services.AddSingleton<IFileSystemWatcher, ManualFileSystemWatcher>();

            // Add test command providers
            services.AddSingleton<ITestCommandProvider, DnxTestCommandProvider>();

#if DNX451
            //TODO Do roslyn code actions run on Core CLR?
            services.AddSingleton<ICodeActionProvider, RoslynCodeActionProvider>();
            services.AddSingleton<ICodeActionProvider, NRefactoryCodeActionProvider>();
#endif

            if (Program.Environment.TransportType == TransportType.Stdio)
            {
                services.AddSingleton<IEventEmitter, StdioEventEmitter>();
            }
            else
            {
                services.AddSingleton<IEventEmitter, NullEventEmitter>();
            }

            services.AddSingleton<ProjectEventForwarder, ProjectEventForwarder>();

            // Setup the options from configuration
            services.Configure<OmniSharpOptions>(Configuration);
        }
Ejemplo n.º 3
0
        public void ConfigureServices(IServiceCollection services, IApplicationLifetime liftime, ISharedTextWriter writer)
        {
            Workspace = new OmnisharpWorkspace();

            // Working around another bad bug in ASP.NET 5
            // https://github.com/aspnet/Hosting/issues/151
            services.AddInstance(liftime);
            services.AddInstance(writer);

            // This is super hacky by it's the easiest way to flow serivces from the 
            // hosting layer, this needs to be easier
            services.AddInstance<IOmnisharpEnvironment>(Program.Environment);

            services.AddMvc(Configuration);

            services.Configure<MvcOptions>(opt =>
            {
                opt.ApplicationModelConventions.Add(new FromBodyApplicationModelConvention());
                opt.Filters.Add(new UpdateBufferFilter(Workspace));
            });

            // Add the omnisharp workspace to the container
            services.AddInstance(Workspace);

            // Caching
            services.AddSingleton<IMemoryCache, MemoryCache>();
            services.AddSingleton<IMetadataFileReferenceCache, MetadataFileReferenceCache>();

            // Add the project systems
            services.AddInstance(new AspNet5Context());
            services.AddInstance(new MSBuildContext());

            services.AddSingleton<IProjectSystem, AspNet5ProjectSystem>();
            services.AddSingleton<IProjectSystem, MSBuildProjectSystem>();

            // Add the file watcher
            services.AddSingleton<IFileSystemWatcher, FileSystemWatcherWrapper>();

            // Add test command providers
            services.AddSingleton<ITestCommandProvider, AspNet5TestCommandProvider>();

            // Add the code action provider
            services.AddSingleton<ICodeActionProvider, EmptyCodeActionProvider>();
            
#if ASPNET50
            services.AddSingleton<ICodeActionProvider, NRefactoryCodeActionProvider>();
#endif

            // Setup the options from configuration
            services.Configure<OmniSharpOptions>(Configuration);
        }
Ejemplo n.º 4
0
        public async Task<FixUsingsResponse> FixUsings(OmnisharpWorkspace workspace, Document document)
        {
            _workspace = workspace;
            _document = document;
            _semanticModel = await document.GetSemanticModelAsync();
            await AddMissingUsings();
            await RemoveUsings();
            await SortUsings();
            await TryAddLinqQuerySyntax();
            var ambiguous = await GetAmbiguousUsings();
            var response = new FixUsingsResponse();
            response.AmbiguousResults = ambiguous;

            return response;
        }
Ejemplo n.º 5
0
        public async Task<FixUsingsResponse> FixUsings(OmnisharpWorkspace workspace, IEnumerable<ICodeActionProvider> codeActionProviders, Document document)
        {
            _workspace = workspace;
            _document = document;
            _semanticModel = await document.GetSemanticModelAsync();
            await AddMissingUsings(codeActionProviders);
            await RemoveUsings(codeActionProviders);
#if DNX451
            await SortUsings();
#endif
            await TryAddLinqQuerySyntax();
            var ambiguous = await GetAmbiguousUsings(codeActionProviders);
            var response = new FixUsingsResponse();
            response.AmbiguousResults = ambiguous;

            return response;
        }
Ejemplo n.º 6
0
        public async Task <FixUsingsResponse> FixUsings(OmnisharpWorkspace workspace, IEnumerable <ICodeActionProvider> codeActionProviders, Document document)
        {
            _workspace     = workspace;
            _document      = document;
            _semanticModel = await document.GetSemanticModelAsync();
            await AddMissingUsings(codeActionProviders);
            await RemoveUsings(codeActionProviders);

#if DNX451
            await SortUsings();
#endif
            await TryAddLinqQuerySyntax();

            var ambiguous = await GetAmbiguousUsings(codeActionProviders);

            var response = new FixUsingsResponse();
            response.AmbiguousResults = ambiguous;

            return(response);
        }
Ejemplo n.º 7
0
        public void ConfigureServices(IServiceCollection services)
        {
            Workspace = new OmnisharpWorkspace();

            // This is super hacky by it's the easiest way to flow serivces from the
            // hosting layer, this needs to be easier
            services.AddInstance <IOmnisharpEnvironment>(Program.Environment);

            services.AddMvc(Configuration);

            services.Configure <MvcOptions>(opt =>
            {
                opt.OutputFormatters.RemoveAll(r => r.Instance is XmlOutputFormatter);
            });

            // Add the omnisharp workspace to the container
            services.AddInstance(Workspace);

            // Caching
            services.AddSingleton <IMemoryCache, MemoryCache>();
            services.AddSingleton <IMetadataFileReferenceCache, MetadataFileReferenceCache>();

            // Add the project systems
            services.AddInstance(new AspNet5Context());
            services.AddInstance(new MSBuildContext());

            services.AddSingleton <IProjectSystem, AspNet5ProjectSystem>();
            services.AddSingleton <IProjectSystem, MSBuildProjectSystem>();

            // Add the file watcher
            services.AddSingleton <IFileSystemWatcher, FileSystemWatcherWrapper>();

            // Add test command providers
            services.AddSingleton <ITestCommandProvider, AspNet5TestCommandProvider>();

            // Setup the options from configuration
            services.Configure <OmniSharpOptions>(Configuration);
        }
        public DnxProjectSystem CreateProjectSystem(
			Solution solution,
			IApplicationLifetime appLifetime,
			DnxContext context)
        {
            var workspace = new OmnisharpWorkspace ();
            var env = new OmnisharpEnvironment (solution.BaseDirectory);
            var options = new OmniSharpOptionsWrapper ();
            var loggerFactory = new LoggerFactory ();
            var cache = new MetadataFileReferenceCache ();
            var emitter = new EventEmitter ();
            var watcher = new FileSystemWatcherWrapper (env);

            return new DnxProjectSystem (
                workspace,
                env,
                options,
                loggerFactory,
                cache,
                appLifetime,
                watcher,
                emitter,
                context);
        }
 public CodeActionController(OmnisharpWorkspace workspace, IEnumerable<ICodeActionProvider> providers)
 {
     _workspace = workspace;
     _codeActionProviders = providers;
 }
Ejemplo n.º 10
0
 public OmnisharpController(OmnisharpWorkspace workspace, IOptions<OmniSharpOptions> optionsAccessor)
 {
     _workspace = workspace;
     _options = optionsAccessor != null ? optionsAccessor.Options : new OmniSharpOptions();
 }
Ejemplo n.º 11
0
 public CodeActionController(OmnisharpWorkspace workspace, IEnumerable <ICodeActionProvider> providers)
 {
     _workspace           = workspace;
     _codeActionProviders = providers;
 }
Ejemplo n.º 12
0
 public StatusMiddleware(RequestDelegate next, OmnisharpWorkspace workspace)
 {
     _next = next;
     _workspace = workspace;
 }
Ejemplo n.º 13
0
        public void ConfigureServices(IServiceCollection services, IApplicationLifetime liftime, ISharedTextWriter writer)
        {
            Workspace = new OmnisharpWorkspace();

            // Working around another bad bug in ASP.NET 5
            // https://github.com/aspnet/Hosting/issues/151
            services.AddInstance(liftime);
            services.AddInstance(writer);

            // This is super hacky by it's the easiest way to flow serivces from the
            // hosting layer, this needs to be easier
            services.AddInstance <IOmnisharpEnvironment>(Program.Environment);

            services.AddMvc(Configuration);

            services.Configure <MvcOptions>(opt =>
            {
                opt.ApplicationModelConventions.Add(new FromBodyApplicationModelConvention());
                opt.Filters.Add(new UpdateBufferFilter(Workspace));
            });

            // Add the omnisharp workspace to the container
            services.AddInstance(Workspace);

            // Caching
            services.AddSingleton <IMemoryCache, MemoryCache>();
            services.AddSingleton <IMetadataFileReferenceCache, MetadataFileReferenceCache>();

            // Add the project systems
            services.AddInstance(new AspNet5Context());
            services.AddInstance(new MSBuildContext());

            services.AddSingleton <IProjectSystem, AspNet5ProjectSystem>();
            services.AddSingleton <IProjectSystem, MSBuildProjectSystem>();

            // Add the file watcher
            services.AddSingleton <IFileSystemWatcher, ManualFileSystemWatcher>();

            // Add test command providers
            services.AddSingleton <ITestCommandProvider, AspNet5TestCommandProvider>();

            // Add the code action provider
            services.AddSingleton <ICodeActionProvider, EmptyCodeActionProvider>();

#if ASPNET50
            services.AddSingleton <ICodeActionProvider, NRefactoryCodeActionProvider>();
#endif

            if (Program.Environment.TransportType == TransportType.Stdio)
            {
                services.AddSingleton <IEventEmitter, StdioEventEmitter>();
            }
            else
            {
                services.AddSingleton <IEventEmitter, NullEventEmitter>();
            }

            services.AddSingleton <ProjectEventForwarder, ProjectEventForwarder>();

            // Setup the options from configuration
            services.Configure <OmniSharpOptions>(Configuration);
        }
 public StatusMiddleware(RequestDelegate next, OmnisharpWorkspace workspace)
 {
     _next      = next;
     _workspace = workspace;
 }
 public ProjectSystemController(AspNet5Context aspnet5Context, MSBuildContext msbuildContext, OmnisharpWorkspace workspace)
 {
     _aspnet5Context = aspnet5Context;
     _msbuildContext = msbuildContext;
     _workspace = workspace;
 }
Ejemplo n.º 16
0
 public OmnisharpController(OmnisharpWorkspace workspace, IOptions <OmniSharpOptions> optionsAccessor)
 {
     _workspace = workspace;
     _options   = optionsAccessor != null ? optionsAccessor.Options : new OmniSharpOptions();
 }
 public ProjectSystemController(AspNet5Context aspnet5Context, MSBuildContext msbuildContext, OmnisharpWorkspace workspace)
 {
     _aspnet5Context = aspnet5Context;
     _msbuildContext = msbuildContext;
     _workspace      = workspace;
 }
 public TestCommandController(OmnisharpWorkspace workspace,
                              IEnumerable<ITestCommandProvider> testCommandProviders)
 {
     _workspace = workspace;
     _testCommandProviders = testCommandProviders;
 }
Ejemplo n.º 19
0
 public OmnisharpController(OmnisharpWorkspace workspace)
 {
     _workspace = workspace;
 }