aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/angularls
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-11-18 15:13:40 +0100
committerGitHub <noreply@github.com>2021-11-18 15:13:40 +0100
commit5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc (patch)
treeffc4b33936996915ab18659ce4e764c8c391a1eb /lua/nvim-lsp-installer/servers/angularls
parentangularls: Add typescript dependency (#261) (diff)
downloadmason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.tar
mason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.tar.gz
mason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.tar.bz2
mason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.tar.lz
mason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.tar.xz
mason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.tar.zst
mason-5be3cf6e91898ee375e5bf4dd59a4598a6aeb6dc.zip
angularls: use server root dir for probe locations (#266)
Diffstat (limited to 'lua/nvim-lsp-installer/servers/angularls')
-rw-r--r--lua/nvim-lsp-installer/servers/angularls/init.lua33
1 files changed, 3 insertions, 30 deletions
diff --git a/lua/nvim-lsp-installer/servers/angularls/init.lua b/lua/nvim-lsp-installer/servers/angularls/init.lua
index 0718be54..59349efc 100644
--- a/lua/nvim-lsp-installer/servers/angularls/init.lua
+++ b/lua/nvim-lsp-installer/servers/angularls/init.lua
@@ -2,20 +2,6 @@ local server = require "nvim-lsp-installer.server"
local npm = require "nvim-lsp-installer.installers.npm"
return function(name, root_dir)
- local util = require "lspconfig/util"
- --
- -- Angular requires a node_modules directory to probe for @angular/language-service and typescript
- -- in order to use your projects configured versions.
- -- This defaults to the vim cwd, but will get overwritten by the resolved root of the file.
- local function get_probe_dir(dir)
- local project_root = util.find_node_modules_ancestor(dir)
-
- return project_root and (project_root .. "/node_modules") or ""
- end
-
- local default_probe_dir = get_probe_dir(vim.fn.getcwd())
- local executable_path = npm.executable(root_dir, "ngserver")
-
return server.Server:new {
name = name,
root_dir = root_dir,
@@ -24,26 +10,13 @@ return function(name, root_dir)
installer = npm.packages { "@angular/language-server", "typescript" },
default_options = {
cmd = {
- executable_path,
+ npm.executable(root_dir, "ngserver"),
"--stdio",
"--tsProbeLocations",
- default_probe_dir,
+ root_dir,
"--ngProbeLocations",
- default_probe_dir,
+ root_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