Search in sources :

Example 56 with JSONObject

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

the class InitializeResult method create.

public static InitializeResult create(ServerCapabilities capabilities) {
    final JSONObject json = new JSONObject();
    json.put("capabilities", capabilities.jsonData);
    return new InitializeResult(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 57 with JSONObject

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

the class DiagnosticRelatedInformation method create.

/**
 * Creates a new DiagnosticRelatedInformation literal.
 */
public static DiagnosticRelatedInformation create(Location location, String message) {
    final JSONObject json = new JSONObject();
    json.put("location", location.jsonData);
    json.put("message", message);
    return new DiagnosticRelatedInformation(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 58 with JSONObject

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

the class DidChangeWorkspaceFoldersParams method create.

public static DidChangeWorkspaceFoldersParams create(WorkspaceFoldersChangeEvent event) {
    final JSONObject json = new JSONObject();
    json.put("event", event.jsonData);
    return new DidChangeWorkspaceFoldersParams(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 59 with JSONObject

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

the class ExecuteCommandOptions method create.

public static ExecuteCommandOptions create(List<String> commands) {
    final JSONObject json = new JSONObject();
    JSONArray commandsJsonArr = new JSONArray();
    for (String string : commands) {
        commandsJsonArr.put(string);
    }
    json.put("commands", commandsJsonArr);
    return new ExecuteCommandOptions(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 60 with JSONObject

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

the class Hover method create.

@SuppressWarnings("deprecation")
public static Hover create(Object contents) {
    final JSONObject json = new JSONObject();
    if (contents instanceof List) {
        final JSONArray jsonArr = new JSONArray();
        for (Object obj : (List<?>) contents) {
            jsonArr.put(obj instanceof MarkedString ? ((MarkedString) obj).jsonData : obj);
        }
        json.put("contents", jsonArr);
    } else if (contents instanceof MarkupContent) {
        json.put("contents", ((MarkupContent) contents).jsonData);
    } else if (contents instanceof MarkedString) {
        json.put("contents", ((MarkedString) contents).jsonData);
    } else {
        json.put("contents", contents);
    }
    return new Hover(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) List(java.util.List) ArrayList(java.util.ArrayList) JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Aggregations

JSONObject (com.oracle.truffle.tools.utils.json.JSONObject)318 JSONArray (com.oracle.truffle.tools.utils.json.JSONArray)71 ArrayList (java.util.ArrayList)20 Params (com.oracle.truffle.tools.chromeinspector.commands.Params)18 DebugValue (com.oracle.truffle.api.debug.DebugValue)14 DebugException (com.oracle.truffle.api.debug.DebugException)11 CommandProcessException (com.oracle.truffle.tools.chromeinspector.server.CommandProcessException)10 SourceSection (com.oracle.truffle.api.source.SourceSection)8 HashMap (java.util.HashMap)8 List (java.util.List)8 Collection (java.util.Collection)7 Breakpoint (com.oracle.truffle.api.debug.Breakpoint)6 Source (com.oracle.truffle.api.source.Source)6 Map (java.util.Map)6 LanguageInfo (com.oracle.truffle.api.nodes.LanguageInfo)5 NoSuspendedThreadException (com.oracle.truffle.tools.chromeinspector.InspectorExecutionContext.NoSuspendedThreadException)5 RemoteObject (com.oracle.truffle.tools.chromeinspector.types.RemoteObject)5 JSONTokener (com.oracle.truffle.tools.utils.json.JSONTokener)5 Test (org.junit.Test)5 Location (com.oracle.truffle.tools.chromeinspector.types.Location)4