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