#pragma warning restore 0169

		public SignatureHelpPresenter(ISignatureHelpSession session, ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, IClassifierAggregatorService classifierAggregatorService, IClassificationFormatMap classificationFormatMap) {
			if (session == null)
				throw new ArgumentNullException(nameof(session));
			if (textBufferFactoryService == null)
				throw new ArgumentNullException(nameof(textBufferFactoryService));
			if (contentTypeRegistryService == null)
				throw new ArgumentNullException(nameof(contentTypeRegistryService));
			if (classifierAggregatorService == null)
				throw new ArgumentNullException(nameof(classifierAggregatorService));
			if (classificationFormatMap == null)
				throw new ArgumentNullException(nameof(classificationFormatMap));
			this.session = session;
			control = new SignatureHelpPresenterControl { DataContext = this };
			signatureTextBuffer = textBufferFactoryService.CreateTextBuffer();
			otherTextBuffer = textBufferFactoryService.CreateTextBuffer();
			signatureTextBuffer.Properties[SignatureHelpConstants.SessionBufferKey] = session;
			otherTextBuffer.Properties[SignatureHelpConstants.SessionBufferKey] = session;
			this.contentTypeRegistryService = contentTypeRegistryService;
			this.classifierAggregatorService = classifierAggregatorService;
			this.classificationFormatMap = classificationFormatMap;
			defaultExtendedContentType = contentTypeRegistryService.GetContentType(DefaultExtendedContentTypeName);
			Debug.Assert(defaultExtendedContentType != null);
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			session.Dismissed += Session_Dismissed;
			session.SelectedSignatureChanged += Session_SelectedSignatureChanged;
			control.MouseDown += Control_MouseDown;
			// This isn't exposed but ReadOnlyObservableCollection<ISignature> does implement the interface
			((INotifyCollectionChanged)session.Signatures).CollectionChanged += Signatures_CollectionChanged;
			UpdateSelectedSignature();
			UpdatePresentationSpan();
		}
Beispiel #2
0
        private ITextBuffer CreateNewBuffer(Document document, CancellationToken cancellationToken)
        {
            // is it okay to create buffer from threads other than UI thread?
            var contentTypeService = document.Project.LanguageServices.GetService <IContentTypeLanguageService>();
            var contentType        = contentTypeService.GetDefaultContentType();

            return(_textBufferFactoryService.CreateTextBuffer(document.GetTextAsync(cancellationToken).WaitAndGetResult(cancellationToken).ToString(), contentType));
        }
        private async ValueTask <ITextBuffer> CreateNewBufferAsync(Document document, CancellationToken cancellationToken)
        {
            await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var contentTypeService = document.GetRequiredLanguageService <IContentTypeLanguageService>();
            var contentType        = contentTypeService.GetDefaultContentType();

#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task (containing method uses JTF)
            var text = await document.State.GetTextAsync(cancellationToken);

#pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task
            return(_textBufferFactoryService.CreateTextBuffer(text.ToString(), contentType));
        }
Beispiel #4
0
        /// <summary>
        /// Create an ITextBuffer with the specified content
        /// </summary>
        public static ITextBuffer CreateTextBufferRaw(this ITextBufferFactoryService textBufferFactoryService, string content, IContentType contentType = null)
        {
            var textBuffer = contentType != null
                ? textBufferFactoryService.CreateTextBuffer(contentType)
                : textBufferFactoryService.CreateTextBuffer();

            if (!string.IsNullOrEmpty(content))
            {
                textBuffer.Replace(new Span(0, 0), content);
            }

            return(textBuffer);
        }
Beispiel #5
0
        /// <summary>
        /// Create an ITextBuffer with the specified content type and lines
        /// </summary>
        public static ITextBuffer CreateTextBuffer(this ITextBufferFactoryService textBufferFactoryService, IContentType contentType, params string[] lines)
        {
            var textBuffer = contentType != null
                ? textBufferFactoryService.CreateTextBuffer(contentType)
                : textBufferFactoryService.CreateTextBuffer();

            if (lines.Length != 0)
            {
                var text = lines.Aggregate((x, y) => x + Environment.NewLine + y);
                textBuffer.Replace(new Span(0, 0), text);
            }

            return(textBuffer);
        }
Beispiel #6
0
        public IEditValue Create(string text, EditValueFlags flags)
        {
            var buffer    = textBufferFactoryService.CreateTextBuffer(text, contentType);
            var rolesHash = new HashSet <string>(textEditorFactoryService.DefaultRoles, StringComparer.OrdinalIgnoreCase)
            {
                EditValueConstants.EditValueTextViewRole,
            };

            // This also disables: line compressor, current line highlighter
            rolesHash.Remove(PredefinedTextViewRoles.Document);
            rolesHash.Remove(PredefinedTextViewRoles.Zoomable);
            foreach (var s in extraTextViewRoles)
            {
                rolesHash.Add(s);
            }
            var roles    = textEditorFactoryService.CreateTextViewRoleSet(rolesHash);
            var textView = textEditorFactoryService.CreateTextView(buffer, roles);

            try {
                return(new EditValueImpl(textView, flags));
            }
            catch {
                textView.Close();
                throw;
            }
        }
