Search in sources :

Example 66 with JSONObject

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

Example 67 with JSONObject

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

the class ApplyWorkspaceEditResponse method create.

public static ApplyWorkspaceEditResponse create(Boolean applied) {
    final JSONObject json = new JSONObject();
    json.put("applied", applied);
    return new ApplyWorkspaceEditResponse(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 68 with JSONObject

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

the class CodeAction method create.

/**
 * Creates a new code action.
 *
 * @param title The title of the code action.
 * @param command The command to execute.
 * @param kind The kind of the code action.
 */
public static CodeAction create(String title, Command command, CodeActionKind kind) {
    final JSONObject json = new JSONObject();
    json.put("title", title);
    json.putOpt("kind", kind != null ? kind.getStringValue() : null);
    json.putOpt("command", command != null ? command.jsonData : null);
    return new CodeAction(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 69 with JSONObject

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

the class Color method create.

/**
 * Creates a new Color literal.
 */
public static Color create(double red, double green, double blue, double alpha) {
    final JSONObject json = new JSONObject();
    json.put("red", red);
    json.put("green", green);
    json.put("blue", blue);
    json.put("alpha", alpha);
    return new Color(json);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 70 with JSONObject

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

the class CodeActionParams method create.

public static CodeActionParams create(TextDocumentIdentifier textDocument, Range range, CodeActionContext context) {
    final JSONObject json = new JSONObject();
    json.put("textDocument", textDocument.jsonData);
    json.put("range", range.jsonData);
    json.put("context", context.jsonData);
    return new CodeActionParams(json);
}
Also used : 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