From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server Date: Fri, 09 Dec 2022 17:04:25 +0100 Message-ID: <87h6y4pnqu.fsf@gmx.de> References: <87cz9v9irh.fsf@gmail.com> <83o7terf9a.fsf@gnu.org> <87k042tqze.fsf@dfreeman.email> <87fseqtpiu.fsf@dfreeman.email> <875yfm8lzf.fsf@gmail.com> <83wn82osoo.fsf@gnu.org> <871qq8xfzr.fsf@gmx.de> <87mt8uwo2q.fsf@dfreeman.email> <87zgcs6nvb.fsf@gmx.de> <87r0y3luad.fsf@dfreeman.email> <87iljf72ua.fsf@gmx.de> <87a64qykcf.fsf@gmx.de> <87v8nejy32.fsf@dfreeman.email> <87o7sl6awm.fsf@gmx.de> <87h6y7uioy.fsf@dfreeman.email> <87wn72ovn1.fsf@gmx.de> <87cz8tvh9q.fsf@dfreeman.email> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13528"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Felician Nemeth , 58790@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Dmitry Gutov , Eli Zaretskii , Stefan Kangas To: Danny Freeman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 09 17:05:27 2022 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 1p3fsN-0003HG-7C for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 17:05:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3fs8-0004cw-3r; Fri, 09 Dec 2022 11:05:12 -0500 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 1p3fry-0004cP-UN for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 11:05:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3frx-0000Yt-Tu for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 11:05:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3frx-0006IM-P4 for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 11:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Dec 2022 16:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58790 X-GNU-PR-Package: emacs Original-Received: via spool by 58790-submit@debbugs.gnu.org id=B58790.167060187724189 (code B ref 58790); Fri, 09 Dec 2022 16:05:01 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 9 Dec 2022 16:04:37 +0000 Original-Received: from localhost ([127.0.0.1]:36996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3frY-0006I5-UY for submit@debbugs.gnu.org; Fri, 09 Dec 2022 11:04:37 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:56229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3frX-0006Hy-6x for 58790@debbugs.gnu.org; Fri, 09 Dec 2022 11:04:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1670601866; bh=prpD4pIFHqb5oF5UCX8pFNHAE8K9t/UgQylRg9qhhow=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=Y5iXUv/Hg9xUzsA1v60ioqbpWHBZs3JFmrJSd8vz+NsPFurxDvIf8/BIIMl0DHrHA IIND+4YXzLX4ZLG6HZ/tL4Q7/waClDRcN5p+2d8Q92JGxI+Ur/3z6MgUpKrFTlyaY3 K36oGdmhrZlqyqIq5eQ2ceyVlpfRsfV07Vd0/nBuUPUrGGYKXXA/cP6MCA61kLOlN/ STjEw9EVaLoem93deKsOgA4EYF3oaSju2Q+3ViFD8fW1hf/wqCFrNpzQMda/2BS0vU FPPiUe+j4n3y2nubMVzl8SeK8VajrHka/2SQsqoKNTqOGsrXo2zgbmD95+zVj6RLkU krcKsILgvWsfw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.11]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MNKhs-1pIQnA2gFW-00Ol9s; Fri, 09 Dec 2022 17:04:26 +0100 In-Reply-To: <87cz8tvh9q.fsf@dfreeman.email> (Danny Freeman's message of "Thu, 08 Dec 2022 14:07:59 -0500") X-Provags-ID: V03:K1:k12L8QqDqqLBsFtAEQn6jKHjT6/CIUJ1Wp/JX/gQBeqtp8aO+dW gWBUX34dUMm1vNGMpHYe4SLIEk6Qtwc4/Z3mFxO/hKSdWl5PXw7voHlXpwSgxfnN7Ahd2TV j5wrgqyoIOmdImiTBkF/g8XASSWcclbOG7HDV6Lr36wvspAkFtzg+ji3DmOnHJ1Z6DCJ1AF oIgb0b6BgTJTQj4kuIELA== UI-OutboundReport: notjunk:1;M01:P0:9Q5VKKtEDnc=;ZFWLLKQSZET3M/5P3by6XHE+PVd 84TLcEq0TVRJzp3FJ9KYHPYleXd9fFA4GXUnRq4GQ/cbqxnHPXtt6ClePUSH6WURlZiN8JkKl d3Ykcvz6D4bU0FQJ+qV/L9kLolEXhgO4hnQNzlbyTeO2q/OUXeOX6i9fJ5f4rwVyhCdUgbc6u TR7LaD1mF5NkfQXdnugea1nBOjRcvVznPSTCAc36XIEOOv4/Zh6iFSdnO1cffVTznFzpkkhON D7luFIK1pKfFQMFxhjwn8JaSkoJi0g5VSDi65SQ/bEI40yrwTLOXp6iXcNmb9hneg+F/LgzS7 WniyLj34jOFdkxPkS4ytbOM9usu/giHBkhUfHFzZ27KB8U7cAO4vsZiOyC1F7lR6inO9TV6A3 qwcLJBF5jjf4HmAUsgpAYZIn7epl0dMg9QsTXCs/ETzozUyBRbwcI+duEvGjQacPA/D6i7e9O S3MWnConrVQLeuhj7pS5CxlT7jW23b7cHDxy015JMR03iNk2+xHdpLyggv2cKmMLeNsuuupUC Uon651u8WEuCjp95a7fxSoZJKyx3vofQNJm1f/yN6BwaoSRKC2tGvJ9nJGZLSh1DKqmKlP04u OrE/lrKO7JSh9L3ywnpzUAM23g8+5dXPX9xtyKx8QpCRkdcivyqFaltvqALT+Z68tZkLgzs2g aH+K2pg3RJ+kvGmjz0nh5uQ7Lg4/4/TRArgijsE2O/m6dEs9CTYh8OeyGG2+vtQTom7IFPucH K9QG0sZNH1Kupg/thXvZVXyvId58OImyThOUNXT1bhfDtRIm9DWNbqmdSX1fd0MGgqNccBEu 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:250414 Archived-At: Danny Freeman writes: Hi Danny, >> The LSP server shouldn't care. It returns a local file name, like >> "jar:file:///home/albinus/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj". This >> is because the file is local from the server's pov. > >> It is the client, Eglot, which must be able to access this file on the >> remote machine. A task for your jarchive file name handler, I believe. >> >> Or do I misunderstand the architecture? > > I think I am just confused at this point. Can you explain more about > what your current setup is for this question? In trying to understand, > it sounds like you are using Emacs to connect to a remote machine > somewhere via tramp. On the remote machine is a clojure project and a > running clojure-lsp server. When you try to navigate to a definition in > a jar, it is returning a jar URI pointing to something on your local > machine, not the remote machine like it should? Does that sound right? Yes, this is what it looks like. I don't believe it is an error in the LSP server. The eglot architecture, AFAIU, runs always the the LSP server on the same machine as the file under investigation is located on. For local files it is obvious: in eglot--connect, make-process is called, which connects to the LSP server on the local machine. If you have a remote file, say /ssh:user@host:/usr/local/src/emacs/src/dbusbind.c (in order to use a more simple LSP server like clangd), they same happens: make-process is called. *But* make-process realizes that default-directory is a remote one (/ssh:user@host:/usr/local/src/emacs/src//), and so it calls clangd on that remote host. That LSP server doesn't care where the client is called from. It still does --8<---------------cut here---------------start------------->8--- [client-request] (id:20) Fri Dec 9 16:47:05 2022: (:jsonrpc "2.0" :id 20 :method "textDocument/definition" :params (:textDocument (:uri "file:///usr/local/src/emacs/src/dbusbind.c") :position (:line 171 :character 0))) [server-reply] (id:20) Fri Dec 9 16:47:05 2022: (:id 20 :jsonrpc "2.0" :result [(:range (:end (:character 22 :line 172) :start (:character 0 :line 172)) :uri "file:///usr/local/src/emacs/src/dbusbind.c")]) --8<---------------cut here---------------end--------------->8--- So the client requests to get a definition in (the server local) file "file:///usr/local/src/emacs/src/dbusbind.c" at a given position, and the server replies with a pointer to the (server local) file "file:///usr/local/src/emacs/src/dbusbind.c". It is up to the client (eglot), to translate this information into remote file name syntax "/ssh:user@host:/usr/local/src/emacs/src/dbusbind.c". > Fwiw, I have never used tramp before, so I'm not sure how Eglot or > clojure-lsp will behave in that kind of environment. I suppose for clojure the same spplies. If the LSP server on that remote host returns something like a (server local) file "jar:file:///home/albinus/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj", it is up to the (eglot) client to recognize this as a pointer to the remote file at the given location. This problem is not tackled yet by your jarchive package. Best regards, Michael.