コード例 #1
0
ファイル: rmarkdown.js プロジェクト: AlanCal/rstudio
 this.getLanguageMode = function(position)
 {
    var state = Utils.getPrimaryState(this.$session, position.row);
    var mode = activeMode(state);
    if (mode === "r")
       return "R";
    else if (mode === "r-cpp")
       return "C_CPP";
    else if (mode === "yaml")
       return "YAML";
    else
       return "Markdown";
 };
コード例 #2
0
ファイル: loader.js プロジェクト: justacec/rstudio
   this.reindent = function(range) {

      var mode = this.getMode();
      if (!mode.getNextLineIndent)
         return;

      var start = range.start.row;
      var end = range.end.row;

      // First line is always unindented
      if (start === 0) {
         this.applyIndent(0, "");
         start++;
      }

      for (var i = start; i <= end; i++)
      {
         var state = Utils.getPrimaryState(this, i - 1);
         if (Utils.endsWith(state, "qstring"))
            continue;

         var newIndent = mode.getNextLineIndent(state,
                                                this.getLine(i - 1),
                                                this.getTabString(),
                                                i - 1,
                                                true);

         this.applyIndent(i, newIndent);
         mode.autoOutdent(state, this, i);
      }

      // optional outdenting (currently hard-wired for C++ modes)
      var codeModel = mode.codeModel;
      if (typeof codeModel !== "undefined") {
         var align = codeModel.alignContinuationSlashes;
         if (typeof align !== "undefined") {
            align(this.getDocument(), {
               start: start,
               end: end
            });
         }
      }


   };
コード例 #3
0
ファイル: sweave.js プロジェクト: rlugojr/rstudio
 this.getLanguageMode = function(position)
 {
    var state = Utils.getPrimaryState(this.$session, position.row);
    return state.match(/^r-/) ? 'R' : 'TeX';
 };