Beispiel #7
0
        public async Task InteractiveWindowIntegration01()
        {
            var workflow = UIThreadHelper.Instance.Invoke(() => _workflowProvider.GetOrCreate());
            var history  = workflow.History;
            var session  = workflow.RSession;

            using (await UIThreadHelper.Instance.Invoke(() => workflow.GetOrCreateVisualComponent(_interactiveWindowComponentContainerFactory))) {
                workflow.ActiveWindow.Should().NotBeNull();
                session.IsHostRunning.Should().BeTrue();

                var eval   = workflow.ActiveWindow.InteractiveWindow.Evaluator;
                var result = await eval.ExecuteCodeAsync("x <- c(1:10)\r\n");

                result.Should().Be(ExecutionResult.Success);
                history.HasEntries.Should().BeTrue();
                history.HasSelectedEntries.Should().BeFalse();
                history.SelectHistoryEntry(0);
                history.HasSelectedEntries.Should().BeTrue();

                var textBuffer = _textBufferFactory.CreateTextBuffer(_contentTypeRegistryService.GetContentType(RContentTypeDefinition.ContentType));
                var textView   = UIThreadHelper.Instance.Invoke(() => _textEditorFactory.CreateTextView(textBuffer, _textEditorFactory.DefaultRoles));

                history.SendSelectedToTextView(textView);
                var text = textBuffer.CurrentSnapshot.GetText();
                text.Should().Be("x <- c(1:10)");

                UIThreadHelper.Instance.Invoke(() => textView.Close());
            }
        }
        public void UpdatePreview(string text)
        {
            const string start = "//[";
            const string end   = "//]";

            var service   = MefV1HostServices.Create(_componentModel.DefaultExportProvider);
            var workspace = new PreviewWorkspace(service);
            var fileName  = string.Format("project.{0}", Language == "C#" ? "csproj" : "vbproj");
            var project   = workspace.CurrentSolution.AddProject(fileName, "assembly.dll", Language);

            // use the mscorlib, system, and system.core that are loaded in the current process.
            string[] references =
            {
                "mscorlib",
                "System",
                "System.Core"
            };

            var metadataService = workspace.Services.GetService <IMetadataService>();

            var referenceAssemblies = Thread.GetDomain().GetAssemblies()
                                      .Where(x => references.Contains(x.GetName(true).Name, StringComparer.OrdinalIgnoreCase))
                                      .Select(a => metadataService.GetReference(a.Location, MetadataReferenceProperties.Assembly));

            project = project.WithMetadataReferences(referenceAssemblies);

            var document  = project.AddDocument("document", SourceText.From(text, Encoding.UTF8));
            var formatted = Formatter.FormatAsync(document, this.Options).WaitAndGetResult(CancellationToken.None);

            var textBuffer = _textBufferFactoryService.CreateTextBuffer(formatted.GetTextAsync().Result.ToString(), _contentType);

            var container = textBuffer.AsTextContainer();
            var documentBackedByTextBuffer = document.WithText(container.CurrentText);

            var bufferText = textBuffer.CurrentSnapshot.GetText().ToString();
            var startIndex = bufferText.IndexOf(start, StringComparison.Ordinal);
            var endIndex   = bufferText.IndexOf(end, StringComparison.Ordinal);
            var startLine  = textBuffer.CurrentSnapshot.GetLineNumberFromPosition(startIndex) + 1;
            var endLine    = textBuffer.CurrentSnapshot.GetLineNumberFromPosition(endIndex);

            var projection = _projectionBufferFactory.CreateProjectionBufferWithoutIndentation(_contentTypeRegistryService,
                                                                                               _editorOptions.CreateOptions(),
                                                                                               textBuffer.CurrentSnapshot,
                                                                                               "",
                                                                                               LineSpan.FromBounds(startLine, endLine));

            var textView = _textEditorFactoryService.CreateTextView(projection,
                                                                    _textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable));

            this.TextViewHost = _textEditorFactoryService.CreateTextViewHost(textView, setFocus: false);

            workspace.TryApplyChanges(documentBackedByTextBuffer.Project.Solution);
            workspace.OpenDocument(document.Id);

            this.TextViewHost.Closed += (s, a) =>
            {
                workspace.Dispose();
                workspace = null;
            };
        }
        public DocumentViewerControl(ITextBufferFactoryService textBufferFactoryService, IDsTextEditorFactoryService dsTextEditorFactoryService, IDocumentViewerHelper textEditorHelper)
        {
            if (textBufferFactoryService == null)
            {
                throw new ArgumentNullException(nameof(textBufferFactoryService));
            }
            if (dsTextEditorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(dsTextEditorFactoryService));
            }
            this.textEditorHelper   = textEditorHelper ?? throw new ArgumentNullException(nameof(textEditorHelper));
            defaultContentType      = textBufferFactoryService.TextContentType;
            cachedColorsList        = new CachedColorsList();
            emptyContent            = new DocumentViewerContent(string.Empty, CachedTextColorsCollection.Empty, SpanDataCollection <ReferenceInfo> .Empty, new Dictionary <string, object>());
            currentContent          = new CurrentContent(emptyContent, defaultContentType);
            spanReferenceCollection = SpanDataCollection <ReferenceAndId> .Empty;

            var textBuffer = textBufferFactoryService.CreateTextBuffer(textBufferFactoryService.TextContentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var roles   = dsTextEditorFactoryService.CreateTextViewRoleSet(defaultRoles);
            var options = new TextViewCreatorOptions {
                EnableUndoHistory = false
            };
            var textView        = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, options);
            var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true);
            Children.Add(wpfTextViewHost.HostControl);
        }
