GNU bug report logs - #65359
[PATCH] eglot: add "lexical" LSP server

Previous Next

Package: emacs;

Reported by: Mou Tong <mou.tong <at> outlook.com>

Date: Fri, 18 Aug 2023 01:44:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65359 in the body.
You can then email your comments to 65359 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Fri, 18 Aug 2023 01:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mou Tong <mou.tong <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 18 Aug 2023 01:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mou Tong <mou.tong <at> outlook.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] eglot: add "lexical" LSP server
Date: Fri, 18 Aug 2023 01:38:39 +0000
[Message part 1 (text/plain, inline)]
There is a new LSP server for elixir: [lexical].

Although it said there had problems to use it with eglot, but I didn't
meet the [problem] it said in the instruction.

And I had used it for serveral projects and it worked fine, I put this
in my config and I don't know if there is a better way:

```emacs-lisp
(with-eval-after-load 'eglot
  (setf (alist-get '(elixir-mode elixir-ts-mode heex-ts-mode)
                   eglot-server-programs
                   nil nil #'equal)
        (eglot-alternatives
         `(("start_lexical.sh")
           ,(if (and (fboundp 'w32-shell-dos-semantics)
                     (w32-shell-dos-semantics))
                '("language_server.bat")
              '("language_server.sh"))))))
```

So I send a patch like this.

[lexical]: https://github.com/lexical-lsp/lexical

[problem]: https://github.com/lexical-lsp/lexical/blob/main/pages/installation.md#vanilla-emacs-with-eglot

[Message part 2 (text/html, inline)]
[0001-Add-lexical-LSP-server-to-Eglot.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Fri, 18 Aug 2023 06:01:01 GMT) Full text and rfc822 format available.

Message #8 received at 65359 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mou Tong <mou.tong <at> outlook.com>
Cc: 65359 <at> debbugs.gnu.org
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Fri, 18 Aug 2023 09:00:02 +0300
> From: Mou Tong <mou.tong <at> outlook.com>
> Date: Fri, 18 Aug 2023 01:38:39 +0000
> 
> There is a new LSP server for elixir: [lexical].
> 
> Although it said there had problems to use it with eglot, but I didn't
> meet the [problem] it said in the instruction.
> 
> And I had used it for serveral projects and it worked fine, I put this
> in my config and I don't know if there is a better way:
> 
> ```emacs-lisp
> (with-eval-after-load 'eglot
>  (setf (alist-get '(elixir-mode elixir-ts-mode heex-ts-mode)
>                   eglot-server-programs
>                   nil nil #'equal)
>        (eglot-alternatives
>         `(("start_lexical.sh")
>           ,(if (and (fboundp 'w32-shell-dos-semantics)
>                     (w32-shell-dos-semantics))
>                '("language_server.bat")
>              '("language_server.sh"))))))
> ```
> 
> So I send a patch like this. 
> 
> [lexical]: https://github.com/lexical-lsp/lexical
> 
> [problem]:
> https://github.com/lexical-lsp/lexical/blob/main/pages/installation.md#vanilla-emacs-with-eglot
> 
> 
> From f4789e6215291ca2be95f443e0d2a1b122a44b0d Mon Sep 17 00:00:00 2001
> From: dalu <mou.tong <at> outlook.com>
> Date: Thu, 17 Aug 2023 18:34:42 +0800
> Subject: [PATCH] Add "lexical" LSP server to Eglot
> 
> ---
>  lisp/progmodes/eglot.el | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 113ff08e94e..be7ed54c71d 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -219,10 +219,12 @@ eglot-server-programs
>                                   . ("dart" "language-server"
>                                      "--client-id" "emacs.eglot-dart"))
>                                  ((elixir-mode elixir-ts-mode heex-ts-mode)
> -                                 . ,(if (and (fboundp 'w32-shell-dos-semantics)
> -                                             (w32-shell-dos-semantics))
> -                                        '("language_server.bat")
> -                                      '("language_server.sh")))
> +                                 . ,(eglot-alternatives
> +                                     `(("start_lexical.sh")
> +                                       ,(if (and (fboundp 'w32-shell-dos-semantics)
> +                                                 (w32-shell-dos-semantics))
> +                                            '("language_server.bat")
> +                                          '("language_server.sh")))))
>                                  (ada-mode . ("ada_language_server"))
>                                  (scala-mode . ,(eglot-alternatives
>                                                  '("metals" "metals-emacs")))

Thanks, but the fact the command is a shell script again needs the
w32-shell-dos-semantics dance, like language_server.sh did.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Fri, 18 Aug 2023 06:20:02 GMT) Full text and rfc822 format available.

Message #11 received at 65359 <at> debbugs.gnu.org (full text, mbox):

From: Mou Tong <mou.tong <at> outlook.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "65359 <at> debbugs.gnu.org" <65359 <at> debbugs.gnu.org>
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Fri, 18 Aug 2023 06:19:10 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but the fact the command is a shell script again needs the
> w32-shell-dos-semantics dance, like language_server.sh did.

I'm afraid lexical doesn't support Windows for now.

Currently lexical only provides `start_lexical.sh`, but I guess it
will support Windows soon since I had seen such a sentence in this
[PR] (it got merged in last week):

> All of our files can be ported to windows fairly easily

Should we wait until it supports Windows?

[PR]: https://github.com/lexical-lsp/lexical/pull/314





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Fri, 18 Aug 2023 06:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 65359 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mou Tong <mou.tong <at> outlook.com>
Cc: 65359 <at> debbugs.gnu.org
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Fri, 18 Aug 2023 09:39:44 +0300
> From: Mou Tong <mou.tong <at> outlook.com>
> CC: "65359 <at> debbugs.gnu.org" <65359 <at> debbugs.gnu.org>
> Date: Fri, 18 Aug 2023 06:19:10 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks, but the fact the command is a shell script again needs the
> > w32-shell-dos-semantics dance, like language_server.sh did.
> 
> I'm afraid lexical doesn't support Windows for now.

Then we should make this entry be in effect only on systems that
aren't Windows.

> Should we wait until it supports Windows?

I don't mind installing this now, but only if it doesn't break Elixir
support on Windows, which would mean this new entry should be hidden
when Emacs runs on Windows.

I also don't mind waiting...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Fri, 18 Aug 2023 07:09:01 GMT) Full text and rfc822 format available.

Message #17 received at 65359 <at> debbugs.gnu.org (full text, mbox):

From: Mou Tong <mou.tong <at> outlook.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "65359 <at> debbugs.gnu.org" <65359 <at> debbugs.gnu.org>
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Fri, 18 Aug 2023 07:08:42 +0000
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> Then we should make this entry be in effect only on systems that
> aren't Windows.
>
> I don't mind installing this now, but only if it doesn't break Elixir
> support on Windows, which would mean this new entry should be hidden
> when Emacs runs on Windows.

Oh, I see, here is the new patch, I'm using the `eglot-alternatives`
in the else so we don't see lexical on Windows.

> I also don't mind waiting...

Actually I'd like it got merged so I needn't to keep the hack in my
configuration. (Forgive me laziness...)

[0001-Add-lexical-LSP-server-to-Eglot.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Sat, 19 Aug 2023 08:39:01 GMT) Full text and rfc822 format available.

Message #20 received at 65359 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mou Tong <mou.tong <at> outlook.com>, João Távora
 <joaotavora <at> gmail.com>
Cc: 65359 <at> debbugs.gnu.org
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Sat, 19 Aug 2023 11:38:26 +0300
> From: Mou Tong <mou.tong <at> outlook.com>
> CC: "65359 <at> debbugs.gnu.org" <65359 <at> debbugs.gnu.org>
> Date: Fri, 18 Aug 2023 07:08:42 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Then we should make this entry be in effect only on systems that
> > aren't Windows.
> >
> > I don't mind installing this now, but only if it doesn't break Elixir
> > support on Windows, which would mean this new entry should be hidden
> > when Emacs runs on Windows.
> 
> Oh, I see, here is the new patch, I'm using the `eglot-alternatives`
> in the else so we don't see lexical on Windows.
> 
> > I also don't mind waiting...
> 
> Actually I'd like it got merged so I needn't to keep the hack in my
> configuration. (Forgive me laziness...)

João, is the below OK with you?  It's for the master branch.

> From 18161aea6287ffd177834fdac156f6037c410856 Mon Sep 17 00:00:00 2001
> From: dalu <mou.tong <at> outlook.com>
> Date: Thu, 17 Aug 2023 18:34:42 +0800
> Subject: [PATCH] Add "lexical" LSP server to Eglot
> 
> lexical does not support Windows currently
> ---
>  lisp/progmodes/eglot.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 113ff08e94e..65daa0941d5 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -222,7 +222,8 @@ eglot-server-programs
>                                   . ,(if (and (fboundp 'w32-shell-dos-semantics)
>                                               (w32-shell-dos-semantics))
>                                          '("language_server.bat")
> -                                      '("language_server.sh")))
> +                                      (eglot-alternatives
> +                                       '("language_server.sh" "start_lexical.sh"))))
>                                  (ada-mode . ("ada_language_server"))
>                                  (scala-mode . ,(eglot-alternatives
>                                                  '("metals" "metals-emacs")))
> -- 
> 2.41.0
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65359; Package emacs. (Sat, 19 Aug 2023 10:50:01 GMT) Full text and rfc822 format available.

Message #23 received at 65359 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65359 <at> debbugs.gnu.org, Mou Tong <mou.tong <at> outlook.com>
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Sat, 19 Aug 2023 11:51:48 +0100
On Sat, Aug 19, 2023 at 9:38 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Actually I'd like it got merged so I needn't to keep the hack in my
> > configuration. (Forgive me laziness...)
>
> João, is the below OK with you?  It's for the master branch.

Yes, it's fine.  Thanks.

João




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 19 Aug 2023 14:12:02 GMT) Full text and rfc822 format available.

Notification sent to Mou Tong <mou.tong <at> outlook.com>:
bug acknowledged by developer. (Sat, 19 Aug 2023 14:12:02 GMT) Full text and rfc822 format available.

Message #28 received at 65359-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 65359-done <at> debbugs.gnu.org, mou.tong <at> outlook.com
Subject: Re: bug#65359: [PATCH] eglot: add "lexical" LSP server
Date: Sat, 19 Aug 2023 17:11:24 +0300
> From: João Távora <joaotavora <at> gmail.com>
> Date: Sat, 19 Aug 2023 11:51:48 +0100
> Cc: Mou Tong <mou.tong <at> outlook.com>, 65359 <at> debbugs.gnu.org
> 
> On Sat, Aug 19, 2023 at 9:38 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> > > Actually I'd like it got merged so I needn't to keep the hack in my
> > > configuration. (Forgive me laziness...)
> >
> > João, is the below OK with you?  It's for the master branch.
> 
> Yes, it's fine.  Thanks.

Thanks, installed on master, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Sep 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 335 days ago.

Previous Next


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