From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server Date: Sat, 29 Oct 2022 18:09:36 +0100 Message-ID: References: <87fsf6k5fx.fsf@betli.tmit.bme.hu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000005c76905ec2f713f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38779"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58790@debbugs.gnu.org, Stefan Kangas , Danny Freeman To: Felician Nemeth Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 29 19:10:17 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 1oopLc-0009tl-A5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Oct 2022 19:10:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oopLQ-0006HP-AM; Sat, 29 Oct 2022 13:10:04 -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 1oopLO-0006HB-UC for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 13:10:02 -0400 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 1oopLO-0001Zw-Mp for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 13:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oopLO-0000Ti-Ai for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 13:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Oct 2022 17:10: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.16670633981824 (code B ref 58790); Sat, 29 Oct 2022 17:10:02 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 29 Oct 2022 17:09:58 +0000 Original-Received: from localhost ([127.0.0.1]:36518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oopLJ-0000TM-K5 for submit@debbugs.gnu.org; Sat, 29 Oct 2022 13:09:57 -0400 Original-Received: from mail-oa1-f51.google.com ([209.85.160.51]:43982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oopLF-0000T2-2y for 58790@debbugs.gnu.org; Sat, 29 Oct 2022 13:09:56 -0400 Original-Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-13c2cfd1126so9560756fac.10 for <58790@debbugs.gnu.org>; Sat, 29 Oct 2022 10:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=j1lJFD0UdY/Mle22YRrc10YGVB7p2T97qE1UNQOjeEg=; b=ME2GwVfuNa72hy2GqNiQRbzkTwpm2DP5OilHYDkEgnV2JgpKzCsaXAmbWSoGkBqFm5 15O/UzoWuaokfuHrr7KwMGWu3fjKhG5Xg6IbK2TsCg/YY72SlQbscgBwNYjuBT6NaxFS jbGJTwxYCL9v0+Uep/wEfwBc+FnZ64sZrYBmzP/GcuPsyioCz3c05HaKZLNdlzfVNc2a ByT6ZxAk95nViOfwDO3KC0ordcRZrgxwPLUMll++NAznuYbqHDDwh0itgbKwCo7Niqxt EhAz1QBxc+4JRZdDTGV1G/vweV7/IK1ueIl4eDLr0UMLdGki1obXqnoZD6TYzOMtZHF6 FoRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j1lJFD0UdY/Mle22YRrc10YGVB7p2T97qE1UNQOjeEg=; b=0ngD2t9OOvGx6mHMRoK/L3Vc81LksI0DzAb8BBA56DIaa/mJbVJl899SoCBim5P2C5 F6UxtPTsIYihprShjlcZ7/c1D5XafsVQ/Qpyxq8IWBsAbPyG2JerfnILeWvcFr3eoFEh oy5UwpkXzfbGEHUTUtnfHwAAWcClt1belmXLi4UHFfp7Vh/ODz1GcwzFJ7OO1cIYhibX pf6/7tjkPPv2UNsoZfTrXWnv4aZlgm8YuTyZ1kx+BkMTPDj+/Z/Y1ftJGhsVsR+xnvBZ sxPiykdGEi8uRT7oEbFNLY1STweikSUFkP38NXo960xF6eRu68oZSN+FTcA1DaiO+KPo eg8g== X-Gm-Message-State: ACrzQf21fnJCyMINmLEA5agTqOqzbWZSj4V+m7CLwxBKkTlqBf232GZa ZxHY2E3ACkZgWqoJW/NiU4o0mgLj/RuaPANj0qI= X-Google-Smtp-Source: AMsMyM6hWlalHZ82QMi8GwY4eaQuQyEYuuFiTVEyibn9oRZ1M5gg9A+D/Br2A7HSj66jsyEuChT3x58TYVjZQO6xKq4= X-Received: by 2002:a05:6870:2155:b0:13c:8db1:2446 with SMTP id g21-20020a056870215500b0013c8db12446mr3920084oae.171.1667063387374; Sat, 29 Oct 2022 10:09:47 -0700 (PDT) In-Reply-To: <87fsf6k5fx.fsf@betli.tmit.bme.hu> 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246559 Archived-At: --00000000000005c76905ec2f713f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes, i think that makes sense. Can't look at that pull request right now, but my current thinking is to leave the URI unprocessed if the scheme is anything other than file://. Then file-name-handler-alist can decide what to do with it. But warning the user on such occasions sounds a bit too noisy. Maybe a one-time warning. The only other thing to watch out for is that wherever find-file lands is, its buffer-file-name should probably be left with the unchanged URI, so that eglot--path-to-uri can return it and tell the LSP server that we're now managing the buffer using the original URI. Jo=C3=A3o On Sat, Oct 29, 2022, 16:36 Felician Nemeth wrote: > > The problem occurs when using `xref-find-defintions` while eglot is > > managing a clojure buffer with clojure-lsp. If the symbol that > > xref-find-definitions is activated on is defined in a jar file, > > clojure-lsp by default will provide a location with a response like > > the following > > > > (:jsonrpc "2.0" :id 14 :result > > (:uri > > > "zipfile:///Users/andreperictavares/.m2/repository/org/clojure/tools.nam= espace/0.3.1/tools.namespace-0.3.1.jar::clojure/tools/namespace/find.clj" > > ... )) > > > > Can you, please, consider merging something like github#854? > https://github.com/joaotavora/eglot/pull/854 > > Currently, Eglot assumes that the uri-scheme is always "file". I think > Eglot should at least warn the user if this assumption is false instead > of silently failing as it currently does. > > Thanks. > --00000000000005c76905ec2f713f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes, i think that makes sense. Can't look at that pul= l request right now, but my current thinking is to leave the URI unprocesse= d if the scheme is anything other than file://.=C2=A0

Then file-name-handler-alist can = decide what to do with it.

But warning the user on such occasions sounds a bit too noisy. Maybe a o= ne-time warning.

The= only other thing to watch out for is that wherever find-file lands is, its= buffer-file-name should probably be left with the unchanged URI, so that e= glot--path-to-uri can return it and tell the LSP server that we're now = managing the buffer using the original URI.

Jo=C3=A3o

On Sat, Oct 29, 2022, 16:36 Felici= an Nemeth <felician.nemeth@= gmail.com> wrote:
> The= problem occurs when using `xref-find-defintions` while eglot is
> managing a clojure buffer with clojure-lsp. If the symbol that
> xref-find-definitions is activated on is defined in a jar file,
> clojure-lsp by default will provide a location with a response like > the following
>
> (:jsonrpc "2.0" :id 14 :result
>=C2=A0 =C2=A0(:uri
>=C2=A0 =C2=A0"zipfile:///Users/andreperictavares/.m2/repository/or= g/clojure/tools.namespace/0.3.1/tools.namespace-0.3.1.jar::clojure/tools/na= mespace/find.clj"
> ... ))
>

Can you, please, consider merging something like github#854?
https://github.com/joaotavora/eglot/pull/854<= /a>

Currently, Eglot assumes that the uri-scheme is always "file".=C2= =A0 I think
Eglot should at least warn the user if this assumption is false instead
of silently failing as it currently does.

Thanks.
--00000000000005c76905ec2f713f--