Beispiel #10
0
        public void UpdatePreview(string text)
        {
            const string start = "//[";
            const string end   = "//]";

            var sourceText = SourceText.From(text);
            var syntaxTree = SyntaxFactory.ParseSyntaxTree(sourceText);
            var edits      = Formatter.GetEdits(syntaxTree, new TextSpan(sourceText, 0, text.Length), _optionsService.FormattingOptions);
            var formatted  = Formatter.ApplyEdits(text, edits);

            var textBuffer = _textBufferFactoryService.CreateTextBuffer(formatted, _contentType);

            var bufferText = textBuffer.CurrentSnapshot.GetText().ToString();
            var startIndex = bufferText.IndexOf(start, StringComparison.Ordinal);
            var endIndex   = bufferText.IndexOf(end, StringComparison.Ordinal);
            var startLine  = textBuffer.CurrentSnapshot.GetLineNumberFromPosition(startIndex) + 1;
            var endLine    = textBuffer.CurrentSnapshot.GetLineNumberFromPosition(endIndex);

            var projection = _projectionBufferFactory.CreateProjectionBufferWithoutIndentation(_contentTypeRegistryService,
                                                                                               _editorOptions.CreateOptions(),
                                                                                               textBuffer.CurrentSnapshot,
                                                                                               "",
                                                                                               LineSpan.FromBounds(startLine, endLine));

            var textView = _textEditorFactoryService.CreateTextView(projection,
                                                                    _textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable));

            this.TextViewHost = _textEditorFactoryService.CreateTextViewHost(textView, setFocus: false);
        }
Beispiel #11
0
        public LogEditor(LogEditorOptions options, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            this.dispatcher       = Dispatcher.CurrentDispatcher;
            this.cachedColorsList = new CachedColorsList();
            options = options?.Clone() ?? new LogEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));

            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = textBufferFactoryService.CreateTextBuffer(contentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var rolesList = new List <string>(defaultRoles);

            rolesList.AddRange(options.ExtraRoles);
            var roles           = dnSpyTextEditorFactoryService.CreateTextViewRoleSet(rolesList);
            var textView        = dnSpyTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
            var wpfTextViewHost = dnSpyTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            this.wpfTextView     = wpfTextViewHost.TextView;
            wpfTextView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStylesConstants.DefaultValue);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
            SetNewDocument();
        }
Beispiel #12
0
        public override bool TryCreateFor(ITextBuffer hostDocumentBuffer, out VirtualDocument virtualDocument)
        {
            if (hostDocumentBuffer is null)
            {
                throw new ArgumentNullException(nameof(hostDocumentBuffer));
            }

            if (!hostDocumentBuffer.ContentType.IsOfType(RazorLSPContentTypeDefinition.Name))
            {
                // Another content type we don't care about.
                virtualDocument = null;
                return(false);
            }

            var hostDocumentUri = _fileUriProvider.GetOrCreate(hostDocumentBuffer);

            // Index.cshtml => Index.cshtml__virtual.html
            var virtualHtmlFilePath = hostDocumentUri.GetAbsoluteOrUNCPath() + VirtualHtmlFileNameSuffix;
            var virtualHtmlUri      = new Uri(virtualHtmlFilePath);

            var htmlBuffer = _textBufferFactory.CreateTextBuffer();

            _fileUriProvider.AddOrUpdate(htmlBuffer, virtualHtmlUri);
            htmlBuffer.Properties.AddProperty(ContainedLanguageMarker, true);

            // Create a text document to trigger the Html language server initialization.
            _textDocumentFactory.CreateTextDocument(htmlBuffer, virtualHtmlFilePath);

            htmlBuffer.ChangeContentType(HtmlLSPContentType, editTag: null);

            virtualDocument = new HtmlVirtualDocument(virtualHtmlUri, htmlBuffer);
            return(true);
        }
Beispiel #13
0
        public static ITextView MakeTextViewRealTextBuffer(string content, IServiceContainer services)
        {
            ITextBufferFactoryService   svc = services.GetService <ITextBufferFactoryService>();
            IContentTypeRegistryService rg  = services.GetService <IContentTypeRegistryService>();
            ITextBuffer textBuffer          = svc.CreateTextBuffer(content, rg.GetContentType(RContentTypeDefinition.ContentType));

            return(new TextViewMock(textBuffer, 0));
        }
