code: function(text, mode) {
      this.$modified = true;
      this.$breakpoints = [];
      this.$frontMarkers = {};
      this.$backMarkers = {};
      this.$markerId = 1;
      this.$rowCache = [];
      this.$wrapData = [];
      this.$foldData = [];
      this.$undoSelect = true;
      this.$foldData.toString = function() {
          var str = "";
          this.forEach(function(foldLine) {
              str += "\n" + foldLine.toString();
          });
          return str;
      }
  
      if (text instanceof Document) {
          this.setDocument(text);
      } else {
          this.setDocument(new Document(text));
      }
  
      this.selection = new Selection(this);
      this.setMode(mode);
  }
docs: class EditSession
  
  Stores various states related to a [[Document `Document`]]. A single `EditSession` can be in charge of several `Document`s.
  
   
  new EditSession(text, mode)
  - text (Document | String): If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text
  - mode (TextMode): The inital language mode to use for the document
  
  Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`.