diff --git a/modules/plugins/languages/astro.nix b/modules/plugins/languages/astro.nix index 1f3f3003..54bb47a6 100644 --- a/modules/plugins/languages/astro.nix +++ b/modules/plugins/languages/astro.nix @@ -35,20 +35,8 @@ '' function(_, config) -- TODO: Make this a shared util function - local get_typescript_server_path = function(root_dir) - local project_roots = vim.fs.find('node_modules', { path = root_dir, upward = true, limit = math.huge }) - for _, project_root in ipairs(project_roots) do - local typescript_path = project_root .. '/typescript' - local stat = vim.loop.fs_stat(typescript_path) - if stat and stat.type == 'directory' then - return typescript_path .. '/lib' - end - end - return ''' - end - if config.init_options and config.init_options.typescript and not config.init_options.typescript.tsdk then - config.init_options.typescript.tsdk = get_typescript_server_path(config.root_dir) + config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir) end end ''; diff --git a/modules/plugins/languages/haskell.nix b/modules/plugins/languages/haskell.nix index 5a5cb142..13344486 100644 --- a/modules/plugins/languages/haskell.nix +++ b/modules/plugins/languages/haskell.nix @@ -23,7 +23,7 @@ servers = { hls = { enable = true; - cmd = [(getExe pkgs.haskellPackages.haskell-language-server) "--debug"]; + cmd = [(getExe pkgs.haskellPackages.haskell-language-server) "--lsp"]; filetypes = ["haskell" "lhaskell"]; on_attach = mkLuaInline @@ -51,29 +51,9 @@ */ '' function(bufnr, on_dir) - local root_pattern = function(...) - local patterns = M.tbl_flatten { ... } - return function(startpath) - startpath = M.strip_archive_subpath(startpath) - for _, pattern in ipairs(patterns) do - local match = M.search_ancestors(startpath, function(path) - for _, p in ipairs(vim.fn.glob(table.concat({ escape_wildcards(path), pattern }, '/'), true, true)) do - if vim.uv.fs_stat(p) then - return path - end - end - end) - - if match ~= nil then - return match - end - end - end - end - local fname = vim.api.nvim_buf_get_name(bufnr) - on_dir(root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname)) - end + on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname)) + end ''; settings = { haskell = {