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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations