godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.47k stars 148 forks source link

Add support for type inference inlay hints #588

Closed LeoDog896 closed 4 months ago

LeoDog896 commented 4 months ago

Godot version

4.2

VS Code version

1.86.0

Godot Tools VS Code extension version

2.0.0; bf1d739d073c93f62abf280a7ae19d5c3054c935

System information

Windows 10

Problem statement

You can't see the type of inferred assignments without having to hover over the variable or the function that creates it

Proposed solution

Use VSCode's native inlay hints feature.

Extra notes:

Calinou commented 4 months ago

Sounds good to me. I suggest coordinating with @DaelonSuzuka on this, but it may be better to focus on finalizing what's already being developed so we can release the long overdue 2.0.0.

DaelonSuzuka commented 4 months ago

Not a bad idea. I investigated inlay hints for types before, but the type information that's available from the LSP is inconsistent. I wasn't sure how good the experience would be if only half or less of the variables had hints resolve properly.

I don't mind implementing this

If you want to do it you're more than welcome. I'm already familiar with the systems required so it would probably take me an hour or two to add this.

Implementation notes off the top of my head:

This extension has never implemented inlay hints, so it doesn't seem as if the platform information above matters.

Open a scene file lol:

image

LeoDog896 commented 4 months ago

Open a scene file lol:

whoops! meant in GDScript;

DaelonSuzuka commented 4 months ago

whoops! meant in GDScript;

I assume most users have never even opened a scene file in VSCode, so I have to take every opportunity to shill all the work I put into those features!

LeoDog896 commented 4 months ago

whoops! meant in GDScript;

I assume most users have never even opened a scene file in VSCode, so I have to take every opportunity to shill all the work I put into those features!

So far, this is the best extension I've used to resolve pesty merge conflicts, so thanks for the extra scene features! 👍 (that's also why I wanted to contribute back in the first place; after that, I'm finding the dual vs/godot coding experience quite nice)

Calinou commented 4 months ago