-
Notifications
You must be signed in to change notification settings - Fork 27
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
Pylance doesn’t recorgnise Micropython specific keywords anymore after reopening a project #226
Comments
Does this also happen if you open a blank folder, run configure project and then create a main.py with import machine? |
I'm encountering similar symptoms with a new project
Yes, it does Steps to reproduce on Windows 10:
At this point, I see the error from Pylance: My
The micropico stubs do exist in my Windows user's home directory in a folder As a workaround, I copied the .micropico-stubs directory from my home directory to my project directory. I changed the above lines in
After saving It appears that Pylance is not successfully using the stubs in my Windows user home directory. |
Yes, I can confirm that as well. |
I confirm the issue as well, @jimkr work around worked, instead of copying the whole directory I simply used the absolute path with my user account, for me being "C:\Users<user-name>l.micropico-stubs\included". |
Yes |
Following @sandylnur's suggestion to add the absolute path of the users folder to settings.json, partly resolves the problem, but not completely. It recognises
|
I'd guess that pylance is using the python standard library versions of time and gc, which contain different methods. It's not using the micropython stubs, so isn't aware of the micropython functions. I'm not sure how (or whether it's even possible) to make the micropython stubs take precedence. |
Could it have something to do with the version of MicroPython I'm using (1.23)? I don't think it should, because it used to be working when I was using the 1.23 preview. |
@HLammers No, the syntaxhighlighting and auto-completion is completely independent from the firmware installed on your board. The problem could be ~ as prefix for the user home in the vscode configuration. I have to do some test but I may have a solution to this. |
Error in Python Language server output with absolute path entered into pylance settings "include" paths and nothing in settings.json: 2024-06-17 14:52:54.371 [info] Auto-Indent enabled |
Signed-off-by: paulober <[email protected]>
What are the steps to reproduce this issue?
What happens?
Pylance shows errors when using Micropython specific keywords. For example:
import machine
gives the error ‘Import "machine" could not be resolved Pylance [reportMissingImports]’.The code can be uploaded to a Pico and runs normally.
What were you expecting to happen?
I expect those Micropython specific keywords to be recognised normally after reopening the project, just as it used to be.
Any logs, error output, etc?
Any other comments?
Rerunning Micropico: Configure project doesn’t resolve the issue, also not after deleting the .micropico file.
Which version of MicroPico are you using?
3.7.8
Support info
Copy this from the
Help -> Info/About -> Copy
(Code -> About Visual Studio Code -> Copy
on macOS) option in Visual Studio Code:The text was updated successfully, but these errors were encountered: