static string GetWordBeforeCaret (TextEditor editor) { int startOffset = editor.CaretOffset; int offset = startOffset - 1; while (offset > 0) { char ch = editor.GetCharAt (offset); if (!IsIdentifierPart (ch)) { offset++; break; } offset--; } if (offset >= startOffset) return ""; return editor.GetTextBetween (offset, startOffset); }
public static string GetTemplateShortcutBeforeCaret (TextEditor editor) { int offset = editor.CaretOffset; if (offset == 0) return ""; int start = FindPrevWordStart (editor, offset - 1); return editor.GetTextBetween (start, offset); }
public string GetText(int startPosition, int endPosition) { return(data.GetTextBetween(startPosition, endPosition)); }