@Test public void getCommandsTest() throws ExecutionException, InterruptedException { var commands = Map.of( "command1", Map.<String, Object>of( "name", "command1", "definition", ":noh", "script_id", 55, "bang", false, "bar", true, "register", false, "nargs", "+" ), "command2", Map.<String, Object>of( "name", "command2", "definition", ":ls", "script_id", 55, "bang", true, "bar", false, "register", true, "nargs", "?" ) ); var commandsOptions = new GetCommandsOptions(false); assertNormalBehavior( () -> CompletableFuture.completedFuture(new ResponseMessage(1, null, commands)), () -> bufferStreamApi.getCommands(commandsOptions), request -> assertMethodAndArguments(request, NeovimBufferApi.GET_COMMANDS, buffer, commandsOptions), result -> { assertEquals(2, result.size()); CommandInfo command1 = result.get("command1"); assertEquals("command1", command1.getName()); assertEquals(":noh", command1.getDefinition()); assertEquals(55, command1.getScriptId()); assertFalse(command1.isBang()); assertTrue(command1.isBar()); assertFalse(command1.isRegister()); assertEquals(1, command1.getNumberOfArgs().getMin()); assertNull(command1.getNumberOfArgs().getMax()); CommandInfo command2 = result.get("command2"); assertEquals("command2", command2.getName()); assertEquals(":ls", command2.getDefinition()); assertEquals(55, command2.getScriptId()); assertTrue(command2.isBang()); assertFalse(command2.isBar()); assertTrue(command2.isRegister()); assertEquals(0, command2.getNumberOfArgs().getMin()); assertEquals(1, command2.getNumberOfArgs().getMax().intValue()); result.toString(); } ); var badCommandsOptions = new GetCommandsOptions(true); assertErrorBehavior( () -> bufferStreamApi.getCommands(badCommandsOptions), request -> assertMethodAndArguments(request, NeovimBufferApi.GET_COMMANDS, buffer, badCommandsOptions) ); }
@Override public CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions) { return sendWithResponseOfMapType( prepareMessage(GET_COMMANDS).addArgument(commandsOptions), String.class, CommandInfo.class ); }
BufferStreamApi extends BaseStreamApi implements NeovimBufferApi { @Override public CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions) { return sendWithResponseOfMapType( prepareMessage(GET_COMMANDS).addArgument(commandsOptions), String.class, CommandInfo.class ); } }
BufferStreamApi extends BaseStreamApi implements NeovimBufferApi { @Override public CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions) { return sendWithResponseOfMapType( prepareMessage(GET_COMMANDS).addArgument(commandsOptions), String.class, CommandInfo.class ); } BufferStreamApi(ReactiveRpcStreamer reactiveRpcStreamer,
                           Buffer model); }
BufferStreamApi extends BaseStreamApi implements NeovimBufferApi { @Override public CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions) { return sendWithResponseOfMapType( prepareMessage(GET_COMMANDS).addArgument(commandsOptions), String.class, CommandInfo.class ); } BufferStreamApi(ReactiveRpcStreamer reactiveRpcStreamer,
                           Buffer model); @Override Buffer get(); @Override CompletableFuture<Integer> getLineCount(); @Override CompletableFuture<List<String>> getLines(int start, int end, boolean strictIndexing); @Override CompletableFuture<Void> setLines(int start, int end, boolean strictIndexing, List<String> replacement); @Override CompletableFuture<Integer> getOffset(int index); @Override CompletableFuture<Object> getVar(String name); @Override CompletableFuture<Void> deleteVar(String name); @Override CompletableFuture<Void> setVar(String name, Object value); @Override CompletableFuture<Object> getOption(String name); @Override CompletableFuture<Void> setOption(String name, Object value); @Override CompletableFuture<Integer> getNumber(); @Override CompletableFuture<String> getName(); @Override CompletableFuture<Void> setName(String name); @Override CompletableFuture<Boolean> isLoaded(); @Override CompletableFuture<Boolean> isValid(); @Override CompletableFuture<VimCoords> getMark(String name); @Override CompletableFuture<Object> getChangedTick(); @Override CompletableFuture<List<VimKeyMap>> getKeymap(String mode); @Override CompletableFuture<Void> setKeymap(String mode, String lhs, String rhs, Map<String, Boolean> options); @Override CompletableFuture<Void> deleteKeymap(String mode, String lhs); @Override CompletableFuture<Integer> addHighlight(int srcId, String hlGroup, int line, int colStart, int colEnd); @Override CompletableFuture<Void> clearHighlight(int srcId, int lineStart, int lineEnd); @Override CompletableFuture<Void> clearNamespace(int namespaceId, int lineStart, int lineEnd); @Override CompletableFuture<Integer> setVirtualText(int namespaceId, int line, List<HighlightedText> chunks, Map optionalParams); @Override CompletableFuture<Boolean> attach(boolean loadFullBufferOnStart, Map opts); @Override CompletableFuture<Boolean> detach(); @Override CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions); @Override String toString(); }
BufferStreamApi extends BaseStreamApi implements NeovimBufferApi { @Override public CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions) { return sendWithResponseOfMapType( prepareMessage(GET_COMMANDS).addArgument(commandsOptions), String.class, CommandInfo.class ); } BufferStreamApi(ReactiveRpcStreamer reactiveRpcStreamer,
                           Buffer model); @Override Buffer get(); @Override CompletableFuture<Integer> getLineCount(); @Override CompletableFuture<List<String>> getLines(int start, int end, boolean strictIndexing); @Override CompletableFuture<Void> setLines(int start, int end, boolean strictIndexing, List<String> replacement); @Override CompletableFuture<Integer> getOffset(int index); @Override CompletableFuture<Object> getVar(String name); @Override CompletableFuture<Void> deleteVar(String name); @Override CompletableFuture<Void> setVar(String name, Object value); @Override CompletableFuture<Object> getOption(String name); @Override CompletableFuture<Void> setOption(String name, Object value); @Override CompletableFuture<Integer> getNumber(); @Override CompletableFuture<String> getName(); @Override CompletableFuture<Void> setName(String name); @Override CompletableFuture<Boolean> isLoaded(); @Override CompletableFuture<Boolean> isValid(); @Override CompletableFuture<VimCoords> getMark(String name); @Override CompletableFuture<Object> getChangedTick(); @Override CompletableFuture<List<VimKeyMap>> getKeymap(String mode); @Override CompletableFuture<Void> setKeymap(String mode, String lhs, String rhs, Map<String, Boolean> options); @Override CompletableFuture<Void> deleteKeymap(String mode, String lhs); @Override CompletableFuture<Integer> addHighlight(int srcId, String hlGroup, int line, int colStart, int colEnd); @Override CompletableFuture<Void> clearHighlight(int srcId, int lineStart, int lineEnd); @Override CompletableFuture<Void> clearNamespace(int namespaceId, int lineStart, int lineEnd); @Override CompletableFuture<Integer> setVirtualText(int namespaceId, int line, List<HighlightedText> chunks, Map optionalParams); @Override CompletableFuture<Boolean> attach(boolean loadFullBufferOnStart, Map opts); @Override CompletableFuture<Boolean> detach(); @Override CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions commandsOptions); @Override String toString();  }