vscode-clangd
vscode-clangd copied to clipboard
Wastefully many inlayHints requests
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.
Also when disabling the Inlay Hints those are still shown in the editor.
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
Thanks!