Ejemplo n.º 1
0
        private static Document CreateDocument(LinqPadWorkspace workspace, LinqPadSourceTextContainer textContainer, Project project)
        {
            var id       = DocumentId.CreateNewId(project.Id);
            var solution = project.Solution.AddDocument(id, project.Name, textContainer.CurrentText);

            workspace.SetCurrentSolution(solution);
            workspace.OpenDocument(id, textContainer);
            return(solution.GetDocument(id));
        }
Ejemplo n.º 2
0
        public DocumentId AddDocument(LinqPadSourceTextContainer container)
        {
            var workspace = new LinqPadWorkspace(host: this.host, roslynEditorHost: this);
            var project   = this.CreateProject(workspace.CurrentSolution);
            var document  = CreateDocument(
                workspace: workspace,
                project: project,
                textContainer: container);

            var a = document.GetTextAsync().Result.Container;

            this.workspaces.TryAdd(document.Id, workspace);
            return(document.Id);
        }