Visual Studio Code, rust-analyzer: Cannot disable inlay hints

Hi everyone,

I'm exploring rust-analyzer plugin on Visual Studio Code. For some reason I cannot disable inlay hints. I know that this used to work for me previously.
What I've tried so far:

  • Removing keybinding for inlay hints
  • Disabling and re-enabling extension
  • Reinstalling extension
  • Searched for similar issue to be reported on the plugin's repository.

I'm using rust-analyzer version 0.2.792 on Visual Studio Code version 1.61.2. OS Ubuntu 20.04.3 LTS.

Is anyone experiencing the same issue?

Have checked settings.json file. It has

"rust-analyzer.inlayHints.enable": false,

setting, which doesn't change on inlay hints toggling. It always stays as "false". Have tried to remove it and to restart IDE. This didn't help as well :frowning:

EDIT: wrong advice, the config name in tho OP is correct.

Have tried to put setting which you've suggested. Editor has highlighted it as unknown configuration setting :thinking:
Screenshot from 2021-10-31 15-26-24
When I'm clicking on ">Rust Analyzer: Toggle inlay hints",

"rust-analyzer.inlayHints.enable": false,

setting is created for some reason

Oups, indeed, I am just wrong.

:thinking: Hm, "rust-analyzer.inlayHints.enable": false, works for me locally: toggling this setting toggles the hints in the editor.

I guess, the best next step to debug this is to check in the logs if rust-analyzer sees this config.

To enable logging, add

    "rust-analyzer.server.extraEnv": {
        "RA_LOG": "rust_analyzer=info",
    },

to the config (or just make sure that the env var is set for Code istelf)

Then, in the Output, in the Rust Analyzer Language Server, you should see something like this:

[INFO rust_analyzer::config] updating config from JSON: {
  "cargoRunner": null,
  "runnableEnv": null,
  "inlayHints": {
    "enable": false, // <- this one is intersting
    "smallerHints": true,
    "chainingHints": true,
    "maxLength": 25,
    "parameterHints": true,
    "typeHints": true
  },

I'm not sure what have helped, but now the issue is gone. The output of Rust Analyzer Language Server seem to properly fetch setting as for now. This is the output from my log. It seems to be literally the same to the one you've posted:

[INFO rust_analyzer::config] updating config from JSON: {
  "cargoRunner": null,
  "runnableEnv": null,
  "inlayHints": {
    "enable": false,
    "smallerHints": true,
    "chainingHints": true,
    "maxLength": 25,
    "parameterHints": true,
    "typeHints": true
  },

What I did previously was following:

  • I've switched to the previous, 0.2.784, plugin version. The issue was still present. I've switched back to the newest version
  • Then I've cloned and opened rust-analyzer repository expecting to find something there. Have received your reply, and switched IDE back to the previous project.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.