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

lsp-typescript: fails to correctly resolve tsserver on NixOS #4539

Open
2 of 3 tasks
gekoke opened this issue Sep 5, 2024 · 3 comments
Open
2 of 3 tasks

lsp-typescript: fails to correctly resolve tsserver on NixOS #4539

gekoke opened this issue Sep 5, 2024 · 3 comments
Labels

Comments

@gekoke
Copy link

gekoke commented Sep 5, 2024

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

With lsp-clients-typescript-prefer-use-project-ts-server set to the default value of nil, lsp-typescript fails to resolve the path to tsserver correctly on NixOS. lsp-typescript then falls back to the tsserver configured by the project.

Logs:

[lspserver] Typescript specified through user setting ignored due to invalid path "/nix/store/z1a0wb285s8vcphf9g7z52vb4xfwsfp5-typescript-5.5.4/bin"

Output of realpath $(which tsserver):

/nix/store/z1a0wb285s8vcphf9g7z52vb4xfwsfp5-typescript-5.5.4/bin/tsserver

Steps to reproduce

Open a TypeScript project with lsp-clients-typescript-prefer-use-project-ts-server set to the default value of nil and tsserver in path on NixOS.

Expected behavior

Path to the globally installed tsserver is resolved correctly

Which Language Server did you use?

typescript-language-server

OS

Linux

Error callstack

No response

Anything else?

No response

@gekoke gekoke added the bug label Sep 5, 2024
@zeorin
Copy link

zeorin commented Sep 19, 2024

IIRC tsserver has to be in Emacs' exec-path. I set mine like this: https://github.com/zeorin/dotfiles/blob/9f58ab43a56c8a3abec4e50008a03e38e7be5aea/home-manager/emacs/doom.nix#L33-L147

@gekoke
Copy link
Author

gekoke commented Sep 19, 2024

IIRC tsserver has to be in Emacs' exec-path. I set mine like this: https://github.com/zeorin/dotfiles/blob/9f58ab43a56c8a3abec4e50008a03e38e7be5aea/home-manager/emacs/doom.nix#L33-L147

Writing that sort of config is something that I've been putting off that would probably save me a ton of headache. Currently, I'm just dumping my language tooling to my user's path.

Despite that, it does seem like lsp-mode is trying to resolve the path, just failing at doing so correctly. Therefore, I'm not sure if this issue is invalid - it seems like this should work even if the program is in the user's path.

@zeorin
Copy link

zeorin commented Sep 19, 2024

You might be interested in https://github.com/purcell/exec-path-from-shell.

It seems intuitive that exec-path should automatically sync with PATH, but they can be used for different purposes: purcell/envrc#19 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants