0

As you can see in the following picture, vscode is inserting that pink highlighted : String in the for loop. There is no actual text there, as if I move the cursor, it just skips over it, so it's just visual. What is vscode telling me to do with it? there's no suggestion when I hover over it.

enter image description here

Kalcifer
  • 1,211
  • 12
  • 18
  • Is it inserting the type-name into the _saved_ Rust source file, or is it "virtual text" that's added in the code editor window but not actually part of the saved file? – Dai Sep 24 '22 at 21:54
  • Have you seen this? https://stackoverflow.com/questions/66174400/how-to-get-type-hints-to-display – Dai Sep 24 '22 at 21:54
  • @Dai It's just virtual text. If I open the source file in anoter text-editor, there is no type-name. What's also weird, is that if I then type in `: String` like it shows, it throws a syntax error, so it isn't even correct, so I'm not sure what the point of it is. – Kalcifer Sep 24 '22 at 21:57
  • @Dai, RE: the parameter hints, I disabled both parameter hints settings for the rust-analyzer extension, and it only got rid of the colon, but left the type-name. – Kalcifer Sep 24 '22 at 22:00
  • Ah I found it. It was the "type-hints" option. – Kalcifer Sep 24 '22 at 22:01
  • @Kalcifer "so I'm not sure what the point of it is" - it is very useful when your program is larger than a hello world. – Sergio Tulentsev Sep 26 '22 at 16:13

2 Answers2

1

VSCode is simply telling you the type of argument. The rust analyzer module puts these in places where the type is inferred to let you know what type the variable actually is.

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85
0

Disabling rust-analyzer.inlayHints.typeHints.enable removes type hints.

Kalcifer
  • 1,211
  • 12
  • 18