CodeEditorOptions CopyTo(CodeEditorOptions other) { base.CopyTo(other); other.TextBuffer = TextBuffer; other.Roles.Clear(); foreach (var r in Roles) other.Roles.Add(r); return other; }
CodeEditorOptions CopyTo(CodeEditorOptions other) { base.CopyTo(other); other.TextBuffer = TextBuffer; other.Roles.Clear(); foreach (var r in Roles) { other.Roles.Add(r); } return(other); }
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); }
CodeEditorOptions CopyTo(CodeEditorOptions other) { base.CopyTo(other); other.TextBuffer = TextBuffer; return(other); }
public ICodeEditor Create(CodeEditorOptions options) => new CodeEditor(options, dsTextEditorFactoryService, contentTypeRegistryService, textBufferFactoryService, editorOptionsFactoryService);
RoslynCodeDocument CreateDocument(ProjectId projectId, IDecompiledDocument doc) { var options = new CodeEditorOptions(); options.ContentTypeString = ContentType; options.Roles.Add(PredefinedDsTextViewRoles.RoslynCodeEditor); options.Roles.Add(TextViewRole); var codeEditor = codeEditorProvider.Create(options); codeEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategory); codeEditor.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true); var textBuffer = codeEditor.TextView.TextBuffer; textBuffer.Replace(new Span(0, textBuffer.CurrentSnapshot.Length), doc.Code); var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectId), doc.NameNoExtension + FileExtension, null, SourceCodeKind.Regular, TextLoader.From(codeEditor.TextBuffer.AsTextContainer(), VersionStamp.Create())); return new RoslynCodeDocument(codeEditor, documentInfo, doc.NameNoExtension); }