(Optional<Box> box, String property, String text, Consumer<String> ret, int line, int ch)
| 110 | public RemoteEditor.ExtendedCommand callTable_alternative = null; |
| 111 | |
| 112 | public void requestCommands(Optional<Box> box, String property, String text, Consumer<String> ret, int line, int ch) { |
| 113 | |
| 114 | // now we need to ask everybody if they have any commands to offer based on the above. |
| 115 | |
| 116 | //todo: handle no box case |
| 117 | List<Triple<String, String, Runnable>> commands = getCommandsAndDocs(box.get()); |
| 118 | |
| 119 | CompletionStats.stats.autosuggestCommands(commands); |
| 120 | |
| 121 | Log.log("remote.trace", () -> " commands are :" + commands); |
| 122 | |
| 123 | JSONStringer stringer = new JSONStringer(); |
| 124 | stringer.array(); |
| 125 | callTable.clear(); |
| 126 | callTableName.clear(); |
| 127 | |
| 128 | for (Triple<String, String, Runnable> r : commands) { |
| 129 | String u = UUID.randomUUID() |
| 130 | .toString(); |
| 131 | callTable.put(u, r.third); |
| 132 | callTableName.put(u, r.first); |
| 133 | stringer.object(); |
| 134 | stringer.key("name") |
| 135 | .value(r.first); |
| 136 | stringer.key("info") |
| 137 | .value(format(r.second)); |
| 138 | stringer.key("call") |
| 139 | .value(u); |
| 140 | stringer.endObject(); |
| 141 | } |
| 142 | |
| 143 | |
| 144 | Log.log("remote.trace", () -> " call table looks like :" + callTable); |
| 145 | |
| 146 | stringer.endArray(); |
| 147 | |
| 148 | ret.accept(stringer.toString()); |
| 149 | |
| 150 | } |
| 151 | |
| 152 | static public void exportAsCommand(Box inside, Runnable r, String name, String doc) { |
| 153 | inside.properties.getOrConstruct(command) |
no test coverage detected