From b89530f9f8783f19a172ed3a94fca2ba993c653b Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 26 Aug 2022 21:25:39 +0800 Subject: Revert "fix: remove the config.commands (#2092)" (#2093) This reverts commit 99e0dc9937b124dee7d8107185e804ff96466279. --- test/lspconfig_spec.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test') diff --git a/test/lspconfig_spec.lua b/test/lspconfig_spec.lua index 7bee8ceb..f98568c1 100644 --- a/test/lspconfig_spec.lua +++ b/test/lspconfig_spec.lua @@ -213,6 +213,41 @@ describe('lspconfig', function() ]]) end) end) + + describe('user commands', function() + it('should translate command definition to nvim_create_user_command options', function() + eq( + { + nargs = '*', + complete = 'custom,v:lua.some_global', + }, + exec_lua [[ + local util = require("lspconfig.util") + return util._parse_user_command_options({ + function () end, + "-nargs=* -complete=custom,v:lua.some_global" + }) + ]] + ) + + eq( + { + desc = 'My awesome description.', + nargs = '*', + complete = 'custom,v:lua.another_global', + }, + exec_lua [[ + local util = require("lspconfig.util") + return util._parse_user_command_options({ + function () end, + ["-nargs"] = "*", + "-complete=custom,v:lua.another_global", + description = "My awesome description." + }) + ]] + ) + end) + end) end) describe('config', function() -- cgit v1.2.3-70-g09d2