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: Sun, 14 Jul 2024 11:36:34 +0200 Message-ID: References: <6e65694c-88d6-4c54-93a8-2ffb843ce6d0@thykier.net> <86bk31lsvd.fsf@gnu.org> <86cyngk2qm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4275"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 72088@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 14 11:39:35 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 1sSvhe-0000us-Lj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Jul 2024 11:39:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSvh9-0003Xv-UF; Sun, 14 Jul 2024 05:39:03 -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 1sSvh7-0003Xb-9Z for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2024 05:39:01 -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 1sSvh7-0003Be-17 for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2024 05:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sSvh8-0006Op-4z for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2024 05:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Niels Thykier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Jul 2024 09:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72088 X-GNU-PR-Package: emacs Original-Received: via spool by 72088-submit@debbugs.gnu.org id=B72088.172094990024528 (code B ref 72088); Sun, 14 Jul 2024 09:39:02 +0000 Original-Received: (at 72088) by debbugs.gnu.org; 14 Jul 2024 09:38:20 +0000 Original-Received: from localhost ([127.0.0.1]:57166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSvgS-0006NY-BY for submit@debbugs.gnu.org; Sun, 14 Jul 2024 05:38:20 -0400 Original-Received: from mailrelay4-1.pub.mailoutpod2-cph3.one.com ([46.30.211.179]:36149) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSvgQ-0006NG-0s for 72088@debbugs.gnu.org; Sun, 14 Jul 2024 05:38:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thykier.net; s=rsa1; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=b+B63i/jaQX61sv1Q0pjjQIl2ZvG2i8L/HEvV2HX+Iw=; b=fOQ9hWJVu70WIioX1kN9o0hQcSB8d18EhHbBtwYPFfMPIlots7ECA5cIZ6JvCcZ+1CyiOTDKU1P7i 0gxmtepwmrbuiithzI3ciQsLuXoHWhVzjsdymHVQoO47Qcu/yHY4kwZC9ZQWQ2qZJqo/1GkKScN9G/ 7yaV7YlaccLWRxUG3kB6ktMDimSZN/+CF1TXS9qJ+5HCot3Jfb8z72ny3hTS9k9BM1U4SSgPKCcviy Hh6qw0nQNh42kuEHoMes7HtQA3CsNURWYYBUZiPnkOSmoolKh/RpghKYhH+EMxTSl7zh9wyijjxuiv mTTBDEGre6cab96giKtCI/tZSUuZD3g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=thykier.net; s=ed1; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=b+B63i/jaQX61sv1Q0pjjQIl2ZvG2i8L/HEvV2HX+Iw=; b=XfAUHZIPfQhgbdQGEdks/xZ/3EZgrHBylbOZ07//VpxIc8o2VFbsWXarCBbf14Y/siYjdKCmEJs8N MC0DFoxBA== X-HalOne-ID: 8f49b239-41c4-11ef-b3df-0b89bdf0fe56 Original-Received: from [127.0.0.1] (unknown [103.251.167.20]) by mailrelay4.pub.mailoutpod2-cph3.one.com (Halon) with ESMTPSA id 8f49b239-41c4-11ef-b3df-0b89bdf0fe56; Sun, 14 Jul 2024 09:36:39 +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 In-Reply-To: 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:288836 Archived-At: João Távora: > On Sun, Jul 14, 2024, 05:37 Eli Zaretskii wrote: > >> AFAIU, the OP tried to use the same LSP server for several languages, >> or something like that. >> > > Yes, but how? What are the major modes in question? What information was > added to eglot-server-programs, if any? Hi, The `eglot-server-programs` are defined as: ``` (with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(debian-control-mode . ("debputy" "lsp" "server"))) (add-to-list 'eglot-server-programs '(debian-changelog-mode . ("debputy" "lsp" "server"))) (add-to-list 'eglot-server-programs '(debian-copyright-mode . ("debputy" "lsp" "server"))) (add-to-list 'eglot-server-programs '(makefile-gmake-mode . ("debputy" "lsp" "server"))) (add-to-list 'eglot-server-programs '(yaml-mode . ("debputy" "lsp" "server"))) (add-to-list 'eglot-server-programs '(debian-autopkgtest-control-mode . ("debputy" "lsp" "server"))) ) ``` Concrete case I was debugging was a `debian/control` file (`debian-control-mode`) + a `debian/rules` file (`makefile-qmake-mode`). The "debian-X" modes is coming from https://salsa.debian.org/emacsen-team/dpkg-dev-el. I did not remember actively installing the `makefile-qmake-mode`, so I assume it is bundled with emacs. The "yaml-mode" is elpa-yaml-mode (https://github.com/yoshiki/yaml-mode). Note: The `makefile-gmake-mode` and `yaml-mode` registrations would ideally be restricted to specific file names (such as `debian/rules` and `debian/debputy.manifest`). Mentioning it mostly for the context (I have not looked into how to do that at an eglot level yet). > Are the two different files in question in the same project? Yes, as far as I can tell, eglot considers them to be in the same project. Concretely, the files are both in a .git repo and eglot reports the git root dir as a workspace folder to the server. > The OP consistently conflates file type and > major mode, which is not always true. Apologies for that. The language server in question works with at least 4 distinct syntactical formats (YAML, make, the debian changelog format plus 3 distinct deb822 files). You are correct that the 3 deb822 files do have different major modes despite being the same file format at a syntactical level. Nevertheless, in the concrete case, the problem appears between two distinct file formats *and* major-modes. > A simple example of a LSP server that > manages different files in (slightly) different major modes (as long as in > the same project) is clangd. But there are a few others, I think. The > docstring of eglot-server-programs should be studied. > > João > >> > I read through https://www.gnu.org/software/emacs/manual/html_node/eglot/Setting-Up-LSP-Servers.html and I do not see anything here that decides how to control whether one or two instances per project will be spawned. Best regards, Niels