vscode-clangd icon indicating copy to clipboard operation
vscode-clangd copied to clipboard

Wastefully many inlayHints requests

Open sam-mccall opened this issue 3 years ago • 3 comments

This feature will become on-by-default in clangd 14, so I want to look at the impl a bit more carefully.

Some points about the original design mean the server has to process a lot of requests:

  • on edit we refresh every open file, not just the edited one (fixed in https://github.com/clangd/vscode-clangd/commit/221af5c13608f8dc43e5bdb95ff0ef9fc27a6448)
  • we evict the cached hints when a file becomes inactive (e.g. background tab), so bringing a tab to foreground always means fetching hints again. #277
  • a request is issued on every change, and the previous request is cancelled. This issues more requests than if a debounce/requests-in-flight limit was used, and clangd doesn't always save that much from cancellation. I don't know what the best option is yet.

To be clear, I don't think any of this was a mistake: choices probably made sense for rust-analyzer (maybe these requests are cheap) and a direct port of the client was the best option for us.

sam-mccall avatar Jan 09 '22 10:01 sam-mccall

Also when disabling the Inlay Hints those are still shown in the editor.

kalman5 avatar Jan 19 '22 20:01 kalman5

Also when disabling the Inlay Hints those are still shown in the editor.

You're probably noticing a recent change in how the feature's enablement is controlled, see https://github.com/clangd/vscode-clangd/issues/280#issuecomment-1011880365

HighCommander4 avatar Jan 19 '22 21:01 HighCommander4

Thanks!

kalman5 avatar Jan 20 '22 00:01 kalman5