> Date: Fri, 12 Jul 2024 13:33:56 +0200
> From: Niels Thykier <niels@thykier.net>
>
> Hi
>
> Thanks for providing LSP support in emacs. :)
>
>
> For reference, I used emacs 29.4 from Debian when I tested. If this
> feature has changed in emacs 30, then I would not have seen it yet (I am
> not tracking emacs/eglot development a lot).
>
>
> I am working on a language server for Debian packaging (called
> `debputy`). The Debian packaging files consists of several different
> file formats with cross references between the formats. As a
> consequence, I built my language server to be a "polyglot" (multi-language).
>
> While testing with eglot, I noticed that my language server was not
> informed of all changes. As far as I can see, eglot spawns a language
> server per file format (major mode) and then only informs the language
> server of events (didOpen/didChange) for that major mode. This happens
> even through it is exactly the same command + args for both major modes.
>
> The next result is that my language server when used via emacs + eglot,
> requires the user to save a file before the language server can "see"
> the effect when you are working in a different file.
>
> I was a bit in doubt whether the spec accounted for polyglot language
> servers, so I asked in the LSP github for clarification. They made the
> argument that a language server should be able to see events for other
> file formats and suggested that I contacted you (the eglot maintainers)
> about this
> (https://github.com/microsoft/language-server-protocol/issues/1964).
> They acknowledged this was implicit and then listed the two key features
> they saw as supporting this implicit requirement (both of them boils
> down to DocumentSelector as I read it).
>
> I tried a static registration with a DocumentSelector on `**/debian/*`
> (I think it was hover docs, though it might have been completion), but
> my debugging suggested that my instances did not get didOpen/didChange
> events "across" the file formats even with this registration.
>
> Can we work towards a solution where I can ask eglot to provide
> didOpen/didChange events across formats? :)
João, any comments or suggestions?