use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class RegistrationParams method create.
public static RegistrationParams create(List<Registration> registrations) {
final JSONObject json = new JSONObject();
JSONArray registrationsJsonArr = new JSONArray();
for (Registration registration : registrations) {
registrationsJsonArr.put(registration.jsonData);
}
json.put("registrations", registrationsJsonArr);
return new RegistrationParams(json);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class SelectionRangeParams method create.
public static SelectionRangeParams create(TextDocumentIdentifier textDocument, List<Position> positions) {
final JSONObject json = new JSONObject();
json.put("textDocument", textDocument.jsonData);
JSONArray positionsJsonArr = new JSONArray();
for (Position position : positions) {
positionsJsonArr.put(position.jsonData);
}
json.put("positions", positionsJsonArr);
return new SelectionRangeParams(json);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class SelectionRangeParams method setPositions.
public SelectionRangeParams setPositions(List<Position> positions) {
final JSONArray json = new JSONArray();
for (Position position : positions) {
json.put(position.jsonData);
}
jsonData.put("positions", json);
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class PublishDiagnosticsParams method getDiagnostics.
/**
* An array of diagnostic information items.
*/
public List<Diagnostic> getDiagnostics() {
final JSONArray json = jsonData.getJSONArray("diagnostics");
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 ShowMessageRequestParams method getActions.
/**
* The message action items to present.
*/
public List<MessageActionItem> getActions() {
final JSONArray json = jsonData.optJSONArray("actions");
if (json == null) {
return null;
}
final List<MessageActionItem> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
list.add(new MessageActionItem(json.getJSONObject(i)));
}
return Collections.unmodifiableList(list);
}
Aggregations