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

Code completion of the generic type parameter in GetNode #16

Open
atadi96 opened this issue May 28, 2021 · 2 comments
Open

Code completion of the generic type parameter in GetNode #16

atadi96 opened this issue May 28, 2021 · 2 comments

Comments

@atadi96
Copy link

atadi96 commented May 28, 2021

Hello,

I've had the pleasure of trying the extension, and enjoyed the code completion of the node name string in GetNode(...).
However, typing out the generic type parameter for GetNode still feels tedious to me, so I thought that the code completion could be extended with that information. I think this would also benefit the majority of the users.

For example in the current case if you type as far as GetNode<AnimatedSprite>( then code completion will give you options like e.g. "MainCharacterSprite", "CollisionShape2D".

The code completion could be extended so that typing GetNode would yield the following completion options for the scene from the previous example: GetNode<AnimatedSprite>("MainCharacterSprite"), GetNode<CollisionShape2D>("CollisionShape2D").

Is it possible to provide this richer code completion from the extension?

@atadi96
Copy link
Author

atadi96 commented May 28, 2021

I hoped that I could help implementing this functionality, I tracked down the code completion request to this line of code.

const response = await this.client.peer?.sendRequest('CodeCompletion', JSON.stringify(request));

which as I see calls into a socket connection of localhost:port where port is loaded from projectDir/.mono/metadata/ide_messaging_meta.txt which is the connection for what the code calls "Godot Ide Server".
I tried looking up "Godot Ide Server" in this repo and the godotengine repo but I haven't found any obvious traces of it anywhere. If someone would please guide me to the Godot Ide Server source, I'd see if I can contribute to this feature.

Thanks for reading the issue and any help in advance!

@neikeq
Copy link
Contributor

neikeq commented May 30, 2021

This is hard with the way the extension implements code completion right now. We use regex to toggle suggestions and we have no semantic information, so what we can do is very limited.

I would like to make our Roslyn completion providers work as NuGet packages to use them in VSCode, but this is currently blocked by a few issues. First one I link in godotengine/godot-csharp-visualstudio#18. Second one is that OmniSharp's VSCode completion provider is only triggered by . and characters. We need it to be triggered by (, ", and , as well, otherwise it won't show up for node paths (unless you trigger suggestions manually via the shortcut).

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

No branches or pull requests

2 participants