internal InteractiveEvaluator(
            IContentType contentType,
            HostServices hostServices,
            IViewClassifierAggregatorService classifierAggregator,
            IInteractiveWindowCommandsFactory commandsFactory,
            ImmutableArray<IInteractiveWindowCommand> commands,
            string responseFilePath,
            string initialWorkingDirectory,
            string interactiveHostPath,
            Type replType)
        {
            Debug.Assert(responseFilePath == null || PathUtilities.IsAbsolute(responseFilePath));

            _contentType = contentType;
            _responseFilePath = responseFilePath;
            _workspace = new InteractiveWorkspace(this, hostServices);
            _contentTypeChangedHandler = new EventHandler<ContentTypeChangedEventArgs>(LanguageBufferContentTypeChanged);
            _classifierAggregator = classifierAggregator;
            _initialWorkingDirectory = initialWorkingDirectory;
            _commandsFactory = commandsFactory;
            _commands = commands;

            var hostPath = interactiveHostPath;
            _interactiveHost = new InteractiveHost(replType, hostPath, initialWorkingDirectory);
            _interactiveHost.ProcessStarting += ProcessStarting;
        }
Exemple #2
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary<string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     _loader = new MSBuildProjectLoader(this, properties);
 }
        internal InteractiveEvaluator(
            IContentType contentType,
            HostServices hostServices,
            IViewClassifierAggregatorService classifierAggregator,
            IInteractiveWindowCommandsFactory commandsFactory,
            ImmutableArray<IInteractiveWindowCommand> commands,
            string responseFilePath,
            string initialWorkingDirectory,
            string interactiveHostPath,
            Type replType)
        {
            Debug.Assert(responseFilePath == null || PathUtilities.IsAbsolute(responseFilePath));

            _contentType = contentType;
            _responseFilePath = responseFilePath;
            _workspace = new InteractiveWorkspace(this, hostServices);
            _contentTypeChangedHandler = new EventHandler<ContentTypeChangedEventArgs>(LanguageBufferContentTypeChanged);
            _classifierAggregator = classifierAggregator;
            _initialWorkingDirectory = initialWorkingDirectory;
            _commandsFactory = commandsFactory;
            _commands = commands;

            // The following settings will apply when the REPL starts without .rsp file.
            // They are discarded once the REPL is reset.
            ReferenceSearchPaths = ImmutableArray<string>.Empty;
            SourceSearchPaths = ImmutableArray<string>.Empty;
            WorkingDirectory = initialWorkingDirectory;
            var metadataService = _workspace.CurrentSolution.Services.MetadataService;
            _metadataReferenceResolver = CreateMetadataReferenceResolver(metadataService, ReferenceSearchPaths, _initialWorkingDirectory);
            _sourceReferenceResolver = CreateSourceReferenceResolver(SourceSearchPaths, _initialWorkingDirectory);

            _interactiveHost = new InteractiveHost(replType, interactiveHostPath, initialWorkingDirectory);
            _interactiveHost.ProcessStarting += ProcessStarting;
        }
 internal InteractiveWorkspace(HostServices hostServices)
     : base(hostServices, WorkspaceKind.Interactive)
 {
     // register work coordinator for this workspace
     _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>();
     _registrationService.Register(this);
 }
Exemple #5
0
		///<summary>Creates an <see cref="EditorWorkspace"/> powered by the specified MEF host services.</summary>
		public EditorWorkspace(HostServices host) : base(host, WorkspaceKind.Host) {
			(host as MefV1HostServices)?.GetExports<RoslynSetup>().Single().Value.ToString();

			ISolutionCrawlerRegistrationService.GetMethod("Register")
				.Invoke(GetInternalService(ISolutionCrawlerRegistrationService), new[] { this });

			// TODO: http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.EditorFeatures/Implementation/Workspaces/ProjectCacheService.cs,63?
		}
        internal RoslynWorkspace(HostServices host, INuGetProvider nuGetProvider, RoslynHost roslynHost)
            : base(host, WorkspaceKind.Host)
        {
            _nuGetProvider = nuGetProvider;
            _referencesDirectives = new ConcurrentDictionary<string, DirectiveInfo>();

            RoslynHost = roslynHost;
        }
            public MarkdownWorkspace(HostServices host) : base(host, WorkspaceKind.Interactive) // TODO: Change to Host on next release
            {
                var wcrService = typeof(HostWorkspaceServices)
                    .GetMethod(nameof(HostWorkspaceServices.GetService))
                    .MakeGenericMethod(IWorkCoordinatorRegistrationService)
                    .Invoke(Services, null);

                IWorkCoordinatorRegistrationService.GetMethod("Register").Invoke(wcrService, new[] { this });
            }
            public MarkdownWorkspace(HostServices host) : base(host, WorkspaceKind.Host)
            {
                var scrService = typeof(HostWorkspaceServices)
                    .GetMethod("GetService")
                    .MakeGenericMethod(ISolutionCrawlerRegistrationService)
                    .Invoke(Services, null);

                ISolutionCrawlerRegistrationService.GetMethod("Register").Invoke(scrService, new[] { this });
            }
        internal InteractiveWorkspace(InteractiveEvaluator engine, HostServices hostServices)
            : base(hostServices, "Interactive")
        {
            this.Engine = engine;

            // register work coordinator for this workspace
            _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>();
            _registrationService.Register(this);
        }
