Search in sources :

Example 31 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class ResultsPrinter method printRawResults.

void printRawResults() {
    JSONArray output = new JSONArray();
    for (Results results : resultsList) {
        JSONObject jsonResults = new JSONObject();
        jsonResults.put("location", results.location);
        jsonResults.put("samples", new JSONArray(results.samples));
        output.put(jsonResults);
    }
    stream.print(output);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 32 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class CompletionOptions method getTriggerCharacters.

/**
 * Most tools trigger completion request automatically without explicitly requesting it using a
 * keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user starts to type an
 * identifier. For example if the user types `c` in a JavaScript file code complete will
 * automatically pop up present `console` besides others as a completion item. Characters that
 * make up identifiers don't need to be listed here.
 *
 * If code complete should automatically be trigger on characters not being valid inside an
 * identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
 */
public List<String> getTriggerCharacters() {
    final JSONArray json = jsonData.optJSONArray("triggerCharacters");
    if (json == null) {
        return null;
    }
    final List<String> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        list.add(json.getString(i));
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 33 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class ConfigurationParams method getItems.

public List<ConfigurationItem> getItems() {
    final JSONArray json = jsonData.getJSONArray("items");
    final List<ConfigurationItem> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        list.add(new ConfigurationItem(json.getJSONObject(i)));
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 34 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class ConfigurationParams method setItems.

public ConfigurationParams setItems(List<ConfigurationItem> items) {
    final JSONArray json = new JSONArray();
    for (ConfigurationItem configurationItem : items) {
        json.put(configurationItem.jsonData);
    }
    jsonData.put("items", json);
    return this;
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 35 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class Coverage method setCovered.

public Coverage setCovered(List<Range> covered) {
    final JSONArray json = new JSONArray();
    for (Range range : covered) {
        json.put(range.jsonData);
    }
    jsonData.put("covered", json);
    return this;
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

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