You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain
Bug description
LSP servers which need to be configured by a directory local variable (e.g., project file for Ada LS), aren't initialized correctly when that configuration is set using a normal directory local variable. This happens even when delaying the initialization of lsp to the hack-local-variables-hook as specified in the FAQ. The reason for this is that lsp-defcustom utilizes a custom set function which invokes lsp-register-custom-settings, and this setter is not invoked using the hack-local-variables initialization, which just creates a buffer local variable (via make-local-variable).
I've been able to work around this by using eval and setopt in my .dir-locals.el to cause the setter to be invoked, like this:
;;; Directory Local Variables -*- no-byte-compile: t -*-;;; For more information see (info "(emacs) Directory Variables")
((ada-ts-mode . ((eval. (setopt lsp-ada-project-file "src/gtkada.gpr")))))
However, I think it might be better for lsp-mode to look through the buffer local variables when it starts up and call the setter for any of them which correlate to an lsp-defcustom. That would allow the normal setting of directory local variables to work without resorting to eval and setopt as demonstrated above.
Steps to reproduce
Setting a directory local variable in the normal way for a lsp-defcustom (i.e., lsp-ada-project-file) should cause the issue to be observed. Using this approach, the lsp-defcustom's default value (e.g., "default.gpr") is used when first connecting with the server.
Expected behavior
I expect the value specified in the directory-local variable to be used when communicating with the server.
Which Language Server did you use?
Ada Language Server
OS
Linux
Error callstack
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
LSP servers which need to be configured by a directory local variable (e.g., project file for Ada LS), aren't initialized correctly when that configuration is set using a normal directory local variable. This happens even when delaying the initialization of
lsp
to thehack-local-variables-hook
as specified in the FAQ. The reason for this is thatlsp-defcustom
utilizes a custom set function which invokeslsp-register-custom-settings
, and this setter is not invoked using the hack-local-variables initialization, which just creates a buffer local variable (viamake-local-variable
).I've been able to work around this by using
eval
andsetopt
in my .dir-locals.el to cause the setter to be invoked, like this:However, I think it might be better for
lsp-mode
to look through the buffer local variables when it starts up and call the setter for any of them which correlate to anlsp-defcustom
. That would allow the normal setting of directory local variables to work without resorting toeval
andsetopt
as demonstrated above.Steps to reproduce
Setting a directory local variable in the normal way for a lsp-defcustom (i.e., lsp-ada-project-file) should cause the issue to be observed. Using this approach, the lsp-defcustom's default value (e.g., "default.gpr") is used when first connecting with the server.
Expected behavior
I expect the value specified in the directory-local variable to be used when communicating with the server.
Which Language Server did you use?
Ada Language Server
OS
Linux
Error callstack
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: