Search in sources :

Example 66 with JSONArray

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);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 67 with JSONArray

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);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 68 with JSONArray

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;
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 69 with JSONArray

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);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 70 with JSONArray

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);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Aggregations

JSONArray (com.oracle.truffle.tools.utils.json.JSONArray)195 JSONObject (com.oracle.truffle.tools.utils.json.JSONObject)85 ArrayList (java.util.ArrayList)74 DebugValue (com.oracle.truffle.api.debug.DebugValue)8 Params (com.oracle.truffle.tools.chromeinspector.commands.Params)8 Collection (java.util.Collection)7 List (java.util.List)7 DebugException (com.oracle.truffle.api.debug.DebugException)6 Source (com.oracle.truffle.api.source.Source)5 SourceSection (com.oracle.truffle.api.source.SourceSection)4 CommandProcessException (com.oracle.truffle.tools.chromeinspector.server.CommandProcessException)4 HashMap (java.util.HashMap)4 Location (com.oracle.truffle.tools.chromeinspector.types.Location)3 Script (com.oracle.truffle.tools.chromeinspector.types.Script)3 CPUSampler (com.oracle.truffle.tools.profiler.CPUSampler)3 CPUSamplerData (com.oracle.truffle.tools.profiler.CPUSamplerData)3 PrintWriter (java.io.PrintWriter)3 Map (java.util.Map)3 TruffleContext (com.oracle.truffle.api.TruffleContext)2 Breakpoint (com.oracle.truffle.api.debug.Breakpoint)2