Skip to content

Logic for lsp-server-install-dir is incorrect #4758

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

Open
3 tasks done
bjourne opened this issue Apr 11, 2025 · 5 comments
Open
3 tasks done

Logic for lsp-server-install-dir is incorrect #4758

bjourne opened this issue Apr 11, 2025 · 5 comments
Labels

Comments

@bjourne
Copy link

bjourne commented Apr 11, 2025

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

This code:

(defcustom lsp-server-install-dir (expand-file-name
                                   (locate-user-emacs-file (f-join ".cache" "lsp")))
  "Directory in which the servers will be installed."
  :risky t
  :type 'directory
  :package-version '(lsp-mode . "6.3")
  :group 'lsp-mode)

My path to init.el is ~/.config/emacs/init.el so the installation directory will be set to ~/.config/emacs/.cache/lsp/. I suggest that user-emacs-directory should be used instead. There is no need for the ".cache" prefix since the directory is located inside the emacs config hierarchy.

Steps to reproduce

LSP server install with no ~/.emacs file.

Expected behavior

The install directory should make more sense (e.g., not contain two dots)

Which Language Server did you use?

TypeScript

OS

Linux

Error callstack

Anything else?

No response

@bjourne bjourne added the bug label Apr 11, 2025
@kiennq
Copy link
Member

kiennq commented Apr 11, 2025

That lsp-server-install-dir is configurable so you can set it yourselves if you want.

@bjourne
Copy link
Author

bjourne commented Apr 11, 2025

Yup, but the default is wrong. And other paths built with locate-user-emacs-file may also similarly be wrong.

@kiennq
Copy link
Member

kiennq commented Apr 11, 2025

I think changing the default would disrupt everyone existing configuration and should be avoided.
The locate-user-emacs-file and user-emacs-directory should return the same path per its document though. The former one is used since it can create missing directory automatically.
I think your suggestion is to remove the .cache path. I think that can be a valid user preference but given that no one has complained so far, I would just keep the current default value and let the new user to customize that path instead of breaking everyone current working env.

@bjourne
Copy link
Author

bjourne commented Apr 11, 2025

Fair point about backwards compatibility. Though I think you will have to change the path sooner or later anyways. The double dots in the path suggests that the original intent of the code perhaps was to install to ~/.cache/lsp instead.

@mattiasdrp
Copy link
Contributor

I don't see any issue in having recursive dotted directories since .cache is supposed to be a hidden directory inside your emacs directory. I don't think the original intent was to install to .cache/lsp but to .emacs.d/.cache/lsp instead and that's perfectly fine for me.

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

3 participants