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

[Bug] Available modules not suggested in auto-import #759

Closed
laurensvalk opened this issue Oct 25, 2022 · 4 comments
Closed

[Bug] Available modules not suggested in auto-import #759

laurensvalk opened this issue Oct 25, 2022 · 4 comments
Labels
bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application topic: code completion Issues involving automaic code completion (intellesense)

Comments

@laurensvalk
Copy link
Member

Describe the bug
This is the opposite of #757.

It seems that all files are scanned for their content, but not their name for importing.

image

Above, I would expect it to offer my_module as an import.

@laurensvalk laurensvalk added bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application labels Oct 25, 2022
@dlech
Copy link
Member

dlech commented Oct 25, 2022

This is due to https://github.com/pybricks/pybricks-api/blob/4573fd27609aae3bc7c6f24ed1384c926a735d95/jedi/src/pybricks_jedi/__init__.py#L260-L262

We can probably fix it by adding a check of module_path so that filter only applies to the "system" directories and not the user directory.

@dlech
Copy link
Member

dlech commented Nov 28, 2022

It turns out that module_path has very bad performance, so that is not a viable solution.

@laurensvalk
Copy link
Member Author

laurensvalk commented Nov 28, 2022

Is it a bad idea to inject the names wherever it gets these from? (Would need update only when a file is deleted/added/renamed).

image

@dlech
Copy link
Member

dlech commented Nov 28, 2022

I tried this a while ago and it wasn't as easy as it seems like it should be. I don't remember exactly where I was getting stuck, but I gave up for the time being and moved on to lower hanging fruit.

Another possible solution might be to figure out how to get Pyodide to install the pybricks package in a different location, then we could just change sys.path and not have to have any filter at all.

@dlech dlech added the topic: code completion Issues involving automaic code completion (intellesense) label Dec 5, 2022
dlech added a commit to pybricks/pybricks-api that referenced this issue Dec 28, 2022
This function will be used to fix import completion of user module
names in Pybricks Code.

Issue: pybricks/support#759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application topic: code completion Issues involving automaic code completion (intellesense)
Projects
None yet
Development

No branches or pull requests

2 participants