-
Notifications
You must be signed in to change notification settings - Fork 110
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
compas imports - work with pylance intellisense #621
Comments
I've posted an issue on Pylance's Github about it. You can check it here, but that is the summary: |
Arh, that's an interesting reply from them. Perhaps it is modifiable from compas's side. Pylance is based on Pyright, which is a static type analyzer. It is able to evaluate expressions like This of course will increase the maintenance work on compas development. I personally like the goal of this two-level import in compas where I believe is to shield users from internal implementation changes from version to version, I just don't know how much more extra maintenance work there is to be done. |
do you know if it can work with |
I do not know. |
I think that would work. We would need to auto-generate them otherwise the effort to keep them up-to-date would be too high. |
what seems to yield the correct result is to add a Pylance correctly autocompletes if i add this to from .mesh import BaseMesh
from typing import Any
class Mesh(BaseMesh):
bounding_box: Any = ...
bounding_box_xy: Any = ...
collapse_edge: Any = ...
connected_components: Any = ...
cut: Any = ...
dual: Any = ...
face_adjacency: Any = ...
flip_cycles: Any = ...
is_connected: Any = ...
smooth_centroid: Any = ...
smooth_area: Any = ...
split_edge: Any = ...
split_face: Any = ...
transform: Any = ...
transformed: Any = ...
unify_cycles: Any = ...
quads_to_triangles: Any = ...
def transform_numpy(self, M: Any) -> None: ...
def to_trimesh(self) -> None: ...
def to_quadmesh(self) -> None: ... however, it seems a bit complicated to automate. perhaps one could automate collecting the stubs based on the contents of |
a simpler definition also works from .mesh import *
class Mesh(BaseMesh):
pass however, the following doesn't from .mesh import * |
the https://github.com/numpy/numpy/blob/master/numpy/__init__.pyi |
gentle ping. |
working on it. will send a pr by the end of next week... |
Thanks so much. This will be major life saver. 🌈 |
solved since version |
@brgcode and all who worked on this. Just wanted to say thank you. Worked perfectly with VScode and pylance now. 👍 |
Feature Request
Pylance is a feature rich python language plugin for VSCode. It provide code analysis and intellisense.
The intellisense function works with python default functions and types and almost all other libraries I used (such as numpy). However it does not work with compas.
I suspect this is caused by the 2-layer-deep import routing that compas uses. If I write the full path, or in fact keep the default full path that Pylance automatically creates, the intellisense works, See below where
intersection_line_plane
is yellow, that one works.I think @Achillx has faced similar problem.
The text was updated successfully, but these errors were encountered: