use of org.rstudio.studio.client.workbench.views.source.model.CppDiagnostic in project rstudio by rstudio.
the class LintManager method performCppLintServerRequest.
private void performCppLintServerRequest(final LintContext context) {
cppCompletionContext_.cppCompletionOperation(new CppCompletionOperation() {
@Override
public void execute(String docPath, int line, int column) {
server_.getCppDiagnostics(target_.getPath(), new ServerRequestCallback<JsArray<CppDiagnostic>>() {
@Override
public void onResponseReceived(JsArray<CppDiagnostic> diag) {
if (context.token.isInvalid())
return;
final JsArray<LintItem> cppLint = CppCompletionRequest.asLintArray(diag);
server_.lintRSourceDocument(target_.getId(), target_.getPath(), context.showMarkers, context.explicit, new ServerRequestCallback<JsArray<LintItem>>() {
@Override
public void onResponseReceived(JsArray<LintItem> rLint) {
if (context.token.isInvalid())
return;
JsArray<LintItem> allLint = JsArray.createArray().cast();
for (int i = 0; i < cppLint.length(); i++) allLint.push(cppLint.get(i));
for (int i = 0; i < rLint.length(); i++) allLint.push(rLint.get(i));
showLint(context, allLint);
}
@Override
public void onError(ServerError error) {
Debug.logError(error);
}
});
}
@Override
public void onError(ServerError error) {
Debug.logError(error);
}
});
}
});
}
use of org.rstudio.studio.client.workbench.views.source.model.CppDiagnostic in project rstudio by rstudio.
the class CppCompletionRequest method asLintArray.
public static JsArray<LintItem> asLintArray(JsArray<CppDiagnostic> diagnostics) {
JsArray<LintItem> lint = JsArray.createArray(diagnostics.length()).cast();
for (int i = 0; i < diagnostics.length(); i++) {
CppDiagnostic d = diagnostics.get(i);
if (d.getPosition() != null) {
Range range = getRangeForDiagnostic(d);
lint.set(i, LintItem.create(range.getStart().getRow(), range.getStart().getColumn(), range.getEnd().getRow(), range.getEnd().getColumn(), d.getMessage(), cppDiagnosticSeverityToLintType(d.getSeverity())));
}
}
return lint;
}
Aggregations