Beispiel #14
0
        public static ITextView MakeTextViewRealTextBuffer(string content)
        {
            ITextBufferFactoryService   svc = EditorShell.Current.ExportProvider.GetExportedValue <ITextBufferFactoryService>();
            IContentTypeRegistryService rg  = EditorShell.Current.ExportProvider.GetExportedValue <IContentTypeRegistryService>();
            ITextBuffer textBuffer          = svc.CreateTextBuffer(content, rg.GetContentType(RContentTypeDefinition.ContentType));

            return(new TextViewMock(textBuffer, 0));
        }
Beispiel #15
0
        public IRHistory CreateRHistory(IRInteractiveWorkflow interactiveWorkflow)
        {
            var textBuffer = _textBufferFactory.CreateTextBuffer(_contentType);
            var history    = new RHistory(interactiveWorkflow, textBuffer, _fileSystem, _settings, _editorOperationsFactory, _rtfBuilderService, () => RemoveRHistory(textBuffer));

            _histories[textBuffer] = history;
            return(history);
        }
            internal Document GetDocument(MetadataAsSourceFile file)
            {
                using var reader = new StreamReader(file.FilePath);
                var textBuffer = _textBufferFactoryService.CreateTextBuffer(reader, _textBufferFactoryService.TextContentType);

                Assert.True(_metadataAsSourceService.TryAddDocumentToWorkspace(file.FilePath, textBuffer));

                return(textBuffer.AsTextContainer().GetRelatedDocuments().Single());
            }
Beispiel #17
0
        private IClassifier GetClassifier(string content, out ITextBuffer textBuffer)
        {
            textBuffer = _tbfs.CreateTextBuffer(new ContentTypeMock(MdContentTypeDefinition.ContentType));
            textBuffer.Insert(0, content);

            MdClassifierProvider classifierProvider = new MdClassifierProvider(_crs, _ctrs, _cnp);

            return(classifierProvider.GetClassifier(textBuffer));
        }
Beispiel #18
0
        public IRHistory CreateRHistory(IRInteractiveWorkflowVisual interactiveWorkflow)
        {
            var contentType = _contentTypeRegistryService.GetContentType(RHistoryContentTypeDefinition.ContentType);
            var textBuffer  = _textBufferFactory.CreateTextBuffer(contentType);
            var history     = new RHistory(interactiveWorkflow, textBuffer, _fs, _settings, _editorOperationsFactory, _rtfBuilderService, () => RemoveRHistory(textBuffer));

            _histories[textBuffer] = history;
            return(history);
        }
Beispiel #19
0
        ITextBuffer IInteractiveWindowEditorFactoryService.CreateAndActivateBuffer(IInteractiveWindow window)
        {
            if (!window.Properties.TryGetProperty(typeof(IContentType), out IContentType contentType))
            {
                contentType = _contentTypeRegistry.GetContentType(ContentType);
            }

            return(_textBufferFactoryService.CreateTextBuffer(contentType));
        }
Beispiel #20
0
        public void UpdatePreview(string text)
        {
            var service   = VisualStudioMefHostServices.Create(_componentModel.GetService <ExportProvider>());
            var workspace = new PreviewWorkspace(service);
            var fileName  = "project." + (Language == "C#" ? "csproj" : "vbproj");
            var project   = workspace.CurrentSolution.AddProject(fileName, "assembly.dll", Language);

            // use the mscorlib, system, and system.core that are loaded in the current process.
            string[] references =
            {
                "mscorlib",
                "System",
                "System.Core"
            };

            var metadataService = workspace.Services.GetService <IMetadataService>();

            var referenceAssemblies = Thread.GetDomain().GetAssemblies()
                                      .Where(x => references.Contains(x.GetName(true).Name, StringComparer.OrdinalIgnoreCase))
                                      .Select(a => metadataService.GetReference(a.Location, MetadataReferenceProperties.Assembly));

            project = project.WithMetadataReferences(referenceAssemblies);

            var document = project.AddDocument("document", SourceText.From(text, Encoding.UTF8));
            var fallbackFormattingOptions = _globalOptions.GetSyntaxFormattingOptions(document.Project.LanguageServices);
            var optionService             = workspace.Services.GetRequiredService <IOptionService>();
            var configOptions             = OptionStore.GetOptions().AsAnalyzerConfigOptions(optionService, document.Project.Language);
            var formattingService         = document.GetRequiredLanguageService <ISyntaxFormattingService>();
            var formattingOptions         = formattingService.GetFormattingOptions(configOptions, fallbackFormattingOptions);
            var formatted = Formatter.FormatAsync(document, formattingOptions, CancellationToken.None).WaitAndGetResult(CancellationToken.None);

            var textBuffer = _textBufferFactoryService.CreateTextBuffer(formatted.GetTextSynchronously(CancellationToken.None).ToString(), _contentType);

            var container = textBuffer.AsTextContainer();

            var projection = _projectionBufferFactory.CreateProjectionBufferWithoutIndentation(_contentTypeRegistryService,
                                                                                               _editorOptions.CreateOptions(),
                                                                                               textBuffer.CurrentSnapshot,
                                                                                               separator: "",
                                                                                               exposedLineSpans: GetExposedLineSpans(textBuffer.CurrentSnapshot).ToArray());

            var textView = _textEditorFactoryService.CreateTextView(projection,
                                                                    _textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Interactive));

            this.TextViewHost = _textEditorFactoryService.CreateTextViewHost(textView, setFocus: false);

            workspace.TryApplyChanges(document.Project.Solution);
            workspace.OpenDocument(document.Id, container);

            this.TextViewHost.Closed += (s, a) =>
            {
                workspace.Dispose();
                workspace = null;
            };
        }
