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