From 9551bbc1e207ea9a9d436f1bf02a22afc33f6aa6 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 17 Sep 2021 16:05:20 +0200 Subject: optimize io (70%+ startup speedups) (#93) --- lua/nvim-lsp-installer/servers/angularls/init.lua | 57 +++++++++++------------ 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'lua/nvim-lsp-installer/servers/angularls/init.lua') diff --git a/lua/nvim-lsp-installer/servers/angularls/init.lua b/lua/nvim-lsp-installer/servers/angularls/init.lua index 8de5b29f..89c62741 100644 --- a/lua/nvim-lsp-installer/servers/angularls/init.lua +++ b/lua/nvim-lsp-installer/servers/angularls/init.lua @@ -11,37 +11,36 @@ local function get_probe_dir(root_dir) return project_root and (project_root .. "/node_modules") or "" end -local default_probe_dir = get_probe_dir(vim.fn.getcwd()) +return function(name, root_dir) + local default_probe_dir = get_probe_dir(vim.fn.getcwd()) + local executable_path = npm.executable(root_dir, "ngserver") -local root_dir = server.get_server_root_path "angularls" - -local executable_path = npm.executable(root_dir, "ngserver") - -return server.Server:new { - name = "angularls", - root_dir = root_dir, - installer = npm.packages { "@angular/language-server" }, - default_options = { - cmd = { - executable_path, - "--stdio", - "--tsProbeLocations", - default_probe_dir, - "--ngProbeLocations", - default_probe_dir, - }, - on_new_config = function(new_config, new_root_dir) - local new_probe_dir = get_probe_dir(new_root_dir) - - -- We need to check our probe directories because they may have changed. - new_config.cmd = { + return server.Server:new { + name = name, + root_dir = root_dir, + installer = npm.packages { "@angular/language-server" }, + default_options = { + cmd = { executable_path, "--stdio", "--tsProbeLocations", - new_probe_dir, + default_probe_dir, "--ngProbeLocations", - new_probe_dir, - } - end, - }, -} + default_probe_dir, + }, + on_new_config = function(new_config, new_root_dir) + local new_probe_dir = get_probe_dir(new_root_dir) + + -- We need to check our probe directories because they may have changed. + new_config.cmd = { + executable_path, + "--stdio", + "--tsProbeLocations", + new_probe_dir, + "--ngProbeLocations", + new_probe_dir, + } + end, + }, + } +end -- cgit v1.2.3-70-g09d2