Function: eglot-uri-to-path
eglot-uri-to-path is a byte-compiled function defined in eglot.el.gz.
Signature
(eglot-uri-to-path URI)
Documentation
Convert URI to file path, helped by eglot-current-server.
Aliases
eglot--uri-to-path (obsolete since 1.16)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(defun eglot-uri-to-path (uri)
"Convert URI to file path, helped by `eglot-current-server'."
(when (keywordp uri) (setq uri (substring (symbol-name uri) 1)))
(let* ((server (eglot-current-server))
(remote-prefix (and server (eglot--trampish-p server)))
(url (url-generic-parse-url uri)))
;; Only parse file:// URIs, leave other URI untouched as
;; `file-name-handler-alist' should know how to handle them
;; (bug#58790).
(if (string= "file" (url-type url))
(let* ((retval (url-unhex-string (url-filename url)))
;; Remove the leading "/" for local MS Windows-style paths.
(normalized (if (and (not remote-prefix)
(eq system-type 'windows-nt)
(cl-plusp (length retval))
(eq (aref retval 0) ?/))
(w32-long-file-name (substring retval 1))
retval)))
(concat remote-prefix normalized))
uri)))