From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Niels Thykier Newsgroups: gmane.emacs.bugs Subject: bug#72088: eglot: Segregates language servers in a way that hampers polyglot language servers Date: Fri, 12 Jul 2024 13:33:56 +0200 Message-ID: <6e65694c-88d6-4c54-93a8-2ffb843ce6d0@thykier.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28191"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: 72088@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 13 05:23:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sSTM0-00078k-Hx for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Jul 2024 05:23:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSTLk-0004G9-GP; Fri, 12 Jul 2024 23:23:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSTLh-0004Fc-St for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 23:23:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSTLh-0006uC-Gr for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 23:23:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sSTLh-0007vj-TV for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 23:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Niels Thykier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jul 2024 03:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72088 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172084097630463 (code B ref -1); Sat, 13 Jul 2024 03:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Jul 2024 03:22:56 +0000 Original-Received: from localhost ([127.0.0.1]:54951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSTLc-0007vA-2d for submit@debbugs.gnu.org; Fri, 12 Jul 2024 23:22:56 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSEXU-0006K0-H3 for submit@debbugs.gnu.org; Fri, 12 Jul 2024 07:34:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSEXT-0006FT-GZ for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 07:34:12 -0400 Original-Received: from mailrelay5-1.pub.mailoutpod2-cph3.one.com ([2a02:2350:5:404::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSEXP-0003Rz-Of for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 07:34:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thykier.net; s=rsa1; h=content-transfer-encoding:content-type:subject:from:to:mime-version:date: message-id:from; bh=VN3j25iX4yn87kBomFDTMtQ2jmE7C1wk5LXbo8O+YZ4=; b=CPBkQop5VHqLf3A8fq0zqib+/XFHzZPweeaNMshABkW1qz6/Lgo069Mz+aXV8Ava+Zkc8aGs6E/zg mnlO6lkCjVwuziqYhQ+BB/zQiWl7UjwfaXNsjTJzPwg+AGArlJNLdLCEIIS+qkFlyhuWI80Iou1viJ gbcVvxzDJBzHwGzgXKMBx5mu7htaOvSD/jb+IjoxY+kcie5g1+w4kMXerzhG9xdQZ920/i4EoFEte6 K8/oJnfSZHH+WolHjP0DGzQSqdAyMsWE2zxGFH33IvPvk8t1vsyqqyh/RWS7xghJ/5gjoZmXePaJuX aT0IKHKpToAcI3/Uiv9MDQ7dXY4wfLQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=thykier.net; s=ed1; h=content-transfer-encoding:content-type:subject:from:to:mime-version:date: message-id:from; bh=VN3j25iX4yn87kBomFDTMtQ2jmE7C1wk5LXbo8O+YZ4=; b=m3nQyh/CFO41bXfPFSqSjA4TxXiWSv5T0/ss1BiWZkAqRBjNLxNrHDVn5QFOMHcx9cwL3zSi0+l3+ fRbPfapCQ== X-HalOne-ID: 9fa17d46-4042-11ef-abf1-6f719e79c8e4 Original-Received: from [127.0.0.1] (unknown [185.220.101.187]) by mailrelay5.pub.mailoutpod2-cph3.one.com (Halon) with ESMTPSA id 9fa17d46-4042-11ef-abf1-6f719e79c8e4; Fri, 12 Jul 2024 11:33:59 +0000 (UTC) Content-Language: en-US Autocrypt: addr=niels@thykier.net; keydata= xsFNBEoc+tABEAC2hwVc8hIXriemyLerYBq5Q7d0QrYkuvruWGRbDvfegqGJDopZb/Tq2jBm 2QwGIy7ikTxgOqcH2fQH5zJuYq6WC4ST9DdXghhqh6pm1e68dhyJrWmmdmgV42bvb5GvtMGC vfeSCsqJrp1yjJCHyJmBj33ExBhPr4YGLOJc45wol0LB8HfqietRaGKiS5Vsay6D+LUCEPKX EZD72nh+VdKZdy8YNBUF+e27LapLH+6dkH8wR7OJU8SoVwhVOZcpf4mjmw3iiQIvWKJhokhG K1cjZ7huIZEs+x0XlEwA1FWLCMp9Ktnum8NlF7uQfGEpfQ1Oofr50vxx8cnGoVnwUKIRcRx9 uBGRWehTBnbe/7CSXIbvWY7T4KHjbI33k8P6ytVxpVNHrSKK2P4Fb6Dsh7QondikzvMdlWqD h0rhjchpPXAUuqT/3ItSlJhllFkfTDUG26tFq1v3AlPLayPvFjkC9HUAiu5rqSJsNR/bDSxo /JfBerzzbqfw4aQ0iYoT/0zJ3PqaqsAqU8dHdTXHbrryzqM+sD65Q87ZhC9BFIXENplIQ91V JNxjuq0PEHJDZ9lAh3+Paa6LUAEhqGffTpdEo1iyqY6zDT6cBgFY7MWJiM8rWkI8IADj4aiz wBEud1nEjIVYZkk0qF8kFhvn3j88cfTV3/8OgRvL3lWsOoDEdwARAQABzSFOaWVscyBUaHlr aWVyIDxuaWVsc0B0aHlraWVyLm5ldD7CwZMEEwEIAD0CGy8GCwkIBwMCBBUCCAMEFgIDAQIe AQIXgBYhBLMTGkUdv998oFtBlwVLu599gGRCBQJk5 Received-SPF: none client-ip=2a02:2350:5:404::1; envelope-from=niels@thykier.net; helo=mailrelay5-1.pub.mailoutpod2-cph3.one.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 12 Jul 2024 23:22:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288784 Archived-At: 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? :) Best regards, Niels