public REditorDocument(ITextBuffer textBuffer, ICoreShell shell) {
_shell = shell;
_textDocumentFactoryService = _shell.ExportProvider.GetExportedValue<ITextDocumentFactoryService>();
_textDocumentFactoryService.TextDocumentDisposed += OnTextDocumentDisposed;
TextBuffer = textBuffer;
IsClosed = false;
ServiceManager.AddService(this, TextBuffer, shell);
var clh = ServiceManager.GetService<IContainedLanguageHost>(textBuffer);
_editorTree = new EditorTree(textBuffer, shell, new ExpressionTermFilter(clh));
if (REditorSettings.SyntaxCheckInRepl) {
_validator = new TreeValidator(EditorTree, shell);
}
_editorTree.Build();
}
#endregion