Skip to content

Remove url anchors in lsp--uri-to-path#4983

Open
themkat wants to merge 4 commits intoemacs-lsp:masterfrom
themkat:lsp--uri-to-path--handle-file-anchors
Open

Remove url anchors in lsp--uri-to-path#4983
themkat wants to merge 4 commits intoemacs-lsp:masterfrom
themkat:lsp--uri-to-path--handle-file-anchors

Conversation

@themkat
Copy link
Contributor

@themkat themkat commented Jan 30, 2026

Originally I thought about removing the "target" from the URL completely, but I found one test case:

                 (should (equal (lsp--uri-to-path "file:///home/nim-%23devel")
                                "/home/nim-#devel"))

As I understand it, we want # to be in the resulting URL if is was encoded, but remove it if it was explicit. The big assumption is therefore that the uris we get will follow the rules of standard http paths. (I've never seen a address URL encode the anchor, only # symbols existing in text). I've added a test that illustrate my point and how I imagine language servers work with paths containing #. (though I have NEVER seen it IRL. Just assume from the tests and current code that it is wanted. Also read that # symbols in filenames are allowed, so we can probably assume that they are url encoded).

Fixes #4976

@themkat themkat marked this pull request as ready for review January 30, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lsp--uri-to-path does not handle uri anchors

1 participant