Beispiel #21
0
        public FirstUseOptimization(IThemeClassificationTypeService themeClassificationTypeService, ITextBufferFactoryService textBufferFactoryService, IRoslynDocumentationProviderFactory docFactory, IRoslynDocumentChangedService roslynDocumentChangedService)
        {
            var buffer = textBufferFactoryService.CreateTextBuffer();
            var tagger = new RoslynTagger(buffer, themeClassificationTypeService, roslynDocumentChangedService);

            Task.Run(() => InitializeAsync(buffer, tagger, docFactory))
            .ContinueWith(t => {
                var ex = t.Exception;
                Debug.Assert(ex == null);
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
        }
Beispiel #22
0
        public ITextBuffer CreateTextBuffer(string source, string filePath, string contentType)
        {
            var ct         = contentTypeRegistry.GetContentType(contentType);
            var textBuffer = textBufferFactory.CreateTextBuffer(source, ct);

            var documentId = CurrentSolution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault();

            documentId = documentId ?? CreateDocumentId(filePath);
            OnDocumentOpened(documentId, textBuffer.AsTextContainer());

            return(textBuffer);
        }
Beispiel #23
0
        private void CreateTextViewHost(string text, string filePath)
        {
            ITextDataModel textDataModel;

            text = text ?? string.Empty;

            var diskBuffer = _textBufferFactoryService.CreateTextBuffer(text, ContentType);
            var cs         = _services.GetService <ICompositionService>();

            _editorViewModel = EditorViewModelFactory.CreateEditorViewModel(diskBuffer, _services);

            if (_editorViewModel != null)
            {
                textDataModel = new TextDataModel(diskBuffer, _editorViewModel.ViewBuffer.As <ITextBuffer>());
            }
            else
            {
                textDataModel = new TextDataModel(diskBuffer, diskBuffer);
            }

            var textBuffer = textDataModel.DocumentBuffer;

            TextDocument = _textDocumentFactoryService.CreateTextDocument(textBuffer, filePath);

            SetGlobalEditorOptions();
            var textView = _textEditorFactoryService.CreateTextView(textDataModel,
                                                                    new DefaultTextViewRoleSet(),
                                                                    GlobalOptions);

            _wpftextViewHost = _textEditorFactoryService.CreateTextViewHost(textView, true);

            ApplyDefaultSettings();
            Control.Content = _wpftextViewHost.HostControl;

            var baseController = new BaseController();

            BaseController = baseController;

            if (_editorViewModel != null)
            {
                CommandTarget = _editorViewModel.GetCommandTarget(textView.ToEditorView());
                var controller = CommandTarget as Common.Core.UI.Commands.Controller;
                Debug.Assert(controller != null);
                controller.ChainedController = baseController;
            }
            else
            {
                CommandTarget = baseController;
            }

            baseController.Initialize(textView, EditorOperations, UndoManager, _services);
        }
Beispiel #24
0
		public CodeEditor(CodeEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) {
			options = options?.Clone() ?? new CodeEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = options.TextBuffer;
			if (textBuffer == null)
				textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			TextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
			TextViewHost.TextView.Options.SetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId, true);
		}
Beispiel #25
0
        private void CreateTextViewHost(string text, string filePath)
        {
            text = text ?? string.Empty;

            var diskBuffer = _textBufferFactoryService.CreateTextBuffer(text, ContentType);
            var cs         = _coreShell.GetService <ICompositionService>();

            _editorIntance = EditorInstanceFactory.CreateEditorInstance(diskBuffer, cs);

            ITextDataModel textDataModel;

            if (_editorIntance != null)
            {
                textDataModel = new TextDataModel(diskBuffer, _editorIntance.ViewBuffer);
            }
            else
            {
                textDataModel = new TextDataModel(diskBuffer, diskBuffer);
            }

            var textBuffer = textDataModel.DocumentBuffer;

            TextDocument = _textDocumentFactoryService.CreateTextDocument(textBuffer, filePath);

            SetGlobalEditorOptions();
            var textView = _textEditorFactoryService.CreateTextView(textDataModel,
                                                                    new DefaultTextViewRoleSet(),
                                                                    GlobalOptions);

            _wpftextViewHost = _textEditorFactoryService.CreateTextViewHost(textView, true);

            ApplyDefaultSettings();
            Control.Content = _wpftextViewHost.HostControl;

            var baseController = new BaseController();

            BaseController = baseController;

            if (_editorIntance != null)
            {
                CommandTarget = _editorIntance.GetCommandTarget(textView);
                var controller = CommandTarget as Microsoft.Languages.Editor.Controller.Controller;
                controller.ChainedController = baseController;
            }
            else
            {
                CommandTarget = baseController;
            }

            baseController.Initialize(textView, EditorOperations, UndoManager, _coreShell);
        }
        private EpochQuickInfoContent ConstructHighlightableContent(string text, TypeOfContent typeOfContent)
        {
            var content = new EpochQuickInfoContent();

            content.Lines = new List <List <ClassificationSpan> >();

            if (typeOfContent == TypeOfContent.Variable)
            {
                content.Glyph = m_glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);
            }
            else if (typeOfContent == TypeOfContent.Function)
            {
                content.Glyph = content.SubGlyph = m_glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic);
            }
            else if (typeOfContent == TypeOfContent.Structure)
            {
                content.Glyph    = m_glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupType, StandardGlyphItem.GlyphItemPublic);
                content.SubGlyph = m_glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);
            }

            var contentType = m_contentTypes.GetContentType("EpochFile");
            var buffer      = m_bufferFactory.CreateTextBuffer(text, contentType);
            var snapshot    = buffer.CurrentSnapshot;

            var classifier = m_classifierProvider.GetClassifier(buffer) as EpochClassifier;

            classifier.ParsedProject = m_subjectBuffer.Properties.GetProperty <Parser.Project>(typeof(Parser.Project));
            var spans = classifier.GetAllSpans(new SnapshotSpan(snapshot, 0, text.Length), true);

            var lines = text.Count(x => x == '\n') + 1;

            for (int i = 0; i < lines; ++i)
            {
                var line = new List <ClassificationSpan>();
                foreach (var span in spans)
                {
                    if (span.Span.Start.GetContainingLine().LineNumber == i)
                    {
                        line.Add(span);
                    }
                }

                content.Lines.Add(line);
            }

            return(content);
        }
