emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.79k stars 889 forks source link

Please support AUCTeX new mode names out of box #4332

Open ikumikeita opened 8 months ago

ikumikeita commented 8 months ago

Thank you for the bug report

Bug description

I'm participating in develop of AUCTeX, Emacs TeX editing environment. Recently AUCTeX changed its major mode names as described in https://lists.gnu.org/archive/html/auctex-devel/2024-01/msg00002.html ; for example, latex-mode was renamed to LaTeX-mode. We would appreciate if you could add support for those new mode names in lsp-mode out of the box.

Steps to reproduce

Please have a look at a message sent to AUCTeX bug tracker: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69057

Expected behavior

We hope lsp-mode to work with AUCTeX new mode names out of the box.

Which Language Server did you use?

TexLab 5.12.3, but it would be independent of choice of the server.

OS

Linux

Error callstack

No response

Anything else?

I don't use lsp-mode myself. This is a request to upstream triggered by a bug report to AUCTeX development team.

eli-tziperman commented 8 months ago

texlab seems to work for me now under AUCtex, but lsp-grammarly does not. Perhaps this is related to this issue?

rossedwards64 commented 8 months ago

auctex modes are still not working for me in lsp-mode, but i've been using this hack as a workaround:

(maphash (lambda (k v)
           (let ((mode-list (lsp--client-major-modes v))
             (tex-mode-list '(tex-mode latex-mode))
             (auctex-mode-list '(TeX-mode LaTeX-mode)))
         (when (and (equal k 'texlab2)
                (cl-intersection mode-list tex-mode-list))
           (progn
             (dolist (mode auctex-mode-list)
               (setf (lsp--client-major-modes v)
                 (cl-pushnew mode mode-list)))
             (add-to-list 'lsp-language-id-configuration '(\`mode . "latex"))))))
         lsp-clients)
rromoli commented 7 months ago

I still get this error even if I add the code from above LSP :: The following servers support current file but do not have automatic installation: texlab2

rromoli commented 7 months ago

I add LaTeX-mode to the lsp-register-client in the file lsp-tex.el ad it seems to work. I'm not elisp expert so probably my correction is trivial and perhaps not sufficient. Hope that someone more expert than me could fix it in the new version.

(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-texlab-executable)
                  :major-modes '(plain-tex-mode latex-mode LaTeX-mode)
                  :priority (if (eq lsp-tex-server 'texlab) 1 -1)
                  :server-id 'texlab))
dschrempf commented 6 months ago

This is still a problem here. I think we only need to add LaTeX-mode to the lsp-language-id-configuration.