emacs-lsp / lsp-docker

Scripts and configurations to leverage lsp-mode in docker environment
GNU General Public License v3.0
241 stars 34 forks source link

Add the quote to avoid evaluating the list of LSP major mode #87

Closed vmfhrmfoaj closed 4 months ago

vmfhrmfoaj commented 4 months ago

If LSP client has :major-modes (e.g., :major-modes '(perl-mode cperl-mode)), lsp-docker--create-activation-function-by-project-dir-and-base-client will return a function like below: When this function is called, major-modes list will be evaluated. It caused an error.

(lambda (current-file-name current-major-mode)
  (let ((current-project-root (lsp-workspace-root))
        (registered-project-root ,project-dir)
        (base-activation-fn nil)                   ; ,(lsp--client-activation-fn base-lsp-client) => nil
        (base-major-modes (perl-mode cperl-mode))) ; ,(lsp--client-major-modes base-lsp-client)   => (perl-mode cperl-mode)
    (and (f-same? current-project-root registered-project-root)
         (or (if (functionp base-activation-fn)
                 (funcall base-activation-fn current-file-name current-major-mode)
               nil)
             (-contains? base-major-modes current-major-mode)))))