Beispiel #27
0
 private SourceText CreateTextInternal(Stream stream, Encoding encoding, CancellationToken cancellationToken)
 {
     try
     {
         cancellationToken.ThrowIfCancellationRequested();
         stream.Seek(0, SeekOrigin.Begin);
         using (var reader = new StreamReader(stream, encoding, detectEncodingFromByteOrderMarks: true, bufferSize: 1024, leaveOpen: true))
         {
             var buffer = _textBufferFactory.CreateTextBuffer(reader, _unknownContentType);
             return(buffer.CurrentSnapshot.AsRoslynText(reader.CurrentEncoding));
         }
     }
     catch (DecoderFallbackException) when(encoding != Encoding.Default)
     {
         return(null);
     }
 }
Beispiel #28
0
        private bool TryCreateDirectoryTextBuffer(string directoryPath, out ITextBuffer textBuffer)
        {
            var contents = _fileSystem.ReadDirectoryContents(directoryPath);

            if (contents.IsNone())
            {
                textBuffer = null;
                return(false);
            }

            var contentType = _contentTypeRegistryService.GetContentType(DirectoryContentType.Name);
            var text        = string.Join(Environment.NewLine, contents.Value);

            textBuffer = _textBufferFactoryService.CreateTextBuffer(text, contentType);
            textBuffer.Properties.AddProperty(s_nameKey, directoryPath);
            return(true);
        }
Beispiel #29
0
 private void MaybeLoadVimRc()
 {
     if (!_vim.IsVimRcLoaded && String.IsNullOrEmpty(_vim.Settings.VimRcPaths))
     {
         // Need to pass the LoadVimRc call a function to create an ITextView that
         // can be used to load the settings against.  We don't want this ITextView
         // coming back through TextViewCreated so give it a ITextViewRole that won't
         // hit our filter
         Func <ITextView> createViewFunc = () => _editorFactoryService.CreateTextView(
             _bufferFactoryService.CreateTextBuffer(),
             _editorFactoryService.NoRoles);
         if (!_vim.LoadVimRc(_fileSystem, createViewFunc.ToFSharpFunc()))
         {
             // If no VimRc file is loaded add a couple of sanity settings
             _vim.VimRcLocalSettings.AutoIndent = true;
         }
     }
 }
