private void CreateMethodComment(ITextChange change) { int position = change.NewEnd; string text = this.view.TextSnapshot.ToString(); using (ITextEdit editor = this.view.TextBuffer.CreateEdit()) { try { this.tabs = StubUtils.GetIndention(position, this.view.TextSnapshot); string summaryString = StubUtils.Options.MultiLineSummary ? NewLine() : ""; string parameters = GetFunctionParameters(position); string returnTag = GetReturnTag(position); string commentBody = summaryString + parameters + returnTag; string autoComment = this.tabs + "/**" + commentBody; if (!String.IsNullOrEmpty(commentBody)) { autoComment += Environment.NewLine + this.tabs; } autoComment += " */"; int lineStart = this.view.TextSnapshot.GetLineFromPosition(position).Start.Position; Span firstLineSpan = new Span(lineStart, change.NewSpan.End - lineStart); editor.Replace(firstLineSpan, autoComment); ITextSnapshot after = editor.Apply(); ////Move the caret back at the comment description //int lineNumber = after.GetLineNumberFromPosition(change.NewPosition); //var lineSnapShotPoint = after.GetLineFromLineNumber(lineNumber).End; //this.view.Caret.MoveTo(lineSnapShotPoint); //view.Caret.MoveTo( // view.GetTextViewLineContainingBufferPosition( // after.GetLineFromPosition( // after.GetText().IndexOf(autoComment)).Start)); //view.Caret.MoveTo( // view.GetTextViewLineContainingBufferPosition( // view.TextSnapshot.GetLineFromPosition( // view.TextSnapshot.GetText().IndexOf(fn)).Start)); } catch (Exception ex) { Console.WriteLine(ERROR_MSG_PREFIX + ex.Message); } } }