aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-05-01 11:11:19 -0700
committerGitHub <noreply@github.com>2021-05-01 11:11:19 -0700
commit6e48e492432b241652ab0bb5d6a2acf89f5bda55 (patch)
tree726164bd042ed4851d4f32811ac0b5a810f7802d /lua/lspconfig.lua
parentMerge pull request #864 from nanotee/zeta_note (diff)
parentUse dofile instead of require for faster setup({}) (diff)
downloadnvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.tar
nvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.tar.gz
nvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.tar.bz2
nvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.tar.lz
nvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.tar.xz
nvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.tar.zst
nvim-lspconfig-6e48e492432b241652ab0bb5d6a2acf89f5bda55.zip
Merge pull request #861 from mjlbach/dofile
Use dofile instead of require for faster loading
Diffstat (limited to 'lua/lspconfig.lua')
-rw-r--r--lua/lspconfig.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua
index 7a6fb080..1023167b 100644
--- a/lua/lspconfig.lua
+++ b/lua/lspconfig.lua
@@ -4,6 +4,8 @@ local M = {
util = require 'lspconfig/util';
}
+local script_path = M.util.script_path()
+
M._root = {}
function M.available_servers()
@@ -84,7 +86,9 @@ end
local mt = {}
function mt:__index(k)
if configs[k] == nil then
- pcall(require, 'lspconfig/'..k)
+ -- dofile is used here as a performance hack to increase the speed of calls to setup({})
+ -- dofile does not cache module lookups, and requires the absolute path to the target file
+ dofile(script_path .. 'lspconfig/' .. k .. ".lua")
end
return configs[k]
end