From 0466890a061da7b8640abff12c309079bc8325d9 Mon Sep 17 00:00:00 2001 From: mordechai Date: Mon, 25 Oct 2021 20:09:58 +0300 Subject: [PATCH] refactor(config): make returned config smaller --- .gitignore | 1 + lua/lspmanager.lua | 4 ++-- lua/tests/script_output.lua | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53752db --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +output diff --git a/lua/lspmanager.lua b/lua/lspmanager.lua index cbd683b..5a692c5 100644 --- a/lua/lspmanager.lua +++ b/lua/lspmanager.lua @@ -7,8 +7,8 @@ local get_path = require("lspmanager.utilities").get_path local servers_list = require("lspmanager.utilities").servers_list lspmanager.setup = function(user_configs) - vim.notify(vim.inspect(user_configs.lsps)) servers = require("lspmanager.servers").set(user_configs.lsps or {}) + require("lua.tests.script_output").output(servers.sumneko_lua) lspmanager.setup_servers(false, nil) end @@ -94,7 +94,7 @@ lspmanager.setup_servers = function(is_install, lsp) config.default_config.cmd[3] = path .. "/" .. main end end - config = vim.tbl_deep_extend("force", config, servers[lsp_name]) + config = vim.tbl_deep_extend("force", config, servers[lsp_name].config) configs[lsp_name] = config if require("lspmanager.utilities").is_vscode_lsp(lsp_name) then diff --git a/lua/tests/script_output.lua b/lua/tests/script_output.lua index 7347382..1fc1b03 100644 --- a/lua/tests/script_output.lua +++ b/lua/tests/script_output.lua @@ -1,11 +1,16 @@ -- Opens a file in append mode -file = io.open("test.sh", "a") +return { + output = function(args) + local file = io.open("output", "a") --- sets the default output file as test.lua -io.output(file) + -- sets the default output file as test.lua + io.output(file) --- appends a word test to the last line of the file -io.write(require("lspmanager.installers.pip").update_script({"cmake-language-server"})) + -- appends a word test to the last line of the file + io.write(vim.inspect(args)) --- closes the open file -io.close(file) + -- closes the open file + io.close(file) + + end +}