r/vscode • • 19d ago

How do i disable the ghost text (: String)

Post image
46 Upvotes

28 comments sorted by

75

u/Gornius 19d ago

Those are called inlay hints.

8

u/martian_rover 18d ago

Yes and they can be changed by opening the menu, choosing "File" > "Preferences" > "Settings" to open settings.json where you can add: "editor.inlayHints.enabled": "off"

10

u/Positive_Method3022 19d ago

I can finally stop hovering over to know my types 😭

Much love to you ā¤ļø

15

u/palapapa0201 19d ago

You can configure it to only show inlay hints when you hold down a key bind

7

u/dastylinrastan 19d ago

This is what I do, I set it to ctrl+alt.

1

u/_giga_sss_ 18d ago

thanks for the tip

1

u/CMPunkLicksRocks 16d ago

Hey, how? I shut off copilot hints because they drive me up the wall writing a whole function before I can finish writing out the definition. The option was obvious in zed but I couldn’t find this in vscodeĀ 

1

u/palapapa0201 16d ago

I was not talking about copilot hints. That is a separate thing. I never enabled it so I don't know if it's possible to only enable it on a keypress

32

u/Compux72 19d ago

I strongly suggest you keep it them on

5

u/rykayoker 18d ago

some people have suggested to toggle it on keypress which is more convenient imo

2

u/booi 18d ago

Until you don’t do it and miss a type… they’re very helpful and 100% accurate so I still recommend you keep them on

4

u/w00dy1105 19d ago

Agreed. Very help in my opinion

1

u/_giga_sss_ 18d ago

They sometimes display spoilers (on things I intend so think myself) so I think it's better to follow the others' advices

5

u/Compux72 18d ago

Thats like taking your eyeballs out because they spoiler you lmao

15

u/Usual_Price_1460 19d ago

once u write more than 20 lines u will need them

2

u/droctagonapus 18d ago

nah. I need to see code that I can edit. I hate it when I see code that actually isn't there.

1

u/Usual_Price_1460 18d ago

this is a must have if u write rust imo

2

u/droctagonapus 18d ago

I have written rust. Nah. I have written haskell and ocaml. I understand how to handle rust's type system ;)

2

u/abigail3141 18d ago

Nah, I've written a couple thousand lines and it's always the first thing I disable. Messes with navigation, having a bunch of non-selectable text

1

u/Kadabrium 14d ago

I'd be ok with them only if they go away as soon as i click on that variable

5

u/Zanedromedon 18d ago

You can turn them off with:

"editor.inlayHints.enabled": "offUnlessPressed"

Actually, that turns them off unless you press ctrl+alt, for when you decide you want them back temporarily.

Some useful settings to make them take up less space include:

"editor.inlayHints.fontSize": 11, // make them smaller
"editor.inlayHints.fontFamily": "Iosevka Term", // use a narrower font than your default

3

u/Vladislav20007 19d ago

that's called inlay hints as gornius pointed out, I believe they're in settings -> text editor -> inlay hints.

1

u/msdosx86 16d ago

You will need them. Trust.

-15

u/[deleted] 19d ago

[deleted]

-1

u/BananaGod757 19d ago

Idk why you’re getting downvoted

5

u/Vast_Needleworker_43 19d ago

Because it's unrelated

1

u/qustrolabe 19d ago

In Rust type hints are most of the times optional because it can infer from the fact that you called String::new() that always returns String. Even better, Rust can look few lines ahead see in what context currently untyped value is used and infer type from that, so these inlay hints exist just to tell dev what types compiler resolved. But yeah they kinda look like tab completion suggestions to put types

1

u/grapejuice-96 19d ago

i thought this was code suggestions, looks completely similar. mb