diff options
| author | William Boman <william@redwill.se> | 2022-07-06 19:41:43 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2022-07-07 00:39:59 +0200 |
| commit | 5f634e0c37e723fc0c33e06b4fd5c2180178db40 (patch) | |
| tree | fa4f09363adefa8259e23e4d1ea036db628b1243 /lua/mason-lspconfig/server_configurations/angularls/init.lua | |
| parent | feat(health): use stderr for java version, also check for JAVA_HOME (#765) (diff) | |
| download | mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.gz mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.bz2 mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.lz mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.xz mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.zst mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.zip | |
mason.nvim
Diffstat (limited to 'lua/mason-lspconfig/server_configurations/angularls/init.lua')
| -rw-r--r-- | lua/mason-lspconfig/server_configurations/angularls/init.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lua/mason-lspconfig/server_configurations/angularls/init.lua b/lua/mason-lspconfig/server_configurations/angularls/init.lua new file mode 100644 index 00000000..c9076c4e --- /dev/null +++ b/lua/mason-lspconfig/server_configurations/angularls/init.lua @@ -0,0 +1,41 @@ +local platform = require "mason.core.platform" +local npm = require "mason.core.managers.npm" +local _ = require "mason.core.functional" +local path = require "mason.core.path" + +---@param install_dir string +return function(install_dir) + local append_node_modules = _.map(function(dir) + return path.concat { dir, "node_modules" } + end) + + local function get_cmd(workspace_dir) + local cmd = { + "ngserver", + "--stdio", + "--tsProbeLocations", + table.concat(append_node_modules { install_dir, workspace_dir }, ","), + "--ngProbeLocations", + table.concat( + append_node_modules { + path.concat { install_dir, "node_modules", "@angular", "language-server" }, + workspace_dir, + }, + "," + ), + } + if platform.is_win then + cmd[1] = vim.fn.exepath(cmd[1]) + end + + return cmd + end + + return { + cmd = get_cmd(vim.loop.cwd()), + cmd_env = npm.env(install_dir), + on_new_config = function(new_config, root_dir) + new_config.cmd = get_cmd(root_dir) + end, + } +end |
