diff options
| author | Jaehwang Jung <tomtomjhj@gmail.com> | 2024-04-07 08:09:27 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-07 01:09:27 +0200 |
| commit | 1505b7a70e82d3aa8edef68b4a1b306a06187cb3 (patch) | |
| tree | 250a23c29bc79ddb7d5c1247d4d5753d85707e84 /lua | |
| parent | feat: add `ruff` (#385) (diff) | |
| download | mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.tar mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.tar.gz mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.tar.bz2 mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.tar.lz mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.tar.xz mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.tar.zst mason-lspconfig-1505b7a70e82d3aa8edef68b4a1b306a06187cb3.zip | |
perf: lazy-require some modules during config (#387)
Diffstat (limited to 'lua')
3 files changed, 9 insertions, 8 deletions
diff --git a/lua/mason-lspconfig/server_configurations/astro/init.lua b/lua/mason-lspconfig/server_configurations/astro/init.lua index d556719..3ef9cff 100644 --- a/lua/mason-lspconfig/server_configurations/astro/init.lua +++ b/lua/mason-lspconfig/server_configurations/astro/init.lua @@ -1,9 +1,9 @@ -local typescript = require "mason-lspconfig.typescript" - ---@param install_dir string return function(install_dir) return { on_new_config = function(new_config, workspace_dir) + local typescript = require "mason-lspconfig.typescript" + new_config.init_options.typescript.serverPath = typescript.resolve_tsserver(install_dir, workspace_dir) new_config.init_options.typescript.tsdk = typescript.resolve_tsdk(install_dir, workspace_dir) end, diff --git a/lua/mason-lspconfig/server_configurations/pylsp/init.lua b/lua/mason-lspconfig/server_configurations/pylsp/init.lua index c9b3db7..9d930b0 100644 --- a/lua/mason-lspconfig/server_configurations/pylsp/init.lua +++ b/lua/mason-lspconfig/server_configurations/pylsp/init.lua @@ -1,15 +1,16 @@ local _ = require "mason-core.functional" local a = require "mason-core.async" -local notify = require "mason-lspconfig.notify" -local pip3 = require "mason-core.managers.pip3" -local process = require "mason-core.process" -local spawn = require "mason-core.spawn" ---@param install_dir string return function(install_dir) vim.api.nvim_create_user_command( "PylspInstall", a.scope(function(opts) + local notify = require "mason-lspconfig.notify" + local pip3 = require "mason-core.managers.pip3" + local process = require "mason-core.process" + local spawn = require "mason-core.spawn" + local plugins = opts.fargs local plugins_str = table.concat(plugins, ", ") notify(("Installing %s..."):format(plugins_str)) diff --git a/lua/mason-lspconfig/server_configurations/volar/init.lua b/lua/mason-lspconfig/server_configurations/volar/init.lua index 76fa188..21148dd 100644 --- a/lua/mason-lspconfig/server_configurations/volar/init.lua +++ b/lua/mason-lspconfig/server_configurations/volar/init.lua @@ -1,9 +1,9 @@ -local typescript = require "mason-lspconfig.typescript" - ---@param install_dir string return function(install_dir) return { on_new_config = function(new_config, workspace_dir) + local typescript = require "mason-lspconfig.typescript" + local tsdk = typescript.resolve_tsdk(install_dir, workspace_dir) new_config.init_options.typescript.serverPath = tsdk new_config.init_options.typescript.tsdk = tsdk |
