From 6974d0c6c18f683256c3f96b902eae79660b5590 Mon Sep 17 00:00:00 2001 From: Dingcheng Yue Date: Sat, 10 Apr 2021 00:00:45 +0100 Subject: lsp: deep copy vim.lsp.log when reloading If vim.lsp.log is loaded the second time, the vim.log.levels will be modified with additional entries from 0-5. This will cause the require to fail as level:lower does not exists on numbered value. --- runtime/lua/vim/lsp/log.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua index 331e980e67..471a311c16 100644 --- a/runtime/lua/vim/lsp/log.lua +++ b/runtime/lua/vim/lsp/log.lua @@ -10,7 +10,7 @@ local log = {} -- Can be used to lookup the number from the name or the name from the number. -- Levels by name: 'trace', 'debug', 'info', 'warn', 'error' -- Level numbers begin with 'trace' at 0 -log.levels = vim.log.levels +log.levels = vim.deepcopy(vim.log.levels) -- Default log level is warn. local current_log_level = log.levels.WARN -- cgit