Beispiel #30
0
        public CodeEditor(CodeEditorOptions options, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            options = options?.Clone() ?? new CodeEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = options.TextBuffer;

            if (textBuffer == null)
            {
                textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
            }
            var roles    = dnSpyTextEditorFactoryService.CreateTextViewRoleSet(defaultRoles);
            var textView = dnSpyTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);

            TextViewHost = dnSpyTextEditorFactoryService.CreateTextViewHost(textView, false);
            TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.CodeEditor);
            TextViewHost.TextView.Options.SetOptionValue(DefaultDnSpyTextViewOptions.RefreshScreenOnChangeId, true);
        }
        public override bool TryCreateFor(ITextBuffer hostDocumentBuffer, out VirtualDocument virtualDocument)
        {
            if (hostDocumentBuffer is null)
            {
                throw new ArgumentNullException(nameof(hostDocumentBuffer));
            }

            if (!hostDocumentBuffer.ContentType.IsOfType(HostDocumentContentTypeName))
            {
                // Another content type we don't care about.
                virtualDocument = null;
                return(false);
            }

            var hostDocumentUri = _fileUriProvider.GetOrCreate(hostDocumentBuffer);

            // E.g. Index.cshtml => Index.cshtml__virtual.html (for html), similar for other languages
            var virtualLanguageFilePath = hostDocumentUri.GetAbsoluteOrUNCPath() + LanguageFileNameSuffix;
            var virtualLanguageUri      = new Uri(virtualLanguageFilePath);

            var languageBuffer = _textBufferFactory.CreateTextBuffer();

            _fileUriProvider.AddOrUpdate(languageBuffer, virtualLanguageUri);

            // This ensures that LiveShare does not serialize this virtual document to disk in LiveShare & Codespaces scenarios.
            languageBuffer.Properties.AddProperty(ContainedLanguageMarker, true);

            if (!(LanguageBufferProperties is null))
            {
                foreach (var keyValuePair in LanguageBufferProperties)
                {
                    languageBuffer.Properties.AddProperty(keyValuePair.Key, keyValuePair.Value);
                }
            }

            // Create a text document to trigger language server initialization for the contained language.
            _textDocumentFactory.CreateTextDocument(languageBuffer, virtualLanguageFilePath);

            languageBuffer.ChangeContentType(LanguageContentType, editTag: null);

            virtualDocument = CreateVirtualDocument(virtualLanguageUri, languageBuffer);
            return(true);
        }
        public InteractiveWindow(
            IInteractiveWindowEditorFactoryService host,
            IContentTypeRegistryService contentTypeRegistry,
            ITextBufferFactoryService bufferFactory,
            IProjectionBufferFactoryService projectionBufferFactory,
            IEditorOperationsFactoryService editorOperationsFactory,
            ITextEditorFactoryService editorFactory,
            IIntellisenseSessionStackMapService intellisenseSessionStackMap,
            ISmartIndentationService smartIndenterService,
            IInteractiveEvaluator evaluator)
        {
            if (evaluator == null)
            {
                throw new ArgumentNullException(nameof(evaluator));
            }

            _dangerous_uiOnly = new UIThreadOnly(this, host);

            this.Properties = new PropertyCollection();
            _history = new History();

            _intellisenseSessionStackMap = intellisenseSessionStackMap;
            _smartIndenterService = smartIndenterService;

            var textContentType = contentTypeRegistry.GetContentType("text");
            var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
            var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

            _outputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
            _standardInputBuffer = bufferFactory.CreateTextBuffer();

            var projBuffer = projectionBufferFactory.CreateProjectionBuffer(
                new EditResolver(this),
                Array.Empty<object>(),
                ProjectionBufferOptions.None,
                replContentType);

            // we need to set IReplPromptProvider property before TextViewHost is instantiated so that ReplPromptTaggerProvider can bind to it 
            projBuffer.Properties.AddProperty(typeof(InteractiveWindow), this);

            _projectionBuffer = projBuffer;
            _dangerous_uiOnly.AppendNewOutputProjectionBuffer(); // Constructor runs on UI thread.
            projBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);

            var roleSet = editorFactory.CreateTextViewRoleSet(
                PredefinedTextViewRoles.Analyzable,
                PredefinedTextViewRoles.Editable,
                PredefinedTextViewRoles.Interactive,
                PredefinedTextViewRoles.Zoomable,
                PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);

            _textView = host.CreateTextView(this, projBuffer, roleSet);

            _textView.Caret.PositionChanged += CaretPositionChanged;

            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.WordWrap);

            _lineBreakString = _textView.Options.GetNewLineCharacter();
            _dangerous_uiOnly.EditorOperations = editorOperationsFactory.GetEditorOperations(_textView); // Constructor runs on UI thread.

            _buffer = new OutputBuffer(this);
            _outputWriter = new InteractiveWindowWriter(this, spans: null);

            SortedSpans errorSpans = new SortedSpans();
            _errorOutputWriter = new InteractiveWindowWriter(this, errorSpans);
            OutputClassifierProvider.AttachToBuffer(_outputBuffer, errorSpans);

            RequiresUIThread();
            evaluator.CurrentWindow = this;
            _evaluator = evaluator;
        }
		public FirstUseOptimization(IThemeClassificationTypeService themeClassificationTypeService, ITextBufferFactoryService textBufferFactoryService, IRoslynDocumentationProviderFactory docFactory, IRoslynDocumentChangedService roslynDocumentChangedService) {
			var buffer = textBufferFactoryService.CreateTextBuffer();
			var tagger = new RoslynTagger(buffer, themeClassificationTypeService, roslynDocumentChangedService);
			Task.Run(() => InitializeAsync(buffer, tagger, docFactory))
			.ContinueWith(t => {
				var ex = t.Exception;
				Debug.Assert(ex == null);
			}, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
		}
 public static ITextView MakeTextViewRealTextBuffer(string content, string contentType, ITextBufferFactoryService svc, IContentTypeRegistryService rg) {
     ITextBuffer textBuffer = svc.CreateTextBuffer(content, rg.GetContentType(contentType));
     return new TextViewMock(textBuffer, 0);
 }
Beispiel #35
0
		public LogEditor(LogEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) {
			dispatcher = Dispatcher.CurrentDispatcher;
			cachedColorsList = new CachedColorsList();
			options = options?.Clone() ?? new LogEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));

			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
			var rolesList = new List<string>(defaultRoles);
			rolesList.AddRange(options.ExtraRoles);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(rolesList);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			this.wpfTextViewHost = wpfTextViewHost;
			wpfTextView = wpfTextViewHost.TextView;
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
			SetNewDocument();
		}
