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, 02 Dec 2022 17:14:01 +0100 Message-ID: <87o7sl6awm.fsf@gmx.de> References: <4d50b820-7053-75eb-5b11-d3d36a02b013@dfreeman.email> <87v8nxsrq6.fsf@gmail.com> <87cza40xgs.fsf@dfreeman.email> <83edubrvf0.fsf@gnu.org> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39438"; 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 02 17:15:25 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 1p18hB-000A2X-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Dec 2022 17:15:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p18gq-0000fA-Do; Fri, 02 Dec 2022 11:15:04 -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 1p18go-0000ek-EH for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 11:15:02 -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 1p18go-0004Ug-3c for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 11:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p18gn-00072F-Ta for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 11:15: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, 02 Dec 2022 16:15: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.166999765327021 (code B ref 58790); Fri, 02 Dec 2022 16:15:01 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 2 Dec 2022 16:14:13 +0000 Original-Received: from localhost ([127.0.0.1]:47533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p18g0-00071l-Pv for submit@debbugs.gnu.org; Fri, 02 Dec 2022 11:14:13 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:32821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p18fx-00071e-Qt for 58790@debbugs.gnu.org; Fri, 02 Dec 2022 11:14:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669997642; bh=DTY1xD1bLc7wV2l3nDgGebT89U8yCDbFP4KljDZWn1o=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=LYdqeKQidHvcRMoNLSbmc9qT1n9s0HXDi9ANvNlg5d8HF4ANMLsG4xPFSG/iPia4O d+tIeg22Q+iMmfY+9s/a3NlO4oEa9RRk4mYFKI3JyiBrLwfsVTf1MtsEkjaXPVYBU1 3D4qy3sWXAE1NWBb66E41xO21J4g7c/sJSe9p3f/z/OG9hBUwnPX95Okg93/ouMrn5 icd7zb0w0X6elghkSLEita22va9RhAHm01TMxgyTa2xdLZaxmPQCqkGEwNPGpqyEzp 4GLzMABlh/GhvFih4G1M8g+jx6zCJtMErCPmEkNgYbwbDYwPEy62Tk5mVKIReImnjI xZfqUBbQaTGYg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.11]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N3bSt-1osEwM37el-010ah3; Fri, 02 Dec 2022 17:14:01 +0100 In-Reply-To: <87v8nejy32.fsf@dfreeman.email> (Danny Freeman's message of "Wed, 16 Nov 2022 17:59:08 -0500") X-Provags-ID: V03:K1:oFXLP32Z/fzwiJ4wc6gLpkmilx6429FxsdcouIfSz5Hmx8/QhXT UDTigtO9zzR9KsjdeLL1X1Eb0Cew6+6E/bMkH/AkkSjqM+IaXJIGyOk0VIb18Xmm029DEFg xOTU+IZrW/tw8d/+YNR3bK+6ScjlxZzmeVlNHgQgeW92Wrz72byevYEfPxHBLBZ9EcEngHk vPVGw9LphOuIGmiEvfL7A== UI-OutboundReport: notjunk:1;M01:P0:49zttV7lR44=;L9RbSd2LIx/yr/q8Yeerye1/wTd /fM8r+7/ElEJLv4YPQuIq1OGLU31f6sI5Lg04AAqWo+km1PWT6bWrUy/9BmEp6oxOPXojjvjn pN3RbfdHiZKcxp4ceZYh1b8I3KQaMsNnPAEhn0UhZ0HhNdco7ysellsBY/szwWOviGegdZzJ6 bOzdD74SBH8h3cGHQuuw/U/ee6tRtI8r3qDqLtVAN0ChkFJM6z5s4La+TSqHZayHU1jKWbv2c VNklupcRQjvqWS/g/FCl8g47/q+wDdJ9oSe3zptpli7RCibRTALNaIhlckvRlYrdFx/lOwNo/ b6Z8kVa+8gvvs/Hqgo+s9FQsBRMJOqMjBGv66nTrLwxzAaUoBer5jDbPLNYpp5fQD0cl6mAE/ bsUR9/kJ3TTdC5Ppt8q/whDEQJl47LaE7xkKhn5D8GRxCteoV5ZpYS0RTsPFxuU3tLXt5SMlV ul3q5pj4unIEHdTrvgQD8s3yIU/Pgbf4mcfsqXjq27oVTQIRoamBd1w/EFDTLP//45eeU9oxJ ojCYsWM6cSIaapfajfTRpKnxlyIwZG+r2gsLxsq4CwIqeVb5fqJXdP+RLfj7STRvrwVYvEGC7 8v1e03M6XR/QODKxqgziTT3R9nLVz2Lfz5lE1zaIG68sDl8r0lxtqKdnfL3YmaJjn5eqGKIPp QtYMAIJ8xYIFHK4qagYQZV7FvS6Sevjyu3jYE23UylhUwvyt1qzz54UP+SRGv+r5YgHs/lVef tQwC+ijkAp+p2S9/eVbZRkw/TnJvlZPNBQPHWPh+m5ODgFrxdE2tWigvI/EhpirV1wO984yu 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:249764 Archived-At: Danny Freeman writes: Hi Danny, Sorry for being late, it took me a while to find a free time slot. >> url-handlers.el supports already non-canonical schemes, see >> `url-tramp-protocols'. We could add "jar" and "zipfile" to another user >> option, `url-archive-protocols', and let tramp-archive.el do the job. > > I think this could be a nice thing to include in emacs itself. > I have already implemented this funcitonality in a package on elpa: > https://elpa.gnu.org/packages/jarchive.html if you want to look. Well, the jar: and zipfile: semantics is a little bit different from what url-handlers supports. So let's continue with your package ATM; we could replace it by an implementation in url-handlers later on if we like. I gave your package a short review, it looks nice. Testing it together with eglot and the recipe below works nicely. Just one recommendation: I would add in jarchive--file-name-handler --8<---------------cut here---------------start------------->8--- ((eq op 'abbreviate-file-name) uri) ((eq op 'make-auto-save-file-name) nil) ((eq op 'vc-registered) nil) --8<---------------cut here---------------end--------------->8--- Eval prior your tests --8<---------------cut here---------------start------------->8--- (trace-function 'jarchive--file-name-handler) --8<---------------cut here---------------end--------------->8--- and you'll see what I mean in buffer *trace-output*. >> Danny would, probably, but the recipe would involve a particular LSP server and clojure toolchain, i think. > > Indeed I do :) I've prepared the test as indicated. > Running `M-x eglot` > Then `M-x xref-find-definitions` over the symbol `inc` should reproduce > the error. Well, running the test together with your package looks fine. What I don't understand is the following sequence: --8<---------------cut here---------------start------------->8--- [client-request] (id:6) Fri Dec 2 17:04:01 2022: (:jsonrpc "2.0" :id 6 :method "textDocument/definition" :params (:textDocument (:uri "file:///usr/local/src/eglot-xref-to-jar-repo/src/user.clj") :position (:line 3 :character 3))) [server-reply] (id:6) Fri Dec 2 17:04:01 2022: (:jsonrpc "2.0" :id 6 :result (:uri "jar:file:///home/albinus/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj" :range (:start (:line 923 :character 6) :end (:line 923 :character 9)))) --8<---------------cut here---------------end--------------->8--- That means, that the client (my local Emacs) has asked for "textDocument/definition" on the file user.clj, as indicated by your recipe. The remote server has returned as answer, that this definition is in "jar:file:///home/albinus/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj". This file must be located on the server, because the server cannot know anything about my local configuration, right? But your jarchive package opens this file locally. It works, because on my local machine I have the same file, but it looks confusing to me. What if the file doesn't exist locally? Best regards, Michael.