Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary<string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     _loader = new MSBuildProjectLoader(this, properties);
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 internal InteractiveWorkspace(HostServices hostServices)
     : base(hostServices, WorkspaceKind.Interactive)
 {
     // register work coordinator for this workspace
     _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>();
     _registrationService.Register(this);
 }
Ejemplo n.º 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?
		}
Ejemplo n.º 6
0
        internal RoslynWorkspace(HostServices host, INuGetProvider nuGetProvider, RoslynHost roslynHost)
            : base(host, WorkspaceKind.Host)
        {
            _nuGetProvider = nuGetProvider;
            _referencesDirectives = new ConcurrentDictionary<string, DirectiveInfo>();

            RoslynHost = roslynHost;
        }
Ejemplo n.º 7
0
            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 });
            }
Ejemplo n.º 8
0
            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 });
            }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 13
0
        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();
            }
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 15
0
 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))
 {
 }
Ejemplo n.º 16
0
        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();
            }
        }
Ejemplo n.º 17
0
 public ScriptingWorkspace(HostServices hostServices) : base(hostServices, WorkspaceKind.Host)
 {
     documentationProviders = new ConcurrentDictionary<string, DocumentationProvider>();
 }
Ejemplo n.º 18
0
		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);
		}
Ejemplo n.º 19
0
 public MetadataAsSourceWorkspace(MetadataAsSourceFileService fileService, HostServices hostServices)
     : base(hostServices, "MetadataAsSource")
 {
     this.FileService = fileService;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 21
0
 public PreviewWorkspace(HostServices hostServices)
     : base(hostServices, WorkspaceKind.Preview)
 {
 }
Ejemplo n.º 22
0
 internal InteractiveWorkspace(HostServices host)
     : base(host, "Interactive")
 {
 }
Ejemplo n.º 23
0
 public AdhocWorkspace(HostServices host, string workspaceKind = "Custom")
     : base(host, workspaceKind)
 {
 }