File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -1774,7 +1774,12 @@ On other systems, returns path without change."
1774
1774
(file
1775
1775
(concat (decode-coding-string (url-filename url)
1776
1776
(or locale-coding-system 'utf-8))
1777
- (when target
1777
+ (when (and target
1778
+ (not (s-match
1779
+ (rx "#" (group (1+ num)) (or "," "#")
1780
+ (group (1+ num))
1781
+ string-end)
1782
+ uri)))
1778
1783
(concat "#" target))))
1779
1784
(file-name (if (and type (not (string= type "file")))
1780
1785
(if-let ((handler (lsp--get-uri-handler type)))
@@ -4869,7 +4874,7 @@ Applies on type formatting."
4869
4874
(pcase type
4870
4875
("file"
4871
4876
(find-file (lsp--uri-to-path url))
4872
- (-when-let ((_ line column) (s-match (rx "#" (group (1+ num)) "," (group (1+ num))) url))
4877
+ (-when-let ((_ line column) (s-match (rx "#" (group (1+ num)) (or "," "#") (group (1+ num))) url))
4873
4878
(goto-char (lsp--position-to-point
4874
4879
(lsp-make-position :character (1- (string-to-number column))
4875
4880
:line (1- (string-to-number line)))))))
Original file line number Diff line number Diff line change 27
27
28
28
(ert-deftest lsp--path-to-uri-1 ()
29
29
(elenv-with-windows
30
- (let ((lsp--uri-file-prefix " file:///" ))
31
- (should (equal (lsp--path-to-uri " c:/Users/?/" ) " file:///c:/Users/%3F/" ))))
30
+ (let ((lsp--uri-file-prefix " file:///" ))
31
+ (should (equal (lsp--path-to-uri " c:/Users/?/" ) " file:///c:/Users/%3F/" ))))
32
32
(elenv-with-os '(darwin gnu/linux)
33
- (let ((lsp--uri-file-prefix " file://" ))
34
- (should (equal (lsp--path-to-uri " /root/file/hallo welt" ) " file:///root/file/hallo%20welt" )))
35
- (should (equal (lsp--uri-to-path " file:///home/nim-%23devel" )
36
- " /home/nim-#devel" ))))
33
+ (let ((lsp--uri-file-prefix " file://" ))
34
+ (should (equal (lsp--path-to-uri " /root/file/hallo welt" ) " file:///root/file/hallo%20welt" )))
35
+ (should (equal (lsp--uri-to-path " file:///home/nim-%23devel" )
36
+ " /home/nim-#devel" ))
37
+ (should (equal (lsp--uri-to-path " file:///home/yyoncho/Sources/DemoProjects/lua/lua.lua#1#9" )
38
+ " /home/yyoncho/Sources/DemoProjects/lua/lua.lua" ))))
37
39
38
40
(ert-deftest lsp--path-to-uri-2 ()
39
41
(let ((lsp--uri-file-prefix " file:///" )
You can’t perform that action at this time.
0 commit comments