コード例 #1
0
    private string GetMarker(ITextSnapshotLine line, TextLineFragment fragment, SnapshotPoint point) {
      string[] markers = {
        "for(",
      };

      return markers
        .Where(marker => fragment.GetText(point - line.Start, marker.Length) == marker)
        .FirstOrDefault();
    }
コード例 #2
0
    private string GetMarker(ITextSnapshotLine line, TextLineFragment fragment, SnapshotPoint point) {
      string[] markers = {
        "else",
        "else if",
      };

      var match = markers
        .Where(marker => fragment.GetText(point - line.Start, marker.Length) == marker)
        .FirstOrDefault();
      if (match != null) {
        // If last character of line is not "{", we are good
        var end = line.GetFragment(line.End.Position - 1, line.End.Position, TextLineFragment.Options.Default);
        if (end.GetText() != "{")
          return null;
      }
      return match;
    }