Skip to content

Conversation

@listochkin
Copy link
Contributor

@listochkin listochkin commented May 16, 2022

While VSCode uses it's own implementation for URIs
which notably doesn't have any limits of URI size, the renderer itself
relies on Web platform engine, that limits the length of the URLs and
bails out when the attribute length of an href inside a tag is too
long.

Command URIs have a form of command:command-name?arguments, where
arguments is a percent-encoded array of data we want to pass along to
the command function. For "Show References" this is a list of all file
URIs with locations of every reference, and it can get quite long.

This PR introduces another intermediary linkToCommand command. When
we render a command link, a reference to a command with all its arguments
is stored in a map, and instead a linkToCommand link is rendered
with the key to that map.

For now the map is cleaned up periodically (I've set it to every
10 minutes). In general case we'll probably need to introduce TTLs or
flags to denote ephemeral links (like these in hover popups) and
persistent links and clean those separately. But for now simply keeping
the last few links in the map should be good enough. Likewise, we could
add code to remove a target command from the map after the link is
clicked, but assuming most links in hover sheets won't be clicked anyway
this code won't change the overall memory use much.

Closes #9926

@listochkin listochkin force-pushed the show-implementations-display-error branch from f7671f6 to cf46c33 Compare May 16, 2022 18:57
@listochkin listochkin marked this pull request as ready for review May 16, 2022 19:14
@listochkin listochkin marked this pull request as draft May 17, 2022 14:57
@bors
Copy link
Contributor

bors commented May 17, 2022

☔ The latest upstream changes (presumably #12294) made this pull request unmergeable. Please resolve the merge conflicts.

@listochkin listochkin force-pushed the show-implementations-display-error branch from cf46c33 to a524f03 Compare May 18, 2022 09:49
@listochkin listochkin marked this pull request as ready for review May 18, 2022 10:14
@jonas-schievink
Copy link
Contributor

@bors delegate+

@bors
Copy link
Contributor

bors commented May 18, 2022

✌️ @listochkin can now approve this pull request

While VSCode [uses it's own implementation for URIs](https://github.com/microsoft/vscode-uri)
which notably doesn't have any limits of URI size, the renderer itself
relies on Web platform engine, that limits the length of the URLs and
bails out when the attribute length of an `href` inside `a` tag is too
long.

Command URIs have a form of `command:command-name?arguments`, where
`arguments` is a percent-encoded array of data we want to pass along to
the command function. For "Show References" this is a list of all file
URIs with locations of every reference, and it can get quite long.

This PR introduces another intermediary `linkToCommand` command. When
we render a command link, a reference to a command with all its arguments
is stored in a map, and instead a `linkToCommand` link is rendered
with the key to that map.

For now the map is cleaned up periodically (I've set it to every
10 minutes). In general case we'll probably need to introduce TTLs or
flags to denote ephemeral links (like these in hover popups) and
persistent links and clean those separately. But for now simply keeping
the last few links in the map should be good enough. Likewise, we could
add code to remove a target command from the map after the link is
clicked, but assuming most links in hover sheets won't be clicked anyway
this code won't change the overall memory use much.

Closes rust-lang#9926
@listochkin listochkin force-pushed the show-implementations-display-error branch from a524f03 to e87e1bc Compare May 18, 2022 13:12
@listochkin
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented May 18, 2022

📌 Commit e87e1bc has been approved by listochkin

@bors
Copy link
Contributor

bors commented May 18, 2022

⌛ Testing commit e87e1bc with merge 76030eb...

@bors
Copy link
Contributor

bors commented May 18, 2022

☀️ Test successful - checks-actions
Approved by: listochkin
Pushing 76030eb to master...

@bors bors merged commit 76030eb into rust-lang:master May 18, 2022
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.

"Show implementations" display error

3 participants