[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 33e83ba 44/49: Fix #638: convert colon to hex in
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eglot 33e83ba 44/49: Fix #638: convert colon to hex in URI |
Date: |
Wed, 17 Mar 2021 18:41:50 -0400 (EDT) |
branch: externals/eglot
commit 33e83ba4a7a3f704e44e9b49373afe842e4b50b8
Author: Theodor Thornhill <theo@thornhill.no>
Commit: João Távora <joaotavora@gmail.com>
Fix #638: convert colon to hex in URI
On windows, in the path portion of the URI, ':' must be hexified to
'%3A'. In the URL scheme, the ':' stays.
* eglot.el (eglot--uri-path-allowed-chars): define what characters are
allowed in path portion of URI.
* eglot.el (eglot--path-to-uri): ensure colon in 'file://' stays, but
and others are hexified.
Co-authored-by: João Távora
---
eglot-tests.el | 8 +++++++-
eglot.el | 14 ++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 9f9b428..b76fe16 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -1107,7 +1107,7 @@ will assume it exists."
;; Set up a loopback TRAMP method that’s just a shell so the remote
;; host is really just the local host.
(let ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path))
- (tramp-methods '(("loopback"
+ (tramp-methods '(("loopback"
(tramp-login-program "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login ("-l"))
@@ -1118,6 +1118,12 @@ will assume it exists."
;; method, fixtures will be automatically made “remote".
(eglot-tests--auto-detect-running-server-1)))
+(ert-deftest eglot--path-to-uri-windows ()
+ (should (string-prefix-p "file:///"
+ (eglot--path-to-uri "c:/Users/Foo/bar.lisp")))
+ (should (string-suffix-p "c%3A/Users/Foo/bar.lisp"
+ (eglot--path-to-uri "c:/Users/Foo/bar.lisp"))))
+
(provide 'eglot-tests)
;;; eglot-tests.el ends here
diff --git a/eglot.el b/eglot.el
index e0896c8..d4300e1 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1190,13 +1190,19 @@ If optional MARKER, return a marker instead"
(funcall eglot-move-to-column-function col)))
(if marker (copy-marker (point-marker)) (point)))))
+(defconst eglot--uri-path-allowed-chars
+ (let ((vec (copy-sequence url-path-allowed-chars)))
+ (aset vec ?: nil) ;; see github#639
+ vec)
+ "Like `url-path-allows-chars' but more restrictive.")
+
(defun eglot--path-to-uri (path)
"URIfy PATH."
- (url-hexify-string
- (concat "file://" (if (eq system-type 'windows-nt) "/")
+ (concat "file://" (if (eq system-type 'windows-nt) "/")
+ (url-hexify-string
;; Again watch out for trampy paths.
- (directory-file-name (file-local-name (file-truename path))))
- url-path-allowed-chars))
+ (directory-file-name (file-local-name (file-truename path)))
+ eglot--uri-path-allowed-chars)))
(defun eglot--uri-to-path (uri)
"Convert URI to file path, helped by `eglot--current-server'."
- [elpa] externals/eglot 1a54fc0 40/49: Per #627: URIfy better, (continued)
- [elpa] externals/eglot 1a54fc0 40/49: Per #627: URIfy better, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 7f2e680 38/49: Fix #627: handle empty actions array in window/showMessageRequest, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot d00dfe3 08/49: Fix #592: run exit-function only for finished completion, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 8305eed 18/49: * eglot.el (eglot): Tweak docstring grammar., Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 50b0e84 22/49: Fix #602: fully handle LSP glob syntax, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 550ffc2 34/49: Per #602: tweak glob-parsing grammar, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 133c25e 24/49: Close #613: explicitly require seq.el, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot a43289e 25/49: Fix #616: also override global flymake-diagnostic-functions, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot fc4c324 29/49: Fix #567: update elixir-ls link in README.md, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 7918fac 43/49: Close #637: Add TRAMP support, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 33e83ba 44/49: Fix #638: convert colon to hex in URI,
Stefan Monnier <=
- [elpa] externals/eglot bf4a7aa 31/49: Fix #406: mention eglot-stay-out-of in README.md, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 65aadca 46/49: Fix #620: simplify eglot--apply-workspace-edit, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 97ed4ca 49/49: Close #643: add new command eglot-shutdown-all, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot f9df418 06/49: Fix #584: Define a face for symbol highlight, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot cb58b72 15/49: Close #603: add fortls for Fotran (f90-mode), Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 147f3b0 16/49: Close #411: offer shortcut commands to commonly invoked code actions, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 99f8d7b 17/49: Per #604: mention common installation pitfalls in README.md, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 2879b83 19/49: * README.md: Mention Google Open Source Peer Bonus, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot d5b840b 20/49: Fix #606, #Fix 608: fix bug in eglot-code-actions, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot eac5264 21/49: Fix #609: flush pending changes to server before code actions request, Stefan Monnier, 2021/03/17