GNU bug report logs - #76423
Major-mode provided LSP server for Eglot

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Wed, 19 Feb 2025 20:34:02 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 76423 <at> debbugs.gnu.org
Cc: monnier <at> iro.umontreal.ca, João Távora <joaotavora <at> gmail.com>, Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
Subject: bug#76423: Major-mode provided LSP server for Eglot
Date: Wed, 19 Feb 2025 15:33:07 -0500
[Message part 1 (text/plain, inline)]
Tags: patch

Tags: patch

Eglot should make it easier for major modes to suggest which LSP
server to use.
Currently major modes end up doing funny dances like:

    branch: externals/bicep-ts-mode
    commit 8192a400fae45cdde32526f96bb7ed5158d98008
    Author: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
    Commit: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
    
        Wait with altering eglot-server-programs until eglot loaded
    ---
     bicep-ts-mode.el | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/bicep-ts-mode.el b/bicep-ts-mode.el
    index 204629b4c6..f047bccae0 100644
    --- a/bicep-ts-mode.el
    +++ b/bicep-ts-mode.el
    @@ -205,11 +205,11 @@ Return nil if there is no name or if NODE is not a defun node."
                                            . bicep-ts-mode))))
     
     ;;;###autoload
    -(and (boundp 'eglot-server-programs)
    -     (file-exists-p (bicep-langserver-path))
    -     (progn
    -       (add-to-list 'eglot-server-programs
    -                    `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path))))))
    +(eval-after-load 'eglot
    +  '(and (file-exists-p (bicep-langserver-path))
    +        (progn
    +          (add-to-list 'eglot-server-programs
    +                       `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path)))))))
     
     (provide 'bicep-ts-mode)

The patch below would let this major modes do it with a simple:

      (setq-local eglot-server-programs
                  `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path))))


- Stefan


[eglot-server.patch (text/patch, attachment)]

This bug report was last modified 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.