title: Automatically adjust height to contents in Ace Cloud 9 editor
body: <p>I'm trying to add the <a href="http://ace.ajax.org" rel="noreferrer">Ace editor</a> to a page, but I don't know how to get the height to be set automatically based on the length of its contents.</p>
  
  <p>Ideally it would work so when the content changes the height is recalculated, but I would be happy with the height just being set on page load.</p>
  
  <p>For a JavaScript novice can someone help me figure out how I work out the length of the code, how many lines it spans, what the new height is and how I update the DOM to reflect this?</p>
  
  <p>I found <a href="https://groups.google.com/d/msg/ace-discuss/qM32mQ6jKQ8/bQK3nxWuB80J" rel="noreferrer">this suggestion</a> in a Google group, but I don't really understand what it's doing and how I get it to adjust the height.</p>
  
  <pre><code>editor.getSession().getDocument().getLength() *
  editor.renderer.lineHeight + editor.renderer.scrollBar.getWidth()
  </code></pre>