emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eglot's interface for major modes


From: Sebastian Poeplau
Subject: Re: eglot's interface for major modes
Date: Thu, 13 Apr 2023 21:36:12 +0200

> Sebastian's version does not fully implement the protocol, but the Ada
> Langauge Server might be a good choice to test the implementation
> against.  In his example, the server sends the window/showDocument
> request in reaction to an eglot-execute-command client-request.  I don't
> know if that complicates a potential testing process.  Probably not.

If you'd like to experiment with the Ada Language Server, here's how to
set up a minimal project:

  minimal_project/
  ├── main.adb
  ├── main.ads
  └── project.gpr

The project definition in project.gpr is this:

  Project P is
     for Main use ("main.adb");
  end P;

The specification of the main unit (main.ads):

  procedure Main;

And the equally useful body (main.adb):

  procedure Main is null;

It's not a very useful project, but it's enough to make the server
respond to "als-other-file" in main.ad[bs].

You can download a prebuilt binary of the language server [1] or use the
Alire package manager to build your own [2]. Then you can use the custom
major mode from my initial message [3] and run the
`ada-light-other-file' command; the mode already monkey-patches eglot
with my (admittedly incomplete) handler for "window/showDocument".

If you want to silence the language server's warning about the lack of
an explicitly specified project file, set
`eglot-workspace-configuration' to (:ada (:projectFile "project.gpr")).


[1] https://github.com/AdaCore/ada_language_server/releases/tag/23.0.16
[2] https://alire.ada.dev/crates/ada_language_server.html
[3] https://github.com/sebastianpoeplau/ada-light-mode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]