bug#80623: Eglot v1.21 patch to handle untitled schema in window/showDocument handler

Felician Nemeth <[email protected]> Sun, 02 Aug 2026 21:30:11 +0200
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> So... how would:
>
> file://foo/bar.baz
> untitled://foo/bar/baz
> untitled://foo.bar.baz
> jar://foo/bar.baz
> ... (other?)
>
> Combine with common "operations" such as "visit", "create", "save", "edit",
> etc and other LSP things.  Maybe some of these operations are not allowed
> depending on the URL scheme.
>
> IOW I need someone to help me design something structurally sound and
> robust enough that probably isn't too far away from what VSCode does.
>
> Who can suggest something?

I was about to suggest something like the following for the simplest
"visit" case:

(cl-defgeneric eglot-find-uri (server scheme uri)
  "Edit the document given by URI.
Similary to `find-file' switch to a buffer visiting the document given
by URI, creating one if none already exists."
...)

But then I read the comment in eglot-uri-to-path and realized that Eglot
already supported extensibility with variable file-name-handler-alist.
I'm guessing the "untitled" scheme can be supported using this variable.

At any rate, if Eglot can find the buffer of an URI, then it can install
its post-command-hooks in that buffer.  And I think it is okay to fail
at "create", "rename", and "delete" for non-file schemes until someone
complains.