Skip to content

Commit

Permalink
refactor(config): make returned config smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
MordechaiHadad committed Oct 25, 2021
1 parent de1921a commit 0466890
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output
4 changes: 2 additions & 2 deletions lua/lspmanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions lua/tests/script_output.lua
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 0466890

Please sign in to comment.