Search in sources :

Example 1 with AnchoredRange

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));
    }
}
Also used : AceAnnotation(org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation) LintItem(org.rstudio.studio.client.workbench.views.output.lint.model.LintItem) AnchoredRange(org.rstudio.studio.client.workbench.views.source.editors.text.ace.AnchoredRange) Breakpoint(org.rstudio.studio.client.common.debugging.model.Breakpoint)

Aggregations

Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)1 AceAnnotation (org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation)1 LintItem (org.rstudio.studio.client.workbench.views.output.lint.model.LintItem)1 AnchoredRange (org.rstudio.studio.client.workbench.views.source.editors.text.ace.AnchoredRange)1