public int calculateFirstMethodOffset() { //var offset = 0; var lines = CodeCompleteTargetText.lines(); var linesToRemove = lines.size() - CodeCompleteCaretLocationOffset.Line + 1; lines.RemoveRange(CodeCompleteCaretLocationOffset.Line - 1, linesToRemove); var topText = StringsAndLists.fromStringList_getText(lines); //for (int i = 0; i < CodeCompleteCaretLocationOffset.Line; i++) // offset += lines[i].Length + 1; // offset--; // var test = CodeCompleteTargetText.Substring(offset); return(topText.Length); }
public string getAdjustedSnippetText(TextArea textArea, int firstMethodOffset) { var currentText = textArea.get_Text();; var size = CodeCompleteTargetText.size(); if (firstMethodOffset < size) { var adjustedSnippeetText = CodeCompleteTargetText.Substring(0, firstMethodOffset); adjustedSnippeetText += currentText.line(); adjustedSnippeetText += "\t}".line() + "}".line(); return(adjustedSnippeetText); } return(currentText); }