private async Task ApplyTextManipulations(DidChangeTextDocumentParams request, string text, string buffer, string changedBuffer, int position, int deletedCharacters)
        {
            TextManipulator textManipulator = new TextManipulator(changedBuffer, position);
            var             manipulations   = textManipulator.ManipulateText(new TextChangeAdapter(position, text, buffer.Substring(position, deletedCharacters)));

            if (manipulations.Count == 0)
            {
                return;
            }

            var edits = manipulations.Select(n =>
            {
                var start = Utils.OffsetToPosition(n.Start, changedBuffer);

                switch (n.Type)
                {
                case ManipulationType.Insert:
                    return(new TextEdit()
                    {
                        NewText = n.Text,
                        Range = new Range(start, start)
                    });

                case ManipulationType.Delete:
                    var end = Utils.OffsetToPosition(n.End, changedBuffer);
                    return(new TextEdit()
                    {
                        NewText = "",
                        Range = new Range(start, end)
                    });

                default:
                    throw new NotSupportedException();
                }
            }).ToList();

            if (edits.Count > 0)
            {
                await _router.ApplyWorkspaceEdit(new ApplyWorkspaceEditParams()
                {
                    Edit = new WorkspaceEdit()
                    {
                        DocumentChanges = new Container <WorkspaceEditDocumentChange>(new WorkspaceEditDocumentChange(new TextDocumentEdit()
                        {
                            TextDocument = request.TextDocument,
                            Edits        = new TextEditContainer(edits)
                        }))
                    }
                });
            }
        }