use of org.rstudio.studio.client.workbench.views.source.editors.text.ace.AnchoredRange in project rstudio by rstudio.
the class AceEditorWidget method showLint.
public void showLint(JsArray<LintItem> lint) {
clearAnnotations();
JsArray<AceAnnotation> annotations = LintItem.asAceAnnotations(lint);
editor_.getSession().setAnnotations(annotations);
// Now, set (and cache) inline markers.
for (int i = 0; i < lint.length(); i++) {
LintItem item = lint.get(i);
AnchoredRange range = createAnchoredRange(Position.create(item.getStartRow(), item.getStartColumn()), Position.create(item.getEndRow(), item.getEndColumn()));
String clazz = "unknown";
if (item.getType() == "error")
clazz = lintStyles_.error();
else if (item.getType() == "warning")
clazz = lintStyles_.warning();
else if (item.getType() == "info")
clazz = lintStyles_.info();
else if (item.getType() == "style")
clazz = lintStyles_.style();
int id = editor_.getSession().addMarker(range, clazz, "text", true);
annotations_.add(new AnchoredAceAnnotation(annotations.get(i), range, id));
}
}
Aggregations