CodeFormatter.K_JAVASCRIPT_UNIT, text, startOffset,
endOffset - startOffset, 0, Settings.LINE_SEPARATOR);
if (edit != null) {
edit.apply(doc);
} else {
throw new FormattingFailedException();
}
return doc.get();
} catch (BadLocationException e) {
throw new RuntimeException(e);