Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to disable inlay hints #215

Closed
SpaceIm opened this issue Aug 12, 2021 · 5 comments
Closed

Add an option to disable inlay hints #215

SpaceIm opened this issue Aug 12, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@SpaceIm
Copy link

SpaceIm commented Aug 12, 2021

Is there a way in settings.json to disable inlay hints added in #168?

Turning off editor.inlayHints.enabled doesn't work for clangd, and I don't see any specific property.

@SpaceIm SpaceIm added the enhancement New feature or request label Aug 12, 2021
@HighCommander4
Copy link
Contributor

The feature is currently opt-in on the server side: it requires --inlay-hints=true in clangd.arguments to be enabled.

@SpaceIm
Copy link
Author

SpaceIm commented Aug 12, 2021

OK thanks, I've updated my version of clangd (I was using an old beta version which surprisingly returns clangd version 13.0.0 (https://github.com/llvm/llvm-project 5144f730a8a8a4c7c7984ff945187a9aa83c91ac) with clangd --version).

@SpaceIm SpaceIm closed this as completed Aug 12, 2021
@magiruuvelvet
Copy link

magiruuvelvet commented Aug 26, 2021

Is there no way to get rid of inlay hints with version 13.0.0-4ca0fbfa? I tried setting editor.inlayHints.enabled to false and even tried --inlay-hints=false, but it still forcefully shows parameter hints. Is a update of clangd really required just to disable a feature??? What could even cause this and why is editor.inlayHints.enabled ignored?

EDIT: I will just update to current main v14 and hope the feature can be disabled. Still weird that there is no way to get rid of it when it is supposed to be opt-in.

@HighCommander4
Copy link
Contributor

HighCommander4 commented Aug 26, 2021

Some background here:

  • The patch to add inlay hint support to the clangd server merged on April 14. At the time, the intention was to enable the feature via a client-side option. (But one specific to clangd, not the built-in editor.inlayHints.enabled; see below for more on that.)
  • During review of the patch adding client-side support, it was decided that the feature should instead be controlled using a command-line option.
  • The client-side patch, together with a server patch to add the --inlay-hint command line option, were merged on May 3.

Now, you happen to be using a pre-release version 13.0.0-4ca0fbfa, which is dated April 24 -- happening to fall in between April 14 and May 3 -- presumably in combination with a client that's more recent than May 3. So, yes, in that exact combination, there is no way to disable the hints.

Please bear in mind that pre-release versions do not make stability guarantees, and hiccups like this can sometimes arise and necessitate upgrading to a newer pre-release version (or, in this case, downgrading your client as an alternative).

To answer your final question:

why is editor.inlayHints.enabled ignored?

This option controls vscode's built-in inlay hints API. Clangd's implementation predates that and does not use it (it rolls its own with editor decorations). We will switch to the official API in due course (we're also waiting for the LSP protocol piece to be finalized).

@magiruuvelvet
Copy link

Thanks for the explanation. In the meantime I upgraded my clangd and I can now disable the feature :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants