コード例 #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;
        }
コード例 #2
0
ファイル: MSBuildWorkspace.cs プロジェクト: noahstein/roslyn
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary<string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     _loader = new MSBuildProjectLoader(this, properties);
 }
コード例 #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;
        }
コード例 #4
0
 internal InteractiveWorkspace(HostServices hostServices)
     : base(hostServices, WorkspaceKind.Interactive)
 {
     // register work coordinator for this workspace
     _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>();
     _registrationService.Register(this);
 }
コード例 #5
0
ファイル: EditorWorkspace.cs プロジェクト: SLaks/VSEmbed
		///<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?
		}
コード例 #6
0
        internal RoslynWorkspace(HostServices host, INuGetProvider nuGetProvider, RoslynHost roslynHost)
            : base(host, WorkspaceKind.Host)
        {
            _nuGetProvider = nuGetProvider;
            _referencesDirectives = new ConcurrentDictionary<string, DirectiveInfo>();

            RoslynHost = roslynHost;
        }
コード例 #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 });
            }
コード例 #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 });
            }
コード例 #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);
        }
コード例 #10
0
ファイル: MSBuildWorkspace.cs プロジェクト: nagyist/roslyn
 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);
 }
コード例 #11
0
ファイル: MSBuildWorkspace.cs プロジェクト: furesoft/roslyn
 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;
 }
コード例 #12
0
ファイル: InteractiveWorkspace.cs プロジェクト: nemec/roslyn
        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);
        }
コード例 #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();
            }
        }
コード例 #14
0
ファイル: MSBuildWorkspace.cs プロジェクト: furesoft/roslyn
        /// <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());
        }
コード例 #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))
 {
 }
コード例 #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();
            }
        }
コード例 #17
0
ファイル: ScriptingWorkspace.cs プロジェクト: jhorv/dotnetpad
 public ScriptingWorkspace(HostServices hostServices) : base(hostServices, WorkspaceKind.Host)
 {
     documentationProviders = new ConcurrentDictionary<string, DocumentationProvider>();
 }
コード例 #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);
		}
コード例 #19
0
 public MetadataAsSourceWorkspace(MetadataAsSourceFileService fileService, HostServices hostServices)
     : base(hostServices, "MetadataAsSource")
 {
     this.FileService = fileService;
 }
コード例 #20
0
ファイル: MSBuildWorkspace.cs プロジェクト: RoryVL/roslyn
 /// <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);
 }
コード例 #21
0
ファイル: PreviewWorkspace.cs プロジェクト: Rickinio/roslyn
 public PreviewWorkspace(HostServices hostServices)
     : base(hostServices, WorkspaceKind.Preview)
 {
 }
コード例 #22
0
 internal InteractiveWorkspace(HostServices host)
     : base(host, "Interactive")
 {
 }
コード例 #23
0
ファイル: AdhocWorkspace.cs プロジェクト: Rickinio/roslyn
 public AdhocWorkspace(HostServices host, string workspaceKind = "Custom")
     : base(host, workspaceKind)
 {
 }