static Microsoft.CodeAnalysis.Text.TextChange ToCodeAnalysisTextChange(ITextDocument editor, TextEdit edit)
        {
            var segment = editor.GetTextSegment(edit.Range);

            if (segment.IsInvalid)
            {
                throw new ArgumentException(string.Format("Invalid TextEdit.Range."));
            }

            return(new Microsoft.CodeAnalysis.Text.TextChange(
                       new Microsoft.CodeAnalysis.Text.TextSpan(segment.Offset, segment.Length),
                       edit.NewText
                       ));
        }