vscode-mayapy icon indicating copy to clipboard operation
vscode-mayapy copied to clipboard

maya.cmds auto-completion issue

Open benblo opened this issue 4 years ago • 5 comments

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?

benblo avatar Sep 23 '20 13:09 benblo

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

from maya import cmds
cmds.polyEvalue()

using maya.cmds. seem not work.

FXTD-ODYSSEY avatar Dec 30 '20 06:12 FXTD-ODYSSEY

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?

benblo avatar Jan 04 '21 16:01 benblo

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

yes

FXTD-ODYSSEY avatar Jan 09 '21 10:01 FXTD-ODYSSEY

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!

Nodgers avatar Jan 21 '21 16:01 Nodgers

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

edlgm avatar Apr 03 '23 21:04 edlgm