Exemple #10
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary<string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     // always make a copy of these build properties (no mutation please!)
     this.properties = properties ?? ImmutableDictionary<string, string>.Empty;
     this.SetSolutionProperties(solutionFilePath: null);
 }
Exemple #11
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary<string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     // always make a copy of these build properties (no mutation please!)
     _properties = properties ?? ImmutableDictionary<string, string>.Empty;
     this.SetSolutionProperties(solutionFilePath: null);
     this.LoadMetadataForReferencedProjects = false;
     this.SkipUnrecognizedProjects = true;
 }
Exemple #12
0
        internal InteractiveWorkspace(InteractiveEvaluator engine, HostServices hostServices)
            : base(hostServices, "Interactive")
        {
            this.Engine = engine;

            // register work coordinator for this workspace
            _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>();
            _registrationService.Register(this);

            // TODO (https://github.com/dotnet/roslyn/issues/5107): Enable in Interactive.
            this.Options = this.Options.WithChangedOption(InternalFeatureOnOffOptions.Snippets, false);
        }
        internal VisualStudioWorkspace(HostServices hostServices, WorkspaceBackgroundWork backgroundWork)
            : base(hostServices, WorkspaceKind.Host)
        {
            if ((backgroundWork & WorkspaceBackgroundWork.Compile) != 0)
            {
                _backgroundCompiler = new BackgroundCompiler(this);
            }

            if ((backgroundWork & WorkspaceBackgroundWork.Parse) != 0)
            {
                _backgroundParser = new BackgroundParser(this);
                _backgroundParser.Start();
            }
        }
Exemple #14
0
        /// <summary>
        /// Create a new instance of a workspace that can be populated by opening solution and project files.
        /// </summary>
        /// <param name="properties">The MSBuild properties used when interpreting project files.
        /// These are the same properties that are passed to msbuild via the /property:&lt;n&gt;=&lt;v&gt; command line argument.</param>
        /// <param name="hostServices">The <see cref="HostServices"/> used to configure this workspace.</param>
        public static MSBuildWorkspace Create(IDictionary<string, string> properties, HostServices hostServices)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            if (hostServices == null)
            {
                throw new ArgumentNullException(nameof(hostServices));
            }

            return new MSBuildWorkspace(hostServices, properties.ToImmutableDictionary());
        }
 public CSharpInteractiveEvaluator(
     HostServices hostServices,
     IViewClassifierAggregatorService classifierAggregator,
     IInteractiveWindowCommandsFactory commandsFactory,
     ImmutableArray<IInteractiveWindowCommand> commands,
     IContentTypeRegistryService contentTypeRegistry,
     string responseFileDirectory,
     string initialWorkingDirectory)
     : base(
         contentTypeRegistry.GetContentType(ContentTypeNames.CSharpContentType),
         hostServices,
         classifierAggregator,
         commandsFactory,
         commands,
         (responseFileDirectory != null) ? Path.Combine(responseFileDirectory, InteractiveResponseFile) : null,
         initialWorkingDirectory,
         typeof(InteractiveHostEntryPoint).Assembly.Location,
         typeof(CSharpReplServiceProvider))
 {
 }
        internal VisualStudioWorkspace(HostServices hostServices, WorkspaceBackgroundWork backgroundWork)
            : base(hostServices, WorkspaceKind.Host)
        {
            if ((backgroundWork & WorkspaceBackgroundWork.Compile) != 0)
            {
                _backgroundCompiler = new BackgroundCompiler(this);

                var cacheService = Services.GetService<IWorkspaceCacheService>();
                if (cacheService != null)
                {
                    cacheService.CacheFlushRequested += OnCacheFlushRequested;
                }
            }

            if ((backgroundWork & WorkspaceBackgroundWork.Parse) != 0)
            {
                _backgroundParser = new BackgroundParser(this);
                _backgroundParser.Start();
            }
        }
Exemple #17
0
 public ScriptingWorkspace(HostServices hostServices) : base(hostServices, WorkspaceKind.Host)
 {
     documentationProviders = new ConcurrentDictionary<string, DocumentationProvider>();
 }
		static MonoDevelopWorkspace ()
		{
			List<Assembly> assemblies = new List<Assembly> ();
			foreach (var asmName in mefHostServices) {
				try {
					var asm = Assembly.Load (asmName);
					if (asm == null)
						continue;
					assemblies.Add (asm);
				} catch (Exception) {
					LoggingService.LogError ("Error - can't load host service assembly: " + asmName);
				}
			}
			assemblies.Add (typeof(MonoDevelopWorkspace).Assembly);
			services = Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (assemblies);
		}
 public MetadataAsSourceWorkspace(MetadataAsSourceFileService fileService, HostServices hostServices)
     : base(hostServices, "MetadataAsSource")
 {
     this.FileService = fileService;
 }
Exemple #20
0
 /// <summary>
 /// Create a new instance of a workspace that can be populated by opening solution and project files.
 /// </summary>
 /// <param name="hostServices">The <see cref="HostServices"/> used to configure this workspace.</param>
 public static MSBuildWorkspace Create(HostServices hostServices)
 {
     return Create(ImmutableDictionary<string, string>.Empty, hostServices);
 }
Exemple #21
0
 public PreviewWorkspace(HostServices hostServices)
     : base(hostServices, WorkspaceKind.Preview)
 {
 }
 internal InteractiveWorkspace(HostServices host)
     : base(host, "Interactive")
 {
 }
Exemple #23
0
 public AdhocWorkspace(HostServices host, string workspaceKind = "Custom")
     : base(host, workspaceKind)
 {
 }