public ScriptEvaluator(DefaultAssemblies defaultAssemblies) { this.scriptOptions = ScriptOptions.Default .WithReferences(defaultAssemblies.Assemblies.Value) .WithImports(defaultAssemblies.DefaultUsings); this.parseOptions = new CSharpParseOptions(LanguageVersion.Latest, kind: SourceCodeKind.Script); }
public WorkspaceManager(DefaultAssemblies defaultAssemblies) { EditorToSubmission = new ConcurrentDictionary <Guid, LinkedListNode <ReplSubmission> >(); OrderedSubmissions = new LinkedList <ReplSubmission>(); var host = MefHostServices.Create(MefHostServices.DefaultAssemblies); this.workspace = new AdhocWorkspace(host); this.defaultAssemblies = defaultAssemblies; this.compilationOptions = new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, usings: defaultAssemblies.DefaultUsings ); }
public ReplServices(FileIO injectedIO = null) // defaults to real io { // some of the initialization can be heavy, and causes slow startup time for the UI. // run it in a background thread so the UI can render immediately. requiredInitialization = Task.WhenAll( Task.Run(() => { this.syntaxHighlighter = new SyntaxHighlighter("Themes/theme.vssettings"); UserConfigurationLoaded?.Invoke(this, new UserConfiguration ( syntaxHighlighter.BackgroundColor, syntaxHighlighter.ForegroundColor )); this.codeCompleter = new CodeCompleter(); }), Task.Run(() => { this.io = injectedIO ?? FileIO.RealIO; var assemblies = new DefaultAssemblies(new DotNetAssemblyLocator(() => new Process(), io)); this.scriptEvaluator = new ScriptEvaluator(assemblies); this.workspaceManager = new WorkspaceManager(assemblies); }) ); commandInitialization = Task.Run(async() => { await requiredInitialization; this.commandHandlers = new ICommandHandler[] { new ExitCommandHandler(), new HelpCommandHandler(), new AssemblyReferenceCommandHandler(scriptEvaluator, workspaceManager, io), new NugetReferenceCommandHandler(scriptEvaluator, workspaceManager, new NugetPackageInstaller(io)), new EvaluationCommandHandler(scriptEvaluator, workspaceManager, new PrettyPrinter()) }; this.savers = new ISessionSaver[] { new CSharpSessionSaver(io, workspaceManager), new MarkdownSessionSaver(io), }; this.dataFlowAnalyzer = new DataFlowAnalyzer(); }); }