GNU bug report logs - #58790
Eglot URI parsing bug when using clojure-lsp server

Previous Next

Package: emacs;

Reported by: Danny Freeman <danny <at> dfreeman.email>

Date: Wed, 26 Oct 2022 05:08:04 UTC

Severity: normal

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #143 received at 58790 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Richard Copley <rcopley <at> gmail.com>
Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
 Danny Freeman <danny <at> dfreeman.email>, 58790 <at> debbugs.gnu.org,
 Michael Albinus <michael.albinus <at> gmx.de>,
 Stefan Kangas <stefankangas <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#58790: Eglot URI parsing bug when using clojure-lsp server
Date: Wed, 23 Nov 2022 12:36:37 +0000
[Message part 1 (text/plain, inline)]
Yes,I think I follow.  To be clear I think the problem is somewhere in

(defun eglot--path-to-uri (path)
  "URIfy PATH."
  (let ((truepath (file-truename path)))
    (if (url-type (url-generic-parse-url truepath))
        ;; Path is already a URI, so forward it to the LSP server
        ;; untouched.  The server should be able to handle it, since
        ;; it provided this URI to clients in the first place.
        truepath
      ...)

So either url-generic-parse-url and url-type is fixed in url-parse.el, or
we must add some Windows-specific guards in eglot.el.  Or likely
both, since url-parse.el is not a :core ELPA package.

Richard/Danny, can you perhaps come up with some patch?

João

On Wed, Nov 23, 2022 at 11:55 AM Richard Copley <rcopley <at> gmail.com> wrote:

> On 22/11/2022 14:30, Michael Albinus wrote:
> > João Távora <joaotavora <at> gmail.com> writes:
> >
> > Hi João,
> >
> >>      Both seem to be OK, although I'm not sure that it is the right
> >>      approach in eglot--path-to-uri just to concat "file://" and the
> >>      file-local-name part of a remote file name.
> >>
> >> Can you describe a case where this would be problematic? Remember
> >> that, from the point of view of the server, the file is always local.
> >> That's regardless of whether eglot invoked the server remotely or
> >> locally.
> >
> > Got it.
> >
> > Best regards, Michael.
>
> Hi All,
>
> For file names with a Windows drive letter and forward slashes (as
> emitted by CMAKE_EXPORT_COMPILE_COMMANDS), the drive letter is
> misinterpreted as a URL type, leading to repeated errors,
>    "clangd only supports 'file' URI scheme for workspace files".
>
>
> (let ((path "c:/projects/awesome-project/source/main.cpp"))
>    (message "type %s, url %s"
>             (url-type (url-generic-parse-url path))
>             (eglot--path-to-uri path)))
>
> ;; => "type c, url c:/projects/awesome-project/source/main.cpp"
>
>

-- 
João Távora
[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.