Search in sources :

Example 41 with JSONArray

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

the class CodeActionContext method getOnly.

/**
 * Requested kind of actions to return.
 *
 * Actions not of this kind are filtered out by the client before being shown. So servers can
 * omit computing them.
 */
public List<CodeActionKind> getOnly() {
    final JSONArray json = jsonData.optJSONArray("only");
    if (json == null) {
        return null;
    }
    final List<CodeActionKind> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        list.add(CodeActionKind.get(json.getString(i)));
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 42 with JSONArray

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

the class CodeActionOptions method getCodeActionKinds.

/**
 * CodeActionKinds that this server may return.
 *
 * The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server may list
 * out every specific kind they provide.
 */
public List<CodeActionKind> getCodeActionKinds() {
    final JSONArray json = jsonData.optJSONArray("codeActionKinds");
    if (json == null) {
        return null;
    }
    final List<CodeActionKind> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        list.add(CodeActionKind.get(json.getString(i)));
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 43 with JSONArray

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

the class CompletionItem method getCommitCharacters.

/**
 * An optional set of characters that when pressed while this completion is active will accept
 * it first and then type that character. *Note* that all commit characters should have
 * `length=1` and that superfluous characters will be ignored.
 */
public List<String> getCommitCharacters() {
    final JSONArray json = jsonData.optJSONArray("commitCharacters");
    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 44 with JSONArray

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

the class CompletionItem method getTags.

/**
 * Tags for this completion item.
 *
 * @since 3.15.0
 */
public List<CompletionItemTag> getTags() {
    final JSONArray json = jsonData.optJSONArray("tags");
    if (json == null) {
        return null;
    }
    final List<CompletionItemTag> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        list.add(CompletionItemTag.get(json.getInt(i)));
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 45 with JSONArray

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

the class CompletionItem method setTags.

public CompletionItem setTags(List<CompletionItemTag> tags) {
    if (tags != null) {
        final JSONArray json = new JSONArray();
        for (CompletionItemTag completionItemTag : tags) {
            json.put(completionItemTag.getIntValue());
        }
        jsonData.put("tags", 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