public async Task UpdateBuffer(ChangeBufferRequest request)
        {
            if (request.FileName == null)
            {
                return;
            }

            var documentIds = _workspace.CurrentSolution.GetDocumentIdsWithFilePath(request.FileName);
            if (!documentIds.IsEmpty)
            {
                foreach (var documentId in documentIds)
                {
                    var document = _workspace.CurrentSolution.GetDocument(documentId);
                    var sourceText = await document.GetTextAsync();
                    var startOffset = sourceText.Lines.GetPosition(new LinePosition(request.StartLine - 1, request.StartColumn - 1));
                    var endOffset = sourceText.Lines.GetPosition(new LinePosition(request.EndLine - 1, request.EndColumn - 1));

                    sourceText = sourceText.WithChanges(new[] {
                        new TextChange(new TextSpan(startOffset, endOffset - startOffset), request.NewText)
                    });

                    _workspace.OnDocumentChanged(documentId, sourceText);
                }
            }
            else
            {
                // TODO@joh ensure the edit is an insert at offset zero
                TryAddTransientDocument(request.FileName, request.NewText);
            }
        }
        public async Task<ObjectResult> ChangeBuffer(ChangeBufferRequest request)
        {
            foreach (var documentId in _workspace.CurrentSolution.GetDocumentIdsWithFilePath(request.FileName))
            {
                var document = _workspace.CurrentSolution.GetDocument(documentId);
                var sourceText = await document.GetTextAsync();
                var startOffset = sourceText.Lines.GetPosition(new LinePosition(request.StartLine - 1, request.StartColumn - 1));
                var endOffset = sourceText.Lines.GetPosition(new LinePosition(request.EndLine - 1, request.EndColumn - 1));

                sourceText = sourceText.WithChanges(new[] {
                    new Microsoft.CodeAnalysis.Text.TextChange(new TextSpan(startOffset, endOffset - startOffset), request.NewText)
                });

                _workspace.OnDocumentChanged(documentId, sourceText);
            }
            return new ObjectResult(true);
        }
 public async Task<ObjectResult> ChangeBuffer(ChangeBufferRequest request)
 {
     await _workspace.BufferManager.UpdateBuffer(request);
     return new ObjectResult(true);
 }