GHpython VScode AutoComplete

Hi everyone, I met the some question in GHpython. I am trying to import ghpythonlib.components in VScode, it works but cannot AutoComplete like rhinoscriptsyntax.
image

Any ideas?

Thanks

This is not going to work. ghpythonlib.components is dynamically generated based on what is available in Grasshopper.

2 Likes

Thanks steve,When I use ghpythonlib.components in GHpython ,it can Autocomplete GH components like“Absolute”,“Addition”and"AdjustPlane" .How can I Achieve the same Autocomplete in VScode?

Thanks :slight_smile:

GhPython can do this because it is the same process as Grasshopper and therefore can ask grasshopper about all of the components available. This is not available in VSCode. Someone would have to write a program to communicate between Rhino and VSCode or to generate a python stub file based on the components available on your computer.

1 Like

Hi @WenjieHuang

you also emailed me in private. Steve is correct. There might be some way but it would involve knowing very well the VSCode code completion library, which I don’t.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

1 Like

Thank you! This answer helped me a lot :slight_smile:

@WenjieHuang well, I’m glad.

In cases such as the ones Steve mentions, I’ve seen this being done with .pyi files.

But I’m reading long discussions with those and VSCode, so I don’t know if this will be easy/a long rabbit hole or how it works. I cannot start this project at this point.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

1 Like