From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server Date: Wed, 07 Dec 2022 13:56:37 -0500 Message-ID: <87h6y7uioy.fsf@dfreeman.email> References: <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> <87o7sl6awm.fsf@gmx.de> Reply-To: Danny Freeman Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17840"; mail-complaints-to="usenet@ciao.gmane.io" 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: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 07 20:19:46 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 1p2zxI-0004Lu-ML for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Dec 2022 20:19:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2zw5-0007uV-6v; Wed, 07 Dec 2022 14:18:29 -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 1p2zvf-0007rJ-2o for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 14:18:26 -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 1p2zve-0004zG-Og for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 14:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2zve-0000A0-Hm for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 14:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Dec 2022 19:18:02 +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.1670440680603 (code B ref 58790); Wed, 07 Dec 2022 19:18:02 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 7 Dec 2022 19:18:00 +0000 Original-Received: from localhost ([127.0.0.1]:51769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2zvb-00009f-Nb for submit@debbugs.gnu.org; Wed, 07 Dec 2022 14:18:00 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:53640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2zvW-00009Y-Pk for 58790@debbugs.gnu.org; Wed, 07 Dec 2022 14:17:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1670440673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VvFJNgJqmCXpVQu5ocdhAzhQVuyuFNdE9CRmT2+vaE0=; b=wWnewob+epIHYRDR+lm+2+kCnsUdZJAuKxF1lL9E7BWp2Dq3FUCXu+9taeFInod6whoyXK NYcq1+6MenZVSQAZb0g45IKUVO+zH0aaWxGJunOStnvn+XAzeTfURxwEa/AKIkQ58MJ6Zo yjTz3gJFFFcFYsEzYGsghH1fEV2ogG0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <87o7sl6awm.fsf@gmx.de> X-Migadu-Flow: FLOW_OUT 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:250212 Archived-At: Michael Albinus writes: > Danny Freeman writes: > > Hi Danny, > > Sorry for being late, it took me a while to find a free time slot. > No worries, we are all busy! I understand. > 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 > > ((eq op 'abbreviate-file-name) uri) > ((eq op 'make-auto-save-file-name) nil) > ((eq op 'vc-registered) nil) > > > Eval prior your tests > > (trace-function 'jarchive--file-name-handler) > > > and you'll see what I mean in buffer *trace-output*. I do see that, I'll be publishing a change that includes this later today. I'll have to remember to use trace-function more often. What a nifty tool! > > Well, running the test together with your package looks fine. What I > don't understand is the following sequence: > > [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)))) > > 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? The server should be running on your machine locally, and have access to everything Emacs does. It knows the location of that jar because it uses the clojure build tool to create a classpath for the project, which contains the full location of the clojure-1.10.3.jar file. >From what the clojure-lsp maintainers tell me, it will not run on a remote machine and be able to work with a project on your local machine. I'm not sure what it would return for a definition if it was able to run on a remote machine. > 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. I did some testing with this and it depends. Clojure-lsp needs the jar dependencies to do it's analysis, so it will use whatever clojure build tool the project uses to download them on startup if they do not exist (given that it is listed as a dependency in the project file, deps.edn in the case of my recipe). If it doesn't exist locally after clojure-lsp has started then it will return the same jar path, but opening the jar file will of course fail. If this happens it's because the user or some other process deleted the jar. There isn't much to be done about that. -- Danny Freeman