MemberReference CreateReference(int line, int col, string name) { int pos = text.LocationToOffset(line - 1, col - 1); int spos = text.LocationToOffset(line - 1, 0); int epos = text.LocationToOffset(line, 0); if (epos == -1) { epos = text.Length - 1; } string txt; // FIXME: do we always need to do this? or just in my test cases so far? :) // use the base name and not the FullName name = GetNameWithoutPrefix(name); // FIXME: is there a better way to do this? // update @pos to point to the actual identifier and not the // public/private/whatever modifier. int i; txt = text.GetTextBetween(pos, text.Length - 1); if (txt != null && (i = txt.IndexOf(name)) > 0) { pos += i; } if (spos != -1) { txt = text.GetTextBetween(spos, epos - 1); } else { txt = null; } return(new MemberReference(null, fileName, pos, line, col, name, txt)); }
public string GetText(int startPosition, int endPosition) { return(document.GetTextBetween(startPosition, endPosition)); }