Beispiel #36
0
		public ReplEditor(ReplEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename, ITextViewUndoManagerProvider textViewUndoManagerProvider) {
			dispatcher = Dispatcher.CurrentDispatcher;
			this.pickSaveFilename = pickSaveFilename;
			options = options?.Clone() ?? new ReplEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
			PrimaryPrompt = options.PrimaryPrompt;
			SecondaryPrompt = options.SecondaryPrompt;
			subBuffers = new List<ReplSubBuffer>();
			cachedColorsList = new CachedColorsList();
			TextClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.Text);
			ReplPrompt1ClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.ReplPrompt1);
			ReplPrompt2ClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.ReplPrompt2);

			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			this.wpfTextViewHost = wpfTextViewHost;
			wpfTextView = wpfTextViewHost.TextView;
			textViewUndoManager = textViewUndoManagerProvider.GetTextViewUndoManager(wpfTextView);
			ReplEditorUtils.AddInstance(this, wpfTextView);
			wpfTextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
			//TODO: ReplEditorOperations doesn't support virtual space
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.UseVirtualSpaceId, false);
			//TODO: Support box selection
			wpfTextView.Options.SetOptionValue(DefaultDsTextViewOptions.AllowBoxSelectionId, false);
			wpfTextView.Options.OptionChanged += Options_OptionChanged;
			wpfTextView.TextBuffer.ChangedLowPriority += TextBuffer_ChangedLowPriority;
			wpfTextView.Closed += WpfTextView_Closed;
			wpfTextView.TextBuffer.Changed += TextBuffer_Changed;
			AddNewDocument();
			WriteOffsetOfPrompt(null, true);
			ReplEditorOperations = new ReplEditorOperations(this, wpfTextView, editorOperationsFactoryService);
			wpfTextView.VisualElement.Loaded += WpfTextView_Loaded;
			UpdateRefreshScreenOnChange();
			CustomLineNumberMargin.SetOwner(wpfTextView, new ReplCustomLineNumberMarginOwner(this, themeClassificationTypeService));
		}
            public UIThreadOnly(
                InteractiveWindow window,
                IInteractiveWindowEditorFactoryService factory,
                IContentTypeRegistryService contentTypeRegistry,
                ITextBufferFactoryService bufferFactory,
                IProjectionBufferFactoryService projectionBufferFactory,
                IEditorOperationsFactoryService editorOperationsFactory,
                ITextEditorFactoryService editorFactory,
                IRtfBuilderService rtfBuilderService,
                IIntellisenseSessionStackMapService intellisenseSessionStackMap,
                ISmartIndentationService smartIndenterService,
                IInteractiveEvaluator evaluator,
                IWaitIndicator waitIndicator)
            {
                _window = window;
                _factory = factory;
                _rtfBuilderService = (IRtfBuilderService2)rtfBuilderService;
                _intellisenseSessionStackMap = intellisenseSessionStackMap;
                _smartIndenterService = smartIndenterService;
                _waitIndicator = waitIndicator;
                Evaluator = evaluator;

                var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
                var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

                OutputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
                StandardInputBuffer = bufferFactory.CreateTextBuffer();
                _inertType = bufferFactory.InertContentType;

                _projectionBuffer = projectionBufferFactory.CreateProjectionBuffer(
                    new EditResolver(window),
                    Array.Empty<object>(),
                    ProjectionBufferOptions.None,
                    replContentType);

                _projectionBuffer.Properties.AddProperty(typeof(InteractiveWindow), window);

                AppendNewOutputProjectionBuffer();
                _projectionBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);

                var roleSet = editorFactory.CreateTextViewRoleSet(
                    PredefinedTextViewRoles.Analyzable,
                    PredefinedTextViewRoles.Editable,
                    PredefinedTextViewRoles.Interactive,
                    PredefinedTextViewRoles.Zoomable,
                    PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);

                TextView = factory.CreateTextView(window, _projectionBuffer, roleSet);
                TextView.Caret.PositionChanged += CaretPositionChanged;

                var options = TextView.Options;
                options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
                options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
                options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
                options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
                options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.None);

                _lineBreakString = options.GetNewLineCharacter();
                EditorOperations = editorOperationsFactory.GetEditorOperations(TextView);

                _buffer = new OutputBuffer(window);
                OutputWriter = new InteractiveWindowWriter(window, spans: null);

                SortedSpans errorSpans = new SortedSpans();
                ErrorOutputWriter = new InteractiveWindowWriter(window, errorSpans);
                OutputClassifierProvider.AttachToBuffer(OutputBuffer, errorSpans);
            }