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 09:31:41 +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="19512"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 72088@debbugs.gnu.org To: Eli Zaretskii , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 14 09:34:22 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 1sStkT-0004rT-N5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Jul 2024 09:34:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sStkB-0006Gm-Qu; Sun, 14 Jul 2024 03:34: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 1sStkA-0006GZ-FJ for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2024 03:34: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 1sStk9-0008QN-Vf for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2024 03:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sStkA-0003Le-6v for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2024 03:34: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 07:34: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.172094241612837 (code B ref 72088); Sun, 14 Jul 2024 07:34:02 +0000 Original-Received: (at 72088) by debbugs.gnu.org; 14 Jul 2024 07:33:36 +0000 Original-Received: from localhost ([127.0.0.1]:57066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sStjj-0003Ky-Mw for submit@debbugs.gnu.org; Sun, 14 Jul 2024 03:33:36 -0400 Original-Received: from mailrelay6-1.pub.mailoutpod3-cph3.one.com ([46.30.211.245]:35153) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sStjf-0003Kg-0x for 72088@debbugs.gnu.org; Sun, 14 Jul 2024 03:33:34 -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=tNMc0BG5emJmbWgg4RVfA4RYsMzQW3XbFhNegHUrhJg=; b=ENYj4d4eXB9oo2hI6yqgG44S9xYXA82LD1wCKpmpOpsHCgOKNd2gzXBUn4/AfvLSlvu5S1Ds65j6U tIArBxDC/TJgdeL/kaVMxpSMP4qJ6jCylmnVLlOd3D7G3WnTCX3sIcYNZNztXBpeba032JqUC5BnHe tFloEJORCdEPjbdmYeWynf/A4lY0RcKP68S04gyhRz7CqUyvoaeYOALbsriLLw4MHKbmgpsHTfDTkc DB3M0vuaaKkDNCNLsTdl/Es2Mz3w2pXCDjJ1FY1Ger8tipudNz9EOmEQ0bByCsFnbEEr0D5yjUdHTJ 9qFE0C8b09rcelYDpYwJQ/hoR6GD8Eg== 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=tNMc0BG5emJmbWgg4RVfA4RYsMzQW3XbFhNegHUrhJg=; b=gEAOI5o1vqfva2RtwOntDsqAkWHc771DYf2p21k/bnso+VMJUwYPH8r8sLEYzMi7nb7ITNGYdJioR 6yPhml4Ag== X-HalOne-ID: 1cd01377-41b3-11ef-9270-4912a091495a Original-Received: from [127.0.0.1] (tor-exit-38.for-privacy.net [185.220.101.38]) by mailrelay6.pub.mailoutpod3-cph3.one.com (Halon) with ESMTPSA id 1cd01377-41b3-11ef-9270-4912a091495a; Sun, 14 Jul 2024 07:31:52 +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: <86cyngk2qm.fsf@gnu.org> 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:288832 Archived-At: Eli Zaretskii: >> From: João Távora >> Date: Sat, 13 Jul 2024 17:29:04 +0100 >> Cc: Niels Thykier , 72088@debbugs.gnu.org >> >> Major modes in eglot-server-programs don't work? What was attempted? I couldn't understand. Look at >> existing examples, like C/C++ file types being handled by the same server, and others. > > AFAIU, the OP tried to use the same LSP server for several languages, > or something like that. Correct, I am using the same LSP server for several languages (major-modes). I observe that eglot spawns an instance *per* major mode even though I use exactly the same definition in eglot-server-programs. Additionally, each instance only receives "didOpen" and "didChange" events for the given mode they were spawned for. From my PoV, ideally, it would be possible to ask eglot to spawn only one instance across all major modes and it would receive "didOpen" and "didChange" events for all the modes that it was registered for. Like the singleton pattern from programming languages. Alternatively, I think it would also be possible to have an instance per major mode as long as they receive the "didOpen" and "didChange" for all relevant modes (that is, eglot sends the same "didOpen"/"didChange" event to multiple servers). The downside of the later approach is that the same computations happen twice and is sent back to eglot that then has deal with the duplication. Notably push diagnostics would then happen once per server per major mode. Note since I am the author of the language server, I am looking for a way for eglot manage the life-cycle of the language server. Asking my consumers to manually start and stop the language server would make it a second-class language server at best. Best regards, Niels