FXTD-ODYSSEY / vscode-mayapy

Visual Studio Code Extension for Autdoesk Maya Python Developer
MIT License
38 stars 10 forks source link

maya.cmds auto-completion issue #3

Open benblo opened 4 years ago

benblo commented 4 years ago

Hi! thanks for the awesome extension, very useful! I'm having an issue with maya.cmds though, auto-completion is very slow with Jedi, and doesn't work at all with Pylance. All the other packages I've tried (maya.OpenMaya, maya.mel, pymel.core, etc) all work fine (and really fast) with Pylance.

Just to clarify, when typing maya.cmds. using Jedi, it takes maybe 10 seconds for the function list to appear (so much that for a long time I thought it was just not working at all, I only discovered this by mistake).

With Pylance the autocomplete list appears instantly, but I only get generic things like __dict__, none of the actual APIs appear. And if I set typeCheckingMode to basic, Pylance explictly reports that functions don't exist (eg maya.cmds.file()).

Do you have any clue what the issue might be?

FXTD-ODYSSEY commented 3 years ago

Sorry I didn't notice your issue. image I test it.

from maya import cmds
cmds.polyEvalue()

using maya.cmds. seem not work.

benblo commented 3 years ago

You're right, it does work with Jedi (and it's not as slow as what I described, though that was a few VsCode releases ago).

It still doesn't work at all with Pylance though... until I dug a little, and was able to fix it by replacing the global import directives with relative imports (in .vscode\extensions\fxtd-odyssey.mayapy-1.0.4\mayaSDK\maya\cmds\__init__.py) Before: from maya.cmds.Animation import * After: from .Animation import * ... so that's good news!

Now that it's finally working, I see the docstrings could be improved. They were generated from your MayaDoc repo, right?

FXTD-ODYSSEY commented 3 years ago

Now that it's finally working, I see the docstrings could be improved. They were generated from your MayaDoc repo, right?

yes

Nodgers commented 3 years ago

You're right, it does work with Jedi (and it's not as slow as what I described, though that was a few VsCode releases ago).

It still doesn't work at all with Pylance though... until I dug a little, and was able to fix it by replacing the global import directives with relative imports (in .vscode\extensions\fxtd-odyssey.mayapy-1.0.4\mayaSDK\maya\cmds\__init__.py) Before: from maya.cmds.Animation import * After: from .Animation import * ... so that's good news!

Now that it's finally working, I see the docstrings could be improved. They were generated from your MayaDoc repo, right?

This fixed the issue for me too, thank you!

edlgm commented 1 year ago

You're right, it does work with Jedi (and it's not as slow as what I described, though that was a few VsCode releases ago).

It still doesn't work at all with Pylance though... until I dug a little, and was able to fix it by replacing the global import directives with relative imports (in .vscode\extensions\fxtd-odyssey.mayapy-1.0.4\mayaSDK\maya\cmds\__init__.py) Before: from maya.cmds.Animation import * After: from .Animation import * ... so that's good news!

Now that it's finally working, I see the docstrings could be improved. They were generated from your MayaDoc repo, right?

This doesn't seem to work with my and Pylance :(. Any ideas on why this could be? I am just trying to get the color formatting on the modules from Pylance