use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class Coverage method getUncovered.
/**
* Uncovered ranges.
*/
public List<Range> getUncovered() {
final JSONArray json = jsonData.getJSONArray("uncovered");
final List<Range> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
list.add(new Range(json.getJSONObject(i)));
}
return Collections.unmodifiableList(list);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class DeclarationRegistrationOptions method create.
public static DeclarationRegistrationOptions create(List<Object> documentSelector) {
final JSONObject json = new JSONObject();
if (documentSelector != null) {
JSONArray documentSelectorJsonArr = new JSONArray();
for (Object object : documentSelector) {
if (object instanceof DocumentFilter) {
documentSelectorJsonArr.put(((DocumentFilter) object).jsonData);
} else {
documentSelectorJsonArr.put(object);
}
}
json.put("documentSelector", documentSelectorJsonArr);
} else {
json.put("documentSelector", JSONObject.NULL);
}
return new DeclarationRegistrationOptions(json);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class Diagnostic method setTags.
public Diagnostic setTags(List<DiagnosticTag> tags) {
if (tags != null) {
final JSONArray json = new JSONArray();
for (DiagnosticTag diagnosticTag : tags) {
json.put(diagnosticTag.getIntValue());
}
jsonData.put("tags", json);
}
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class CodeAction method getDiagnostics.
/**
* The diagnostics that this code action resolves.
*/
public List<Diagnostic> getDiagnostics() {
final JSONArray json = jsonData.optJSONArray("diagnostics");
if (json == null) {
return null;
}
final List<Diagnostic> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
list.add(new Diagnostic(json.getJSONObject(i)));
}
return Collections.unmodifiableList(list);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class CodeActionContext method setOnly.
public CodeActionContext setOnly(List<CodeActionKind> only) {
if (only != null) {
final JSONArray json = new JSONArray();
for (CodeActionKind codeActionKind : only) {
json.put(codeActionKind.getStringValue());
}
jsonData.put("only", json);
}
return this;
}
Aggregations