예제 #1
0
        private void SetSubmissionDocument(ITextBuffer buffer, Project project)
        {
            var documentId = DocumentId.CreateNewId(project.Id, debugName: project.Name);
            var solution   = project.Solution
                             .AddDocument(documentId, project.Name, buffer.CurrentSnapshot.AsText());

            _workspace.SetCurrentSolution(solution);

            // opening document will start workspace listening to changes in this text container
            _workspace.OpenDocument(documentId, buffer.AsTextContainer());
        }
예제 #2
0
        private void SetSubmissionDocument(ITextBuffer buffer, Project project)
        {
            // Try to unregister our buffer with our workspace. This is a bit of a hack,
            // but we may have registered the buffer with the workspace if it was
            // transitioned to an Interactive Command buffer.
            _workspace.UnregisterText(buffer.AsTextContainer());

            var documentId = DocumentId.CreateNewId(project.Id, debugName: project.Name);
            var solution   = project.Solution
                             .AddDocument(documentId, project.Name, buffer.CurrentSnapshot.AsText());

            _workspace.SetCurrentSolution(solution);

            // opening document will start workspace listening to changes in this text container
            _workspace.OpenDocument(documentId, buffer.AsTextContainer());
        }