private TextBufferContainer(ITextBuffer editorBuffer, Encoding encoding) { Contract.ThrowIfNull(editorBuffer); Contract.ThrowIfNull(encoding); _weakEditorBuffer = new WeakReference <ITextBuffer>(editorBuffer); _currentText = new SnapshotSourceText(TextBufferMapper.ToRoslyn(editorBuffer.CurrentSnapshot), encoding, this); }
private SnapshotSourceText(ITextSnapshot editorSnapshot, Encoding encodingOpt) { Contract.ThrowIfNull(editorSnapshot); this.RoslynSnapshot = TextBufferMapper.ToRoslyn(editorSnapshot); _containerOpt = TextBufferContainer.From(editorSnapshot.TextBuffer); _reiteratedVersion = editorSnapshot.Version.ReiteratedVersionNumber; _encodingOpt = encodingOpt; }