Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

astro LSP fails to load typescript from monorepo subdirectory #476

Open
2 tasks done
Hacksore opened this issue Oct 19, 2024 · 0 comments
Open
2 tasks done

astro LSP fails to load typescript from monorepo subdirectory #476

Hacksore opened this issue Oct 19, 2024 · 0 comments

Comments

@Hacksore
Copy link

Problem description

Hi folks 👋

Related: #74

I seem to have noticed the following error when opening an astro file in a subpackage of my pnpm monorepo.

Error executing vim.schedule lua callback: ...HEAD-4833a63_1/share/nvim/runtime/lua/vim/lsp/client.lua:584: RPC[Error] code_name = InternalError, message = "Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in \"/Users/hacksore/code/overlayed/apps/web/node_modules/typescript/lib\""
stack traceback:
	[C]: in function 'assert'
	...HEAD-4833a63_1/share/nvim/runtime/lua/vim/lsp/client.lua:584: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

This is true because in my monorepo I pin typescript to the project root so apps/web/node_modules/typescript does not exists.

As a crude workaround I've installed typescript into the nested package and the errors goes away but perhaps there is a better fix for this.

Why do you think this is an issue with mason-lspconfig.nvim?

Ideally the LSP params should be smart enough to support monorepos by traversing to the root if the CWD doesnt contain one perhaps?

Otherwise fallback to a vendor dir.

Neovim version (>= 0.7)

main ✔ $ nvim --version
NVIM v0.11.0-dev-1001+g4833a6392-Homebrew
Build type: Release
LuaJIT 2.1.1727870382
Run "nvim -V1 -v" for more info

Operating system/version

macOS Sequioa

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

  • Yes

Affected language servers

astro-ls

Steps to reproduce

  1. create a monorepo
  2. make apps/astro-app via npx create-astro
  3. open any astro file in the sub directory

Actual behavior

error above

Expected behavior

LSP to find the typescript monorepo root version of typescript or fallback to vendored folder.

LspInfo

- Config: astro
  filetypes:         astro
  cmd:               ~/.local/share/nvim/mason/bin/astro-ls --stdio
  version:           `2.15.3`
  executable:        true
  autostart:         true
  root directory:    ~/code/overlayed/apps/web

LspLog

No response

Healthcheck

==============================================================================
mason:                                         require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-10-19-aback-cherry` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.24.5 built on darwin23.2.0.`
- OK curl: `curl 8.7.1 (x86_64-apple-darwin24.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.62.0`
- OK gzip: `Apple gzip 448.0.3`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- OK cargo: `cargo 1.81.0 (2dbb1af80 2024-08-20)`
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Ruby: `ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin23]`
- OK node: `v20.12.2`
- OK luarocks: `/opt/homebrew/bin/luarocks 3.11.1`
- OK Go: `go version go1.23.2 darwin/arm64`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK npm: `10.5.0`
- OK python: `Python 3.13.0`
- OK RubyGem: `3.5.18`
- OK pip: `pip 24.2 from /opt/homebrew/lib/python3.13/site-packages/pip (python 3.13)`
- OK python venv: `Ok`
- OK JAVA_HOME: `openjdk version "17.0.13" 2024-10-15`
- OK java: `openjdk version "17.0.13" 2024-10-15`
- OK javac: `javac 17.0.13`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 1. Remaining: 59. Limit: 60. Reset: Sat Oct 19 13:23:59 2024.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

@Hacksore Hacksore changed the title astro LSP failes to load typescript from monorepo subdirectory astro LSP fails to load typescript from monorepo subdirectory Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant