Skip to content

fix: decode file URIs in document hyperlink labels#1422

Merged
sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
sebthom:issue-474
Nov 25, 2025
Merged

fix: decode file URIs in document hyperlink labels#1422
sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
sebthom:issue-474

Conversation

@sebthom
Copy link
Copy Markdown
Member

@sebthom sebthom commented Nov 25, 2025

DocumentLinkDetector now derives the hyperlink label from the decoded URI path for file:// links, so percent-encoded characters (e.g. %C3%A9) are shown as their human-readable form while still opening the original URI.

Fixes #474

DocumentLinkDetector now derives the hyperlink label from the decoded
URI path for file:// links, so percent-encoded characters (e.g. %C3%A9)
are shown as their human-readable form while still opening the original
URI.
@sebthom sebthom requested a review from rubenporras November 25, 2025 15:03
if (uri.isEmpty())
return uri;

if (uri.startsWith(LSPEclipseUtils.FILE_URI)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about decoding other URIs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decode them to what? Here we turn file URLs in readable file paths.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant something like #1426.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that still a valid URL? here we convert from valid but barely readable URL to readable and valid local file path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by valid? It is the same one, just decoded. Do you mean by valid that you can copy it and pasten into a "browser", then I think not, but the same would be valid for the path. Since this is meant to be shown to the user, not as an input for a browser, I think this should be better that showing the encoded URL, shouldn't it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we should only decode if the decoded form is directly usable by the end user which in case of local files seems obvious. But I don't have a strong preference if we should or should not do the same for other types of URLs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we should only decode if the decoded form is directly usable by the end user which in case of local files seems obvious. But I don't have a strong preference if we should or should not do the same for other types of URLs.

@sebthom sebthom merged commit 6b2d12a into eclipse-lsp4e:main Nov 25, 2025
19 of 21 checks passed
@sebthom sebthom deleted the issue-474 branch December 2, 2025 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.

Escaped strings (URIs) shown to users

2 participants