Skip to content

error of Angular LSP #1597

@wert2all

Description

@wert2all

Checklist

  • I have searched through the AstroNvim documentation
  • I have searched through the existing issues of this project
  • I have searched the existing issues of plugins related to this issue
  • I can replicate the bug with the minimal repro.lua provided below

Neovim version (nvim -v)

0.11.3

Operating system/version

arch btw

Terminal/GUI

kitty

Describe the bug

Angular LSP is broken after some updates. It throws an error after open any component:

  Warn  03:36:52 notify.warn Client angularls quit with exit code 1 and signal 0. Check log for errors: ~/.local/state/nvim/lsp.log

and ~/.local/state/nvim/lsp.log

ackages/angular-language-server/node_modules/@angular/language-server/index.js:219086\n      throw new Error(`Failed to resolve '${packageName}' with minimum version '${minVersion}' from ` + JSON.stringify(probeLocations, null, 2));\n      ^\n\nError: Failed to resolve '@angular/language-service' with minimum version '15.0' from ...........

Steps to Reproduce

  1. install angular pack
  2. open ant angular component

-- fail

Expected behavior

I investigate this issue and found a same behavior on r/neovim:

For fixing an issue should set up correct cmd option of angular LSP.

local install_path = vim.fn.stdpath "data" .. "/mason/packages/angular-language-server/node_modules"
local angular_cmd = {
  "ngserver",
  "--stdio",
  "--tsProbeLocations",
  install_path,
  "--ngProbeLocations",
  install_path .. "/@angular/language-server/node_modules",
}
return {
  "AstroNvim/astrolsp",
  opts = {
    config = {
      angularls = {
        cmd = angular_cmd,
        on_new_config = function(new_config, _) new_config.cmd = angular_cmd end,
      },
    },
  },
}

I could create a PR, but I have no clue how to do it correctly.

Screenshots

No response

Additional Context

No response

Minimal configuration

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- install plugins
local plugins = {
  { "AstroNvim/AstroNvim", import = "astronvim.plugins" },
  { "AstroNvim/astrocommunity" },

  -- add any other plugins/customizations here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here (autocommands, vim.filetype, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamIssues that apply to upstream plugins and not AstroNvim directly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions