Search in sources :

Example 1 with AceAnnotation

use of org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation in project rstudio by rstudio.

the class DiagnosticsBackgroundPopup method displayMarkerDiagnostics.

private void displayMarkerDiagnostics(Marker marker) {
    JsArray<AceAnnotation> annotations = editor_.getAnnotations();
    for (int i = 0; i < annotations.length(); i++) {
        AceAnnotation annotation = annotations.get(i);
        int row = annotation.row();
        if (marker.getRange().getStart().getRow() <= row && marker.getRange().getEnd().getRow() >= row) {
            activeMarker_ = marker;
            showPopup(annotation.text(), marker.getRange());
            return;
        }
    }
}
Also used : AceAnnotation(org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation)

Example 2 with AceAnnotation

use of org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation in project rstudio by rstudio.

the class AceEditorWidget method getAnnotations.

public JsArray<AceAnnotation> getAnnotations() {
    JsArray<AceAnnotation> annotations = JsArray.createArray().cast();
    annotations.setLength(annotations_.size());
    for (int i = 0; i < annotations_.size(); i++) annotations.set(i, annotations_.get(i).asAceAnnotation());
    return annotations;
}
Also used : AceAnnotation(org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation) Breakpoint(org.rstudio.studio.client.common.debugging.model.Breakpoint)

Example 3 with AceAnnotation

use of org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation 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

AceAnnotation (org.rstudio.studio.client.workbench.views.output.lint.model.AceAnnotation)3 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)2 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