all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Dmitry Gutov" <dgutov@yandex.ru>, "João Távora" <joaotavora@gmail.com>
Cc: 58790@debbugs.gnu.org, Stefan Kangas <stefankangas@gmail.com>
Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server
Date: Sat, 29 Oct 2022 15:35:24 -0400	[thread overview]
Message-ID: <9bb290c8-f000-31d8-265d-b5441c33eb38@dfreeman.email> (raw)
In-Reply-To: <37716e41-5955-99f6-5204-e760a716fbf6@yandex.ru>


[-- Attachment #1.1.1: Type: text/plain, Size: 4336 bytes --]

 > 2. Eglot converts the URI X into a some file designator Y, using
 >   eglot--uri-to-path.  Y may or may not be === X, as long as there is
 >   exactly one X for every Y.  Eglot makes xref-item objects from it
 >   using xref-make-match and xref-make-file-location.  The designator Y
 >   goes into the 'file' slot of the xref-file-location object.

I will look into seeing if everything can work where Y === X. What this 
means
is that the X will start with `jar:file://`, and the last time I attempted I
had to re-implement all of the file-name-handler-alist operations (there 
are a
LOT). I am not sure why stripping the URI information off made this not
necessary but it sure makes the implement a lot simpler. I still don't fully
understand why, but that is alright. It's just going to take me some time.

 > 4. B2 can be setup in a way so that project-current returns the same
 >    object which is returned in B.  If this is true,
 >    eglot--current-server discovers the same connection which also
 >    manages B1 and Eglot adds buffer B2 to the list of managed buffers in
 >    that connection.
 >
 >    However, if eglot-extend-to-xref is non-nil, eglot--current-server
 >    should also discover the correct connection.  This is less ideal than
 >    making project-current know that the buffers of source code inside
 >    the jar are also in the same project, but it works.  I can explain
 >    the downsides, but it's not very relevant right now.

Depending on the implementation of my file-name-handler-alist function, I
think my only option is to make project-current return the project of buffer
B. NOT doing this results in `eglot-current-server` returning a transient
project, I believe from `eglot--curent-project`, causing a new server to be
started by eglot. I need to spend some more time with this code as well to
make sure I understand how this is being triggered, but it probably 
comes from
my abuse of the file-name-handler-alist.

 > Maybe Eglot just needs to be changed to _not_ strip the leading
 > "jar:file" and leave it completely unchanged.

 > So the server should be able to sort itself out, as long as you give
 > back the very same URI you got -- from the server itself -- to the
 > in-JAR source code.

I hope this is the case. I guess it depends on the lsp server's
implementation. In the case of clojure-lsp, and probably other jvm 
languages I
suspect that it would automatically understand `jar:` URIs.

...

 > The downside is that once a system file discovered by the LSP server, it
 > is associated with a given server (_not project_) in Eglot.  I don't
 > know what happens if another server also points to the same file.
 > Probably nothing very bad, but there may be some suprising behavior: I
 > haven't tested.


 > > Having the jars in project-external-roots could enable the users
 > > (after certain integration work) to search across their contents with
 > > project-or-external-find-regexp, or jump to files inside with
 > > project-or-external-find-file.
 >
 > That's a very nice point.  I don't use Java fortunately, but when I did
 > a long time ago, I think I remember Eclipse let me do this.

That might be nice. I think we would have to just extract the jar 
contents at
that point and use that. Not quite sure.

 > Okay: some new project type. Or a new feature that parses build 
files. Or etc. All of that could be reasonable, but is yet for somebody 
to design and implement.
 >
 > IMHO a feature that takes up the goal of providing comprehensive IDE 
support could take up that responsibility too. But I'm fine either way.
 >
 > That would also depend on whether the LSP protocol is ever going to 
be extended toward providing build file information, running build 
tasks, etc.

That I think this goes beyond the scope of what I want to do, and have the
ability to do. This is encroaching into cider's responsibilities I think. It
provides the full IDE expereince, and does so at the heavyweight cost of
running the actual project.

Thank you both for the input. It's given me a _lot_ to think about and
experiment with. It will probably take me some time to work through these
problems considering my day job and baby. Forgive me if it takes some 
time for
me to respond.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3185 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2022-10-29 19:35 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 21:44 bug#58790: Eglot URI parsing bug when using clojure-lsp server Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-26  6:22 ` Stefan Kangas
2022-10-26 19:50   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-27 15:09     ` João Távora
2022-10-29  1:22       ` Dmitry Gutov
2022-10-29  2:02         ` João Távora
2022-10-29 14:54           ` Dmitry Gutov
2022-10-29 19:35             ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-10-31 14:40               ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-02  8:09                 ` João Távora
2022-11-02 13:15                   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-03 17:10                   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10  9:49                     ` Eli Zaretskii
2022-11-10 11:00                       ` João Távora
2022-11-10 13:47                         ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 15:38                         ` Eli Zaretskii
2022-11-10 21:45                           ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 21:59                             ` João Távora
2022-11-10 22:22                               ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 22:30                                 ` João Távora
2022-11-10 22:48                                   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10 22:48                                 ` João Távora
2022-11-10 22:57                                   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-11  7:29                                   ` Eli Zaretskii
2022-11-12 17:03                                     ` Michael Albinus
2022-11-13 21:04                                       ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-15 19:04                                         ` Michael Albinus
2022-11-15 22:28                                           ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-16  7:53                                             ` Michael Albinus
2022-11-16 10:21                                               ` João Távora
2022-11-16 15:45                                                 ` Michael Albinus
2022-11-16 16:20                                                   ` João Távora
2022-11-16 22:59                                                     ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-02 16:14                                                       ` Michael Albinus
2022-12-07 18:56                                                         ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-08 13:46                                                           ` Michael Albinus
2022-12-08 19:07                                                             ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-09 16:04                                                               ` Michael Albinus
2022-12-10 17:21                                                                 ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-10 17:45                                                                   ` Michael Albinus
2022-11-22 14:30                                                     ` Michael Albinus
2022-11-23 11:55                                                       ` Richard Copley
2022-11-23 12:36                                                         ` João Távora
2022-11-23 12:42                                                           ` Arash Esbati
2022-11-23 12:49                                                             ` Richard Copley
2022-11-23 12:54                                                               ` João Távora
2022-11-23 13:33                                                           ` Eli Zaretskii
2022-11-23 13:44                                                             ` João Távora
2022-11-23 14:03                                                               ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-23 19:53                                                                 ` João Távora
2022-11-11  8:30                               ` Eli Zaretskii
2022-11-11  9:45                                 ` João Távora
2022-11-11 12:01                                   ` Eli Zaretskii
2022-11-11 14:02                                     ` João Távora
2022-11-11 14:45                                       ` Eli Zaretskii
2022-11-12  9:04                                         ` João Távora
2022-11-11  7:16                             ` Eli Zaretskii
2022-11-01 17:25         ` Juri Linkov
2022-10-29 15:36 ` Felician Nemeth
2022-10-29 17:09   ` João Távora
2022-11-09  0:59 ` bug#58790: Robert Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bb290c8-f000-31d8-265d-b5441c33eb38@dfreeman.email \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58790@debbugs.gnu.org \
    --cc=danny@dfreeman.email \
    --cc=dgutov@yandex.ru \
    --cc=joaotavora@gmail.com \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.